[vlc-commits] Backward compatibility: handle the "sub-filter" ambiguity

Yuval Tze git at videolan.org
Wed Apr 20 11:02:38 CEST 2011


vlc | branch: master | Yuval Tze <yuvaltze at gmail.com> | Sun Apr 17 01:38:33 2011 +0300| [a498397a03636faa27ed276ba861629ac81389ee] | committer: Rémi Denis-Courmont

Backward compatibility: handle the "sub-filter" ambiguity

"sub-source" was formerly "sub-filter", and now the "sub-filter" configuration may contain sub-filters or sub-sources configurations.
so if sub-filter configuration was provided but the sub-filter chain creation was failed, try to use the configuration as a sub-source configuration.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 src/video_output/vout_subpictures.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index b7c41e8..ac7d849 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -1454,6 +1454,8 @@ void spu_PutSubpicture( spu_t *p_spu, subpicture_t *p_subpic )
     p_sys->psz_filter_chain_update = NULL;
     vlc_mutex_unlock( &p_sys->lock );
 
+    bool b_left_empty = false;
+
     vlc_mutex_lock( &p_sys->filter_chain_lock );
     if( psz_chain_update )
     {
@@ -1461,10 +1463,30 @@ void spu_PutSubpicture( spu_t *p_spu, subpicture_t *p_subpic )
 
         filter_chain_AppendFromString( p_spu->p->p_filter_chain, psz_chain_update );
 
-        free( psz_chain_update );
+        /* "sub-source"  was formerly "sub-filter", so now the "sub-filter"
+        configuration may contain sub-filters or sub-sources configurations.
+        if the filters chain was left empty it may indicate that it's a sub-source configuration */
+        b_left_empty = ( filter_chain_GetLength( p_spu->p->p_filter_chain ) == 0 );
     }
     vlc_mutex_unlock( &p_sys->filter_chain_lock );
 
+
+    if ( b_left_empty )
+    {
+        /* try to use the configuration as a sub-source configuration */
+
+        vlc_mutex_lock( &p_sys->lock );
+        if ( !p_sys->psz_source_chain_update || !*p_sys->psz_source_chain_update) /* null or empty */
+        {
+            free( p_sys->psz_source_chain_update );
+            p_sys->psz_source_chain_update = psz_chain_update;
+            psz_chain_update = NULL;
+        }
+        vlc_mutex_unlock( &p_sys->lock );
+    }
+
+    free( psz_chain_update );
+
     /* Run filter chain on the new subpicture */
     p_subpic = filter_chain_SubFilter(p_spu->p->p_filter_chain, p_subpic);
     if( !p_subpic )



More information about the vlc-commits mailing list