mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Add additional SEF data types.
PiperOrigin-RevId: 342034166
This commit is contained in:
parent
e3c725aa38
commit
a038b421dd
@ -63,10 +63,20 @@ import java.util.List;
|
|||||||
/** Supported data types. */
|
/** Supported data types. */
|
||||||
@Documented
|
@Documented
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef({TYPE_SLOW_MOTION_DATA})
|
@IntDef({
|
||||||
|
TYPE_SLOW_MOTION_DATA,
|
||||||
|
TYPE_SUPER_SLOW_MOTION_DATA,
|
||||||
|
TYPE_SUPER_SLOW_MOTION_BGM,
|
||||||
|
TYPE_SUPER_SLOW_MOTION_EDIT_DATA,
|
||||||
|
TYPE_SUPER_SLOW_DEFLICKERING_ON
|
||||||
|
})
|
||||||
private @interface DataType {}
|
private @interface DataType {}
|
||||||
|
|
||||||
private static final int TYPE_SLOW_MOTION_DATA = 0x0890;
|
private static final int TYPE_SLOW_MOTION_DATA = 0x0890; // 2192
|
||||||
|
private static final int TYPE_SUPER_SLOW_MOTION_DATA = 0x0b00; // 2816
|
||||||
|
private static final int TYPE_SUPER_SLOW_MOTION_BGM = 0x0b01; // 2817
|
||||||
|
private static final int TYPE_SUPER_SLOW_MOTION_EDIT_DATA = 0x0b03; // 2819
|
||||||
|
private static final int TYPE_SUPER_SLOW_DEFLICKERING_ON = 0x0b04; // 2820
|
||||||
|
|
||||||
private static final String TAG = "SefReader";
|
private static final String TAG = "SefReader";
|
||||||
|
|
||||||
@ -150,14 +160,20 @@ import java.util.List;
|
|||||||
for (int i = 0; i < sdrsLength / LENGTH_OF_ONE_SDR; i++) {
|
for (int i = 0; i < sdrsLength / LENGTH_OF_ONE_SDR; i++) {
|
||||||
scratch.skipBytes(2); // SDR data sub info flag and reserved bits (2).
|
scratch.skipBytes(2); // SDR data sub info flag and reserved bits (2).
|
||||||
@DataType int dataType = scratch.readLittleEndianShort();
|
@DataType int dataType = scratch.readLittleEndianShort();
|
||||||
if (dataType == TYPE_SLOW_MOTION_DATA) {
|
switch (dataType) {
|
||||||
// The read int is the distance from the tail info to the start of the metadata.
|
case TYPE_SLOW_MOTION_DATA:
|
||||||
// Calculated as an offset from the start by working backwards.
|
case TYPE_SUPER_SLOW_MOTION_DATA:
|
||||||
long startOffset = streamLength - tailLength - scratch.readLittleEndianInt();
|
case TYPE_SUPER_SLOW_MOTION_BGM:
|
||||||
int size = scratch.readLittleEndianInt();
|
case TYPE_SUPER_SLOW_MOTION_EDIT_DATA:
|
||||||
dataReferences.add(new DataReference(dataType, startOffset, size));
|
case TYPE_SUPER_SLOW_DEFLICKERING_ON:
|
||||||
} else {
|
// The read int is the distance from the tail info to the start of the metadata.
|
||||||
scratch.skipBytes(8); // startPosition (4), size (4).
|
// Calculated as an offset from the start by working backwards.
|
||||||
|
long startOffset = streamLength - tailLength - scratch.readLittleEndianInt();
|
||||||
|
int size = scratch.readLittleEndianInt();
|
||||||
|
dataReferences.add(new DataReference(dataType, startOffset, size));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
scratch.skipBytes(8); // startPosition (4), size (4).
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,6 +224,24 @@ import java.util.List;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DataType
|
||||||
|
private static int nameToDataType(String name) throws ParserException {
|
||||||
|
switch (name) {
|
||||||
|
case "SlowMotion_Data":
|
||||||
|
return TYPE_SLOW_MOTION_DATA;
|
||||||
|
case "Super_SlowMotion_Data":
|
||||||
|
return TYPE_SUPER_SLOW_MOTION_DATA;
|
||||||
|
case "Super_SlowMotion_BGM":
|
||||||
|
return TYPE_SUPER_SLOW_MOTION_BGM;
|
||||||
|
case "Super_SlowMotion_Edit_Data":
|
||||||
|
return TYPE_SUPER_SLOW_MOTION_EDIT_DATA;
|
||||||
|
case "Super_SlowMotion_Deflickering_On":
|
||||||
|
return TYPE_SUPER_SLOW_DEFLICKERING_ON;
|
||||||
|
default:
|
||||||
|
throw new ParserException("Invalid SEF name");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static final class DataReference {
|
private static final class DataReference {
|
||||||
@DataType public final int dataType;
|
@DataType public final int dataType;
|
||||||
public final long startOffset;
|
public final long startOffset;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user