com.google.android.exoplayer2.video.ColorInfo Java Examples

The following examples show how to use com.google.android.exoplayer2.video.ColorInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MediaFormatUtil.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets a {@link MediaFormat}'s color information. Does nothing if {@code colorInfo} is null.
 *
 * @param format The {@link MediaFormat} being configured.
 * @param colorInfo The color info to set.
 */
@SuppressWarnings("InlinedApi")
public static void maybeSetColorInfo(MediaFormat format, @Nullable ColorInfo colorInfo) {
  if (colorInfo != null) {
    maybeSetInteger(format, MediaFormat.KEY_COLOR_TRANSFER, colorInfo.colorTransfer);
    maybeSetInteger(format, MediaFormat.KEY_COLOR_STANDARD, colorInfo.colorSpace);
    maybeSetInteger(format, MediaFormat.KEY_COLOR_RANGE, colorInfo.colorRange);
    maybeSetByteBuffer(format, MediaFormat.KEY_HDR_STATIC_INFO, colorInfo.hdrStaticInfo);
  }
}
 
Example #2
Source File: MediaFormatUtil.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Sets a {@link MediaFormat}'s color information. Does nothing if {@code colorInfo} is null.
 *
 * @param format The {@link MediaFormat} being configured.
 * @param colorInfo The color info to set.
 */
@SuppressWarnings("InlinedApi")
public static void maybeSetColorInfo(MediaFormat format, @Nullable ColorInfo colorInfo) {
  if (colorInfo != null) {
    maybeSetInteger(format, MediaFormat.KEY_COLOR_TRANSFER, colorInfo.colorTransfer);
    maybeSetInteger(format, MediaFormat.KEY_COLOR_STANDARD, colorInfo.colorSpace);
    maybeSetInteger(format, MediaFormat.KEY_COLOR_RANGE, colorInfo.colorRange);
    maybeSetByteBuffer(format, MediaFormat.KEY_HDR_STATIC_INFO, colorInfo.hdrStaticInfo);
  }
}
 
Example #3
Source File: MediaFormatUtil.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets a {@link MediaFormat}'s color information. Does nothing if {@code colorInfo} is null.
 *
 * @param format The {@link MediaFormat} being configured.
 * @param colorInfo The color info to set.
 */
@SuppressWarnings("InlinedApi")
public static void maybeSetColorInfo(MediaFormat format, @Nullable ColorInfo colorInfo) {
  if (colorInfo != null) {
    maybeSetInteger(format, MediaFormat.KEY_COLOR_TRANSFER, colorInfo.colorTransfer);
    maybeSetInteger(format, MediaFormat.KEY_COLOR_STANDARD, colorInfo.colorSpace);
    maybeSetInteger(format, MediaFormat.KEY_COLOR_RANGE, colorInfo.colorRange);
    maybeSetByteBuffer(format, MediaFormat.KEY_HDR_STATIC_INFO, colorInfo.hdrStaticInfo);
  }
}
 
Example #4
Source File: Format.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("ResourceType")
/* package */ Format(Parcel in) {
  id = in.readString();
  label = in.readString();
  containerMimeType = in.readString();
  sampleMimeType = in.readString();
  codecs = in.readString();
  bitrate = in.readInt();
  maxInputSize = in.readInt();
  width = in.readInt();
  height = in.readInt();
  frameRate = in.readFloat();
  rotationDegrees = in.readInt();
  pixelWidthHeightRatio = in.readFloat();
  boolean hasProjectionData = Util.readBoolean(in);
  projectionData = hasProjectionData ? in.createByteArray() : null;
  stereoMode = in.readInt();
  colorInfo = in.readParcelable(ColorInfo.class.getClassLoader());
  channelCount = in.readInt();
  sampleRate = in.readInt();
  pcmEncoding = in.readInt();
  encoderDelay = in.readInt();
  encoderPadding = in.readInt();
  selectionFlags = in.readInt();
  language = in.readString();
  accessibilityChannel = in.readInt();
  subsampleOffsetUs = in.readLong();
  int initializationDataSize = in.readInt();
  initializationData = new ArrayList<>(initializationDataSize);
  for (int i = 0; i < initializationDataSize; i++) {
    initializationData.add(in.createByteArray());
  }
  drmInitData = in.readParcelable(DrmInitData.class.getClassLoader());
  metadata = in.readParcelable(Metadata.class.getClassLoader());
}
 
