]> git.sesse.net Git - vlc/blobdiff - modules/codec/libass.c
Clean up a bit subpicture region API.
[vlc] / modules / codec / libass.c
index 74b5e100619359f1fb4783971292b918cecea5e7..754ec54da6dd07e74129702551720a49e2eec181 100644 (file)
@@ -78,7 +78,7 @@ typedef struct
     ass_renderer_t  *p_renderer;
     video_format_t  fmt;
 } ass_handle_t;
-static ass_handle_t *AssHandleYield( decoder_t *p_dec );
+static ass_handle_t *AssHandleHold( decoder_t *p_dec );
 static void AssHandleRelease( ass_handle_t * );
 
 /* */
@@ -98,7 +98,7 @@ struct decoder_sys_t
     subpicture_t *p_spu_final;
 };
 static void DecSysRelease( decoder_sys_t *p_sys );
-static void DecSysYield( decoder_sys_t *p_sys );
+static void DecSysHold( decoder_sys_t *p_sys );
 
 struct subpicture_sys_t
 {
@@ -140,7 +140,7 @@ static int Create( vlc_object_t *p_this )
         return VLC_ENOMEM;
 
     /* */
-    p_sys->p_ass = AssHandleYield( p_dec );
+    p_sys->p_ass = AssHandleHold( p_dec );
     if( !p_sys->p_ass )
     {
         free( p_sys );
@@ -174,7 +174,7 @@ static void Destroy( vlc_object_t *p_this )
     DecSysRelease( p_dec->p_sys );
 }
 
-static void DecSysYield( decoder_sys_t *p_sys )
+static void DecSysHold( decoder_sys_t *p_sys )
 {
     vlc_mutex_lock( &p_sys->lock );
     p_sys->i_refcount++;
@@ -290,7 +290,7 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     p_spu->pf_destroy = DestroySubpicture;
     p_spu->p_sys->p_dec_sys = p_sys;
 
-    DecSysYield( p_sys );
+    DecSysHold( p_sys );
 
     block_Release( p_block );
 
@@ -399,7 +399,7 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
         fmt_region.i_height =
         fmt_region.i_visible_height = region[i].y1 - region[i].y0;
 
-        pp_region[i] = r = p_subpic->pf_create_region( VLC_OBJECT(p_spu), &fmt_region );
+        pp_region[i] = r = subpicture_region_New( &fmt_region );
         if( !r )
             break;
         r->i_x = region[i].x0;
@@ -569,7 +569,7 @@ static int BuildRegions( spu_t *p_spu, rectangle_t *p_region, int i_max_region,
 
 static void RegionDraw( subpicture_region_t *p_region, ass_image_t *p_img )
 {
-    const plane_t *p = &p_region->picture.p[0];
+    const plane_t *p = &p_region->p_picture->p[0];
     const int i_x = p_region->i_x;
     const int i_y = p_region->i_y;
     const int i_width  = p_region->fmt.i_width;
@@ -620,17 +620,12 @@ static void RegionDraw( subpicture_region_t *p_region, ass_image_t *p_img )
 
 static void SubpictureReleaseRegions( spu_t *p_spu, subpicture_t *p_subpic )
 {
-    while( p_subpic->p_region )
-    {
-        subpicture_region_t *p_region = p_subpic->p_region;
-        p_subpic->p_region = p_region->p_next;
-        spu_DestroyRegion( p_spu, p_region );
-    }
+    subpicture_region_ChainDelete( p_subpic->p_region );
     p_subpic->p_region = NULL;
 }
 
 /* */
-static ass_handle_t *AssHandleYield( decoder_t *p_dec )
+static ass_handle_t *AssHandleHold( decoder_t *p_dec )
 {
     vlc_mutex_t *p_lock = var_AcquireMutex( "libass" );
     if( !p_lock )