vlc | branch: master | Steve Lhomme <[email protected]> | Thu Nov  7 16:10:13 
2019 +0100| [12559b7b8e5fa761f0a71d312d50fbdce81cef72] | committer: Steve Lhomme

mosaic_bridge: don't attempt to create the filter chain early

Either video_format_update had been called and it missed the filter creation
and didn't update it, so we create the chain before the decoder. Or it was
called after and this initialization was useless and reset afterwards.

Now the filter chain will always use a correct video format and don't try to
create a bogus one when the decoder is opening.

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

 modules/stream_out/mosaic_bridge.c | 58 +++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 35 deletions(-)

diff --git a/modules/stream_out/mosaic_bridge.c 
b/modules/stream_out/mosaic_bridge.c
index dce756cb83..d3b8d76a31 100644
--- a/modules/stream_out/mosaic_bridge.c
+++ b/modules/stream_out/mosaic_bridge.c
@@ -295,6 +295,29 @@ static void *Add( sout_stream_t *p_stream, const 
es_format_t *p_fmt )
     p_sys->p_decoder->fmt_out.p_extra = 0;
     p_sys->p_decoder->pf_decode = NULL;
 
+    /* Create user specified video filters */
+    static const struct filter_video_callbacks cbs =
+    {
+        video_new_buffer_filter,
+    };
+
+    psz_chain = var_GetNonEmptyString( p_stream, CFG_PREFIX "vfilter" );
+    msg_Dbg( p_stream, "psz_chain: '%s'", psz_chain ? psz_chain : "");
+    if( psz_chain )
+    {
+        filter_owner_t owner = {
+            .video = &cbs,
+            .sys = p_owner,
+        };
+
+        p_sys->p_vf2 = filter_chain_NewVideo( p_stream, false, &owner );
+        free( psz_chain );
+    }
+    else
+    {
+        p_sys->p_vf2 = NULL;
+    }
+
     static const struct decoder_owner_callbacks dec_cbs =
     {
         .video = {
@@ -375,41 +398,6 @@ static void *Add( sout_stream_t *p_stream, const 
es_format_t *p_fmt )
 
     msg_Dbg( p_stream, "mosaic bridge id=%s pos=%d", p_es->psz_id, i );
 
-    /* Create user specified video filters */
-    static const struct filter_video_callbacks cbs =
-    {
-        video_new_buffer_filter,
-    };
-
-    psz_chain = var_GetNonEmptyString( p_stream, CFG_PREFIX "vfilter" );
-    msg_Dbg( p_stream, "psz_chain: '%s'", psz_chain ? psz_chain : "");
-    if( psz_chain )
-    {
-        filter_owner_t owner = {
-            .video = &cbs,
-            .sys = p_owner,
-        };
-
-        p_sys->p_vf2 = filter_chain_NewVideo( p_stream, false, &owner );
-        if (p_sys->p_vf2 != NULL)
-        {
-            es_format_t fmt;
-            // at this point the decoder may not have called 
video_update_format_decoder()
-            // so we don't know the actual decoder format yet
-            es_format_Copy( &fmt, &p_sys->p_decoder->fmt_out );
-            if( p_sys->i_chroma )
-                fmt.video.i_chroma = p_sys->i_chroma;
-            filter_chain_Reset( p_sys->p_vf2, &fmt, &fmt );
-            es_format_Clean( &fmt );
-            filter_chain_AppendFromString( p_sys->p_vf2, psz_chain );
-        }
-        free( psz_chain );
-    }
-    else
-    {
-        p_sys->p_vf2 = NULL;
-    }
-
     return p_sys;
 }
 

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to