Example #5
Source File: MediaFormatUtil.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets a {@link MediaFormat}'s color information. Does nothing if {@code colorInfo} is null.
 *
 * @param format The {@link MediaFormat} being configured.
 * @param colorInfo The color info to set.
 */
@SuppressWarnings("InlinedApi")
public static void maybeSetColorInfo(MediaFormat format, @Nullable ColorInfo colorInfo) {
  if (colorInfo != null) {
    maybeSetInteger(format, MediaFormat.KEY_COLOR_TRANSFER, colorInfo.colorTransfer);
    maybeSetInteger(format, MediaFormat.KEY_COLOR_STANDARD, colorInfo.colorSpace);
    maybeSetInteger(format, MediaFormat.KEY_COLOR_RANGE, colorInfo.colorRange);
    maybeSetByteBuffer(format, MediaFormat.KEY_HDR_STATIC_INFO, colorInfo.hdrStaticInfo);
  }
}
 
Example #6
Source File: Format.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("ResourceType")
/* package */ Format(Parcel in) {
  id = in.readString();
  label = in.readString();
  containerMimeType = in.readString();
  sampleMimeType = in.readString();
  codecs = in.readString();
  bitrate = in.readInt();
  maxInputSize = in.readInt();
  width = in.readInt();
  height = in.readInt();
  frameRate = in.readFloat();
  rotationDegrees = in.readInt();
  pixelWidthHeightRatio = in.readFloat();
  boolean hasProjectionData = Util.readBoolean(in);
  projectionData = hasProjectionData ? in.createByteArray() : null;
  stereoMode = in.readInt();
  colorInfo = in.readParcelable(ColorInfo.class.getClassLoader());
  channelCount = in.readInt();
  sampleRate = in.readInt();
  pcmEncoding = in.readInt();
  encoderDelay = in.readInt();
  encoderPadding = in.readInt();
  selectionFlags = in.readInt();
  language = in.readString();
  accessibilityChannel = in.readInt();
  subsampleOffsetUs = in.readLong();
  int initializationDataSize = in.readInt();
  initializationData = new ArrayList<>(initializationDataSize);
  for (int i = 0; i < initializationDataSize; i++) {
    initializationData.add(in.createByteArray());
  }
  drmInitData = in.readParcelable(DrmInitData.class.getClassLoader());
  metadata = in.readParcelable(Metadata.class.getClassLoader());
}
 
Example #7
Source File: MediaFormatUtil.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets a {@link MediaFormat}'s color information. Does nothing if {@code colorInfo} is null.
 *
 * @param format The {@link MediaFormat} being configured.
 * @param colorInfo The color info to set.
 */
@SuppressWarnings("InlinedApi")
public static void maybeSetColorInfo(MediaFormat format, @Nullable ColorInfo colorInfo) {
  if (colorInfo != null) {
    maybeSetInteger(format, MediaFormat.KEY_COLOR_TRANSFER, colorInfo.colorTransfer);
    maybeSetInteger(format, MediaFormat.KEY_COLOR_STANDARD, colorInfo.colorSpace);
    maybeSetInteger(format, MediaFormat.KEY_COLOR_RANGE, colorInfo.colorRange);
    maybeSetByteBuffer(format, MediaFormat.KEY_HDR_STATIC_INFO, colorInfo.hdrStaticInfo);
  }
}
 
