Add SVC layer count to MP4 metadata
This is necessary to implement SEF video flattening. PiperOrigin-RevId: 337048264
This commit is contained in:
parent
c4b346e49d
commit
58ddfe046f
@ -28,6 +28,12 @@ import java.util.Arrays;
|
||||
*/
|
||||
public final class MdtaMetadataEntry implements Metadata.Entry {
|
||||
|
||||
/** Key for the capture frame rate (in frames per second). */
|
||||
public static final String KEY_ANDROID_CAPTURE_FPS = "com.android.capture.fps";
|
||||
/** Key for the temporal SVC layer count. */
|
||||
public static final String KEY_ANDROID_TEMPORAL_LAYER_COUNT =
|
||||
"com.android.video.temporal_layers_count";
|
||||
|
||||
/** The metadata key name. */
|
||||
public final String key;
|
||||
/** The payload. The interpretation of the value depends on {@link #typeIndicator}. */
|
||||
|
@ -30,6 +30,8 @@ import com.google.android.exoplayer2.metadata.id3.InternalFrame;
|
||||
import com.google.android.exoplayer2.metadata.id3.TextInformationFrame;
|
||||
import com.google.android.exoplayer2.util.Log;
|
||||
import com.google.android.exoplayer2.util.ParsableByteArray;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/** Utilities for handling metadata in MP4. */
|
||||
/* package */ final class MetadataUtil {
|
||||
@ -282,8 +284,6 @@ import com.google.android.exoplayer2.util.ParsableByteArray;
|
||||
private static final int TYPE_TOP_BYTE_COPYRIGHT = 0xA9;
|
||||
private static final int TYPE_TOP_BYTE_REPLACEMENT = 0xFD; // Truncated value of \uFFFD.
|
||||
|
||||
private static final String MDTA_KEY_ANDROID_CAPTURE_FPS = "com.android.capture.fps";
|
||||
|
||||
private MetadataUtil() {}
|
||||
|
||||
/** Updates a {@link Format.Builder} to include metadata from the provided sources. */
|
||||
@ -305,15 +305,20 @@ import com.google.android.exoplayer2.util.ParsableByteArray;
|
||||
}
|
||||
} else if (trackType == C.TRACK_TYPE_VIDEO && mdtaMetadata != null) {
|
||||
// Populate only metadata keys that are known to be specific to video.
|
||||
List<MdtaMetadataEntry> mdtaMetadataEntries = new ArrayList<>();
|
||||
for (int i = 0; i < mdtaMetadata.length(); i++) {
|
||||
Metadata.Entry entry = mdtaMetadata.get(i);
|
||||
if (entry instanceof MdtaMetadataEntry) {
|
||||
MdtaMetadataEntry mdtaMetadataEntry = (MdtaMetadataEntry) entry;
|
||||
if (MDTA_KEY_ANDROID_CAPTURE_FPS.equals(mdtaMetadataEntry.key)) {
|
||||
formatBuilder.setMetadata(new Metadata(mdtaMetadataEntry));
|
||||
if (MdtaMetadataEntry.KEY_ANDROID_CAPTURE_FPS.equals(mdtaMetadataEntry.key)
|
||||
|| MdtaMetadataEntry.KEY_ANDROID_TEMPORAL_LAYER_COUNT.equals(mdtaMetadataEntry.key)) {
|
||||
mdtaMetadataEntries.add(mdtaMetadataEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!mdtaMetadataEntries.isEmpty()) {
|
||||
formatBuilder.setMetadata(new Metadata(mdtaMetadataEntries));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user