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


Java C.TRACK_TYPE_VIDEO属性代码示例

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


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

示例1: deriveFormat

/**
 * Derives a track format corresponding to a given container format, by combining it with sample
 * level information obtained from the samples.
 *
 * @param containerFormat The container format for which the track format should be derived.
 * @param sampleFormat A sample format from which to obtain sample level information.
 * @return The derived track format.
 */
private static Format deriveFormat(Format containerFormat, Format sampleFormat) {
  if (containerFormat == null) {
    return sampleFormat;
  }
  String codecs = null;
  int sampleTrackType = MimeTypes.getTrackType(sampleFormat.sampleMimeType);
  if (sampleTrackType == C.TRACK_TYPE_AUDIO) {
    codecs = getAudioCodecs(containerFormat.codecs);
  } else if (sampleTrackType == C.TRACK_TYPE_VIDEO) {
    codecs = getVideoCodecs(containerFormat.codecs);
  }
  return sampleFormat.copyWithContainerInfo(containerFormat.id, codecs, containerFormat.bitrate,
      containerFormat.width, containerFormat.height, containerFormat.selectionFlags,
      containerFormat.language);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:23,代码来源:HlsSampleStreamWrapper.java

示例2: parseHdlr

/**
 * Parses an hdlr atom.
 *
 * @param hdlr The hdlr atom to decode.
 * @return The track type.
 */
private static int parseHdlr(ParsableByteArray hdlr) {
  hdlr.setPosition(Atom.FULL_HEADER_SIZE + 4);
  int trackType = hdlr.readInt();
  if (trackType == TYPE_soun) {
    return C.TRACK_TYPE_AUDIO;
  } else if (trackType == TYPE_vide) {
    return C.TRACK_TYPE_VIDEO;
  } else if (trackType == TYPE_text || trackType == TYPE_sbtl || trackType == TYPE_subt
      || trackType == TYPE_clcp) {
    return C.TRACK_TYPE_TEXT;
  } else if (trackType == TYPE_meta) {
    return C.TRACK_TYPE_METADATA;
  } else {
    return C.TRACK_TYPE_UNKNOWN;
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:22,代码来源:AtomParsers.java

示例3: getDefaultBufferSize

/**
 * Maps a {@link C} {@code TRACK_TYPE_*} constant to the corresponding {@link C}
 * {@code DEFAULT_*_BUFFER_SIZE} constant.
 *
 * @param trackType The track type.
 * @return The corresponding default buffer size in bytes.
 */
public static int getDefaultBufferSize(int trackType) {
  switch (trackType) {
    case C.TRACK_TYPE_DEFAULT:
      return C.DEFAULT_MUXED_BUFFER_SIZE;
    case C.TRACK_TYPE_AUDIO:
      return C.DEFAULT_AUDIO_BUFFER_SIZE;
    case C.TRACK_TYPE_VIDEO:
      return C.DEFAULT_VIDEO_BUFFER_SIZE;
    case C.TRACK_TYPE_TEXT:
      return C.DEFAULT_TEXT_BUFFER_SIZE;
    case C.TRACK_TYPE_METADATA:
      return C.DEFAULT_METADATA_BUFFER_SIZE;
    default:
      throw new IllegalStateException();
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:23,代码来源:Util.java

示例4: getTrackType

/**
 * Returns the {@link C}{@code .TRACK_TYPE_*} constant that corresponds to a specified mime type.
 * {@link C#TRACK_TYPE_UNKNOWN} if the mime type is not known or the mapping cannot be
 * established.
 *
 * @param mimeType The mimeType.
 * @return The {@link C}{@code .TRACK_TYPE_*} constant that corresponds to a specified mime type.
 */
public static int getTrackType(String mimeType) {
  if (TextUtils.isEmpty(mimeType)) {
    return C.TRACK_TYPE_UNKNOWN;
  } else if (isAudio(mimeType)) {
    return C.TRACK_TYPE_AUDIO;
  } else if (isVideo(mimeType)) {
    return C.TRACK_TYPE_VIDEO;
  } else if (isText(mimeType) || APPLICATION_CEA608.equals(mimeType)
      || APPLICATION_CEA708.equals(mimeType) || APPLICATION_MP4CEA608.equals(mimeType)
      || APPLICATION_SUBRIP.equals(mimeType) || APPLICATION_TTML.equals(mimeType)
      || APPLICATION_TX3G.equals(mimeType) || APPLICATION_MP4VTT.equals(mimeType)
      || APPLICATION_RAWCC.equals(mimeType) || APPLICATION_VOBSUB.equals(mimeType)
      || APPLICATION_PGS.equals(mimeType) || APPLICATION_DVBSUBS.equals(mimeType)) {
    return C.TRACK_TYPE_TEXT;
  } else if (APPLICATION_ID3.equals(mimeType)
      || APPLICATION_EMSG.equals(mimeType)
      || APPLICATION_SCTE35.equals(mimeType)
      || APPLICATION_CAMERA_MOTION.equals(mimeType)) {
    return C.TRACK_TYPE_METADATA;
  } else {
    return C.TRACK_TYPE_UNKNOWN;
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:31,代码来源:MimeTypes.java

示例5: 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

示例6: updateForCurrentTrackSelections

private void updateForCurrentTrackSelections() {
    if (player == null) {
        return;
    }
    TrackSelectionArray selections = player.getCurrentTrackSelections();
    for (int i = 0; i < selections.length; i++) {
        if (player.getRendererType(i) == C.TRACK_TYPE_VIDEO && selections.get(i) != null) {
            // Video enabled so artwork must be hidden. If the shutter is closed, it will be opened in
            // onRenderedFirstFrame().
            return;
        }
    }
    // Video disabled so the shutter must be closed.
    shutterView.setVisibility(VISIBLE);
}
 
开发者ID:12d,项目名称:react-native-videoplayer,代码行数:15,代码来源:ExoPlayerView.java

示例7: updateForCurrentTrackSelections

private void updateForCurrentTrackSelections() {
    if (player == null) {
        return;
    }
    TrackSelectionArray selections = player.getCurrentTrackSelections();
    for (int i = 0; i < selections.length; i++) {
        if (player.getRendererType(i) == C.TRACK_TYPE_VIDEO && selections.get(i) != null) {
            // Video enabled so artwork must be hidden. If the shutter is closed, it will be opened in
            // onRenderedFirstFrame().
            hideArtwork();
            return;
        }
    }
    // Video disabled so the shutter must be closed.
    if (shutterView != null) {
        shutterView.setVisibility(VISIBLE);
    }
    // Display artwork if enabled and available, else hide it.
    if (useArtwork) {
        for (int i = 0; i < selections.length; i++) {
            TrackSelection selection = selections.get(i);
            if (selection != null) {
                for (int j = 0; j < selection.length(); j++) {
                    Metadata metadata = selection.getFormat(j).metadata;
                    if (metadata != null && setArtworkFromMetadata(metadata)) {
                        return;
                    }
                }
            }
        }
        if (setArtworkFromBitmap(null)) {
            return;
        }
    }
    // Artwork disabled or unavailable.
    hideArtwork();
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:37,代码来源:SimpleExoPlayerView.java

示例8: updateForCurrentTrackSelections

private void updateForCurrentTrackSelections() {
    if (player == null) {
        return;
    }
    TrackSelectionArray selections = player.getCurrentTrackSelections();
    for (int i = 0; i < selections.length; i++) {
        if (player.getRendererType(i) == C.TRACK_TYPE_VIDEO && selections.get(i) != null) {
            // Video enabled so artwork must be hidden. If the shutter is closed, it will be opened in
            // onRenderedFirstFrame().
            hideArtwork();
            return;
        }
    }
    // Video disabled so the shutter must be closed.
    if (shutterView != null) {
        shutterView.setVisibility(VISIBLE);
    }
    // Display artwork if enabled and available, else hide it.
    if (useArtwork) {
        for (int i = 0; i < selections.length; i++) {
            TrackSelection selection = selections.get(i);
            if (selection != null) {
                for (int j = 0; j < selection.length(); j++) {
                    Metadata metadata = selection.getFormat(j).metadata;
                    if (metadata != null && setArtworkFromMetadata(metadata)) {
                        return;
                    }
                }
            }
        }
        if (setArtworkFromBitmap(defaultArtwork)) {
            return;
        }
    }
    // Artwork disabled or unavailable.
    hideArtwork();
}
 
开发者ID:Tubitv,项目名称:TubiPlayer,代码行数:37,代码来源:TubiExoPlayerView.java

示例9: updateButtonVisibilities

private void updateButtonVisibilities() {
    debugRootView.removeAllViews();

    retryButton.setVisibility(playerNeedsSource ? View.VISIBLE : View.GONE);
    debugRootView.addView(retryButton);

    if (player == null) {
        return;
    }

    MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
    if (mappedTrackInfo == null) {
        return;
    }

    for (int i = 0; i < mappedTrackInfo.length; i++) {
        TrackGroupArray trackGroups = mappedTrackInfo.getTrackGroups(i);
        if (trackGroups.length != 0) {
            Button button = new Button(this);
            int label;
            switch (player.getRendererType(i)) {
                case C.TRACK_TYPE_AUDIO:
                    label = R.string.audio;
                    break;
                case C.TRACK_TYPE_VIDEO:
                    label = R.string.video;
                    break;
                case C.TRACK_TYPE_TEXT:
                    label = R.string.text;
                    break;
                default:
                    continue;
            }
            button.setText(label);
            button.setTag(i);
            button.setOnClickListener(this);
            debugRootView.addView(button, debugRootView.getChildCount() - 1);
        }
    }
}
 
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:40,代码来源:PlayerActivity.java

示例10: selectTracks

@Override
protected TrackSelection[] selectTracks(RendererCapabilities[] rendererCapabilities,
    TrackGroupArray[] rendererTrackGroupArrays, int[][][] rendererFormatSupports)
    throws ExoPlaybackException {
  // Make a track selection for each renderer.
  int rendererCount = rendererCapabilities.length;
  TrackSelection[] rendererTrackSelections = new TrackSelection[rendererCount];
  Parameters params = paramsReference.get();
  boolean videoTrackAndRendererPresent = false;

  for (int i = 0; i < rendererCount; i++) {
    if (C.TRACK_TYPE_VIDEO == rendererCapabilities[i].getTrackType()) {
      rendererTrackSelections[i] = selectVideoTrack(rendererCapabilities[i],
          rendererTrackGroupArrays[i], rendererFormatSupports[i], params.maxVideoWidth,
          params.maxVideoHeight, params.maxVideoBitrate, params.allowNonSeamlessAdaptiveness,
          params.allowMixedMimeAdaptiveness, params.viewportWidth, params.viewportHeight,
          params.orientationMayChange, adaptiveTrackSelectionFactory,
          params.exceedVideoConstraintsIfNecessary, params.exceedRendererCapabilitiesIfNecessary);
      videoTrackAndRendererPresent |= rendererTrackGroupArrays[i].length > 0;
    }
  }

  for (int i = 0; i < rendererCount; i++) {
    switch (rendererCapabilities[i].getTrackType()) {
      case C.TRACK_TYPE_VIDEO:
        // Already done. Do nothing.
        break;
      case C.TRACK_TYPE_AUDIO:
        rendererTrackSelections[i] = selectAudioTrack(rendererTrackGroupArrays[i],
            rendererFormatSupports[i], params.preferredAudioLanguage,
            params.exceedRendererCapabilitiesIfNecessary, params.allowMixedMimeAdaptiveness,
            videoTrackAndRendererPresent ? null : adaptiveTrackSelectionFactory);
        break;
      case C.TRACK_TYPE_TEXT:
        rendererTrackSelections[i] = selectTextTrack(rendererTrackGroupArrays[i],
            rendererFormatSupports[i], params.preferredTextLanguage,
            params.preferredAudioLanguage, params.exceedRendererCapabilitiesIfNecessary);
        break;
      default:
        rendererTrackSelections[i] = selectOtherTrack(rendererCapabilities[i].getTrackType(),
            rendererTrackGroupArrays[i], rendererFormatSupports[i],
            params.exceedRendererCapabilitiesIfNecessary);
        break;
    }
  }
  return rendererTrackSelections;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:47,代码来源:DefaultTrackSelector.java

示例11: maybeConfigureRenderersForTunneling

/**
 * Determines whether tunneling should be enabled, replacing {@link RendererConfiguration}s in
 * {@code rendererConfigurations} with configurations that enable tunneling on the appropriate
 * renderers if so.
 *
 * @param rendererCapabilities The {@link RendererCapabilities} of the renderers for which
 *     {@link TrackSelection}s are to be generated.
 * @param rendererTrackGroupArrays An array of {@link TrackGroupArray}s where each entry
 *     corresponds to the renderer of equal index in {@code renderers}.
 * @param rendererFormatSupports Maps every available track to a specific level of support as
 *     defined by the renderer {@code FORMAT_*} constants.
 * @param rendererConfigurations The renderer configurations. Configurations may be replaced with
 *     ones that enable tunneling as a result of this call.
 * @param trackSelections The renderer track selections.
 * @param tunnelingAudioSessionId The audio session id to use when tunneling, or
 *     {@link C#AUDIO_SESSION_ID_UNSET} if tunneling should not be enabled.
 */
private static void maybeConfigureRenderersForTunneling(
    RendererCapabilities[] rendererCapabilities, TrackGroupArray[] rendererTrackGroupArrays,
    int[][][] rendererFormatSupports, RendererConfiguration[] rendererConfigurations,
    TrackSelection[] trackSelections, int tunnelingAudioSessionId) {
  if (tunnelingAudioSessionId == C.AUDIO_SESSION_ID_UNSET) {
    return;
  }
  // Check whether we can enable tunneling. To enable tunneling we require exactly one audio and
  // one video renderer to support tunneling and have a selection.
  int tunnelingAudioRendererIndex = -1;
  int tunnelingVideoRendererIndex = -1;
  boolean enableTunneling = true;
  for (int i = 0; i < rendererCapabilities.length; i++) {
    int rendererType = rendererCapabilities[i].getTrackType();
    TrackSelection trackSelection = trackSelections[i];
    if ((rendererType == C.TRACK_TYPE_AUDIO || rendererType == C.TRACK_TYPE_VIDEO)
        && trackSelection != null) {
      if (rendererSupportsTunneling(rendererFormatSupports[i], rendererTrackGroupArrays[i],
          trackSelection)) {
        if (rendererType == C.TRACK_TYPE_AUDIO) {
          if (tunnelingAudioRendererIndex != -1) {
            enableTunneling = false;
            break;
          } else {
            tunnelingAudioRendererIndex = i;
          }
        } else {
          if (tunnelingVideoRendererIndex != -1) {
            enableTunneling = false;
            break;
          } else {
            tunnelingVideoRendererIndex = i;
          }
        }
      }
    }
  }
  enableTunneling &= tunnelingAudioRendererIndex != -1 && tunnelingVideoRendererIndex != -1;
  if (enableTunneling) {
    RendererConfiguration tunnelingRendererConfiguration =
        new RendererConfiguration(tunnelingAudioSessionId);
    rendererConfigurations[tunnelingAudioRendererIndex] = tunnelingRendererConfiguration;
    rendererConfigurations[tunnelingVideoRendererIndex] = tunnelingRendererConfiguration;
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:62,代码来源:MappingTrackSelector.java


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