Example #8
Source File: Format.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
Format(
    @Nullable String id,
    @Nullable String label,
    @Nullable String containerMimeType,
    @Nullable String sampleMimeType,
    @Nullable String codecs,
    int bitrate,
    int maxInputSize,
    int width,
    int height,
    float frameRate,
    int rotationDegrees,
    float pixelWidthHeightRatio,
    @Nullable byte[] projectionData,
    @C.StereoMode int stereoMode,
    @Nullable ColorInfo colorInfo,
    int channelCount,
    int sampleRate,
    @C.PcmEncoding int pcmEncoding,
    int encoderDelay,
    int encoderPadding,
    @C.SelectionFlags int selectionFlags,
    @Nullable String language,
    int accessibilityChannel,
    long subsampleOffsetUs,
    @Nullable List<byte[]> initializationData,
    @Nullable DrmInitData drmInitData,
    @Nullable Metadata metadata) {
  this.id = id;
  this.label = label;
  this.containerMimeType = containerMimeType;
  this.sampleMimeType = sampleMimeType;
  this.codecs = codecs;
  this.bitrate = bitrate;
  this.maxInputSize = maxInputSize;
  this.width = width;
  this.height = height;
  this.frameRate = frameRate;
  this.rotationDegrees = rotationDegrees == Format.NO_VALUE ? 0 : rotationDegrees;
  this.pixelWidthHeightRatio =
      pixelWidthHeightRatio == Format.NO_VALUE ? 1 : pixelWidthHeightRatio;
  this.projectionData = projectionData;
  this.stereoMode = stereoMode;
  this.colorInfo = colorInfo;
  this.channelCount = channelCount;
  this.sampleRate = sampleRate;
  this.pcmEncoding = pcmEncoding;
  this.encoderDelay = encoderDelay == Format.NO_VALUE ? 0 : encoderDelay;
  this.encoderPadding = encoderPadding == Format.NO_VALUE ? 0 : encoderPadding;
  this.selectionFlags = selectionFlags;
  this.language = language;
  this.accessibilityChannel = accessibilityChannel;
  this.subsampleOffsetUs = subsampleOffsetUs;
  this.initializationData =
      initializationData == null ? Collections.emptyList() : initializationData;
  this.drmInitData = drmInitData;
  this.metadata = metadata;
}
 
Example #9
Source File: Format.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("ResourceType")
/* package */ Format(Parcel in) {
  id = in.readString();
  label = in.readString();
  selectionFlags = in.readInt();
  roleFlags = in.readInt();
  bitrate = in.readInt();
  codecs = in.readString();
  metadata = in.readParcelable(Metadata.class.getClassLoader());
  // Container specific.
  containerMimeType = in.readString();
  // Elementary stream specific.
  sampleMimeType = in.readString();
  maxInputSize = in.readInt();
  int initializationDataSize = in.readInt();
  initializationData = new ArrayList<>(initializationDataSize);
  for (int i = 0; i < initializationDataSize; i++) {
    initializationData.add(in.createByteArray());
  }
  drmInitData = in.readParcelable(DrmInitData.class.getClassLoader());
  subsampleOffsetUs = in.readLong();
  // Video specific.
  width = in.readInt();
  height = in.readInt();
  frameRate = in.readFloat();
  rotationDegrees = in.readInt();
  pixelWidthHeightRatio = in.readFloat();
  boolean hasProjectionData = Util.readBoolean(in);
  projectionData = hasProjectionData ? in.createByteArray() : null;
  stereoMode = in.readInt();
  colorInfo = in.readParcelable(ColorInfo.class.getClassLoader());
  // Audio specific.
  channelCount = in.readInt();
  sampleRate = in.readInt();
  pcmEncoding = in.readInt();
  encoderDelay = in.readInt();
  encoderPadding = in.readInt();
  // Audio and text specific.
  language = in.readString();
  accessibilityChannel = in.readInt();
}
 
