[vlc-commits] misc: spu: add subpicture_region_NewInternal

Thomas Guillem git at videolan.org
Thu Jun 6 07:40:13 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jun  5 09:52:34 2019 +0200| [ce89a18c41caeefc8b69af33392aa97684623973] | committer: Thomas Guillem

misc: spu: add subpicture_region_NewInternal

This function won't allocate the picture associated with the region.

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

 src/misc/subpicture.c | 12 +++++++++++-
 src/misc/subpicture.h |  2 ++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/misc/subpicture.c b/src/misc/subpicture.c
index 3e2535492a..b78698db5b 100644
--- a/src/misc/subpicture.c
+++ b/src/misc/subpicture.c
@@ -202,7 +202,7 @@ void subpicture_region_private_Delete( subpicture_region_private_t *p_private )
     free( p_private );
 }
 
-subpicture_region_t *subpicture_region_New( const video_format_t *p_fmt )
+subpicture_region_t * subpicture_region_NewInternal( const video_format_t *p_fmt )
 {
     subpicture_region_t *p_region = calloc( 1, sizeof(*p_region ) );
     if( !p_region )
@@ -234,6 +234,16 @@ subpicture_region_t *subpicture_region_New( const video_format_t *p_fmt )
     p_region->i_alpha = 0xff;
     p_region->b_balanced_text = true;
 
+    return p_region;
+}
+
+subpicture_region_t *subpicture_region_New( const video_format_t *p_fmt )
+{
+    subpicture_region_t *p_region =
+        subpicture_region_NewInternal( p_fmt );
+    if( !p_region )
+        return NULL;
+
     if( p_fmt->i_chroma == VLC_CODEC_TEXT )
         return p_region;
 
diff --git a/src/misc/subpicture.h b/src/misc/subpicture.h
index cc051c007b..912a28af46 100644
--- a/src/misc/subpicture.h
+++ b/src/misc/subpicture.h
@@ -25,6 +25,8 @@ struct subpicture_region_private_t {
     picture_t      *p_picture;
 };
 
+subpicture_region_t * subpicture_region_NewInternal( const video_format_t *p_fmt );
+
 subpicture_region_private_t *subpicture_region_private_New(video_format_t *);
 void subpicture_region_private_Delete(subpicture_region_private_t *);
 



More information about the vlc-commits mailing list