void ( * pf_picture_link) ( decoder_t *, picture_t * );
void ( * pf_picture_unlink) ( decoder_t *, picture_t * );
- /* SPU output callbacks */
- subpicture_t * ( * pf_spu_buffer_new) ( decoder_t * );
- void ( * pf_spu_buffer_del) ( decoder_t *, subpicture_t * );
-
/*
* Owner fields
*/
+ /* SPU output callbacks
+ * XXX use decoder_NewSubpicture and decoder_DeleteSubpicture */
+ subpicture_t *(*pf_spu_buffer_new) ( decoder_t * );
+ void (*pf_spu_buffer_del) ( decoder_t *, subpicture_t * );
+
/* Input attachments
* XXX use decoder_GetInputAttachments */
int (*pf_get_attachments)( decoder_t *p_dec, input_attachment_t ***ppp_attachment, int *pi_attachment );
* @}
*/
+/**
+ * This function will return a new subpicture usable by a decoder as an output
+ * buffer. You have to release it using decoder_DeleteSubpicture or by returning
+ * it to the caller as a pf_decode_sub return value.
+ */
+VLC_EXPORT( subpicture_t *, decoder_NewSubpicture, ( decoder_t * ) );
+
+/**
+ * This function will release a subpicture create by decoder_NewSubicture.
+ */
+VLC_EXPORT( void, decoder_DeleteSubpicture, ( decoder_t *, subpicture_t *p_subpicture ) );
+
/**
* This function gives all input attachments at once.
*
* You MUST release the returned values
*/
-VLC_EXPORT( int, decoder_GetInputAttachments, ( decoder_t *p_dec, input_attachment_t ***ppp_attachment, int *pi_attachment ) );
+VLC_EXPORT( int, decoder_GetInputAttachments, ( decoder_t *, input_attachment_t ***ppp_attachment, int *pi_attachment ) );
/**
* This function converts a decoder timestamp into a display date comparable
EnsureUTF8( psz_html );
/* Create the subpicture unit */
- p_spu = p_dec->pf_spu_buffer_new( p_dec );
+ p_spu = decoder_NewSubpicture( p_dec );
if( !p_spu )
{
msg_Warn( p_dec, "can't get spu buffer" );
msg_Err( p_dec, "cannot allocate SPU region" );
free( psz_subtitle );
free( psz_html );
- p_dec->pf_spu_buffer_del( p_dec, p_spu );
+ decoder_DeleteSubpicture( p_dec, p_spu );
return NULL;
}
* displaying is done in the DisplayAnchor function in intf.c (called from
* DisplayPendingAnchor, which in turn is called from the main RunIntf
* loop). */
- p_spu = p_dec->pf_spu_buffer_new( p_dec );
+ p_spu = decoder_NewSubpicture( p_dec );
if( !p_spu )
{
msg_Dbg( p_dec, "couldn't allocate new subpicture" );
return NULL;
}
- p_spu = p_dec->pf_spu_buffer_new( p_dec );
+ p_spu = decoder_NewSubpicture( p_dec );
if( !p_spu )
{
msg_Warn( p_dec, "can't get spu buffer" );
p_spu->p_sys = malloc( sizeof( subpicture_sys_t ));
if( !p_spu->p_sys )
{
- p_dec->pf_spu_buffer_del( p_dec, p_spu );
+ decoder_DeleteSubpicture( p_dec, p_spu );
block_Release( p_block );
return NULL;
}
if( !p_spu->p_sys->p_subs_data )
{
free( p_spu->p_sys );
- p_dec->pf_spu_buffer_del( p_dec, p_spu );
+ decoder_DeleteSubpicture( p_dec, p_spu );
block_Release( p_block );
return NULL;
}
int i;
/* Allocate the subpicture internal data. */
- p_spu = p_dec->pf_spu_buffer_new( p_dec );
+ p_spu = decoder_NewSubpicture( p_dec );
if( !p_spu ) return NULL;
p_spu->i_start = p_data->i_pts;
if( !p_region )
{
msg_Err( p_dec, "cannot allocate SPU region" );
- p_dec->pf_spu_buffer_del( p_dec, p_spu );
+ decoder_DeleteSubpicture( p_dec, p_spu );
return NULL;
}
int i_base_y;
/* Allocate the subpicture internal data. */
- p_spu = p_dec->pf_spu_buffer_new( p_dec );
+ p_spu = decoder_NewSubpicture( p_dec );
if( !p_spu )
return NULL;
/* we have an event */
/* Get a new spu */
- p_spu = p_dec->pf_spu_buffer_new( p_dec );
+ p_spu = decoder_NewSubpicture( p_dec );
if( !p_spu )
{
msg_Err( p_dec, "Failed to allocate spu buffer" );
if( !p_bitmap_region )
{
msg_Err( p_dec, "cannot allocate SPU region" );
- p_dec->pf_spu_buffer_del( p_dec, p_spu );
+ decoder_DeleteSubpicture( p_dec, p_spu );
return NULL;
}
if( !p_spu->p_region )
{
msg_Err( p_dec, "cannot allocate SPU region" );
- p_dec->pf_spu_buffer_del( p_dec, p_spu );
+ decoder_DeleteSubpicture( p_dec, p_spu );
return NULL;
}
return NULL;
}
- p_spu = p_dec->pf_spu_buffer_new( p_dec );
+ p_spu = decoder_NewSubpicture( p_dec );
if( !p_spu )
{
msg_Warn( p_dec, "can't get spu buffer" );
p_spu->p_sys = malloc( sizeof( subpicture_sys_t ));
if( !p_spu->p_sys )
{
- p_dec->pf_spu_buffer_del( p_dec, p_spu );
+ decoder_DeleteSubpicture( p_dec, p_spu );
block_Release( p_block );
return NULL;
}
if( !p_spu->p_sys->p_subs_data )
{
free( p_spu->p_sys );
- p_dec->pf_spu_buffer_del( p_dec, p_spu );
+ decoder_DeleteSubpicture( p_dec, p_spu );
block_Release( p_block );
return NULL;
}
spu_properties_t spu_properties;
/* Allocate the subpicture internal data. */
- p_spu = p_dec->pf_spu_buffer_new( p_dec );
+ p_spu = decoder_NewSubpicture( p_dec );
if( !p_spu ) return NULL;
/* Rationale for the "p_spudec->i_rle_size * 4": we are going to
if( ParseControlSeq( p_dec, p_spu, p_spu_data, &spu_properties ) )
{
/* There was a parse error, delete the subpicture */
- p_dec->pf_spu_buffer_del( p_dec, p_spu );
+ decoder_DeleteSubpicture( p_dec, p_spu );
return NULL;
}
if( ParseRLE( p_dec, p_spu_data, &spu_properties ) )
{
/* There was a parse error, delete the subpicture */
- p_dec->pf_spu_buffer_del( p_dec, p_spu );
+ decoder_DeleteSubpicture( p_dec, p_spu );
return NULL;
}
}
/* Create the subpicture unit */
- p_spu = p_dec->pf_spu_buffer_new( p_dec );
+ p_spu = decoder_NewSubpicture( p_dec );
if( !p_spu )
{
msg_Warn( p_dec, "can't get spu buffer" );
{
msg_Err( p_dec, "cannot allocate SPU region" );
free( psz_subtitle );
- p_dec->pf_spu_buffer_del( p_dec, p_spu );
+ decoder_DeleteSubpicture( p_dec, p_spu );
return NULL;
}
}
/* Create the subpicture unit */
- p_spu = p_dec->pf_spu_buffer_new( p_dec );
+ p_spu = decoder_NewSubpicture( p_dec );
if( !p_spu )
{
msg_Warn( p_dec, "can't get spu buffer" );
int i;
/* Allocate the subpicture internal data. */
- p_spu = p_dec->pf_spu_buffer_new( p_dec );
+ p_spu = decoder_NewSubpicture( p_dec );
if( !p_spu ) return NULL;
p_spu->i_start = p_data->i_pts;
if( !p_region )
{
msg_Err( p_dec, "cannot allocate SVCD subtitle region" );
- p_dec->pf_spu_buffer_del( p_dec, p_spu );
+ decoder_DeleteSubpicture( p_dec, p_spu );
return NULL;
}
strcpy( p_sys->psz_prev_text, psz_text );
/* Create the subpicture unit */
- p_spu = p_dec->pf_spu_buffer_new( p_dec );
+ p_spu = decoder_NewSubpicture( p_dec );
if( !p_spu )
{
msg_Warn( p_dec, "can't get spu buffer" );
error:
if ( p_spu != NULL )
{
- p_dec->pf_spu_buffer_del( p_dec, p_spu );
+ decoder_DeleteSubpicture( p_dec, p_spu );
p_spu = NULL;
}
vbi_unref_page( &p_page );
if( p_spu != NULL )
{
- p_dec->pf_spu_buffer_del( p_dec, p_spu );
+ decoder_DeleteSubpicture( p_dec, p_spu );
p_spu = NULL;
}
/* If there is a page or sub to render, then we do that here */
/* Create the subpicture unit */
- p_spu = p_dec->pf_spu_buffer_new( p_dec );
+ p_spu = decoder_NewSubpicture( p_dec );
if( !p_spu )
{
msg_Warn( p_dec, "can't get spu buffer" );
if( p_spu->p_region == NULL )
{
msg_Err( p_dec, "cannot allocate SPU region" );
- p_dec->pf_spu_buffer_del( p_dec, p_spu );
+ decoder_DeleteSubpicture( p_dec, p_spu );
return NULL;
}
/*****************************************************************************
* Public functions
*****************************************************************************/
+subpicture_t *decoder_NewSubpicture( decoder_t *p_decoder )
+{
+ subpicture_t *p_subpicture = p_decoder->pf_spu_buffer_new( p_decoder );
+ if( !p_subpicture )
+ msg_Warn( p_decoder, "can't get output subpicture" );
+ return p_subpicture;
+}
+void decoder_DeleteSubpicture( decoder_t *p_decoder, subpicture_t *p_subpicture )
+{
+ p_decoder->pf_spu_buffer_del( p_decoder, p_subpicture );
+}
/* decoder_GetInputAttachments:
*/
date_Init
date_Move
date_Set
+decoder_DeleteSubpicture
decoder_GetDisplayDate
decoder_GetDisplayRate
decoder_GetInputAttachments
+decoder_NewSubpicture
decoder_SynchroChoose
decoder_SynchroDate
decoder_SynchroDecode