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


Java Media.setHWDecoderEnabled方法代码示例

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


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

示例1: setMediaOptions

import org.videolan.libvlc.Media; //导入方法依赖的package包/类
public static void setMediaOptions(Media media, Context context, int flags) {
    boolean noHardwareAcceleration = (flags & MEDIA_NO_HWACCEL) != 0;
    boolean noVideo = (flags & MEDIA_VIDEO) == 0;
    final boolean paused = (flags & MEDIA_PAUSED) != 0;
    int hardwareAcceleration = HW_ACCELERATION_DISABLED;

    if (!noHardwareAcceleration) {
        try {
            hardwareAcceleration = PrefUtils.get(context, Prefs.HW_ACCELERATION, HW_ACCELERATION_AUTOMATIC);
        } catch (NumberFormatException ignored) {}
    }
    if (hardwareAcceleration == HW_ACCELERATION_DISABLED)
        media.setHWDecoderEnabled(false, false);
    else if (hardwareAcceleration == HW_ACCELERATION_FULL || hardwareAcceleration == HW_ACCELERATION_DECODING) {
        media.setHWDecoderEnabled(true, true);
        if (hardwareAcceleration == HW_ACCELERATION_DECODING) {
            media.addOption(":no-mediacodec-dr");
            media.addOption(":no-omxil-dr");
        }
    } /* else automatic: use default options */

    if (noVideo)
        media.addOption(":no-video");
    if (paused)
        media.addOption(":start-paused");
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:27,代码来源:VLCOptions.java

示例2: setMedia

import org.videolan.libvlc.Media; //导入方法依赖的package包/类
private void setMedia(Media media) {
  //delay = network buffer + file buffer
  //media.addOption(":network-caching=" + Constants.BUFFER);
  //media.addOption(":file-caching=" + Constants.BUFFER);
  media.addOption(":fullscreen");
  media.setHWDecoderEnabled(true, false);
  player = new MediaPlayer(vlcInstance);
  player.setMedia(media);
  player.setEventListener(this);

  IVLCVout vlcOut = player.getVLCVout();
  //set correct class for render depend of constructor called
  if (surfaceView != null) {
    vlcOut.setVideoView(surfaceView);
    width = surfaceView.getWidth();
    height = surfaceView.getHeight();
  } else if (textureView != null) {
    vlcOut.setVideoView(textureView);
    width = textureView.getWidth();
    height = textureView.getHeight();
  } else if (surfaceTexture != null) {
    vlcOut.setVideoSurface(surfaceTexture);
  } else if (surface != null) {
    vlcOut.setVideoSurface(surface, surfaceHolder);
  } else {
    throw new RuntimeException("You cant set a null render object");
  }
  if (width != 0 && height != 0) vlcOut.setWindowSize(width, height);
  vlcOut.attachViews();
  player.setVideoTrackEnabled(true);
  player.play();
}
 
开发者ID:pedroSG94,项目名称:vlc-example-streamplayer,代码行数:33,代码来源:VlcVideoLibrary.java

示例3: setMediaOptions

import org.videolan.libvlc.Media; //导入方法依赖的package包/类
public static void setMediaOptions(Media media, Context context, int flags) {
    boolean noHardwareAcceleration = (flags & MediaWrapper.MEDIA_NO_HWACCEL) != 0;
    boolean noVideo = (flags & MediaWrapper.MEDIA_VIDEO) == 0;
    final boolean paused = (flags & MediaWrapper.MEDIA_PAUSED) != 0;
    int hardwareAcceleration = HW_ACCELERATION_DISABLED;

    if (!noHardwareAcceleration) {
        try {
            final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
            hardwareAcceleration = Integer.parseInt(pref.getString("hardware_acceleration", "-1"));
        } catch (NumberFormatException ignored) {}
    }
    if (hardwareAcceleration == HW_ACCELERATION_DISABLED)
        media.setHWDecoderEnabled(false, false);
    else if (hardwareAcceleration == HW_ACCELERATION_FULL || hardwareAcceleration == HW_ACCELERATION_DECODING) {
        media.setHWDecoderEnabled(true, true);
        if (hardwareAcceleration == HW_ACCELERATION_DECODING) {
            media.addOption(":no-mediacodec-dr");
            media.addOption(":no-omxil-dr");
        }
    } /* else automatic: use default options */

    if (noVideo)
        media.addOption(":no-video");
    if (paused)
        media.addOption(":start-paused");
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:28,代码来源:VLCOptions.java


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