Example #10
Source File: Format.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
Format(
    @Nullable String id,
    @Nullable String label,
    @C.SelectionFlags int selectionFlags,
    @C.RoleFlags int roleFlags,
    int bitrate,
    @Nullable String codecs,
    @Nullable Metadata metadata,
    // Container specific.
    @Nullable String containerMimeType,
    // Elementary stream specific.
    @Nullable String sampleMimeType,
    int maxInputSize,
    @Nullable List<byte[]> initializationData,
    @Nullable DrmInitData drmInitData,
    long subsampleOffsetUs,
    // Video specific.
    int width,
    int height,
    float frameRate,
    int rotationDegrees,
    float pixelWidthHeightRatio,
    @Nullable byte[] projectionData,
    @C.StereoMode int stereoMode,
    @Nullable ColorInfo colorInfo,
    // Audio specific.
    int channelCount,
    int sampleRate,
    @C.PcmEncoding int pcmEncoding,
    int encoderDelay,
    int encoderPadding,
    // Audio and text specific.
    @Nullable String language,
    int accessibilityChannel) {
  this.id = id;
  this.label = label;
  this.selectionFlags = selectionFlags;
  this.roleFlags = roleFlags;
  this.bitrate = bitrate;
  this.codecs = codecs;
  this.metadata = metadata;
  // Container specific.
  this.containerMimeType = containerMimeType;
  // Elementary stream specific.
  this.sampleMimeType = sampleMimeType;
  this.maxInputSize = maxInputSize;
  this.initializationData =
      initializationData == null ? Collections.emptyList() : initializationData;
  this.drmInitData = drmInitData;
  this.subsampleOffsetUs = subsampleOffsetUs;
  // Video specific.
  this.width = width;
  this.height = height;
  this.frameRate = frameRate;
  this.rotationDegrees = rotationDegrees == Format.NO_VALUE ? 0 : rotationDegrees;
  this.pixelWidthHeightRatio =
      pixelWidthHeightRatio == Format.NO_VALUE ? 1 : pixelWidthHeightRatio;
  this.projectionData = projectionData;
  this.stereoMode = stereoMode;
  this.colorInfo = colorInfo;
  // Audio specific.
  this.channelCount = channelCount;
  this.sampleRate = sampleRate;
  this.pcmEncoding = pcmEncoding;
  this.encoderDelay = encoderDelay == Format.NO_VALUE ? 0 : encoderDelay;
  this.encoderPadding = encoderPadding == Format.NO_VALUE ? 0 : encoderPadding;
  // Audio and text specific.
  this.language = Util.normalizeLanguageCode(language);
  this.accessibilityChannel = accessibilityChannel;
}
 
Example #11
Source File: Format.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public static Format createVideoSampleFormat(
    @Nullable String id,
    @Nullable String sampleMimeType,
    @Nullable String codecs,
    int bitrate,
    int maxInputSize,
    int width,
    int height,
    float frameRate,
    @Nullable List<byte[]> initializationData,
    int rotationDegrees,
    float pixelWidthHeightRatio,
    byte[] projectionData,
    @C.StereoMode int stereoMode,
    @Nullable ColorInfo colorInfo,
    @Nullable DrmInitData drmInitData) {
  return new Format(
      id,
      /* label= */ null,
      /* selectionFlags= */ 0,
      /* roleFlags= */ 0,
      bitrate,
      codecs,
      /* metadata= */ null,
      /* containerMimeType= */ null,
      sampleMimeType,
      maxInputSize,
      initializationData,
      drmInitData,
      OFFSET_SAMPLE_RELATIVE,
      width,
      height,
      frameRate,
      rotationDegrees,
      pixelWidthHeightRatio,
      projectionData,
      stereoMode,
      colorInfo,
      /* channelCount= */ NO_VALUE,
      /* sampleRate= */ NO_VALUE,
      /* pcmEncoding= */ NO_VALUE,
      /* encoderDelay= */ NO_VALUE,
      /* encoderPadding= */ NO_VALUE,
      /* language= */ null,
      /* accessibilityChannel= */ NO_VALUE);
}
 
Example #12
Source File: Format.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("ResourceType")
/* package */ Format(Parcel in) {
  id = in.readString();
  label = in.readString();
  selectionFlags = in.readInt();
  roleFlags = in.readInt();
  bitrate = in.readInt();
  codecs = in.readString();
  metadata = in.readParcelable(Metadata.class.getClassLoader());
  // Container specific.
  containerMimeType = in.readString();
  // Elementary stream specific.
  sampleMimeType = in.readString();
  maxInputSize = in.readInt();
  int initializationDataSize = in.readInt();
  initializationData = new ArrayList<>(initializationDataSize);
  for (int i = 0; i < initializationDataSize; i++) {
    initializationData.add(in.createByteArray());
  }
  drmInitData = in.readParcelable(DrmInitData.class.getClassLoader());
  subsampleOffsetUs = in.readLong();
  // Video specific.
  width = in.readInt();
  height = in.readInt();
  frameRate = in.readFloat();
  rotationDegrees = in.readInt();
  pixelWidthHeightRatio = in.readFloat();
  boolean hasProjectionData = Util.readBoolean(in);
  projectionData = hasProjectionData ? in.createByteArray() : null;
  stereoMode = in.readInt();
  colorInfo = in.readParcelable(ColorInfo.class.getClassLoader());
  // Audio specific.
  channelCount = in.readInt();
  sampleRate = in.readInt();
  pcmEncoding = in.readInt();
  encoderDelay = in.readInt();
  encoderPadding = in.readInt();
  // Audio and text specific.
  language = in.readString();
  accessibilityChannel = in.readInt();
}
 
