本文整理汇总了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");
}
示例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();
}
示例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");
}