[vlc-devel] commit: Unregister a "sub filter"' s private SPU channel when destroying the (Antoine Cellerier )

git version control git at videolan.org
Tue Jun 10 16:57:46 CEST 2008


vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Tue Jun 10 16:59:13 2008 +0200| [c55222a882256a2c28245dc6cf9486bcf969befd]

Unregister a "sub filter"'s private SPU channel when destroying the
filter. Since filter destruction is always requested by the subpicture
core itself, we already have the subpicture lock so no need to lock.

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

 src/video_output/vout_subpictures.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 51ac67f..14dd76d 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -1142,12 +1142,13 @@ subpicture_t *spu_SortSubpictures( spu_t *p_spu, mtime_t display_date,
  * This function destroys the subpictures which belong to the spu channel
  * corresponding to i_channel_id.
  *****************************************************************************/
-static void SpuClearChannel( spu_t *p_spu, int i_channel )
+static void SpuClearChannel( spu_t *p_spu, int i_channel, bool b_locked )
 {
     int          i_subpic;                               /* subpicture index */
     subpicture_t *p_subpic = NULL;                  /* first free subpicture */
 
-    vlc_mutex_lock( &p_spu->subpicture_lock );
+    if( !b_locked )
+        vlc_mutex_lock( &p_spu->subpicture_lock );
 
     for( i_subpic = 0; i_subpic < VOUT_MAX_SUBPICTURES; i_subpic++ )
     {
@@ -1173,7 +1174,8 @@ static void SpuClearChannel( spu_t *p_spu, int i_channel )
         }
     }
 
-    vlc_mutex_unlock( &p_spu->subpicture_lock );
+    if( !b_locked )
+        vlc_mutex_unlock( &p_spu->subpicture_lock );
 }
 
 /*****************************************************************************
@@ -1192,7 +1194,7 @@ static int spu_vaControlDefault( spu_t *p_spu, int i_query, va_list args )
 
     case SPU_CHANNEL_CLEAR:
         i = (int)va_arg( args, int );
-        SpuClearChannel( p_spu, i );
+        SpuClearChannel( p_spu, i, false );
         break;
 
     default:
@@ -1364,5 +1366,7 @@ static int sub_filter_allocation_init( filter_t *p_filter, void *p_data )
 
 static void sub_filter_allocation_clear( filter_t *p_filter )
 {
+    filter_owner_sys_t *p_sys = p_filter->p_owner;
+    SpuClearChannel( p_sys->p_spu, p_sys->i_channel, true );
     free( p_filter->p_owner );
 }




More information about the vlc-devel mailing list