Add the HlsMetadataEntry from the Master playlist to the Hls tracks

PiperOrigin-RevId: 243624081
This commit is contained in:
aquilescanta 2019-04-15 16:54:03 +01:00 committed by AquilesCanta
parent e9a7d47f62
commit 9ddd39c1c0
3 changed files with 28 additions and 0 deletions

View File

@ -1059,12 +1059,18 @@ public final class Format implements Parcelable {
@Nullable String label, @Nullable String label,
@Nullable String sampleMimeType, @Nullable String sampleMimeType,
@Nullable String codecs, @Nullable String codecs,
@Nullable Metadata metadata,
int bitrate, int bitrate,
int width, int width,
int height, int height,
int channelCount, int channelCount,
@C.SelectionFlags int selectionFlags, @C.SelectionFlags int selectionFlags,
@Nullable String language) { @Nullable String language) {
if (this.metadata != null) {
metadata = this.metadata.copyWithAppendedEntriesFrom(metadata);
}
return new Format( return new Format(
id, id,
label, label,
@ -1127,6 +1133,12 @@ public final class Format implements Parcelable {
codecs = codecsOfType; codecs = codecsOfType;
} }
} }
Metadata metadata =
this.metadata == null
? manifestFormat.metadata
: this.metadata.copyWithAppendedEntriesFrom(manifestFormat.metadata);
float frameRate = this.frameRate; float frameRate = this.frameRate;
if (frameRate == NO_VALUE && trackType == C.TRACK_TYPE_VIDEO) { if (frameRate == NO_VALUE && trackType == C.TRACK_TYPE_VIDEO) {
frameRate = manifestFormat.frameRate; frameRate = manifestFormat.frameRate;

View File

@ -78,6 +78,21 @@ public final class Metadata implements Parcelable {
return entries[index]; return entries[index];
} }
/**
* Returns a copy of this metadata with the entries of the specified metadata appended. Returns
* this instance if {@code other} is null.
*
* @param other The metadata that holds the entries to append. If null, this methods returns this
* instance.
* @return The metadata instance with the appended entries.
*/
public Metadata copyWithAppendedEntriesFrom(@Nullable Metadata other) {
if (other == null) {
return this;
}
return copyWithAppendedEntries(other.entries);
}
/** /**
* Returns a copy of this metadata with the specified entries appended. * Returns a copy of this metadata with the specified entries appended.
* *

View File

@ -1126,6 +1126,7 @@ import java.util.Map;
playlistFormat.label, playlistFormat.label,
mimeType, mimeType,
codecs, codecs,
playlistFormat.metadata,
bitrate, bitrate,
playlistFormat.width, playlistFormat.width,
playlistFormat.height, playlistFormat.height,