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 ) );
/**
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.
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.
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
*****************************************************************************/
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 );
}
/*
}
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;
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 );
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;
return;
}
- spu_DestroySubpicture( p_vout->p_spu, p_subpic );
+ subpicture_Delete( p_subpic );
vlc_object_release( p_vout );
}
sout_StreamNew
sout_UpdateStatistic
__spu_Create
-spu_CreateSubpicture
spu_Destroy
-spu_DestroySubpicture
spu_DisplaySubpicture
spu_Init
spu_RenderSubpictures
__str_format
__str_format_meta
str_format_time
+subpicture_Delete
+subpicture_New
+subpicture_region_New
subpicture_region_ChainDelete
subpicture_region_Delete
subpicture_region_New
if( !psz_string ) return VLC_EGENERIC;
- p_spu = spu_CreateSubpicture( p_spu_channel );
+ p_spu = subpicture_New();
if( !p_spu )
return VLC_EGENERIC;
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;
}
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;
if( !psz_string ) return VLC_EGENERIC;
- p_spu = spu_CreateSubpicture( p_vout->p_spu );
+ p_spu = subpicture_New();
if( !p_spu )
return VLC_EGENERIC;
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;
}
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 );
#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
{
#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 *,
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.
*/
/*****************************************************************************
* 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 )
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;