[vlc-commits] videotoolbox: add an option to enable hwdec

Thomas Guillem git at videolan.org
Mon Apr 23 08:58:43 CEST 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Apr 20 16:28:14 2018 +0200| [edc7ccd9a70267830b257ebfcc6700dbdc095650] | committer: Thomas Guillem

videotoolbox: add an option to enable hwdec

Use --no-videotoolbox to disable hardware-accelerated video decoding on
macOS/iOS.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=edc7ccd9a70267830b257ebfcc6700dbdc095650
---

 modules/codec/videotoolbox.m | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 37f64ac9d0..e39ca57694 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -78,6 +78,8 @@ const CFStringRef kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDe
 static int OpenDecoder(vlc_object_t *);
 static void CloseDecoder(vlc_object_t *);
 
+#define VT_ENABLE_TEXT N_("Enable Hardware decoder")
+#define VT_ENABLE_LONGTEXT N_("Use VideoToolbox for hardware-accelerated video decoding")
 #define VT_REQUIRE_HW_DEC N_("Use Hardware decoders only")
 #define VT_FORCE_CVPX_CHROMA "Force the VT decoder CVPX chroma"
 #define VT_FORCE_CVPX_CHROMA_LONG "Values can be 'BGRA', 'y420', '420f', '420v', '2vuy'. \
@@ -91,6 +93,7 @@ set_capability("video decoder",800)
 set_callbacks(OpenDecoder, CloseDecoder)
 
 add_obsolete_bool("videotoolbox-temporal-deinterlacing")
+add_bool("videotoolbox", true, VT_ENABLE_TEXT, VT_ENABLE_LONGTEXT, false)
 add_bool("videotoolbox-hw-decoder-only", true, VT_REQUIRE_HW_DEC, VT_REQUIRE_HW_DEC, false)
 add_string("videotoolbox-cvpx-chroma", "", VT_FORCE_CVPX_CHROMA, VT_FORCE_CVPX_CHROMA_LONG, true);
 vlc_module_end()
@@ -1333,6 +1336,9 @@ static int OpenDecoder(vlc_object_t *p_this)
 {
     decoder_t *p_dec = (decoder_t *)p_this;
 
+    if (!var_InheritBool(p_dec, "videotoolbox"))
+        return VLC_EGENERIC;
+
 #if TARGET_OS_IPHONE
     if (unlikely([[UIDevice currentDevice].systemVersion floatValue] < 8.0)) {
         msg_Warn(p_dec, "decoder skipped as OS is too old");



More information about the vlc-commits mailing list