| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
package com.drew.metadata.mov.atoms; |
| 22 |
|
| 23 |
import com.drew.lang.SequentialReader; |
| 24 |
import com.drew.lang.annotations.NotNull; |
| 25 |
import com.drew.metadata.mov.QuickTimeDictionary; |
| 26 |
import com.drew.metadata.mov.media.QuickTimeSoundDirectory; |
| 27 |
|
| 28 |
import java.io.IOException; |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
public class SoundSampleDescriptionAtom extends SampleDescriptionAtom<SoundSampleDescriptionAtom.SoundSampleDescription> |
| 36 |
{ |
| 37 |
public SoundSampleDescriptionAtom(SequentialReader reader, Atom atom) throws IOException |
| 38 |
{ |
| 39 |
super(reader, atom); |
| 40 |
} |
| 41 |
|
| 42 |
@NotNull |
| 43 |
@Override |
| 44 |
SoundSampleDescription getSampleDescription(SequentialReader reader) throws IOException |
| 45 |
{ |
| 46 |
return new SoundSampleDescription(reader); |
| 47 |
} |
| 48 |
|
| 49 |
public void addMetadata(QuickTimeSoundDirectory directory) |
| 50 |
{ |
| 51 |
if (sampleDescriptions.size() > 0) { |
| 52 |
|
| 53 |
SoundSampleDescription description = sampleDescriptions.get(0); |
| 54 |
|
| 55 |
QuickTimeDictionary.setLookup(QuickTimeSoundDirectory.TAG_AUDIO_FORMAT, description.dataFormat, directory); |
| 56 |
directory.setInt(QuickTimeSoundDirectory.TAG_NUMBER_OF_CHANNELS, description.numberOfChannels); |
| 57 |
directory.setInt(QuickTimeSoundDirectory.TAG_AUDIO_SAMPLE_SIZE, description.sampleSize); |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
static class SoundSampleDescription extends SampleDescription |
| 62 |
{ |
| 63 |
int version; |
| 64 |
int revisionLevel; |
| 65 |
int vendor; |
| 66 |
int numberOfChannels; |
| 67 |
int sampleSize; |
| 68 |
int compressionID; |
| 69 |
int packetSize; |
| 70 |
long sampleRate; |
| 71 |
|
| 72 |
public SoundSampleDescription(SequentialReader reader) throws IOException |
| 73 |
{ |
| 74 |
super(reader); |
| 75 |
|
| 76 |
version = reader.getUInt16(); |
| 77 |
revisionLevel = reader.getUInt16(); |
| 78 |
vendor = reader.getInt32(); |
| 79 |
numberOfChannels = reader.getUInt16(); |
| 80 |
sampleSize = reader.getUInt16(); |
| 81 |
compressionID = reader.getUInt16(); |
| 82 |
packetSize = reader.getUInt16(); |
| 83 |
sampleRate = reader.getUInt32(); |
| 84 |
} |
| 85 |
} |
| 86 |
} |