Skip to content

Commit

Permalink
Prevent MOV sound sample bounds error
Browse files Browse the repository at this point in the history
Contributes to #561
  • Loading branch information
drewnoakes committed Apr 3, 2022
1 parent 085d36c commit 09f0cd3
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,14 @@ SoundSampleDescription getSampleDescription(SequentialReader reader) throws IOEx

public void addMetadata(QuickTimeSoundDirectory directory)
{
SoundSampleDescription description = sampleDescriptions.get(0);
if (sampleDescriptions.size() > 0) {
// TODO why only the first one?
SoundSampleDescription description = sampleDescriptions.get(0);

QuickTimeDictionary.setLookup(QuickTimeSoundDirectory.TAG_AUDIO_FORMAT, description.dataFormat, directory);
directory.setInt(QuickTimeSoundDirectory.TAG_NUMBER_OF_CHANNELS, description.numberOfChannels);
directory.setInt(QuickTimeSoundDirectory.TAG_AUDIO_SAMPLE_SIZE, description.sampleSize);
QuickTimeDictionary.setLookup(QuickTimeSoundDirectory.TAG_AUDIO_FORMAT, description.dataFormat, directory);
directory.setInt(QuickTimeSoundDirectory.TAG_NUMBER_OF_CHANNELS, description.numberOfChannels);
directory.setInt(QuickTimeSoundDirectory.TAG_AUDIO_SAMPLE_SIZE, description.sampleSize);
}
}

static class SoundSampleDescription extends SampleDescription
Expand Down

0 comments on commit 09f0cd3

Please sign in to comment.