[vlc-commits] decoder: factorize the SAR fixup during decoder format update

Steve Lhomme git at videolan.org
Mon Nov 4 10:42:01 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Aug  6 13:53:42 2019 +0200| [07e48c421db16056d926d3389b210fce2f7b1c5f] | committer: Steve Lhomme

decoder: factorize the SAR fixup during decoder format update

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.

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

 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 dff1143512..be19a64d4b 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 0340a8b360..df2f0667ba 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 )
     {



More information about the vlc-commits mailing list