mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
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`.
|
`ExportException.codecInfo`.
|
||||||
* Track Selection:
|
* Track Selection:
|
||||||
* Extractors:
|
* Extractors:
|
||||||
|
* Fix PCM audio format extraction in AVI containers.
|
||||||
* Audio:
|
* Audio:
|
||||||
* Video:
|
* Video:
|
||||||
* Text:
|
* Text:
|
||||||
|
@ -83,9 +83,9 @@ import com.google.common.collect.ImmutableList;
|
|||||||
int channelCount = body.readLittleEndianUnsignedShort();
|
int channelCount = body.readLittleEndianUnsignedShort();
|
||||||
int samplesPerSecond = body.readLittleEndianInt();
|
int samplesPerSecond = body.readLittleEndianInt();
|
||||||
body.skipBytes(6); // averageBytesPerSecond (4 bytes), nBlockAlign (2 bytes).
|
body.skipBytes(6); // averageBytesPerSecond (4 bytes), nBlockAlign (2 bytes).
|
||||||
int bitsPerSample = body.readUnsignedShort();
|
int bitsPerSample = body.readLittleEndianUnsignedShort();
|
||||||
int pcmEncoding = Util.getPcmEncoding(bitsPerSample);
|
int pcmEncoding = Util.getPcmEncoding(bitsPerSample);
|
||||||
int cbSize = body.readLittleEndianUnsignedShort();
|
int cbSize = body.bytesLeft() > 0 ? body.readLittleEndianUnsignedShort() : 0;
|
||||||
byte[] codecData = new byte[cbSize];
|
byte[] codecData = new byte[cbSize];
|
||||||
body.readBytes(codecData, /* offset= */ 0, codecData.length);
|
body.readBytes(codecData, /* offset= */ 0, codecData.length);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user