• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MediaCodecSelector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.android.exoplayer2.mediacodec.MediaCodecSelector的典型用法代码示例。如果您正苦于以下问题:Java MediaCodecSelector类的具体用法?Java MediaCodecSelector怎么用?Java MediaCodecSelector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MediaCodecSelector类属于com.google.android.exoplayer2.mediacodec包,在下文中一共展示了MediaCodecSelector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: supportsFormat

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
@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,代码行数:25,代码来源:MediaCodecAudioRenderer.java


示例2: MediaCodecVideoRenderer

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
/**
 * @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,代码行数:37,代码来源:MediaCodecVideoRenderer.java


示例3: create

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
@NonNull
public SimpleExoPlayer create(DrmSessionCreator drmSessionCreator,
                              DefaultDrmSessionManager.EventListener drmSessionEventListener,
                              MediaCodecSelector mediaCodecSelector) {
    DrmSessionManager<FrameworkMediaCrypto> drmSessionManager = drmSessionCreator.create(drmSessionEventListener);
    RenderersFactory renderersFactory = new SimpleRenderersFactory(
            context,
            drmSessionManager,
            EXTENSION_RENDERER_MODE_OFF,
            DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS,
            mediaCodecSelector
    );

    DefaultLoadControl loadControl = new DefaultLoadControl();
    return ExoPlayerFactory.newSimpleInstance(renderersFactory, trackSelector, loadControl);
}
 
开发者ID:novoda,项目名称:no-player,代码行数:17,代码来源:ExoPlayerCreator.java


示例4: loadVideo

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
void loadVideo(SurfaceHolder surfaceHolder,
               DrmSessionCreator drmSessionCreator,
               Uri uri,
               ContentType contentType,
               ExoPlayerForwarder forwarder,
               MediaCodecSelector mediaCodecSelector) {
    this.contentType = contentType;
    exoPlayer = exoPlayerCreator.create(drmSessionCreator, forwarder.drmSessionEventListener(), mediaCodecSelector);
    rendererTypeRequester = rendererTypeRequesterCreator.createfrom(exoPlayer);
    exoPlayer.addListener(forwarder.exoPlayerEventListener());
    exoPlayer.setVideoDebugListener(forwarder.videoRendererEventListener());
    MediaSource mediaSource = mediaSourceFactory.create(
            contentType,
            uri,
            forwarder.extractorMediaSourceListener(),
            forwarder.mediaSourceEventListener()
    );
    attachToSurface(surfaceHolder);
    exoPlayer.prepare(mediaSource, RESET_POSITION, DO_NOT_RESET_STATE);
}
 
开发者ID:novoda,项目名称:no-player,代码行数:21,代码来源:ExoPlayerFacade.java


示例5: MediaCodecVideoRenderer

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
/**
 * @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;
  clearLastReportedVideoSize();
}
 
开发者ID:jcodeing,项目名称:K-Sonic,代码行数:37,代码来源:MediaCodecVideoRenderer.java


示例6: buildRenderers

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
private void buildRenderers(Context context,
    DrmSessionManager<FrameworkMediaCrypto> drmSessionManager, ArrayList<Renderer> renderersList,
    long allowedVideoJoiningTimeMs) {
  MediaCodecVideoRenderer videoRenderer = new MediaCodecVideoRenderer(context,
      MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT,
      allowedVideoJoiningTimeMs, drmSessionManager, false, mainHandler, componentListener,
      MAX_DROPPED_VIDEO_FRAME_COUNT_TO_NOTIFY);
  renderersList.add(videoRenderer);

  Renderer audioRenderer = new MediaCodecAudioRenderer(MediaCodecSelector.DEFAULT,
      drmSessionManager, true, mainHandler, componentListener,
      AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
  renderersList.add(audioRenderer);

  Renderer textRenderer = new TextRenderer(componentListener, mainHandler.getLooper());
  renderersList.add(textRenderer);

  MetadataRenderer<List<Id3Frame>> id3Renderer = new MetadataRenderer<>(componentListener,
      mainHandler.getLooper(), new Id3Decoder());
  renderersList.add(id3Renderer);
}
 
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:22,代码来源:SimpleExoPlayer.java


示例7: supportsFormat

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
@Override
protected int supportsFormat(MediaCodecSelector mediaCodecSelector, Format format)
    throws DecoderQueryException {
  String mimeType = format.sampleMimeType;
  if (!MimeTypes.isAudio(mimeType)) {
    return FORMAT_UNSUPPORTED_TYPE;
  }
  if (allowPassthrough(mimeType) && mediaCodecSelector.getPassthroughDecoderInfo() != null) {
    return ADAPTIVE_NOT_SEAMLESS | 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 | formatSupport;
}
 
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:24,代码来源:MediaCodecAudioRenderer.java


示例8: MediaCodecVideoRenderer

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
/**
 * @param context A context.
 * @param mediaCodecSelector A decoder selector.
 * @param videoScalingMode The scaling mode to pass to
 *     {@link MediaCodec#setVideoScalingMode(int)}.
 * @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,
    int videoScalingMode, long allowedJoiningTimeMs,
    DrmSessionManager<FrameworkMediaCrypto> drmSessionManager,
    boolean playClearSamplesWithoutKeys, Handler eventHandler,
    VideoRendererEventListener eventListener, int maxDroppedFramesToNotify) {
  super(C.TRACK_TYPE_VIDEO, mediaCodecSelector, drmSessionManager, playClearSamplesWithoutKeys);
  this.videoScalingMode = videoScalingMode;
  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;
  lastReportedWidth = Format.NO_VALUE;
  lastReportedHeight = Format.NO_VALUE;
  lastReportedPixelWidthHeightRatio = Format.NO_VALUE;
}
 
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:42,代码来源:MediaCodecVideoRenderer.java


示例9: buildAudioRenderers

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
@NonNull
protected List<Renderer> buildAudioRenderers() {
    List<Renderer> renderers = new ArrayList<>();

    renderers.add(new MediaCodecAudioRenderer(MediaCodecSelector.DEFAULT, drmSessionManager, true, handler, audioRendererEventListener, AudioCapabilities.getCapabilities(context)));

    // Adds any registered classes
    List<String> classNames = ExoMedia.Data.registeredRendererClasses.get(ExoMedia.RendererType.AUDIO);
    if (classNames != null) {
        for (String className: classNames) {
            try {
                Class<?> clazz = Class.forName(className);
                Constructor<?> constructor = clazz.getConstructor(Handler.class, AudioRendererEventListener.class);
                Renderer renderer = (Renderer) constructor.newInstance(handler, audioRendererEventListener);
                renderers.add(renderer);
            } catch (Exception e) {
                // Purposefully left blank
            }
        }
    }

    return renderers;
}
 
开发者ID:brianwernick,项目名称:ExoMedia,代码行数:24,代码来源:RendererProvider.java


示例10: buildVideoRenderers

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
@NonNull
protected List<Renderer> buildVideoRenderers() {
    List<Renderer> renderers = new ArrayList<>();

    renderers.add(new MediaCodecVideoRenderer(context, MediaCodecSelector.DEFAULT, videoJoiningTimeMs, drmSessionManager, false, handler, videoRendererEventListener, droppedFrameNotificationAmount));

    // Adds any registered classes
    List<String> classNames = ExoMedia.Data.registeredRendererClasses.get(ExoMedia.RendererType.VIDEO);
    if (classNames != null) {
        for (String className: classNames) {
            try {
                Class<?> clazz = Class.forName(className);
                Constructor<?> constructor = clazz.getConstructor(boolean.class, long.class, Handler.class, VideoRendererEventListener.class, int.class);
                Renderer renderer = (Renderer) constructor.newInstance(true, videoJoiningTimeMs, handler, videoRendererEventListener, droppedFrameNotificationAmount);
                renderers.add(renderer);
            } catch (Exception e) {
                // Purposefully left blank
            }
        }
    }

    return renderers;
}
 
开发者ID:brianwernick,项目名称:ExoMedia,代码行数:24,代码来源:RendererProvider.java


示例11: MediaCodecVideoRenderer

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
/**
 * @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,
    @Nullable DrmSessionManager<FrameworkMediaCrypto> drmSessionManager,
    boolean playClearSamplesWithoutKeys, @Nullable Handler eventHandler,
    @Nullable VideoRendererEventListener eventListener, int maxDroppedFramesToNotify) {
  super(C.TRACK_TYPE_VIDEO, mediaCodecSelector, drmSessionManager, playClearSamplesWithoutKeys);
  this.allowedJoiningTimeMs = allowedJoiningTimeMs;
  this.maxDroppedFramesToNotify = maxDroppedFramesToNotify;
  this.context = context.getApplicationContext();
  frameReleaseTimeHelper = new VideoFrameReleaseTimeHelper(context);
  eventDispatcher = new EventDispatcher(eventHandler, eventListener);
  deviceNeedsAutoFrcWorkaround = deviceNeedsAutoFrcWorkaround();
  pendingOutputStreamOffsetsUs = new long[MAX_PENDING_OUTPUT_STREAM_OFFSET_COUNT];
  outputStreamOffsetUs = C.TIME_UNSET;
  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:y20k,项目名称:transistor,代码行数:41,代码来源:MediaCodecVideoRenderer.java


示例12: buildVideoRenderers

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
@Override
protected void buildVideoRenderers(Context context, Handler mainHandler,
    DrmSessionManager<FrameworkMediaCrypto> drmSessionManager,
    @ExtensionRendererMode int extensionRendererMode, VideoRendererEventListener eventListener,
    long allowedVideoJoiningTimeMs, ArrayList<Renderer> out) {
  out.add(new DebugMediaCodecVideoRenderer(context, MediaCodecSelector.DEFAULT,
      allowedVideoJoiningTimeMs, mainHandler, drmSessionManager, eventListener,
      MAX_DROPPED_VIDEO_FRAME_COUNT_TO_NOTIFY));
}
 
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:10,代码来源:DebugSimpleExoPlayer.java


示例13: DebugMediaCodecVideoRenderer

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
public DebugMediaCodecVideoRenderer(Context context, MediaCodecSelector mediaCodecSelector,
    long allowedJoiningTimeMs, Handler eventHandler,
    DrmSessionManager<FrameworkMediaCrypto> drmSessionManager,
    VideoRendererEventListener eventListener, int maxDroppedFrameCountToNotify) {
  super(context, mediaCodecSelector, allowedJoiningTimeMs, drmSessionManager, false,
      eventHandler, eventListener, maxDroppedFrameCountToNotify);
}
 
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:8,代码来源:DebugSimpleExoPlayer.java


示例14: getDecoderInfo

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
@Override
protected MediaCodecInfo getDecoderInfo(MediaCodecSelector mediaCodecSelector,
    Format format, boolean requiresSecureDecoder) throws DecoderQueryException {
  if (allowPassthrough(format.sampleMimeType)) {
    MediaCodecInfo passthroughDecoderInfo = mediaCodecSelector.getPassthroughDecoderInfo();
    if (passthroughDecoderInfo != null) {
      passthroughEnabled = true;
      return passthroughDecoderInfo;
    }
  }
  passthroughEnabled = false;
  return super.getDecoderInfo(mediaCodecSelector, format, requiresSecureDecoder);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:14,代码来源:MediaCodecAudioRenderer.java


示例15: supportsFormat

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
@Override
protected int supportsFormat(MediaCodecSelector mediaCodecSelector, Format format)
    throws DecoderQueryException {
  String mimeType = format.sampleMimeType;
  if (!MimeTypes.isVideo(mimeType)) {
    return FORMAT_UNSUPPORTED_TYPE;
  }
  boolean requiresSecureDecryption = false;
  DrmInitData drmInitData = format.drmInitData;
  if (drmInitData != null) {
    for (int i = 0; i < drmInitData.schemeDataCount; i++) {
      requiresSecureDecryption |= drmInitData.get(i).requiresSecureDecryption;
    }
  }
  MediaCodecInfo decoderInfo = mediaCodecSelector.getDecoderInfo(mimeType,
      requiresSecureDecryption);
  if (decoderInfo == null) {
    return FORMAT_UNSUPPORTED_SUBTYPE;
  }

  boolean decoderCapable = decoderInfo.isCodecSupported(format.codecs);
  if (decoderCapable && format.width > 0 && format.height > 0) {
    if (Util.SDK_INT >= 21) {
      decoderCapable = decoderInfo.isVideoSizeAndRateSupportedV21(format.width, format.height,
          format.frameRate);
    } else {
      decoderCapable = format.width * format.height <= MediaCodecUtil.maxH264DecodableFrameSize();
      if (!decoderCapable) {
        Log.d(TAG, "FalseCheck [legacyFrameSize, " + format.width + "x" + format.height + "] ["
            + Util.DEVICE_DEBUG_INFO + "]");
      }
    }
  }

  int adaptiveSupport = decoderInfo.adaptive ? ADAPTIVE_SEAMLESS : ADAPTIVE_NOT_SEAMLESS;
  int tunnelingSupport = decoderInfo.tunneling ? TUNNELING_SUPPORTED : TUNNELING_NOT_SUPPORTED;
  int formatSupport = decoderCapable ? FORMAT_HANDLED : FORMAT_EXCEEDS_CAPABILITIES;
  return adaptiveSupport | tunnelingSupport | formatSupport;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:40,代码来源:MediaCodecVideoRenderer.java


示例16: ExoPlayerTwoImpl

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
ExoPlayerTwoImpl(ExoPlayerFacade exoPlayer,
                 PlayerListenersHolder listenersHolder,
                 ExoPlayerForwarder exoPlayerForwarder,
                 LoadTimeout loadTimeoutParam,
                 Heart heart,
                 DrmSessionCreator drmSessionCreator,
                 MediaCodecSelector mediaCodecSelector) {
    this.exoPlayer = exoPlayer;
    this.listenersHolder = listenersHolder;
    this.loadTimeout = loadTimeoutParam;
    this.forwarder = exoPlayerForwarder;
    this.heart = heart;
    this.drmSessionCreator = drmSessionCreator;
    this.mediaCodecSelector = mediaCodecSelector;
}
 
开发者ID:novoda,项目名称:no-player,代码行数:16,代码来源:ExoPlayerTwoImpl.java


示例17: SimpleRenderersFactory

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
/**
 * @param context                   A {@link Context}.
 * @param drmSessionManager         An optional {@link DrmSessionManager}. May be null if DRM protected
 *                                  playbacks are not required..
 * @param extensionRendererMode     The extension renderer mode, which determines if and how
 *                                  available extension renderers are used. Note that extensions must be included in the
 *                                  application build for them to be considered available.
 * @param allowedVideoJoiningTimeMs The maximum duration for which video renderers can attempt
 *                                  to seamlessly join an ongoing playback.
 * @param mediaCodecSelector        Used for selecting the codec for the video renderer.
 */
