]> git.sesse.net Git - vlc/commitdiff
Removed spu_Create/DestroySubpicture in favor of subpicture_*.
authorLaurent Aimar <fenrir@videolan.org>
Sun, 21 Sep 2008 12:22:11 +0000 (14:22 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 21 Sep 2008 12:53:36 +0000 (14:53 +0200)
include/vlc_osd.h
include/vlc_vout.h
modules/stream_out/transcode.c
src/input/decoder.c
src/libvlccore.sym
src/osd/osd_text.c
src/osd/osd_widgets.c
src/video_output/video_text.c
src/video_output/vout_intf.c
src/video_output/vout_subpictures.c

index 8e44fbd389e87bf94c06925c58af4ff98597eab8..a3853905411ac7ab97767b43cc15f28c0fcc4b56 100644 (file)
@@ -99,11 +99,19 @@ VLC_EXPORT( int, spu_Init, ( spu_t * ) );
 VLC_EXPORT( void, spu_Destroy, ( spu_t * ) );
 void spu_Attach( spu_t *, vlc_object_t *, bool );
 
-VLC_EXPORT( subpicture_t *, spu_CreateSubpicture, ( spu_t * ) );
-/* XXX you cannot call spu_DestroySubpicture on a displayed picture */
-VLC_EXPORT( void, spu_DestroySubpicture, ( spu_t *, subpicture_t * ) );
+/**
+ * This function sends a subpicture to the spu_t core.
+ * 
+ * You cannot use the provided subpicture anymore. The spu_t core
+ * will destroy it at its convenience.
+ */
 VLC_EXPORT( void, spu_DisplaySubpicture, ( spu_t *, subpicture_t * ) );
 
+/**
+ * This function asks the spu_t core a list of subpictures to display.
+ *
+ * The returned list can only be used by spu_RenderSubpictures.
+ */
 VLC_EXPORT( subpicture_t *, spu_SortSubpictures, ( spu_t *, mtime_t display_date, bool b_paused, bool b_subtitle_only ) );
 
 /**
index 277afa4200f5fbc12468d0963ec41c70117a77b9..d5409b8969c18ca5a8580ba03262e5a8dfcf6ed1 100644 (file)
@@ -322,14 +322,23 @@ struct subpicture_region_t
     subpicture_region_private_t *p_private;  /**< Private data for spu_t *only* */
 };
 
+/* Subpicture region position flags */
+#define SUBPICTURE_ALIGN_LEFT 0x1
+#define SUBPICTURE_ALIGN_RIGHT 0x2
+#define SUBPICTURE_ALIGN_TOP 0x4
+#define SUBPICTURE_ALIGN_BOTTOM 0x8
+#define SUBPICTURE_ALIGN_MASK ( SUBPICTURE_ALIGN_LEFT|SUBPICTURE_ALIGN_RIGHT| \
+                                SUBPICTURE_ALIGN_TOP |SUBPICTURE_ALIGN_BOTTOM )
+
 /**
- * This function will create a new subpicture.
- * You can must use subpicture_region_Delete to destroy it.
+ * This function will create a new subpicture region.
+ *
+ * You must use subpicture_region_Delete to destroy it.
  */
 VLC_EXPORT( subpicture_region_t *, subpicture_region_New, ( const video_format_t *p_fmt ) );
 
 /**
- * This function will destroy a subpicture allocated by
+ * This function will destroy a subpicture region allocated by
  * subpicture_region_New.
  *
  * You may give it NULL.
@@ -337,7 +346,7 @@ VLC_EXPORT( subpicture_region_t *, subpicture_region_New, ( const video_format_t
 VLC_EXPORT( void, subpicture_region_Delete, ( subpicture_region_t *p_region ) );
 
 /**
- * This function will destroy a list of subpicture allocated by
+ * This function will destroy a list of subpicture regions allocated by
  * subpicture_region_New.
  *
  * Provided for convenience.
@@ -404,17 +413,23 @@ struct subpicture_t
     subpicture_sys_t *p_sys;                              /* subpicture data */
 };
 
+
+/**
+ * This function create a new empty subpicture.
+ *
+ * You must use subpicture_Delete to destroy it.
+ */
+VLC_EXPORT( subpicture_t *, subpicture_New, ( void ) );
+
+/**
+ * This function delete a subpicture created by subpicture_New.
+ * You may give it NULL.
+ */
+VLC_EXPORT( void,  subpicture_Delete, ( subpicture_t *p_subpic ) );
+
 /* Default subpicture channel ID */
 #define DEFAULT_CHAN           1
 
