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

Steve Lhomme git at videolan.org
Mon Nov 4 10:41:58 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Aug  6 13:48:41 2019 +0200| [48516248c9ce2c878e6c6439c44ba005c7a60af4] | committer: Steve Lhomme

decoder: factorize the visible size 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=48516248c9ce2c878e6c6439c44ba005c7a60af4
---

 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 ec605b93a0..dff1143512 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 87ab6bc560..0340a8b360 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;
 



More information about the vlc-commits mailing list