Example #13
Source File: Format.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
Format(
    @Nullable String id,
    @Nullable String label,
    @C.SelectionFlags int selectionFlags,
    @C.RoleFlags int roleFlags,
    int bitrate,
    @Nullable String codecs,
    @Nullable Metadata metadata,
    // Container specific.
    @Nullable String containerMimeType,
    // Elementary stream specific.
    @Nullable String sampleMimeType,
    int maxInputSize,
    @Nullable List<byte[]> initializationData,
    @Nullable DrmInitData drmInitData,
    long subsampleOffsetUs,
    // Video specific.
    int width,
    int height,
    float frameRate,
    int rotationDegrees,
    float pixelWidthHeightRatio,
    @Nullable byte[] projectionData,
    @C.StereoMode int stereoMode,
    @Nullable ColorInfo colorInfo,
    // Audio specific.
    int channelCount,
    int sampleRate,
    @C.PcmEncoding int pcmEncoding,
    int encoderDelay,
    int encoderPadding,
    // Audio and text specific.
    @Nullable String language,
    int accessibilityChannel) {
  this.id = id;
  this.label = label;
  this.selectionFlags = selectionFlags;
  this.roleFlags = roleFlags;
  this.bitrate = bitrate;
  this.codecs = codecs;
  this.metadata = metadata;
  // Container specific.
  this.containerMimeType = containerMimeType;
  // Elementary stream specific.
  this.sampleMimeType = sampleMimeType;
  this.maxInputSize = maxInputSize;
  this.initializationData =
      initializationData == null ? Collections.emptyList() : initializationData;
  this.drmInitData = drmInitData;
  this.subsampleOffsetUs = subsampleOffsetUs;
  // Video specific.
  this.width = width;
  this.height = height;
  this.frameRate = frameRate;
  this.rotationDegrees = rotationDegrees == Format.NO_VALUE ? 0 : rotationDegrees;
  this.pixelWidthHeightRatio =
      pixelWidthHeightRatio == Format.NO_VALUE ? 1 : pixelWidthHeightRatio;
  this.projectionData = projectionData;
  this.stereoMode = stereoMode;
  this.colorInfo = colorInfo;
  // Audio specific.
  this.channelCount = channelCount;
  this.sampleRate = sampleRate;
  this.pcmEncoding = pcmEncoding;
  this.encoderDelay = encoderDelay == Format.NO_VALUE ? 0 : encoderDelay;
  this.encoderPadding = encoderPadding == Format.NO_VALUE ? 0 : encoderPadding;
  // Audio and text specific.
  this.language = Util.normalizeLanguageCode(language);
  this.accessibilityChannel = accessibilityChannel;
}
 
Example #14
Source File: Format.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public static Format createVideoSampleFormat(
    @Nullable String id,
    @Nullable String sampleMimeType,
    @Nullable String codecs,
    int bitrate,
    int maxInputSize,
    int width,
    int height,
    float frameRate,
    @Nullable List<byte[]> initializationData,
    int rotationDegrees,
    float pixelWidthHeightRatio,
    byte[] projectionData,
    @C.StereoMode int stereoMode,
    @Nullable ColorInfo colorInfo,
    @Nullable DrmInitData drmInitData) {
  return new Format(
      id,
      /* label= */ null,
      /* selectionFlags= */ 0,
      /* roleFlags= */ 0,
      bitrate,
      codecs,
      /* metadata= */ null,
      /* containerMimeType= */ null,
      sampleMimeType,
      maxInputSize,
      initializationData,
      drmInitData,
      OFFSET_SAMPLE_RELATIVE,
      width,
      height,
      frameRate,
      rotationDegrees,
      pixelWidthHeightRatio,
      projectionData,
      stereoMode,
      colorInfo,
      /* channelCount= */ NO_VALUE,
      /* sampleRate= */ NO_VALUE,
      /* pcmEncoding= */ NO_VALUE,
      /* encoderDelay= */ NO_VALUE,
      /* encoderPadding= */ NO_VALUE,
      /* language= */ null,
      /* accessibilityChannel= */ NO_VALUE);
}
 
