Fix AVI extractor WAVE format extraction
Allow `WAVEFORMAT` (in addition to `WAVEFORMATEX`), which omits initialization data. Fix reading of bits per sample to use little endian byte order like the other reads. See also the wave format docs linked from https://learn.microsoft.com/en-us/windows/win32/directshow/avi-riff-file-reference#avi-stream-headers. PiperOrigin-RevId: 642962893
This commit is contained in:
parent
d4802a429b
commit
a0312615f2
@ -13,6 +13,7 @@
|
||||
`ExportException.codecInfo`.
|
||||
* Track Selection:
|
||||
* Extractors:
|
||||
* Fix PCM audio format extraction in AVI containers.
|
||||
* Audio:
|
||||
* Video:
|
||||
* Text:
|
||||
|
@ -83,9 +83,9 @@ import com.google.common.collect.ImmutableList;
|
||||
int channelCount = body.readLittleEndianUnsignedShort();
|
||||
int samplesPerSecond = body.readLittleEndianInt();
|
||||
body.skipBytes(6); // averageBytesPerSecond (4 bytes), nBlockAlign (2 bytes).
|
||||
int bitsPerSample = body.readUnsignedShort();
|
||||
int bitsPerSample = body.readLittleEndianUnsignedShort();
|
||||
int pcmEncoding = Util.getPcmEncoding(bitsPerSample);
|
||||
int cbSize = body.readLittleEndianUnsignedShort();
|
||||
int cbSize = body.bytesLeft() > 0 ? body.readLittleEndianUnsignedShort() : 0;
|
||||
byte[] codecData = new byte[cbSize];
|
||||
body.readBytes(codecData, /* offset= */ 0, codecData.length);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user