[vlc-devel] [PATCH 11/18] decoder: factorize the visible size fixup during decoder format update

Steve Lhomme robux4 at ycbcr.xyz
Mon Oct 28 13:41:28 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         | 19 -------------------
 src/input/decoder_helpers.c | 20 ++++++++++++++++++++
 2 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index ec605b93a0a..dff11435126 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -418,25 +418,6 @@ static void FixDisplayFormat(decoder_t *p_dec, video_format_t *fmt)
         }
     }
 
-    if( !fmt->i_visible_width || !fmt->i_visible_height )
-    {
-        if( p_dec->fmt_in.video.i_visible_width &&
-            p_dec->fmt_in.video.i_visible_height )
-        {
-            fmt->i_visible_width  = p_dec->fmt_in.video.i_visible_width;
-            fmt->i_visible_height = p_dec->fmt_in.video.i_visible_height;
-            fmt->i_x_offset       = p_dec->fmt_in.video.i_x_offset;
-            fmt->i_y_offset       = p_dec->fmt_in.video.i_y_offset;
-        }
-        else
-        {
-            fmt->i_visible_width  = fmt->i_width;
-            fmt->i_visible_height = fmt->i_height;
-            fmt->i_x_offset       = 0;
-            fmt->i_y_offset       = 0;
-        }
-    }
-
     if( fmt->i_visible_height == 1088 &&
         var_CreateGetBool( p_dec, "hdtv-fix" ) )
     {
diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index 87ab6bc560f..0340a8b3600 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -90,6 +90,26 @@ 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_width ||
+        !dec->fmt_out.video.i_visible_height )
+    {
+        if( dec->fmt_in.video.i_visible_width &&
+            dec->fmt_in.video.i_visible_height )
+        {
+            dec->fmt_out.video.i_visible_width  = dec->fmt_in.video.i_visible_width;
+            dec->fmt_out.video.i_visible_height = dec->fmt_in.video.i_visible_height;
+            dec->fmt_out.video.i_x_offset       = dec->fmt_in.video.i_x_offset;
+            dec->fmt_out.video.i_y_offset       = dec->fmt_in.video.i_y_offset;
+        }
+        else
+        {
+            dec->fmt_out.video.i_visible_width  = dec->fmt_out.video.i_width;
+            dec->fmt_out.video.i_visible_height = dec->fmt_out.video.i_height;
+            dec->fmt_out.video.i_x_offset       = 0;
+            dec->fmt_out.video.i_y_offset       = 0;
+        }
+    }
+
     if (dec->cbs->video.format_update == NULL)
         return 0;
 
-- 
2.17.1



More information about the vlc-devel mailing list