mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Update CSD and apvC box logic
Update the CSD to contain only the APVDecoderConfigurationRecord and the apvC box to be a full box. The apv clip is also updated to be consistent with the new [specification](https://github.com/AcademySoftwareFoundation/openapv/blob/main/readme/apv_isobmff.md#isobmff-binding-for-apv). The clip is provided by the openAPV team under BSD-3 license. PiperOrigin-RevId: 727868656 (cherry picked from commit 653470f73be98e01e972513ec80e58c2d36cbb3a)
This commit is contained in:
parent
88e7636ae0
commit
625ff234e4
@ -1476,13 +1476,13 @@ public final class BoxParser {
|
||||
} else if (childAtomType == Mp4Box.TYPE_apvC) {
|
||||
mimeType = MimeTypes.VIDEO_APV;
|
||||
|
||||
int childAtomBodySize = childAtomSize - Mp4Box.HEADER_SIZE;
|
||||
int childAtomBodySize = childAtomSize - Mp4Box.FULL_HEADER_SIZE;
|
||||
byte[] initializationDataChunk = new byte[childAtomBodySize];
|
||||
parent.setPosition(childStartPosition + Mp4Box.FULL_HEADER_SIZE); // Skip version and flags.
|
||||
parent.readBytes(initializationDataChunk, /* offset= */ 0, childAtomBodySize);
|
||||
initializationData = ImmutableList.of(initializationDataChunk);
|
||||
|
||||
parent.setPosition(childStartPosition + Mp4Box.HEADER_SIZE);
|
||||
ColorInfo colorInfo = parseApvc(parent);
|
||||
ColorInfo colorInfo = parseApvc(new ParsableByteArray(initializationDataChunk));
|
||||
|
||||
bitdepthLuma = colorInfo.lumaBitdepth;
|
||||
bitdepthChroma = colorInfo.chromaBitdepth;
|
||||
@ -1711,8 +1711,7 @@ public final class BoxParser {
|
||||
ColorInfo.Builder colorInfo = new ColorInfo.Builder();
|
||||
ParsableBitArray bitArray = new ParsableBitArray(data.getData());
|
||||
bitArray.setPosition(data.getPosition() * 8); // Convert byte to bit position.
|
||||
bitArray.skipBytes(4); // skip version and flag (4 bytes)
|
||||
// See APVDecoderConfigurationBox syntax.
|
||||
// See APVDecoderConfigurationRecord syntax.
|
||||
bitArray.skipBytes(1); // configurationVersion
|
||||
int numConfigurationEntries = bitArray.readBits(8); // number_of_configuration_entry
|
||||
for (int i = 0; i < numConfigurationEntries; i++) {
|
||||
|
@ -1523,7 +1523,13 @@ import org.checkerframework.checker.nullness.qual.PolyNull;
|
||||
byte[] csd0 = format.initializationData.get(0);
|
||||
checkArgument(csd0.length > 0, "csd-0 is empty for avpC box.");
|
||||
|
||||
return BoxUtils.wrapIntoBox("apvC", ByteBuffer.wrap(csd0));
|
||||
int versionAndFlags = 0;
|
||||
ByteBuffer apvcBoxContent = ByteBuffer.allocate(csd0.length + BYTES_PER_INTEGER);
|
||||
apvcBoxContent.putInt(versionAndFlags);
|
||||
apvcBoxContent.put(csd0);
|
||||
apvcBoxContent.flip();
|
||||
|
||||
return BoxUtils.wrapIntoBox("apvC", apvcBoxContent);
|
||||
}
|
||||
|
||||
/** Returns the av1C box. */
|
||||
|
@ -19,11 +19,11 @@ track 0:
|
||||
height = 480
|
||||
frameRate = 30.00
|
||||
colorInfo:
|
||||
lumaBitdepth = 8
|
||||
chromaBitdepth = 8
|
||||
metadata = entries=[mdta: key=com.android.version, value=14, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3816721470, modification time=3816721470, timescale=10000]
|
||||
lumaBitdepth = 10
|
||||
chromaBitdepth = 10
|
||||
metadata = entries=[mdta: key=com.android.version, value=15, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3821418903, modification time=3821418903, timescale=10000]
|
||||
initializationData:
|
||||
data = length 22, hash 5F550605
|
||||
data = length 18, hash 77EBC81
|
||||
sample 0:
|
||||
time = 0
|
||||
flags = 1
|
||||
|
@ -19,11 +19,11 @@ track 0:
|
||||
height = 480
|
||||
frameRate = 30.00
|
||||
colorInfo:
|
||||
lumaBitdepth = 8
|
||||
chromaBitdepth = 8
|
||||
metadata = entries=[mdta: key=com.android.version, value=14, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3816721470, modification time=3816721470, timescale=10000]
|
||||
lumaBitdepth = 10
|
||||
chromaBitdepth = 10
|
||||
metadata = entries=[mdta: key=com.android.version, value=15, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3821418903, modification time=3821418903, timescale=10000]
|
||||
initializationData:
|
||||
data = length 22, hash 5F550605
|
||||
data = length 18, hash 77EBC81
|
||||
sample 0:
|
||||
time = 1366655
|
||||
flags = 1
|
||||
|
@ -19,11 +19,11 @@ track 0:
|
||||
height = 480
|
||||
frameRate = 30.00
|
||||
colorInfo:
|
||||
lumaBitdepth = 8
|
||||
chromaBitdepth = 8
|
||||
metadata = entries=[mdta: key=com.android.version, value=14, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3816721470, modification time=3816721470, timescale=10000]
|
||||
lumaBitdepth = 10
|
||||
chromaBitdepth = 10
|
||||
metadata = entries=[mdta: key=com.android.version, value=15, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3821418903, modification time=3821418903, timescale=10000]
|
||||
initializationData:
|
||||
data = length 22, hash 5F550605
|
||||
data = length 18, hash 77EBC81
|
||||
sample 0:
|
||||
time = 2766644
|
||||
flags = 1
|
||||
|
@ -19,11 +19,11 @@ track 0:
|
||||
height = 480
|
||||
frameRate = 30.00
|
||||
colorInfo:
|
||||
lumaBitdepth = 8
|
||||
chromaBitdepth = 8
|
||||
metadata = entries=[mdta: key=com.android.version, value=14, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3816721470, modification time=3816721470, timescale=10000]
|
||||
lumaBitdepth = 10
|
||||
chromaBitdepth = 10
|
||||
metadata = entries=[mdta: key=com.android.version, value=15, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3821418903, modification time=3821418903, timescale=10000]
|
||||
initializationData:
|
||||
data = length 22, hash 5F550605
|
||||
data = length 18, hash 77EBC81
|
||||
sample 0:
|
||||
time = 4133288
|
||||
flags = 536870913
|
||||
|
@ -19,11 +19,11 @@ track 0:
|
||||
height = 480
|
||||
frameRate = 30.00
|
||||
colorInfo:
|
||||
lumaBitdepth = 8
|
||||
chromaBitdepth = 8
|
||||
metadata = entries=[mdta: key=com.android.version, value=14, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3816721470, modification time=3816721470, timescale=10000]
|
||||
lumaBitdepth = 10
|
||||
chromaBitdepth = 10
|
||||
metadata = entries=[mdta: key=com.android.version, value=15, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3821418903, modification time=3821418903, timescale=10000]
|
||||
initializationData:
|
||||
data = length 22, hash 5F550605
|
||||
data = length 18, hash 77EBC81
|
||||
sample 0:
|
||||
time = 0
|
||||
flags = 1
|
||||
|
@ -19,11 +19,11 @@ track 0:
|
||||
height = 480
|
||||
frameRate = 30.00
|
||||
colorInfo:
|
||||
lumaBitdepth = 8
|
||||
chromaBitdepth = 8
|
||||
metadata = entries=[mdta: key=com.android.version, value=14, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3816721470, modification time=3816721470, timescale=10000]
|
||||
lumaBitdepth = 10
|
||||
chromaBitdepth = 10
|
||||
metadata = entries=[mdta: key=com.android.version, value=15, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3821418903, modification time=3821418903, timescale=10000]
|
||||
initializationData:
|
||||
data = length 22, hash 5F550605
|
||||
data = length 18, hash 77EBC81
|
||||
sample 0:
|
||||
time = 1366655
|
||||
flags = 1
|
||||
|
@ -19,11 +19,11 @@ track 0:
|
||||
height = 480
|
||||
frameRate = 30.00
|
||||
colorInfo:
|
||||
lumaBitdepth = 8
|
||||
chromaBitdepth = 8
|
||||
metadata = entries=[mdta: key=com.android.version, value=14, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3816721470, modification time=3816721470, timescale=10000]
|
||||
lumaBitdepth = 10
|
||||
chromaBitdepth = 10
|
||||
metadata = entries=[mdta: key=com.android.version, value=15, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3821418903, modification time=3821418903, timescale=10000]
|
||||
initializationData:
|
||||
data = length 22, hash 5F550605
|
||||
data = length 18, hash 77EBC81
|
||||
sample 0:
|
||||
time = 2766644
|
||||
flags = 1
|
||||
|
@ -19,11 +19,11 @@ track 0:
|
||||
height = 480
|
||||
frameRate = 30.00
|
||||
colorInfo:
|
||||
lumaBitdepth = 8
|
||||
chromaBitdepth = 8
|
||||
metadata = entries=[mdta: key=com.android.version, value=14, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3816721470, modification time=3816721470, timescale=10000]
|
||||
lumaBitdepth = 10
|
||||
chromaBitdepth = 10
|
||||
metadata = entries=[mdta: key=com.android.version, value=15, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3821418903, modification time=3821418903, timescale=10000]
|
||||
initializationData:
|
||||
data = length 22, hash 5F550605
|
||||
data = length 18, hash 77EBC81
|
||||
sample 0:
|
||||
time = 4133288
|
||||
flags = 536870913
|
||||
|
@ -19,11 +19,11 @@ track 0:
|
||||
height = 480
|
||||
frameRate = 30.00
|
||||
colorInfo:
|
||||
lumaBitdepth = 8
|
||||
chromaBitdepth = 8
|
||||
metadata = entries=[mdta: key=com.android.version, value=14, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3816721470, modification time=3816721470, timescale=10000]
|
||||
lumaBitdepth = 10
|
||||
chromaBitdepth = 10
|
||||
metadata = entries=[mdta: key=com.android.version, value=15, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3821418903, modification time=3821418903, timescale=10000]
|
||||
initializationData:
|
||||
data = length 22, hash 5F550605
|
||||
data = length 18, hash 77EBC81
|
||||
sample 0:
|
||||
time = 0
|
||||
flags = 1
|
||||
|
@ -19,11 +19,11 @@ track 0:
|
||||
height = 480
|
||||
frameRate = 30.00
|
||||
colorInfo:
|
||||
lumaBitdepth = 8
|
||||
chromaBitdepth = 8
|
||||
metadata = entries=[mdta: key=com.android.version, value=14, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3816721470, modification time=3816721470, timescale=10000]
|
||||
lumaBitdepth = 10
|
||||
chromaBitdepth = 10
|
||||
metadata = entries=[mdta: key=com.android.version, value=15, xyz: latitude=0.0, longitude=-180.0, Mp4Timestamp: creation time=3821418903, modification time=3821418903, timescale=10000]
|
||||
initializationData:
|
||||
data = length 22, hash 5F550605
|
||||
data = length 18, hash 77EBC81
|
||||
sample 0:
|
||||
time = 0
|
||||
flags = 1
|
||||
|
Binary file not shown.
@ -19,11 +19,11 @@ track 0:
|
||||
height = 480
|
||||
frameRate = 30.00
|
||||
colorInfo:
|
||||
lumaBitdepth = 8
|
||||
chromaBitdepth = 8
|
||||
lumaBitdepth = 10
|
||||
chromaBitdepth = 10
|
||||
metadata = entries=[Mp4Timestamp: creation time=100000000, modification time=500000000, timescale=10000]
|
||||
initializationData:
|
||||
data = length 22, hash 5F550605
|
||||
data = length 18, hash 77EBC81
|
||||
sample 0:
|
||||
time = 0
|
||||
flags = 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user