Example #15
Source File: Format.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
public static Format createVideoSampleFormat(
    @Nullable String id,
    @Nullable String sampleMimeType,
    @Nullable String codecs,
    int bitrate,
    int maxInputSize,
    int width,
    int height,
    float frameRate,
    @Nullable List<byte[]> initializationData,
    int rotationDegrees,
    float pixelWidthHeightRatio,
    @Nullable byte[] projectionData,
    @C.StereoMode int stereoMode,
    @Nullable ColorInfo colorInfo,
    @Nullable DrmInitData drmInitData) {
  return new Format(
      id,
      /* label= */ null,
      /* selectionFlags= */ 0,
      /* roleFlags= */ 0,
      bitrate,
      codecs,
      /* metadata= */ null,
      /* containerMimeType= */ null,
      sampleMimeType,
      maxInputSize,
      initializationData,
      drmInitData,
      OFFSET_SAMPLE_RELATIVE,
      width,
      height,
      frameRate,
      rotationDegrees,
      pixelWidthHeightRatio,
      projectionData,
      stereoMode,
      colorInfo,
      /* channelCount= */ NO_VALUE,
      /* sampleRate= */ NO_VALUE,
      /* pcmEncoding= */ NO_VALUE,
      /* encoderDelay= */ NO_VALUE,
      /* encoderPadding= */ NO_VALUE,
      /* language= */ null,
      /* accessibilityChannel= */ NO_VALUE,
      /* exoMediaCryptoType= */ null);
}
 
Example #16
Source File: Format.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public static Format createVideoSampleFormat(
    @Nullable String id,
    @Nullable String sampleMimeType,
    @Nullable String codecs,
    int bitrate,
    int maxInputSize,
    int width,
    int height,
    float frameRate,
    @Nullable List<byte[]> initializationData,
    int rotationDegrees,
    float pixelWidthHeightRatio,
    byte[] projectionData,
    @C.StereoMode int stereoMode,
    @Nullable ColorInfo colorInfo,
    @Nullable DrmInitData drmInitData) {
  return new Format(
      id,
      /* label= */ null,
      /* containerMimeType= */ null,
      sampleMimeType,
      codecs,
      bitrate,
      maxInputSize,
      width,
      height,
      frameRate,
      rotationDegrees,
      pixelWidthHeightRatio,
      projectionData,
      stereoMode,
      colorInfo,
      /* channelCount= */ NO_VALUE,
      /* sampleRate= */ NO_VALUE,
      /* pcmEncoding= */ NO_VALUE,
      /* encoderDelay= */ NO_VALUE,
      /* encoderPadding= */ NO_VALUE,
      /* selectionFlags= */ 0,
      /* language= */ null,
      /* accessibilityChannel= */ NO_VALUE,
      OFFSET_SAMPLE_RELATIVE,
      initializationData,
      drmInitData,
      /* metadata= */ null);
}
 
Example #17
Source File: Format.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
Format(
    @Nullable String id,
    @Nullable String label,
    @Nullable String containerMimeType,
    @Nullable String sampleMimeType,
    @Nullable String codecs,
    int bitrate,
    int maxInputSize,
    int width,
    int height,
    float frameRate,
    int rotationDegrees,
    float pixelWidthHeightRatio,
    @Nullable byte[] projectionData,
    @C.StereoMode int stereoMode,
    @Nullable ColorInfo colorInfo,
    int channelCount,
    int sampleRate,
    @C.PcmEncoding int pcmEncoding,
    int encoderDelay,
    int encoderPadding,
    @C.SelectionFlags int selectionFlags,
    @Nullable String language,
    int accessibilityChannel,
    long subsampleOffsetUs,
    @Nullable List<byte[]> initializationData,
    @Nullable DrmInitData drmInitData,
    @Nullable Metadata metadata) {
  this.id = id;
  this.label = label;
  this.containerMimeType = containerMimeType;
  this.sampleMimeType = sampleMimeType;
  this.codecs = codecs;
  this.bitrate = bitrate;
  this.maxInputSize = maxInputSize;
  this.width = width;
  this.height = height;
  this.frameRate = frameRate;
  this.rotationDegrees = rotationDegrees == Format.NO_VALUE ? 0 : rotationDegrees;
  this.pixelWidthHeightRatio =
      pixelWidthHeightRatio == Format.NO_VALUE ? 1 : pixelWidthHeightRatio;
  this.projectionData = projectionData;
  this.stereoMode = stereoMode;
  this.colorInfo = colorInfo;
  this.channelCount = channelCount;
  this.sampleRate = sampleRate;
  this.pcmEncoding = pcmEncoding;
  this.encoderDelay = encoderDelay == Format.NO_VALUE ? 0 : encoderDelay;
  this.encoderPadding = encoderPadding == Format.NO_VALUE ? 0 : encoderPadding;
  this.selectionFlags = selectionFlags;
  this.language = language;
  this.accessibilityChannel = accessibilityChannel;
  this.subsampleOffsetUs = subsampleOffsetUs;
  this.initializationData =
      initializationData == null ? Collections.emptyList() : initializationData;
  this.drmInitData = drmInitData;
  this.metadata = metadata;
}
 
