-/**
- * Create a subpicture region
- *
- * \param p_this vlc_object_t
- * \param p_fmt the format that this subpicture region should have
- */
-static void RegionPictureRelease( picture_t *p_pic )
-{
- free( p_pic->p_data_orig );
- /* We use pf_release nullity to know if the picture has already been released. */
- p_pic->pf_release = NULL;
-}
-subpicture_region_t *__spu_CreateRegion( vlc_object_t *p_this,
- video_format_t *p_fmt )
-{
- subpicture_region_t *p_region = malloc( sizeof(subpicture_region_t) );
- if( !p_region ) return NULL;
-
- memset( p_region, 0, sizeof(subpicture_region_t) );
- p_region->i_alpha = 0xff;
- p_region->p_next = NULL;
- p_region->p_cache = NULL;
- p_region->fmt = *p_fmt;
- p_region->psz_text = NULL;
- p_region->p_style = NULL;
-
- if( p_fmt->i_chroma == VLC_FOURCC('Y','U','V','P') )
- p_fmt->p_palette = p_region->fmt.p_palette =
- malloc( sizeof(video_palette_t) );
- else p_fmt->p_palette = p_region->fmt.p_palette = NULL;
-
- p_region->picture.p_data_orig = NULL;
-
- if( p_fmt->i_chroma == VLC_FOURCC('T','E','X','T') ) return p_region;
-
- vout_AllocatePicture( p_this, &p_region->picture, p_fmt->i_chroma,
- p_fmt->i_width, p_fmt->i_height, p_fmt->i_aspect );
-
- if( !p_region->picture.i_planes )
- {
- free( p_region );
- free( p_fmt->p_palette );
- return NULL;
- }
-
- p_region->picture.pf_release = RegionPictureRelease;
-
- return p_region;
-}
-
-/**
- * Make a subpicture region from an existing picture_t
- *
- * \param p_this vlc_object_t
- * \param p_fmt the format that this subpicture region should have
- * \param p_pic a pointer to the picture creating the region (not freed)
- */
-subpicture_region_t *__spu_MakeRegion( vlc_object_t *p_this,
- video_format_t *p_fmt,
- picture_t *p_pic )
-{
- subpicture_region_t *p_region = malloc( sizeof(subpicture_region_t) );
- (void)p_this;
- if( !p_region ) return NULL;
- memset( p_region, 0, sizeof(subpicture_region_t) );
- p_region->i_alpha = 0xff;
- p_region->p_next = 0;
- p_region->p_cache = 0;
- p_region->fmt = *p_fmt;
- p_region->psz_text = 0;
- p_region->p_style = NULL;
-
- if( p_fmt->i_chroma == VLC_FOURCC('Y','U','V','P') )
- p_fmt->p_palette = p_region->fmt.p_palette =
- malloc( sizeof(video_palette_t) );
- else p_fmt->p_palette = p_region->fmt.p_palette = NULL;
-
- memcpy( &p_region->picture, p_pic, sizeof(picture_t) );
- p_region->picture.pf_release = RegionPictureRelease;
-
- return p_region;
-}
-
-/**
- * Destroy a subpicture region
- *
- * \param p_this vlc_object_t
- * \param p_region the subpicture region to destroy
- */
-void __spu_DestroyRegion( vlc_object_t *p_this, subpicture_region_t *p_region )
-{
- if( !p_region ) return;
- if( p_region->picture.pf_release )
- p_region->picture.pf_release( &p_region->picture );
- free( p_region->fmt.p_palette );
- if( p_region->p_cache ) __spu_DestroyRegion( p_this, p_region->p_cache );
-
- free( p_region->psz_text );
- free( p_region->psz_html );
- //free( p_region->p_style ); FIXME --fenrir plugin does not allocate the memory for it. I think it might lead to segfault, video renderer can live longer than the decoder
- free( p_region );
-}
-