[vlc-devel] [PATCH 1/3] videotoolbox: add an option to enable hwdec

Thomas Guillem thomas at gllm.fr
Fri Apr 20 16:46:58 CEST 2018


Use --no-videotoolbox to disable hardware-accelerated video decoding on
macOS/iOS.
---
 modules/codec/videotoolbox.m | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 04e57dfe39..a416377e5d 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");
-- 
2.11.0



More information about the vlc-devel mailing list