Example #18
Source File: Format.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public static Format createVideoSampleFormat(
    @Nullable String id,
    @Nullable String sampleMimeType,
    @Nullable String codecs,
    int bitrate,
    int maxInputSize,
    int width,
    int height,
    float frameRate,
    @Nullable List<byte[]> initializationData,
    int rotationDegrees,
    float pixelWidthHeightRatio,
    byte[] projectionData,
    @C.StereoMode int stereoMode,
    @Nullable ColorInfo colorInfo,
    @Nullable DrmInitData drmInitData) {
  return new Format(
      id,
      /* label= */ null,
      /* containerMimeType= */ null,
      sampleMimeType,
      codecs,
      bitrate,
      maxInputSize,
      width,
      height,
      frameRate,
      rotationDegrees,
      pixelWidthHeightRatio,
      projectionData,
      stereoMode,
      colorInfo,
      /* channelCount= */ NO_VALUE,
      /* sampleRate= */ NO_VALUE,
      /* pcmEncoding= */ NO_VALUE,
      /* encoderDelay= */ NO_VALUE,
      /* encoderPadding= */ NO_VALUE,
      /* selectionFlags= */ 0,
      /* language= */ null,
      /* accessibilityChannel= */ NO_VALUE,
      OFFSET_SAMPLE_RELATIVE,
      initializationData,
      drmInitData,
      /* metadata= */ null);
}
 
Example #19
Source File: MediaCodecUtil.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
@Nullable
private static Pair<Integer, Integer> getAv1ProfileAndLevel(
    String codec, String[] parts, @Nullable ColorInfo colorInfo) {
  if (parts.length < 4) {
    Log.w(TAG, "Ignoring malformed AV1 codec string: " + codec);
    return null;
  }
  int profileInteger;
  int levelInteger;
  int bitDepthInteger;
  try {
    profileInteger = Integer.parseInt(parts[1]);
    levelInteger = Integer.parseInt(parts[2].substring(0, 2));
    bitDepthInteger = Integer.parseInt(parts[3]);
  } catch (NumberFormatException e) {
    Log.w(TAG, "Ignoring malformed AV1 codec string: " + codec);
    return null;
  }

  if (profileInteger != 0) {
    Log.w(TAG, "Unknown AV1 profile: " + profileInteger);
    return null;
  }
  if (bitDepthInteger != 8 && bitDepthInteger != 10) {
    Log.w(TAG, "Unknown AV1 bit depth: " + bitDepthInteger);
    return null;
  }
  int profile;
  if (bitDepthInteger == 8) {
    profile = CodecProfileLevel.AV1ProfileMain8;
  } else if (colorInfo != null
      && (colorInfo.hdrStaticInfo != null
          || colorInfo.colorTransfer == C.COLOR_TRANSFER_HLG
          || colorInfo.colorTransfer == C.COLOR_TRANSFER_ST2084)) {
    profile = CodecProfileLevel.AV1ProfileMain10HDR10;
  } else {
    profile = CodecProfileLevel.AV1ProfileMain10;
  }

  int level = AV1_LEVEL_NUMBER_TO_CONST.get(levelInteger, -1);
  if (level == -1) {
    Log.w(TAG, "Unknown AV1 level: " + levelInteger);
    return null;
  }
  return new Pair<>(profile, level);
}
 