SimpleRenderersFactory(Context context,
                       DrmSessionManager<FrameworkMediaCrypto> drmSessionManager,
                       @ExtensionRendererMode int extensionRendererMode,
                       long allowedVideoJoiningTimeMs,
                       MediaCodecSelector mediaCodecSelector) {
    this.context = context;
    this.drmSessionManager = drmSessionManager;
    this.extensionRendererMode = extensionRendererMode;
    this.allowedVideoJoiningTimeMs = allowedVideoJoiningTimeMs;
    this.mediaCodecSelector = mediaCodecSelector;
}
 
开发者ID:novoda,项目名称:no-player,代码行数:23,代码来源:SimpleRenderersFactory.java


示例18: SonicMediaCodecAudioRenderer

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
public SonicMediaCodecAudioRenderer(MediaCodecSelector mediaCodecSelector,
    DrmSessionManager<FrameworkMediaCrypto> drmSessionManager,
    boolean playClearSamplesWithoutKeys, Handler eventHandler,
    AudioRendererEventListener eventListener, AudioCapabilities audioCapabilities,
    AudioProcessor... audioProcessors) {
  super(mediaCodecSelector, drmSessionManager, playClearSamplesWithoutKeys, eventHandler, eventListener, audioCapabilities, audioProcessors);
  //Init
  bufferIndex = -1;
  speed = 1.0f;
  pitch = 1.0f;
  rate = 1.0f;
}
 
