当前位置: 首页>>代码示例>>Java>>正文


Java Format.NO_VALUE属性代码示例

本文整理汇总了Java中com.google.android.exoplayer2.Format.NO_VALUE属性的典型用法代码示例。如果您正苦于以下问题:Java Format.NO_VALUE属性的具体用法?Java Format.NO_VALUE怎么用?Java Format.NO_VALUE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.android.exoplayer2.Format的用法示例。


在下文中一共展示了Format.NO_VALUE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMediaFormat

@SuppressLint("InlinedApi")
private static MediaFormat getMediaFormat(Format format, CodecMaxValues codecMaxValues,
    boolean deviceNeedsAutoFrcWorkaround, int tunnelingAudioSessionId) {
  MediaFormat frameworkMediaFormat = format.getFrameworkMediaFormatV16();
  // Set the maximum adaptive video dimensions.
  frameworkMediaFormat.setInteger(MediaFormat.KEY_MAX_WIDTH, codecMaxValues.width);
  frameworkMediaFormat.setInteger(MediaFormat.KEY_MAX_HEIGHT, codecMaxValues.height);
  // Set the maximum input size.
  if (codecMaxValues.inputSize != Format.NO_VALUE) {
    frameworkMediaFormat.setInteger(MediaFormat.KEY_MAX_INPUT_SIZE, codecMaxValues.inputSize);
  }
  // Set FRC workaround.
  if (deviceNeedsAutoFrcWorkaround) {
    frameworkMediaFormat.setInteger("auto-frc", 0);
  }
  // Configure tunneling if enabled.
  if (tunnelingAudioSessionId != C.AUDIO_SESSION_ID_UNSET) {
    configureTunnelingV21(frameworkMediaFormat, tunnelingAudioSessionId);
  }
  return frameworkMediaFormat;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:21,代码来源:MediaCodecVideoRenderer.java

示例2: onDisabled

@Override
protected void onDisabled() {
  currentWidth = Format.NO_VALUE;
  currentHeight = Format.NO_VALUE;
  currentPixelWidthHeightRatio = Format.NO_VALUE;
  pendingPixelWidthHeightRatio = Format.NO_VALUE;
  clearReportedVideoSize();
  clearRenderedFirstFrame();
  frameReleaseTimeHelper.disable();
  tunnelingOnFrameRenderedListener = null;
  try {
    super.onDisabled();
  } finally {
    decoderCounters.ensureUpdated();
    eventDispatcher.disabled(decoderCounters);
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:17,代码来源:MediaCodecVideoRenderer.java

示例3: Cea608Decoder

public Cea608Decoder(String mimeType, int accessibilityChannel) {
  ccData = new ParsableByteArray();
  cueBuilders = new LinkedList<>();
  currentCueBuilder = new CueBuilder(CC_MODE_UNKNOWN, DEFAULT_CAPTIONS_ROW_COUNT);
  packetLength = MimeTypes.APPLICATION_MP4CEA608.equals(mimeType) ? 2 : 3;
  switch (accessibilityChannel) {
    case 3:
    case 4:
      selectedField = 2;
      break;
    case 1:
    case 2:
    case Format.NO_VALUE:
    default:
      selectedField = 1;
  }

  setCaptionMode(CC_MODE_UNKNOWN);
  resetCueBuilders();
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:20,代码来源:Cea608Decoder.java

示例4: MediaCodecVideoRenderer

/**
 * @param context A context.
 * @param mediaCodecSelector A decoder selector.
 * @param allowedJoiningTimeMs The maximum duration in milliseconds for which this video renderer
 *     can attempt to seamlessly join an ongoing playback.
 * @param drmSessionManager For use with encrypted content. May be null if support for encrypted
 *     content is not required.
 * @param playClearSamplesWithoutKeys Encrypted media may contain clear (un-encrypted) regions.
 *     For example a media file may start with a short clear region so as to allow playback to
 *     begin in parallel with key acquisition. This parameter specifies whether the renderer is
 *     permitted to play clear regions of encrypted media files before {@code drmSessionManager}
 *     has obtained the keys necessary to decrypt encrypted regions of the media.
 * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
 *     null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 * @param maxDroppedFramesToNotify The maximum number of frames that can be dropped between
 *     invocations of {@link VideoRendererEventListener#onDroppedFrames(int, long)}.
 */
public MediaCodecVideoRenderer(Context context, MediaCodecSelector mediaCodecSelector,
    long allowedJoiningTimeMs, DrmSessionManager<FrameworkMediaCrypto> drmSessionManager,
    boolean playClearSamplesWithoutKeys, Handler eventHandler,
    VideoRendererEventListener eventListener, int maxDroppedFramesToNotify) {
  super(C.TRACK_TYPE_VIDEO, mediaCodecSelector, drmSessionManager, playClearSamplesWithoutKeys);
  this.allowedJoiningTimeMs = allowedJoiningTimeMs;
  this.maxDroppedFramesToNotify = maxDroppedFramesToNotify;
  frameReleaseTimeHelper = new VideoFrameReleaseTimeHelper(context);
  eventDispatcher = new EventDispatcher(eventHandler, eventListener);
  deviceNeedsAutoFrcWorkaround = deviceNeedsAutoFrcWorkaround();
  joiningDeadlineMs = C.TIME_UNSET;
  currentWidth = Format.NO_VALUE;
  currentHeight = Format.NO_VALUE;
  currentPixelWidthHeightRatio = Format.NO_VALUE;
  pendingPixelWidthHeightRatio = Format.NO_VALUE;
  scalingMode = C.VIDEO_SCALING_MODE_DEFAULT;
  clearReportedVideoSize();
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:36,代码来源:MediaCodecVideoRenderer.java

示例5: supportsFormat

@Override
protected int supportsFormat(MediaCodecSelector mediaCodecSelector, Format format)
    throws DecoderQueryException {
  String mimeType = format.sampleMimeType;
  if (!MimeTypes.isAudio(mimeType)) {
    return FORMAT_UNSUPPORTED_TYPE;
  }
  int tunnelingSupport = Util.SDK_INT >= 21 ? TUNNELING_SUPPORTED : TUNNELING_NOT_SUPPORTED;
  if (allowPassthrough(mimeType) && mediaCodecSelector.getPassthroughDecoderInfo() != null) {
    return ADAPTIVE_NOT_SEAMLESS | tunnelingSupport | FORMAT_HANDLED;
  }
  MediaCodecInfo decoderInfo = mediaCodecSelector.getDecoderInfo(mimeType, false);
  if (decoderInfo == null) {
    return FORMAT_UNSUPPORTED_SUBTYPE;
  }
  // Note: We assume support for unknown sampleRate and channelCount.
  boolean decoderCapable = Util.SDK_INT < 21
      || ((format.sampleRate == Format.NO_VALUE
      || decoderInfo.isAudioSampleRateSupportedV21(format.sampleRate))
      && (format.channelCount == Format.NO_VALUE
      ||  decoderInfo.isAudioChannelCountSupportedV21(format.channelCount)));
  int formatSupport = decoderCapable ? FORMAT_HANDLED : FORMAT_EXCEEDS_CAPABILITIES;
  return ADAPTIVE_NOT_SEAMLESS | tunnelingSupport | formatSupport;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:24,代码来源:MediaCodecAudioRenderer.java

示例6: parse

/**
 * Parses AVC configuration data.
 *
 * @param data A {@link ParsableByteArray}, whose position is set to the start of the AVC
 *     configuration data to parse.
 * @return A parsed representation of the HEVC configuration data.
 * @throws ParserException If an error occurred parsing the data.
 */
public static AvcConfig parse(ParsableByteArray data) throws ParserException {
  try {
    data.skipBytes(4); // Skip to the AVCDecoderConfigurationRecord (defined in 14496-15)
    int nalUnitLengthFieldLength = (data.readUnsignedByte() & 0x3) + 1;
    if (nalUnitLengthFieldLength == 3) {
      throw new IllegalStateException();
    }
    List<byte[]> initializationData = new ArrayList<>();
    int numSequenceParameterSets = data.readUnsignedByte() & 0x1F;
    for (int j = 0; j < numSequenceParameterSets; j++) {
      initializationData.add(buildNalUnitForChild(data));
    }
    int numPictureParameterSets = data.readUnsignedByte();
    for (int j = 0; j < numPictureParameterSets; j++) {
      initializationData.add(buildNalUnitForChild(data));
    }

    int width = Format.NO_VALUE;
    int height = Format.NO_VALUE;
    float pixelWidthAspectRatio = 1;
    if (numSequenceParameterSets > 0) {
      byte[] sps = initializationData.get(0);
      SpsData spsData = NalUnitUtil.parseSpsNalUnit(initializationData.get(0),
          nalUnitLengthFieldLength, sps.length);
      width = spsData.width;
      height = spsData.height;
      pixelWidthAspectRatio = spsData.pixelWidthAspectRatio;
    }
    return new AvcConfig(initializationData, nalUnitLengthFieldLength, width, height,
        pixelWidthAspectRatio);
  } catch (ArrayIndexOutOfBoundsException e) {
    throw new ParserException("Error parsing AVC config", e);
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:42,代码来源:AvcConfig.java

示例7: getCodecMaxValues

/**
 * Returns {@link CodecMaxValues} suitable for configuring a codec for {@code format} in a way
 * that will allow possible adaptation to other compatible formats in {@code streamFormats}.
 *
 * @param codecInfo Information about the {@link MediaCodec} being configured.
 * @param format The format for which the codec is being configured.
 * @param streamFormats The possible stream formats.
 * @return Suitable {@link CodecMaxValues}.
 * @throws DecoderQueryException If an error occurs querying {@code codecInfo}.
 */
private static CodecMaxValues getCodecMaxValues(MediaCodecInfo codecInfo, Format format,
    Format[] streamFormats) throws DecoderQueryException {
  int maxWidth = format.width;
  int maxHeight = format.height;
  int maxInputSize = getMaxInputSize(format);
  if (streamFormats.length == 1) {
    // The single entry in streamFormats must correspond to the format for which the codec is
    // being configured.
    return new CodecMaxValues(maxWidth, maxHeight, maxInputSize);
  }
  boolean haveUnknownDimensions = false;
  for (Format streamFormat : streamFormats) {
    if (areAdaptationCompatible(codecInfo.adaptive, format, streamFormat)) {
      haveUnknownDimensions |= (streamFormat.width == Format.NO_VALUE
          || streamFormat.height == Format.NO_VALUE);
      maxWidth = Math.max(maxWidth, streamFormat.width);
      maxHeight = Math.max(maxHeight, streamFormat.height);
      maxInputSize = Math.max(maxInputSize, getMaxInputSize(streamFormat));
    }
  }
  if (haveUnknownDimensions) {
    Log.w(TAG, "Resolutions unknown. Codec max resolution: " + maxWidth + "x" + maxHeight);
    Point codecMaxSize = getCodecMaxSize(codecInfo, format);
    if (codecMaxSize != null) {
      maxWidth = Math.max(maxWidth, codecMaxSize.x);
      maxHeight = Math.max(maxHeight, codecMaxSize.y);
      maxInputSize = Math.max(maxInputSize,
          getMaxInputSize(format.sampleMimeType, maxWidth, maxHeight));
      Log.w(TAG, "Codec max resolution adjusted to: " + maxWidth + "x" + maxHeight);
    }
  }
  return new CodecMaxValues(maxWidth, maxHeight, maxInputSize);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:43,代码来源:MediaCodecVideoRenderer.java

示例8: reset

@Override
public void reset() {
  sonic = null;
  buffer = EMPTY_BUFFER;
  shortBuffer = buffer.asShortBuffer();
  outputBuffer = EMPTY_BUFFER;
  channelCount = Format.NO_VALUE;
  sampleRateHz = Format.NO_VALUE;
  inputBytes = 0;
  outputBytes = 0;
  inputEnded = false;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:12,代码来源:SonicAudioProcessor.java

示例9: reset

@Override
public void reset() {
  flush();
  buffer = EMPTY_BUFFER;
  channelCount = Format.NO_VALUE;
  sampleRateHz = Format.NO_VALUE;
  outputChannels = null;
  active = false;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:9,代码来源:ChannelMappingAudioProcessor.java

示例10: areSizeAndRateSupported

@TargetApi(21)
private static boolean areSizeAndRateSupported(VideoCapabilities capabilities, int width,
    int height, double frameRate) {
  return frameRate == Format.NO_VALUE || frameRate <= 0
      ? capabilities.isSizeSupported(width, height)
      : capabilities.areSizeAndRateSupported(width, height, frameRate);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:7,代码来源:MediaCodecInfo.java

示例11: ResamplingAudioProcessor

/**
 * Creates a new audio processor that converts audio data to {@link C#ENCODING_PCM_16BIT}.
 */
public ResamplingAudioProcessor() {
  sampleRateHz = Format.NO_VALUE;
  channelCount = Format.NO_VALUE;
  encoding = C.ENCODING_INVALID;
  buffer = EMPTY_BUFFER;
  outputBuffer = EMPTY_BUFFER;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:10,代码来源:ResamplingAudioProcessor.java

示例12: getMaxInputSize

/**
 * Returns a maximum input size for a given format.
 *
 * @param format The format.
 * @return A maximum input size in bytes, or {@link Format#NO_VALUE} if a maximum could not be
 *     determined.
 */
private static int getMaxInputSize(Format format) {
  if (format.maxInputSize != Format.NO_VALUE) {
    // The format defines an explicit maximum input size.
    return format.maxInputSize;
  }
  return getMaxInputSize(format.sampleMimeType, format.width, format.height);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:14,代码来源:MediaCodecVideoRenderer.java

示例13: getPixelAspectRatioString

private static String getPixelAspectRatioString(float pixelAspectRatio) {
  return pixelAspectRatio == Format.NO_VALUE || pixelAspectRatio == 1f ? ""
      : (" par:" + String.format(Locale.US, "%.02f", pixelAspectRatio));
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:4,代码来源:DebugTextViewHelper.java

示例14: buildAudioPropertyString

private static String buildAudioPropertyString(Format format) {
    return format.channelCount == Format.NO_VALUE || format.sampleRate == Format.NO_VALUE
            ? "" : format.channelCount + "ch, " + format.sampleRate + "Hz";
}
 
开发者ID:Tubitv,项目名称:TubiPlayer,代码行数:4,代码来源:TubiQualityDialogView.java

示例15: buildAudioPropertyString

private static String buildAudioPropertyString(Format format) {
  return format.channelCount == Format.NO_VALUE || format.sampleRate == Format.NO_VALUE
      ? "" : format.channelCount + "ch, " + format.sampleRate + "Hz";
}
 
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:4,代码来源:TrackSelectionHelper.java


注:本文中的com.google.android.exoplayer2.Format.NO_VALUE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。