Example #20
Source File: Format.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("ResourceType")
/* package */ Format(Parcel in) {
  id = in.readString();
  label = in.readString();
  selectionFlags = in.readInt();
  roleFlags = in.readInt();
  bitrate = in.readInt();
  codecs = in.readString();
  metadata = in.readParcelable(Metadata.class.getClassLoader());
  // Container specific.
  containerMimeType = in.readString();
  // Elementary stream specific.
  sampleMimeType = in.readString();
  maxInputSize = in.readInt();
  int initializationDataSize = in.readInt();
  initializationData = new ArrayList<>(initializationDataSize);
  for (int i = 0; i < initializationDataSize; i++) {
    initializationData.add(in.createByteArray());
  }
  drmInitData = in.readParcelable(DrmInitData.class.getClassLoader());
  subsampleOffsetUs = in.readLong();
  // Video specific.
  width = in.readInt();
  height = in.readInt();
  frameRate = in.readFloat();
  rotationDegrees = in.readInt();
  pixelWidthHeightRatio = in.readFloat();
  boolean hasProjectionData = Util.readBoolean(in);
  projectionData = hasProjectionData ? in.createByteArray() : null;
  stereoMode = in.readInt();
  colorInfo = in.readParcelable(ColorInfo.class.getClassLoader());
  // Audio specific.
  channelCount = in.readInt();
  sampleRate = in.readInt();
  pcmEncoding = in.readInt();
  encoderDelay = in.readInt();
  encoderPadding = in.readInt();
  // Audio and text specific.
  language = in.readString();
  accessibilityChannel = in.readInt();
  // Provided by source.
  exoMediaCryptoType = null;
}
 
Example #21
Source File: Format.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
Format(
    @Nullable String id,
    @Nullable String label,
    @C.SelectionFlags int selectionFlags,
    @C.RoleFlags int roleFlags,
    int bitrate,
    @Nullable String codecs,
    @Nullable Metadata metadata,
    // Container specific.
    @Nullable String containerMimeType,
    // Elementary stream specific.
    @Nullable String sampleMimeType,
    int maxInputSize,
    @Nullable List<byte[]> initializationData,
    @Nullable DrmInitData drmInitData,
    long subsampleOffsetUs,
    // Video specific.
    int width,
    int height,
    float frameRate,
    int rotationDegrees,
    float pixelWidthHeightRatio,
    @Nullable byte[] projectionData,
    @C.StereoMode int stereoMode,
    @Nullable ColorInfo colorInfo,
    // Audio specific.
    int channelCount,
    int sampleRate,
    @C.PcmEncoding int pcmEncoding,
    int encoderDelay,
    int encoderPadding,
    // Audio and text specific.
    @Nullable String language,
    int accessibilityChannel,
    // Provided by source.
    @Nullable Class<? extends ExoMediaCrypto> exoMediaCryptoType) {
  this.id = id;
  this.label = label;
  this.selectionFlags = selectionFlags;
  this.roleFlags = roleFlags;
  this.bitrate = bitrate;
  this.codecs = codecs;
  this.metadata = metadata;
  // Container specific.
  this.containerMimeType = containerMimeType;
  // Elementary stream specific.
  this.sampleMimeType = sampleMimeType;
  this.maxInputSize = maxInputSize;
  this.initializationData =
      initializationData == null ? Collections.emptyList() : initializationData;
  this.drmInitData = drmInitData;
  this.subsampleOffsetUs = subsampleOffsetUs;
  // Video specific.
  this.width = width;
  this.height = height;
  this.frameRate = frameRate;
  this.rotationDegrees = rotationDegrees == Format.NO_VALUE ? 0 : rotationDegrees;
  this.pixelWidthHeightRatio =
      pixelWidthHeightRatio == Format.NO_VALUE ? 1 : pixelWidthHeightRatio;
  this.projectionData = projectionData;
  this.stereoMode = stereoMode;
  this.colorInfo = colorInfo;
  // Audio specific.
  this.channelCount = channelCount;
  this.sampleRate = sampleRate;
  this.pcmEncoding = pcmEncoding;
  this.encoderDelay = encoderDelay == Format.NO_VALUE ? 0 : encoderDelay;
  this.encoderPadding = encoderPadding == Format.NO_VALUE ? 0 : encoderPadding;
  // Audio and text specific.
  this.language = Util.normalizeLanguageCode(language);
  this.accessibilityChannel = accessibilityChannel;
  // Provided by source.
  this.exoMediaCryptoType = exoMediaCryptoType;
}