[vlc-commits] decoder: move the display creation in a separate function

Steve Lhomme git at videolan.org
Wed Oct 9 10:15:50 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Sep 25 09:08:44 2019 +0200| [ae1e4c81c68e077637dfc9f5208f954532e9c94e] | committer: Steve Lhomme

decoder: move the display creation in a separate function

To create the vout and decoder device we don't need to know the DPB.

For now the display still holds the picture pool so the display still needs the
DBP size.

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

 src/input/decoder.c | 52 ++++++++++++++++++++++++++++++++--------------------
 1 file changed, 32 insertions(+), 20 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 9d80f4461b..1a75a862ea 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -455,11 +455,10 @@ static void FixDisplayFormat(decoder_t *p_dec, video_format_t *fmt)
     video_format_AdjustColorSpace( fmt );
 }
 
-static int ModuleThread_UpdateVideoFormat( decoder_t *p_dec )
+static int CreateVoutIfNeeded(struct decoder_owner *p_owner)
 {
-    struct decoder_owner *p_owner = dec_get_owner( p_dec );
+    decoder_t *p_dec = &p_owner->dec;
     bool need_vout = false;
-    bool need_format_update = false;
 
     if( p_owner->p_vout == NULL )
     {
@@ -502,22 +501,6 @@ static int ModuleThread_UpdateVideoFormat( decoder_t *p_dec )
         need_vout = true;
     }
 
-    if ( memcmp( &p_dec->fmt_out.video.mastering,
-                 &p_owner->fmt.video.mastering,
-                 sizeof(p_owner->fmt.video.mastering)) )
-    {
-        msg_Dbg(p_dec, "vout update: mastering data");
-        need_format_update = true;
-    }
-    if ( p_dec->fmt_out.video.lighting.MaxCLL !=
-         p_owner->fmt.video.lighting.MaxCLL ||
-         p_dec->fmt_out.video.lighting.MaxFALL !=
-         p_owner->fmt.video.lighting.MaxFALL )
-    {
-        msg_Dbg(p_dec, "vout update: lighting data");
-        need_format_update = true;
-    }
-
     if( need_vout )
     {
         vout_thread_t *p_vout;
@@ -587,8 +570,37 @@ static int ModuleThread_UpdateVideoFormat( decoder_t *p_dec )
         vlc_fifo_Lock( p_owner->p_fifo );
         p_owner->reset_out_state = true;
         vlc_fifo_Unlock( p_owner->p_fifo );
+
+        return 1; // new vout was created
     }
-    else
+    return 0; // vout unchanged
+}
+
+static int ModuleThread_UpdateVideoFormat( decoder_t *p_dec )
+{
+    struct decoder_owner *p_owner = dec_get_owner( p_dec );
+
+    int created_vout = CreateVoutIfNeeded(p_owner);
+    if (created_vout != 0)
+        return created_vout == -1 ? -1 : 0; // error or new vout was created
+
+    bool need_format_update = false;
+    if ( memcmp( &p_dec->fmt_out.video.mastering,
+                 &p_owner->fmt.video.mastering,
+                 sizeof(p_owner->fmt.video.mastering)) )
+    {
+        msg_Dbg(p_dec, "vout update: mastering data");
+        need_format_update = true;
+    }
+    if ( p_dec->fmt_out.video.lighting.MaxCLL !=
+         p_owner->fmt.video.lighting.MaxCLL ||
+         p_dec->fmt_out.video.lighting.MaxFALL !=
+         p_owner->fmt.video.lighting.MaxFALL )
+    {
+        msg_Dbg(p_dec, "vout update: lighting data");
+        need_format_update = true;
+    }
+
     if ( need_format_update )
     {
         /* the format has changed but we don't need a new vout */



More information about the vlc-commits mailing list