-/* Subpicture position flags */
-#define SUBPICTURE_ALIGN_LEFT 0x1
-#define SUBPICTURE_ALIGN_RIGHT 0x2
-#define SUBPICTURE_ALIGN_TOP 0x4
-#define SUBPICTURE_ALIGN_BOTTOM 0x8
-#define SUBPICTURE_ALIGN_MASK ( SUBPICTURE_ALIGN_LEFT|SUBPICTURE_ALIGN_RIGHT| \
-                                SUBPICTURE_ALIGN_TOP |SUBPICTURE_ALIGN_BOTTOM )
-
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
index 474040f1b11a4b179fba2f8a3db10a03510d3f78..c00374bd141f18d7f39e1bdc082c99c251620a17 100644 (file)
@@ -2419,14 +2419,14 @@ static int transcode_spu_process( sout_stream_t *p_stream,
 
 static subpicture_t *spu_new_buffer( decoder_t *p_dec )
 {
-    sout_stream_t *p_stream = (sout_stream_t *)p_dec->p_owner;
-    return spu_CreateSubpicture( p_stream->p_sys->p_spu );
+    VLC_UNUSED( p_dec );
+    return subpicture_New();
 }
 
 static void spu_del_buffer( decoder_t *p_dec, subpicture_t *p_subpic )
 {
-    sout_stream_t *p_stream = (sout_stream_t *)p_dec->p_owner;
-    spu_DestroySubpicture( p_stream->p_sys->p_spu, p_subpic );
+    VLC_UNUSED( p_dec );
+    subpicture_Delete( p_subpic );
 }
 
 /*
@@ -2542,7 +2542,7 @@ static int transcode_osd_process( sout_stream_t *p_stream,
         }
 
         p_block = id->p_encoder->pf_encode_sub( id->p_encoder, p_subpic );
-        spu_DestroySubpicture( p_sys->p_spu, p_subpic );
+        subpicture_Delete( p_subpic );
         if( p_block )
         {
             p_block->i_dts = p_block->i_pts = in->i_dts;
index 4b5714b35d4d2be3cc84413f8ca09172df7da04e..9545b6ad19a290a5e3c0321410bf648fbbf34d8a 100644 (file)
@@ -1085,7 +1085,7 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
                 if( p_spu->i_start < p_dec->p_owner->i_preroll_end &&
                     ( p_spu->i_stop <= 0 || p_spu->i_stop < p_dec->p_owner->i_preroll_end ) )
                 {
-                    spu_DestroySubpicture( p_vout->p_spu, p_spu );
+                    subpicture_Delete( p_spu );
                 }
                 else
                     spu_DisplaySubpicture( p_vout->p_spu, p_spu );
@@ -1460,7 +1460,7 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec )
         p_sys->p_spu_vout = p_vout;
     }
 
-    p_subpic = spu_CreateSubpicture( p_vout->p_spu );
+    p_subpic = subpicture_New();
     if( p_subpic )
     {
         p_subpic->i_channel = p_sys->i_spu_channel;
@@ -1487,7 +1487,7 @@ static void spu_del_buffer( decoder_t *p_dec, subpicture_t *p_subpic )
         return;
     }
 
-    spu_DestroySubpicture( p_vout->p_spu, p_subpic );
+    subpicture_Delete( p_subpic );
 
     vlc_object_release( p_vout );
 }
index 81e9782843803b2f9f2284e58347d662462a2eb2..11a761bc5dbac525919725187935a0d54cb72814 100644 (file)
@@ -339,9 +339,7 @@ sout_StreamDelete
 sout_StreamNew
 sout_UpdateStatistic
 __spu_Create
-spu_CreateSubpicture
 spu_Destroy
-spu_DestroySubpicture
 spu_DisplaySubpicture
 spu_Init
 spu_RenderSubpictures
@@ -375,6 +373,9 @@ stream_vaControl
 __str_format
 __str_format_meta
 str_format_time
+subpicture_Delete
+subpicture_New
+subpicture_region_New
 subpicture_region_ChainDelete
 subpicture_region_Delete
 subpicture_region_New
index 0657c2d920cdbac54ead36c303f8c1e90354a2c5..ddc3dd10ff30de923d9bac7503ed92021fb13015 100644 (file)
@@ -78,7 +78,7 @@ int osd_ShowTextAbsolute( spu_t *p_spu_channel, int i_channel,
 
     if( !psz_string ) return VLC_EGENERIC;
 
-    p_spu = spu_CreateSubpicture( p_spu_channel );
+    p_spu = subpicture_New();
     if( !p_spu )
         return VLC_EGENERIC;
 
@@ -98,7 +98,7 @@ int osd_ShowTextAbsolute( spu_t *p_spu_channel, int i_channel,
     if( !p_spu->p_region )
     {
         msg_Err( p_spu_channel, "cannot allocate SPU region" );
-        spu_DestroySubpicture( p_spu_channel, p_spu );
+        subpicture_Delete( p_spu );
         return VLC_EGENERIC;
     }
 
index 76765165074b73c5571c4f66750326c6f3c762b1..5e880ead03e9e8faf0a411d1e81b9feade270ca6 100644 (file)
@@ -196,8 +196,10 @@ subpicture_t *osd_CreateWidget( spu_t *p_spu, int i_channel )
     subpicture_t *p_subpic;
     mtime_t i_now = mdate();
 
+    VLC_UNUSED(p_spu);
+
     /* Create and initialize a subpicture */
-    p_subpic = spu_CreateSubpicture( p_spu );
+    p_subpic = subpicture_New();
     if( p_subpic == NULL ) return NULL;
 
     p_subpic->i_channel = i_channel;
index 2fef025debbf7dff8dc1b52e59a7c100fce8307b..d0e7a0ac3c7ca4e8faea8c94bf2f1891c5a2aa94 100644 (file)
@@ -80,7 +80,7 @@ int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
 
     if( !psz_string ) return VLC_EGENERIC;
 
-    p_spu = spu_CreateSubpicture( p_vout->p_spu );
+    p_spu = subpicture_New();
     if( !p_spu )
         return VLC_EGENERIC;
 
@@ -102,7 +102,7 @@ int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
     if( !p_spu->p_region )
     {
         msg_Err( p_vout, "cannot allocate SPU region" );
-        spu_DestroySubpicture( p_vout->p_spu, p_spu );
+        subpicture_Delete( p_spu );
         return VLC_EGENERIC;
     }
 
index 3b7b243de5546b53a15559f79fbcfd74f4129433..3bce1b0b82d32ded5e9ce008aecf783e984a4d35 100644 (file)
@@ -457,7 +457,7 @@ static int VoutSnapshotPip( vout_thread_t *p_vout, image_handler_t *p_image, pic
     if( !p_pip )
         return VLC_EGENERIC;
 
-    p_subpic = spu_CreateSubpicture( p_vout->p_spu );
+    p_subpic = subpicture_New();
     if( p_subpic == NULL )
     {
          picture_Release( p_pip );
index f5124ef36686cfa37d9c28c148fdfdcfc0ca1833..bb6b98300d2945d70d78dd664d14c884d012545a 100644 (file)
 #define VLC_FOURCC_RGBA VLC_FOURCC('R','G','B','A')
 #define VLC_FOURCC_TEXT VLC_FOURCC('T','E','X','T')
 
-/* TODO export */
-static subpicture_t *subpicture_New( void );
-static void subpicture_Delete( subpicture_t *p_subpic );
-static void SubpictureChain( subpicture_t **pp_head, subpicture_t *p_subpic );
-
 /* */
 typedef struct
 {
@@ -142,6 +137,7 @@ static bool spu_area_overlap( spu_area_t, spu_area_t );
 
 #define SCALE_UNIT (1000)
 
+static void SubpictureChain( subpicture_t **pp_head, subpicture_t *p_subpic );
 static int SubpictureCmp( const void *s0, const void *s1 );
 
 static void SpuRenderRegion( spu_t *,
@@ -355,38 +351,6 @@ void spu_DisplaySubpicture( spu_t *p_spu, subpicture_t *p_subpic )
     vlc_mutex_unlock( &p_sys->lock );
 }
 
-/**
- * Allocate a subpicture in the spu heap.
- *
- * This function create a reserved subpicture in the spu heap.
- * A null pointer is returned if the function fails. This method provides an
- * already allocated zone of memory in the spu data fields. It needs locking
- * since several pictures can be created by several producers threads.
- * \param p_spu the subpicture unit in which to create the subpicture
- * \return NULL on error, a reserved subpicture otherwise
- */
-subpicture_t *spu_CreateSubpicture( spu_t *p_spu )
-{
-    VLC_UNUSED(p_spu);
-
-    return subpicture_New();
-}
-
-/**
- * Remove a subpicture from the heap
- *
- * This function frees a previously reserved subpicture.
- * It is meant to be used when the construction of a picture aborted.
- * This function does not need locking since reserved subpictures are ignored
- * by the spu.
- */
-void spu_DestroySubpicture( spu_t *p_spu, subpicture_t *p_subpic )
-{
-    VLC_UNUSED(p_spu);
-
-    subpicture_Delete( p_subpic );
-}
-
 /**
  * This function renders all sub picture units in the list.
  */
@@ -671,10 +635,7 @@ subpicture_t *spu_SortSubpictures( spu_t *p_spu, mtime_t display_date,
 /*****************************************************************************
  * subpicture_t allocation
  *****************************************************************************/
-/**
- * This function create a new empty subpicture.
- */
-static subpicture_t *subpicture_New( void )
+subpicture_t *subpicture_New( void )
 {
     subpicture_t *p_subpic = calloc( 1, sizeof(*p_subpic) );
     if( !p_subpic )
@@ -693,7 +654,7 @@ static subpicture_t *subpicture_New( void )
     return p_subpic;
 }
 
-static void subpicture_Delete( subpicture_t *p_subpic )
+void subpicture_Delete( subpicture_t *p_subpic )
 {
     subpicture_region_ChainDelete( p_subpic->p_region );
     p_subpic->p_region = NULL;