[vlc-commits] videotoolbox: check if the decoder supports deinterlacing

Thomas Guillem git at videolan.org
Fri Jun 2 18:43:48 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jun  2 10:27:37 2017 +0200| [6c61c7e1718afe9588336b659558f41f0eec7c6e] | committer: Thomas Guillem

videotoolbox: check if the decoder supports deinterlacing

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

 modules/codec/videotoolbox.m | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 09fae32bf2..e4b9499e5f 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -143,6 +143,7 @@ struct decoder_sys_t
     bool                        b_invalid_pic_reorder_max;
     bool                        b_poc_based_reorder;
     bool                        b_enable_temporal_processing;
+    bool                        b_handle_deint;
 
     bool                        b_format_propagated;
     bool                        b_abort;
@@ -723,6 +724,23 @@ static int StartVideoToolbox(decoder_t *p_dec)
     if (HandleVTStatus(p_dec, status) != VLC_SUCCESS)
         return VLC_EGENERIC;
 
+    /* Check if the current session supports deinterlacing and temporal
+     * processing */
+    CFDictionaryRef supportedProps = NULL;
+    status = VTSessionCopySupportedPropertyDictionary(p_sys->session,
+                                                      &supportedProps);
+    p_sys->b_handle_deint = status == noErr &&
+        CFDictionaryContainsKey(supportedProps,
+                                kVTDecompressionPropertyKey_FieldMode);
+    p_sys->b_enable_temporal_processing = status == noErr &&
+        CFDictionaryContainsKey(supportedProps,
+                                kVTDecompressionProperty_DeinterlaceMode_Temporal);
+    if (!p_sys->b_handle_deint)
+        msg_Warn(p_dec, "VT decoder doesn't handle deinterlacing");
+
+    if (status == noErr)
+        CFRelease(supportedProps);
+
     return VLC_SUCCESS;
 }
 
@@ -1563,7 +1581,7 @@ static void DecoderCallback(void *decompressionOutputRefCon,
         p_info->p_picture = p_pic;
 
         p_pic->date = pts.value;
-        p_pic->b_progressive = p_info->b_progressive;
+        p_pic->b_progressive = p_sys->b_handle_deint || p_info->b_progressive;
         if(!p_pic->b_progressive)
         {
             p_pic->i_nb_fields = p_info->i_num_ts;



More information about the vlc-commits mailing list