开发者ID:jcodeing,项目名称:K-Sonic,代码行数:13,代码来源:SonicMediaCodecAudioRenderer.java


示例19: supportsFormat

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
@Override
protected int supportsFormat(MediaCodecSelector mediaCodecSelector, Format format)
    throws DecoderQueryException {
  String mimeType = format.sampleMimeType;
  if (!MimeTypes.isVideo(mimeType)) {
    return FORMAT_UNSUPPORTED_TYPE;
  }
  boolean requiresSecureDecryption = false;
  DrmInitData drmInitData = format.drmInitData;
  if (drmInitData != null) {
    for (int i = 0; i < drmInitData.schemeDataCount; i++) {
      requiresSecureDecryption |= drmInitData.get(i).requiresSecureDecryption;
    }
  }
  MediaCodecInfo decoderInfo = mediaCodecSelector.getDecoderInfo(mimeType,
      requiresSecureDecryption);
  if (decoderInfo == null) {
    return FORMAT_UNSUPPORTED_SUBTYPE;
  }

  boolean decoderCapable = decoderInfo.isCodecSupported(format.codecs);
  if (decoderCapable && format.width > 0 && format.height > 0) {
    if (Util.SDK_INT >= 21) {
      if (format.frameRate > 0) {
        decoderCapable = decoderInfo.isVideoSizeAndRateSupportedV21(format.width, format.height,
            format.frameRate);
      } else {
        decoderCapable = decoderInfo.isVideoSizeSupportedV21(format.width, format.height);
      }
    } else {
      decoderCapable = format.width * format.height <= MediaCodecUtil.maxH264DecodableFrameSize();
    }
  }

  int adaptiveSupport = decoderInfo.adaptive ? ADAPTIVE_SEAMLESS : ADAPTIVE_NOT_SEAMLESS;
  int formatSupport = decoderCapable ? FORMAT_HANDLED : FORMAT_EXCEEDS_CAPABILITIES;
  return adaptiveSupport | formatSupport;
}
 
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:39,代码来源:MediaCodecVideoRenderer.java


示例20: buildVideoRenderers

import com.google.android.exoplayer2.mediacodec.MediaCodecSelector; //导入依赖的package包/类
@Override
protected void buildVideoRenderers(Context context,
    DrmSessionManager<FrameworkMediaCrypto> drmSessionManager, long allowedVideoJoiningTimeMs,
    Handler eventHandler, VideoRendererEventListener eventListener,
    @ExtensionRendererMode int extensionRendererMode, ArrayList<Renderer> out) {
  out.add(new DebugMediaCodecVideoRenderer(context, MediaCodecSelector.DEFAULT,
      allowedVideoJoiningTimeMs, drmSessionManager, eventHandler, eventListener,
      MAX_DROPPED_VIDEO_FRAME_COUNT_TO_NOTIFY));
}
 
开发者ID:y20k,项目名称:transistor,代码行数:10,代码来源:DebugRenderersFactory.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ImmutableList类代码示例发布时间:2022-05-23
下一篇:
Java IShaderSource类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap