Java 类com.google.android.exoplayer.audio.AudioCapabilities 实例源码

项目:AndroidTvDemo    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(DemoPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
  Handler mainHandler = player.getMainHandler();

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(mainHandler, null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE, mainHandler, player, 0);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
      mainHandler, player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      MediaCodecSelector.DEFAULT, null, true, mainHandler, player,
      AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      mainHandler.getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
项目:ShaddockVideoPlayer    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(DemoPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
  Handler mainHandler = player.getMainHandler();

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(mainHandler, null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE, mainHandler, player, 0);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
      mainHandler, player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      MediaCodecSelector.DEFAULT, null, true, mainHandler, player,
      AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      mainHandler.getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
项目:ExoPlayerController    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(DemoPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
      null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, player.getMainHandler(),
      player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      null, true, player.getMainHandler(), player, AudioCapabilities.getCapabilities(context));
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      player.getMainHandler().getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
项目:talk-android    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(DemoPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
      null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, player.getMainHandler(),
      player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      null, true, player.getMainHandler(), player, AudioCapabilities.getCapabilities(context));
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      player.getMainHandler().getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
项目:OKPlayer    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(DemoPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
  Handler mainHandler = player.getMainHandler();

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(mainHandler, null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE, mainHandler, player, 0);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
      mainHandler, player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      MediaCodecSelector.DEFAULT, null, true, mainHandler, player,
      AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      mainHandler.getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
项目:Mediathek    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(Player player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
      null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, player.getMainHandler(),
      player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      null, true, player.getMainHandler(), player, AudioCapabilities.getCapabilities(context));
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      player.getMainHandler().getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[Player.RENDERER_COUNT];
  renderers[Player.TYPE_VIDEO] = videoRenderer;
  renderers[Player.TYPE_AUDIO] = audioRenderer;
  renderers[Player.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
项目:WliveTV    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(DemoPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
      null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, player.getMainHandler(),
      player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      null, true, player.getMainHandler(), player, AudioCapabilities.getCapabilities(context));
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      player.getMainHandler().getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
项目:luxunPro    文件:EMExoPlayer.java   
@Override
public void onAudioCapabilitiesChanged(AudioCapabilities audioCapabilities) {
    if (audioCapabilities.equals(this.audioCapabilities)) {
        return;
    }

    this.audioCapabilities = audioCapabilities;
    if (rendererBuilder == null) {
        return;
    }

    //Restarts the media playback to allow the RenderBuilder to handle the audio channel determination
    boolean playWhenReady = getPlayWhenReady();
    long currentPosition = getCurrentPosition();

    replaceRenderBuilder(rendererBuilder);

    player.seekTo(currentPosition);
    player.setPlayWhenReady(playWhenReady);
}
项目:luxunPro    文件:RenderBuilder.java   
public void buildRenderers(EMExoPlayer player) {
    //Create the Sample Source to be used by the renderers
    Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
    DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(), player);
    DataSource dataSource = createDataSource(okHttpClient, null, userAgent);

    ExtractorSampleSource sampleSource = new ExtractorSampleSource(Uri.parse(MediaUtil.getUriWithProtocol(uri)), dataSource,
           allocator, BUFFER_SEGMENT_SIZE * BUFFER_SEGMENTS_TOTAL, player.getMainHandler(), player, 0);

    //Create the Renderers
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context, sampleSource, MediaCodecSelector.DEFAULT,
            MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, MAX_JOIN_TIME, player.getMainHandler(), player, DROPPED_FRAME_NOTIFICATION_AMOUNT);
    EMMediaCodecAudioTrackRenderer audioRenderer = new EMMediaCodecAudioTrackRenderer(sampleSource, MediaCodecSelector.DEFAULT, null, true,
            player.getMainHandler(), player, AudioCapabilities.getCapabilities(context), streamType);
    TrackRenderer captionsRenderer = new TextTrackRenderer(sampleSource, player, player.getMainHandler().getLooper());


    //Create the Render list to send to the callback
    TrackRenderer[] renderers = new TrackRenderer[EMExoPlayer.RENDER_COUNT];
    renderers[EMExoPlayer.RENDER_VIDEO] = videoRenderer;
    renderers[EMExoPlayer.RENDER_AUDIO] = audioRenderer;
    renderers[EMExoPlayer.RENDER_CLOSED_CAPTION] = captionsRenderer;
    player.onRenderers(renderers, bandwidthMeter);
}
项目:exoplayer-textureview    文件:AssetsRendererBuilder.java   
@Override
protected void buildRenderers(RendererBuilderCallback callback) {
    Allocator allocator = new DefaultAllocator(bufferSegmentSize);
    DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
    ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource,
            allocator, bufferSegmentSize * bufferSegmentCount);
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
            sampleSource, MediaCodecSelector.DEFAULT,
            MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
            eventHandler, eventProxy, 50);
    MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
            MediaCodecSelector.DEFAULT, null, true, eventHandler, eventProxy,
            AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);

    TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, eventProxy,
            eventHandler.getLooper());

    // Invoke the callback.
    TrackRenderer[] renderers = new TrackRenderer[Player.RENDERER_COUNT];
    renderers[Player.TYPE_VIDEO] = videoRenderer;
    renderers[Player.TYPE_AUDIO] = audioRenderer;
    renderers[Player.TYPE_TEXT] = textRenderer;
    callback.onRenderers(renderers, bandwidthMeter);
}
项目:ExoPlayerWrapper    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(ExoPlayerWrapper player) {
    Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

    // Build the video and audio renderers.
    DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
            null);
    DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
    ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
            BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
            sampleSource, MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
            player.getMainHandler(), player, 50);
    MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
            MediaCodecSelector.DEFAULT, null, true, player.getMainHandler(), player,
            AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
    TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
            player.getMainHandler().getLooper());

    // Invoke the callback.
    TrackRenderer[] renderers = new TrackRenderer[ExoPlayerWrapper.RENDERER_COUNT];
    renderers[ExoPlayerWrapper.TYPE_VIDEO] = videoRenderer;
    renderers[ExoPlayerWrapper.TYPE_AUDIO] = audioRenderer;
    renderers[ExoPlayerWrapper.TYPE_TEXT] = textRenderer;
    player.onRenderers(renderers, bandwidthMeter);
}
项目:Android-Birdcopy-Application    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(FlyingPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
      null);
  DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, player.getMainHandler(),
      player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      null, true, player.getMainHandler(), player, AudioCapabilities.getCapabilities(context));
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      player.getMainHandler().getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[FlyingPlayer.RENDERER_COUNT];
  renderers[FlyingPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[FlyingPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[FlyingPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
项目:SimpleExoPlayer    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(DemoPlayer player) {
    Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

    // Build the video and audio renderers.
    DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
            null);
    DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
    ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
            BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
            sampleSource, MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
            player.getMainHandler(), player, 50);
    MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
            MediaCodecSelector.DEFAULT, null, true, player.getMainHandler(), player,
            AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
    TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
            player.getMainHandler().getLooper());

    // Invoke the callback.
    TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
    renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
    renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
    renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
    player.onRenderers(renderers, bandwidthMeter);
}
项目:google-media-framework-android    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(ExoplayerWrapper player) {
    Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

    // Build the video and audio renderers.
    DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
            null);
    DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
    ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
            BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
            sampleSource, MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT,
            5000, player.getMainHandler(), player, 50);
    MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
            MediaCodecSelector.DEFAULT, null, true, player.getMainHandler(), player,
            AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
    TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
            player.getMainHandler().getLooper());

    // Invoke the callback.
    TrackRenderer[] renderers = new TrackRenderer[ExoplayerWrapper.RENDERER_COUNT];
    renderers[ExoplayerWrapper.TYPE_VIDEO] = videoRenderer;
    renderers[ExoplayerWrapper.TYPE_AUDIO] = audioRenderer;
    renderers[ExoplayerWrapper.TYPE_TEXT] = textRenderer;
    player.onRenderers(renderers, bandwidthMeter);
}
项目:androidtv-sample    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(DemoPlayer player) {
    Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

    // Build the video and audio renderers.
    DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
            null);
    DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
    ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
            BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
            sampleSource, MediaCodecSelector.DEFAULT,
            MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
            player.getMainHandler(), player, 50);
    MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
            MediaCodecSelector.DEFAULT, null, true, player.getMainHandler(), player,
            AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
    TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
            player.getMainHandler().getLooper());

    // Invoke the callback.
    TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
    renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
    renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
    renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
    player.onRenderers(renderers, bandwidthMeter);
}
项目:androidtv-sample    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(VideoPlayer player) {
    Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

    // Build the video and audio renderers.
    DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
            null);
    DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
    ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
            BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
            sampleSource, MediaCodecSelector.DEFAULT,
            MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
            player.getMainHandler(), player, 50);
    MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
            MediaCodecSelector.DEFAULT, null, true, player.getMainHandler(), player,
            AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
    TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
            player.getMainHandler().getLooper());

    // Invoke the callback.
    TrackRenderer[] renderers = new TrackRenderer[VideoPlayer.RENDERER_COUNT];
    renderers[VideoPlayer.TYPE_VIDEO] = videoRenderer;
    renderers[VideoPlayer.TYPE_AUDIO] = audioRenderer;
    renderers[VideoPlayer.TYPE_TEXT] = textRenderer;
    player.onRenderers(renderers, bandwidthMeter);
}
项目:chilly    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(VideoPlayer player) {
    Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

    // Build the video and audio renderers.
    DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
            null);
    DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
    ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
            BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
            sampleSource, MediaCodecSelector.DEFAULT,
            MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
            player.getMainHandler(), player, 50);
    MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
            MediaCodecSelector.DEFAULT, null, true, player.getMainHandler(), player,
            AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
    TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
            player.getMainHandler().getLooper());

    // Invoke the callback.
    TrackRenderer[] renderers = new TrackRenderer[VideoPlayer.RENDERER_COUNT];
    renderers[VideoPlayer.TYPE_VIDEO] = videoRenderer;
    renderers[VideoPlayer.TYPE_AUDIO] = audioRenderer;
    renderers[VideoPlayer.TYPE_TEXT] = textRenderer;
    player.onRenderers(renderers, bandwidthMeter);
}
项目:android-tv-news    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(VideoPlayer player) {
    Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);

    // Build the video and audio renderers.
    DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(),
            null);
    DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
    ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
            BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE);
    MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
            sampleSource, MediaCodecSelector.DEFAULT,
            MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
            player.getMainHandler(), player, 50);
    MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
            MediaCodecSelector.DEFAULT, null, true, player.getMainHandler(), player,
            AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
    TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
            player.getMainHandler().getLooper());

    // Invoke the callback.
    TrackRenderer[] renderers = new TrackRenderer[VideoPlayer.RENDERER_COUNT];
    renderers[VideoPlayer.TYPE_VIDEO] = videoRenderer;
    renderers[VideoPlayer.TYPE_AUDIO] = audioRenderer;
    renderers[VideoPlayer.TYPE_TEXT] = textRenderer;
    player.onRenderers(renderers, bandwidthMeter);
}
项目:ExoPlayerController    文件:PlayerActivity.java   
@Override
public void onAudioCapabilitiesChanged(AudioCapabilities audioCapabilities) {
    if (player == null) {
        return;
    }
    boolean backgrounded = player.getBackgrounded();
    boolean playWhenReady = player.getPlayWhenReady();
    releasePlayer();
    preparePlayer(playWhenReady);
    player.setBackgrounded(backgrounded);
}
项目:FriendsCameraSDK-android    文件:ExtractorRendererBuilder.java   
@Override
public void buildRenderers(DemoPlayer player) {
  Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
  Handler mainHandler = player.getMainHandler();

  // Build the video and audio renderers.
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(mainHandler, null);
  dataSource  = new CameraDataSource( bandwidthMeter);
  try {
    dataSource.open(new DataSpec(uri));
  } catch (IOException e) {
    e.printStackTrace();
  }
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
      BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE, mainHandler, player, 0);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000,
      mainHandler, player, 50);
  MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      MediaCodecSelector.DEFAULT, null, true, mainHandler, player,
      AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
  TrackRenderer textRenderer = new TextTrackRenderer(sampleSource, player,
      mainHandler.getLooper());

  // Invoke the callback.
  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_TEXT] = textRenderer;
  player.onRenderers(renderers, bandwidthMeter);
}
项目:android_packages_apps_tv    文件:TunerTvInputService.java   
@Override
public void onAudioCapabilitiesChanged(AudioCapabilities audioCapabilities) {
    mAudioCapabilities = audioCapabilities;
    for (TunerSession session : mTunerSessions) {
        if (!session.isReleased()) {
            session.setAudioCapabilities(audioCapabilities);
        }
    }
}
项目:android_packages_apps_tv    文件:TunerSessionWorker.java   
private MpegTsPlayer createPlayer(AudioCapabilities capabilities, BufferManager bufferManager) {
    if (capabilities == null) {
        Log.w(TAG, "No Audio Capabilities");
    }

    MpegTsPlayer player = new MpegTsPlayer(
            new MpegTsRendererBuilder(mContext, bufferManager, this),
            mHandler, mSourceManager, capabilities, this);
    Log.i(TAG, "Passthrough AC3 renderer");
    if (DEBUG) Log.d(TAG, "ExoPlayer created");
    return player;
}
项目:android_packages_apps_tv    文件:MpegTsPlayer.java   
/**
 * Creates MPEG2-TS stream player.
 *
 * @param rendererBuilder the builder of track renderers
 * @param handler the handler for the playback events in track renderers
 * @param sourceManager the manager for {@link DataSource}
 * @param capabilities the {@link AudioCapabilities} of the current device
 * @param listener the listener for playback state changes
 */
public MpegTsPlayer(RendererBuilder rendererBuilder, Handler handler,
        TsDataSourceManager sourceManager, AudioCapabilities capabilities,
        Listener listener) {
    mRendererBuilder = rendererBuilder;
    mPlayer = ExoPlayer.Factory.newInstance(RENDERER_COUNT, MIN_BUFFER_MS, MIN_REBUFFER_MS);
    mPlayer.addListener(this);
    mMainHandler = handler;
    mAudioCapabilities = capabilities;
    mRendererBuildingState = RENDERER_BUILDING_STATE_IDLE;
    mCcListener = new MpegTsCcListener();
    mSourceManager = sourceManager;
    mListener = listener;
}
项目:GLMediaPlayer    文件:CustomExoPlayer.java   
private void preparePlayer(boolean playWhenReady) {
        Uri uri = Uri.parse(dataPath);
        Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
        // Build the video and audio renderers.
        DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(getMainHandler(), null);
        DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent);
        ExtractorSampleSource sampleSource = new ExtractorSampleSource(uri, dataSource, allocator,
                BUFFER_SEGMENT_COUNT * BUFFER_SEGMENT_SIZE, null);


        TextureVideoTrackRenderer videoRenderer = new TextureVideoTrackRenderer(context, sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000
                , null, true, getMainHandler(), this, 50);

        MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
                null, true, getMainHandler(), this, AudioCapabilities.getCapabilities(context));

        // Invoke the callback.
        TrackRenderer[] renderers = new TrackRenderer[RENDERER_COUNT];
        renderers[TYPE_VIDEO] = videoRenderer;
        renderers[TYPE_AUDIO] = audioRenderer;

        player.sendMessage(
                videoRenderer, MediaCodecVideoTrackRenderer.MSG_SET_SURFACE, surface);
        Log.e(TAG, "after send Message");
//        onRenderers(renderers, bandwidthMeter);
        player.prepare(renderers);
        player.setPlayWhenReady(playWhenReady);
    }
项目:miku    文件:HlsChunkSource.java   
public HlsChunkSource(DataSource dataSource, String playlistUrl, HlsPlaylist playlist,
    BandwidthMeter bandwidthMeter, int[] variantIndices, int adaptiveMode,
    AudioCapabilities audioCapabilities) {
  this(dataSource, playlistUrl, playlist, bandwidthMeter, variantIndices, adaptiveMode,
      DEFAULT_MIN_BUFFER_TO_SWITCH_UP_MS, DEFAULT_MAX_BUFFER_TO_SWITCH_DOWN_MS,
      audioCapabilities);
}
项目:miku    文件:TsExtractor.java   
public TsExtractor(long firstSampleTimestampUs, AudioCapabilities audioCapabilities,
    boolean idrKeyframesOnly) {
  this.firstSampleTimestampUs = firstSampleTimestampUs;
  this.idrKeyframesOnly = idrKeyframesOnly;
  tsScratch = new ParsableBitArray(new byte[3]);
  tsPacketBuffer = new ParsableByteArray(TS_PACKET_SIZE);
  streamTypes = new SparseBooleanArray();
  allowedPassthroughStreamTypes = getPassthroughStreamTypes(audioCapabilities);
  tsPayloadReaders = new SparseArray<>();
  tsPayloadReaders.put(TS_PAT_PID, new PatReader());
  lastPts = Long.MIN_VALUE;
}
项目:miku    文件:TsExtractor.java   
/**
 * Returns a sparse boolean array of stream types that can be played back based on
 * {@code audioCapabilities}.
 */
