mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Revert logic to decide whether meta atom is full
The previous logic was changed under the assumption that the first box inside a meta box was not always an hdlr box, but this is not true. #minor-release PiperOrigin-RevId: 357200713
This commit is contained in:
parent
086d8f3a8e
commit
c1ef00ab42
@ -231,20 +231,22 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
* <p>Atoms of type {@link Atom#TYPE_meta} are defined to be full atoms which have four additional
|
* <p>Atoms of type {@link Atom#TYPE_meta} are defined to be full atoms which have four additional
|
||||||
* bytes for a version and a flags field (see 4.2 'Object Structure' in ISO/IEC 14496-12:2005).
|
* bytes for a version and a flags field (see 4.2 'Object Structure' in ISO/IEC 14496-12:2005).
|
||||||
* QuickTime do not have such a full box structure. Since some of these files are encoded wrongly,
|
* QuickTime do not have such a full box structure. Since some of these files are encoded wrongly,
|
||||||
* we can't rely on the file type though. Instead we must check the 4 bytes after the common
|
* we can't rely on the file type though. Instead we must check the 8 bytes after the common
|
||||||
* header bytes ourselves.
|
* header bytes ourselves.
|
||||||
*
|
*
|
||||||
* @param meta The 4 or more bytes following the meta atom size and type.
|
* @param meta The 8 or more bytes following the meta atom size and type.
|
||||||
*/
|
*/
|
||||||
public static void maybeSkipRemainingMetaAtomHeaderBytes(ParsableByteArray meta) {
|
public static void maybeSkipRemainingMetaAtomHeaderBytes(ParsableByteArray meta) {
|
||||||
int startPosition = meta.getPosition();
|
int endPosition = meta.getPosition();
|
||||||
// The next 4 bytes can be either:
|
// The next 8 bytes can be either:
|
||||||
// (iso) 4 zero bytes (version + flags)
|
// (iso) [1 byte version + 3 bytes flags][4 byte size of next atom]
|
||||||
// (qt) 4 byte size of next atom
|
// (qt) [4 byte size of next atom ][4 byte hdlr atom type ]
|
||||||
// In case of (iso) we need to skip the next 4 bytes.
|
// In case of (iso) we need to skip the next 4 bytes.
|
||||||
if (meta.readInt() != 0) {
|
meta.skipBytes(4);
|
||||||
meta.setPosition(startPosition);
|
if (meta.readInt() != Atom.TYPE_hdlr) {
|
||||||
|
endPosition += 4;
|
||||||
}
|
}
|
||||||
|
meta.setPosition(endPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -728,8 +728,8 @@ public final class Mp4Extractor implements Extractor, SeekMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void maybeSkipRemainingMetaAtomHeaderBytes(ExtractorInput input) throws IOException {
|
private void maybeSkipRemainingMetaAtomHeaderBytes(ExtractorInput input) throws IOException {
|
||||||
scratch.reset(4);
|
scratch.reset(8);
|
||||||
input.peekFully(scratch.getData(), 0, 4);
|
input.peekFully(scratch.getData(), 0, 8);
|
||||||
AtomParsers.maybeSkipRemainingMetaAtomHeaderBytes(scratch);
|
AtomParsers.maybeSkipRemainingMetaAtomHeaderBytes(scratch);
|
||||||
input.skipFully(scratch.getPosition());
|
input.skipFully(scratch.getPosition());
|
||||||
input.resetPeekPosition();
|
input.resetPeekPosition();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user