[vlc-devel] [PATCH 13/18] decoder: factorize the SAR fixup during decoder format update

Steve Lhomme robux4 at ycbcr.xyz
Mon Oct 28 13:41:30 CET 2019


This way other decoder owner (thumbnail, transcode, etc) benefit from the same
fix in a consistent manner.

Now we clean the value directly in the dec->fmt_out whereas before it was
cleaned at the vout level and the decoder didn't know about it.

In the end if the decoder didn't write it before it would not have written it
later anyway. And if it really wants to, it can still do it later and issue an
update_format.
---
 src/input/decoder.c         | 21 ---------------------
 src/input/decoder_helpers.c | 21 +++++++++++++++++++++
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index dff11435126..be19a64d4bd 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -418,27 +418,6 @@ static void FixDisplayFormat(decoder_t *p_dec, video_format_t *fmt)
         }
     }
 
-    if( fmt->i_visible_height == 1088 &&
-        var_CreateGetBool( p_dec, "hdtv-fix" ) )
-    {
-        fmt->i_visible_height = 1080;
-        if( !(fmt->i_sar_num % 136))
-        {
-            fmt->i_sar_num *= 135;
-            fmt->i_sar_den *= 136;
-        }
-        msg_Warn( p_dec, "Fixing broken HDTV stream (display_height=1088)");
-    }
-
-    if( !fmt->i_sar_num || !fmt->i_sar_den )
-    {
-        fmt->i_sar_num = 1;
-        fmt->i_sar_den = 1;
-    }
-
-    vlc_ureduce( &fmt->i_sar_num, &fmt->i_sar_den,
-                    fmt->i_sar_num, fmt->i_sar_den, 50000 );
-
     video_format_AdjustColorSpace( fmt );
 }
 
diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index 0340a8b3600..df2f0667baf 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -90,6 +90,27 @@ int decoder_UpdateVideoOutput( decoder_t *dec, vlc_video_context *vctx_out )
     /* */
     dec->fmt_out.video.i_chroma = dec->fmt_out.i_codec;
 
+    if( dec->fmt_out.video.i_visible_height == 1088 &&
+        var_CreateGetBool( dec, "hdtv-fix" ) )
+    {
+        dec->fmt_out.video.i_visible_height = 1080;
+        if( !(dec->fmt_out.video.i_sar_num % 136))
+        {
+            dec->fmt_out.video.i_sar_num *= 135;
+            dec->fmt_out.video.i_sar_den *= 136;
+        }
+        msg_Warn( dec, "Fixing broken HDTV stream (display_height=1088)");
+    }
+
+    if( !dec->fmt_out.video.i_sar_num || !dec->fmt_out.video.i_sar_den )
+    {
+        dec->fmt_out.video.i_sar_num = 1;
+        dec->fmt_out.video.i_sar_den = 1;
+    }
+
+    vlc_ureduce( &dec->fmt_out.video.i_sar_num, &dec->fmt_out.video.i_sar_den,
+                    dec->fmt_out.video.i_sar_num, dec->fmt_out.video.i_sar_den, 50000 );
+
     if( !dec->fmt_out.video.i_visible_width ||
         !dec->fmt_out.video.i_visible_height )
     {
-- 
2.17.1



More information about the vlc-devel mailing list