Java 类com.google.android.exoplayer2.audio.MediaCodecAudioRenderer 实例源码

项目:videoPickPlayer    文件:SimpleExoPlayer.java   
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);
}
项目:ExoMedia    文件:RendererProvider.java   
@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;
}