Select the cenc sinf atom explicitly
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=135692709
This commit is contained in:
parent
1b81cfdb56
commit
d922a21160
@ -47,6 +47,7 @@ import java.util.List;
|
|||||||
private static final int TYPE_sbtl = Util.getIntegerCodeForString("sbtl");
|
private static final int TYPE_sbtl = Util.getIntegerCodeForString("sbtl");
|
||||||
private static final int TYPE_subt = Util.getIntegerCodeForString("subt");
|
private static final int TYPE_subt = Util.getIntegerCodeForString("subt");
|
||||||
private static final int TYPE_clcp = Util.getIntegerCodeForString("clcp");
|
private static final int TYPE_clcp = Util.getIntegerCodeForString("clcp");
|
||||||
|
private static final int TYPE_cenc = Util.getIntegerCodeForString("cenc");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a trak atom (defined in 14496-12).
|
* Parses a trak atom (defined in 14496-12).
|
||||||
@ -1004,7 +1005,7 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses encryption data from an audio/video sample entry, populating {@code out} and returning
|
* Parses encryption data from an audio/video sample entry, populating {@code out} and returning
|
||||||
* the unencrypted atom type, or 0 if no sinf atom was present.
|
* the unencrypted atom type, or 0 if no common encryption sinf atom was present.
|
||||||
*/
|
*/
|
||||||
private static int parseSampleEntryEncryptionData(ParsableByteArray parent, int position,
|
private static int parseSampleEntryEncryptionData(ParsableByteArray parent, int position,
|
||||||
int size, StsdData out, int entryIndex) {
|
int size, StsdData out, int entryIndex) {
|
||||||
@ -1017,10 +1018,10 @@ import java.util.List;
|
|||||||
if (childAtomType == Atom.TYPE_sinf) {
|
if (childAtomType == Atom.TYPE_sinf) {
|
||||||
Pair<Integer, TrackEncryptionBox> result = parseSinfFromParent(parent, childPosition,
|
Pair<Integer, TrackEncryptionBox> result = parseSinfFromParent(parent, childPosition,
|
||||||
childAtomSize);
|
childAtomSize);
|
||||||
Integer dataFormat = result.first;
|
if (result != null) {
|
||||||
Assertions.checkArgument(dataFormat != null, "frma atom is mandatory");
|
|
||||||
out.trackEncryptionBoxes[entryIndex] = result.second;
|
out.trackEncryptionBoxes[entryIndex] = result.second;
|
||||||
return dataFormat;
|
return result.first;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
childPosition += childAtomSize;
|
childPosition += childAtomSize;
|
||||||
}
|
}
|
||||||
@ -1032,6 +1033,7 @@ import java.util.List;
|
|||||||
int position, int size) {
|
int position, int size) {
|
||||||
int childPosition = position + Atom.HEADER_SIZE;
|
int childPosition = position + Atom.HEADER_SIZE;
|
||||||
|
|
||||||
|
boolean isCencScheme = false;
|
||||||
TrackEncryptionBox trackEncryptionBox = null;
|
TrackEncryptionBox trackEncryptionBox = null;
|
||||||
Integer dataFormat = null;
|
Integer dataFormat = null;
|
||||||
while (childPosition - position < size) {
|
while (childPosition - position < size) {
|
||||||
@ -1042,15 +1044,20 @@ import java.util.List;
|
|||||||
dataFormat = parent.readInt();
|
dataFormat = parent.readInt();
|
||||||
} else if (childAtomType == Atom.TYPE_schm) {
|
} else if (childAtomType == Atom.TYPE_schm) {
|
||||||
parent.skipBytes(4);
|
parent.skipBytes(4);
|
||||||
parent.readInt(); // schemeType. Expect cenc
|
isCencScheme = parent.readInt() == TYPE_cenc;
|
||||||
parent.readInt(); // schemeVersion. Expect 0x00010000
|
|
||||||
} else if (childAtomType == Atom.TYPE_schi) {
|
} else if (childAtomType == Atom.TYPE_schi) {
|
||||||
trackEncryptionBox = parseSchiFromParent(parent, childPosition, childAtomSize);
|
trackEncryptionBox = parseSchiFromParent(parent, childPosition, childAtomSize);
|
||||||
}
|
}
|
||||||
childPosition += childAtomSize;
|
childPosition += childAtomSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isCencScheme) {
|
||||||
|
Assertions.checkArgument(dataFormat != null, "frma atom is mandatory");
|
||||||
|
Assertions.checkArgument(trackEncryptionBox != null, "schi->tenc atom is mandatory");
|
||||||
return Pair.create(dataFormat, trackEncryptionBox);
|
return Pair.create(dataFormat, trackEncryptionBox);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TrackEncryptionBox parseSchiFromParent(ParsableByteArray parent, int position,
|
private static TrackEncryptionBox parseSchiFromParent(ParsableByteArray parent, int position,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user