Merge "Add encryption information to TvTrackInfo"

am: 3e6a8c1c0e

Change-Id: I294b50fdcf3fbf366971f23f7487f05799353124
This commit is contained in:
Henry Fang
2019-05-09 12:24:45 -07:00
committed by android-build-merger
2 changed files with 39 additions and 6 deletions

View File

@@ -26786,6 +26786,7 @@ package android.media.tv {
method public int getVideoHeight(); method public int getVideoHeight();
method public float getVideoPixelAspectRatio(); method public float getVideoPixelAspectRatio();
method public int getVideoWidth(); method public int getVideoWidth();
method public boolean isEncrypted();
method public void writeToParcel(android.os.Parcel, int); method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.media.tv.TvTrackInfo> CREATOR; field public static final android.os.Parcelable.Creator<android.media.tv.TvTrackInfo> CREATOR;
field public static final int TYPE_AUDIO = 0; // 0x0 field public static final int TYPE_AUDIO = 0; // 0x0
@@ -26799,6 +26800,7 @@ package android.media.tv {
method public android.media.tv.TvTrackInfo.Builder setAudioChannelCount(int); method public android.media.tv.TvTrackInfo.Builder setAudioChannelCount(int);
method public android.media.tv.TvTrackInfo.Builder setAudioSampleRate(int); method public android.media.tv.TvTrackInfo.Builder setAudioSampleRate(int);
method public android.media.tv.TvTrackInfo.Builder setDescription(CharSequence); method public android.media.tv.TvTrackInfo.Builder setDescription(CharSequence);
method public android.media.tv.TvTrackInfo.Builder setEncrypted(boolean);
method public android.media.tv.TvTrackInfo.Builder setExtra(android.os.Bundle); method public android.media.tv.TvTrackInfo.Builder setExtra(android.os.Bundle);
method public android.media.tv.TvTrackInfo.Builder setLanguage(String); method public android.media.tv.TvTrackInfo.Builder setLanguage(String);
method public android.media.tv.TvTrackInfo.Builder setVideoActiveFormatDescription(byte); method public android.media.tv.TvTrackInfo.Builder setVideoActiveFormatDescription(byte);

View File

@@ -58,6 +58,7 @@ public final class TvTrackInfo implements Parcelable {
private final String mId; private final String mId;
private final String mLanguage; private final String mLanguage;
private final CharSequence mDescription; private final CharSequence mDescription;
private final boolean mEncrypted;
private final int mAudioChannelCount; private final int mAudioChannelCount;
private final int mAudioSampleRate; private final int mAudioSampleRate;
private final int mVideoWidth; private final int mVideoWidth;
@@ -69,13 +70,14 @@ public final class TvTrackInfo implements Parcelable {
private final Bundle mExtra; private final Bundle mExtra;
private TvTrackInfo(int type, String id, String language, CharSequence description, private TvTrackInfo(int type, String id, String language, CharSequence description,
int audioChannelCount, int audioSampleRate, int videoWidth, int videoHeight, boolean encrypted, int audioChannelCount, int audioSampleRate, int videoWidth,
float videoFrameRate, float videoPixelAspectRatio, byte videoActiveFormatDescription, int videoHeight, float videoFrameRate, float videoPixelAspectRatio,
Bundle extra) { byte videoActiveFormatDescription, Bundle extra) {
mType = type; mType = type;
mId = id; mId = id;
mLanguage = language; mLanguage = language;
mDescription = description; mDescription = description;
mEncrypted = encrypted;
mAudioChannelCount = audioChannelCount; mAudioChannelCount = audioChannelCount;
mAudioSampleRate = audioSampleRate; mAudioSampleRate = audioSampleRate;
mVideoWidth = videoWidth; mVideoWidth = videoWidth;
@@ -91,6 +93,7 @@ public final class TvTrackInfo implements Parcelable {
mId = in.readString(); mId = in.readString();
mLanguage = in.readString(); mLanguage = in.readString();
mDescription = in.readString(); mDescription = in.readString();
mEncrypted = in.readInt() != 0;
mAudioChannelCount = in.readInt(); mAudioChannelCount = in.readInt();
mAudioSampleRate = in.readInt(); mAudioSampleRate = in.readInt();
mVideoWidth = in.readInt(); mVideoWidth = in.readInt();
@@ -132,6 +135,18 @@ public final class TvTrackInfo implements Parcelable {
return mDescription; return mDescription;
} }
/**
* Returns {@code true} if the track is encrypted, {@code false} otherwise. If the encryption
* status is unknown or could not be determined, the corresponding value will be {@code false}.
*
* <p>For example: ISO/IEC 13818-1 defines a CA descriptor that can be used to determine the
* encryption status of some broadcast streams.
*/
public boolean isEncrypted() {
return mEncrypted;
}
/** /**
* Returns the audio channel count. Valid only for {@link #TYPE_AUDIO} tracks. * Returns the audio channel count. Valid only for {@link #TYPE_AUDIO} tracks.
* *
@@ -248,6 +263,7 @@ public final class TvTrackInfo implements Parcelable {
dest.writeString(mId); dest.writeString(mId);
dest.writeString(mLanguage); dest.writeString(mLanguage);
dest.writeString(mDescription != null ? mDescription.toString() : null); dest.writeString(mDescription != null ? mDescription.toString() : null);
dest.writeInt(mEncrypted ? 1 : 0);
dest.writeInt(mAudioChannelCount); dest.writeInt(mAudioChannelCount);
dest.writeInt(mAudioSampleRate); dest.writeInt(mAudioSampleRate);
dest.writeInt(mVideoWidth); dest.writeInt(mVideoWidth);
@@ -273,6 +289,7 @@ public final class TvTrackInfo implements Parcelable {
&& mType == obj.mType && mType == obj.mType
&& TextUtils.equals(mLanguage, obj.mLanguage) && TextUtils.equals(mLanguage, obj.mLanguage)
&& TextUtils.equals(mDescription, obj.mDescription) && TextUtils.equals(mDescription, obj.mDescription)
&& mEncrypted == obj.mEncrypted
&& Objects.equals(mExtra, obj.mExtra) && Objects.equals(mExtra, obj.mExtra)
&& (mType == TYPE_AUDIO && (mType == TYPE_AUDIO
? mAudioChannelCount == obj.mAudioChannelCount ? mAudioChannelCount == obj.mAudioChannelCount
@@ -310,6 +327,7 @@ public final class TvTrackInfo implements Parcelable {
private final int mType; private final int mType;
private String mLanguage; private String mLanguage;
private CharSequence mDescription; private CharSequence mDescription;
private boolean mEncrypted;
private int mAudioChannelCount; private int mAudioChannelCount;
private int mAudioSampleRate; private int mAudioSampleRate;
private int mVideoWidth; private int mVideoWidth;
@@ -360,6 +378,19 @@ public final class TvTrackInfo implements Parcelable {
return this; return this;
} }
/**
* Sets the encryption status of the track.
*
* <p>For example: ISO/IEC 13818-1 defines a CA descriptor that can be used to determine the
* encryption status of some broadcast streams.
*
* @param encrypted The encryption status of the track.
*/
public Builder setEncrypted(boolean encrypted) {
mEncrypted = encrypted;
return this;
}
/** /**
* Sets the audio channel count. Valid only for {@link #TYPE_AUDIO} tracks. * Sets the audio channel count. Valid only for {@link #TYPE_AUDIO} tracks.
* *
@@ -490,9 +521,9 @@ public final class TvTrackInfo implements Parcelable {
* @return The new {@link TvTrackInfo} instance * @return The new {@link TvTrackInfo} instance
*/ */
public TvTrackInfo build() { public TvTrackInfo build() {
return new TvTrackInfo(mType, mId, mLanguage, mDescription, mAudioChannelCount, return new TvTrackInfo(mType, mId, mLanguage, mDescription, mEncrypted,
mAudioSampleRate, mVideoWidth, mVideoHeight, mVideoFrameRate, mAudioChannelCount, mAudioSampleRate, mVideoWidth, mVideoHeight,
mVideoPixelAspectRatio, mVideoActiveFormatDescription, mExtra); mVideoFrameRate, mVideoPixelAspectRatio, mVideoActiveFormatDescription, mExtra);
} }
} }
} }