private static SparseBooleanArray getPassthroughStreamTypes(AudioCapabilities audioCapabilities) {
  SparseBooleanArray streamTypes = new SparseBooleanArray();
  if (audioCapabilities != null) {
    if (audioCapabilities.supportsEncoding(C.ENCODING_AC3)) {
      streamTypes.put(TS_STREAM_TYPE_ATSC_AC3, true);
    }
    if (audioCapabilities.supportsEncoding(C.ENCODING_E_AC3)) {
      // TODO: Uncomment when Ac3Reader supports enhanced AC-3.
      // streamTypes.put(TS_STREAM_TYPE_ATSC_E_AC3, true);
    }
  }
  return streamTypes;
}
项目:miku    文件:DashRendererBuilder.java   
public DashRendererBuilder(Context context, String userAgent, String url,
                           MediaDrmCallback drmCallback, AudioCapabilities audioCapabilities) {
  this.context = context;
  this.userAgent = userAgent;
  this.url = url;
  this.drmCallback = drmCallback;
  this.audioCapabilities = audioCapabilities;
}
项目:miku    文件:DashRendererBuilder.java   
public AsyncRendererBuilder(Context context, String userAgent, String url,
                            MediaDrmCallback drmCallback, AudioCapabilities audioCapabilities, MediaPlayer player) {
  this.context = context;
  this.userAgent = userAgent;
  this.drmCallback = drmCallback;
  this.audioCapabilities = audioCapabilities;
  this.player = player;
  MediaPresentationDescriptionParser parser = new MediaPresentationDescriptionParser();
  manifestDataSource = new DefaultUriDataSource(context, userAgent);
  manifestFetcher = new ManifestFetcher<>(url, manifestDataSource, parser);
}
项目:miku    文件:Sample.java   
public Sample(String name, String contentId, String uri, Type type,
              AudioCapabilities audioCapabilities) {
  this.name = name;
  this.contentId = contentId;
  this.uri = uri;
  this.type = type;
  this.audioCapabilities = audioCapabilities;
}
项目:miku    文件:HlsRendererBuilder.java   
public HlsRendererBuilder(Context context, String userAgent, String url,
                          AudioCapabilities audioCapabilities) {
  this.context = context;
  this.userAgent = userAgent;
  this.url = url;
  this.audioCapabilities = audioCapabilities;
}
项目:miku    文件:HlsRendererBuilder.java   
public AsyncRendererBuilder(Context context, String userAgent, String url,
                            AudioCapabilities audioCapabilities, MediaPlayer player) {
  this.context = context;
  this.userAgent = userAgent;
  this.url = url;
  this.audioCapabilities = audioCapabilities;
  this.player = player;
  HlsPlaylistParser parser = new HlsPlaylistParser();
  playlistFetcher = new ManifestFetcher<>(url, new DefaultUriDataSource(context, userAgent),
      parser);
}
项目:ExoPlayer-Demo    文件:PlayerActivity.java   
@Override
public void onAudioCapabilitiesChanged(AudioCapabilities audioCapabilities) {
    if (player == null) {
        return;
    }
    boolean backgrounded = player.getBackgrounded();
    boolean playWhenReady = player.getPlayWhenReady();
    releasePlayer();
    preparePlayer(playWhenReady);
    player.setBackgrounded(backgrounded);
}
项目:sbs-android-tv    文件:VideoPlayerActivity.java   
@Override
public void onAudioCapabilitiesChanged(AudioCapabilities audioCapabilities) {
    boolean audioCapabilitiesChanged = !audioCapabilities.equals(this.audioCapabilities);
    if (player == null || audioCapabilitiesChanged) {
        this.audioCapabilities = audioCapabilities;
        releasePlayer();
        preparePlayer();
    } else if (player != null) {
        player.setBackgrounded(false);
    }
}
项目:sbs-android-tv    文件:HlsRendererBuilder.java   
public HlsRendererBuilder(Context context, String userAgent, String url,
                          AudioCapabilities audioCapabilities) {
    this.context = context;
    this.userAgent = userAgent;
    this.url = url;
    this.audioCapabilities = audioCapabilities;
}
项目:sbs-android-tv    文件:HlsRendererBuilder.java   
public AsyncRendererBuilder(Context context, String userAgent, String url,
                            AudioCapabilities audioCapabilities, VideoPlayer player) {
    this.context = context;
    this.userAgent = userAgent;
    this.url = url;
    this.audioCapabilities = audioCapabilities;
    this.player = player;
    HlsPlaylistParser parser = new HlsPlaylistParser();
    playlistFetcher = new ManifestFetcher<>(url, new DefaultUriDataSource(context, userAgent),
            parser);
}
项目:droidkaigi2016    文件:VideoPlayerActivity.java   
@Override
public void onAudioCapabilitiesChanged(AudioCapabilities audioCapabilities) {
    if (player == null) {
        return;
    }
    boolean backgrounded = player.getBackgrounded();
    boolean playWhenReady = player.getPlayWhenReady();
    releasePlayer();
    preparePlayer(playWhenReady);
    player.setBackgrounded(backgrounded);
}
项目:danish-media-license    文件:HlsRendererBuilder.java   
@Override
public void onSingleManifest(HlsPlaylist manifest) {
  if (canceled) {
    return;
  }

  Handler mainHandler = player.getMainHandler();
  LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(BUFFER_SEGMENT_SIZE));
  DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
  PtsTimestampAdjusterProvider timestampAdjusterProvider = new PtsTimestampAdjusterProvider();

  // Build the video/audio/metadata renderers.
  DataSource dataSource = createDataSource(context, userAgent, bandwidthMeter);
  HlsChunkSource chunkSource = new HlsChunkSource(true /* isMaster */, dataSource, url,
      manifest, DefaultHlsTrackSelector.newDefaultInstance(context), bandwidthMeter,
      timestampAdjusterProvider, HlsChunkSource.ADAPTIVE_MODE_SPLICE);
  HlsSampleSource sampleSource = new HlsSampleSource(chunkSource, loadControl,
      MAIN_BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, mainHandler, player, DemoPlayer.TYPE_VIDEO);
  MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(context,
      sampleSource, MediaCodecSelector.DEFAULT, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT,
      5000, mainHandler, player, 50);
  final MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(
      sampleSource, MediaCodecSelector.DEFAULT, null, true, player.getMainHandler(), player,
      AudioCapabilities.getCapabilities(context), AudioManager.STREAM_MUSIC);
  final MetadataTrackRenderer<List<Id3Frame>> id3Renderer = new MetadataTrackRenderer<>(
      sampleSource, new Id3Parser(), player, mainHandler.getLooper());

  TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT];
  renderers[DemoPlayer.TYPE_VIDEO] = videoRenderer;
  renderers[DemoPlayer.TYPE_AUDIO] = audioRenderer;
  renderers[DemoPlayer.TYPE_METADATA] = id3Renderer;
  player.onRenderers(renderers, bandwidthMeter);
}
项目:Android-Example-HLS-ExoPlayer    文件:PlayerActivity.java   
@Override
public void onAudioCapabilitiesChanged(AudioCapabilities audioCapabilities) {
    if (player == null) {
        return;
    }
    boolean backgrounded = player.getBackgrounded();
    boolean playWhenReady = player.getPlayWhenReady();
    releasePlayer();
    preparePlayer(playWhenReady);
    player.setBackgrounded(backgrounded);
}
项目:AdvancedVideoView    文件:HlsRendererBuilder.java   
public HlsRendererBuilder(Context context, String userAgent, String url, TextView debugTextView,
    AudioCapabilities audioCapabilities) {
  this.context = context;
  this.userAgent = userAgent;
  this.url = url;
  this.debugTextView = debugTextView;
  this.audioCapabilities = audioCapabilities;
}