* globaly, not necessary for the current packet */
block_t * ( * pf_get_cc ) ( decoder_t *, bool pb_present[4] );
- /*
- * Buffers allocation
- */
-
- /* Video output callbacks */
- picture_t * ( * pf_vout_buffer_new) ( decoder_t * );
- void ( * pf_vout_buffer_del) ( decoder_t *, picture_t * );
- void ( * pf_picture_link) ( decoder_t *, picture_t * );
- void ( * pf_picture_unlink) ( decoder_t *, picture_t * );
-
/*
* Owner fields
+ * XXX You MUST not use them directly.
*/
+ /* Video output callbacks
+ * XXX use decoder_NewPicture/decoder_DeletePicture
+ * and decoder_LinkPicture/decoder_UnlinkPicture */
+ picture_t *(*pf_vout_buffer_new)( decoder_t * );
+ void (*pf_vout_buffer_del)( decoder_t *, picture_t * );
+ void (*pf_picture_link) ( decoder_t *, picture_t * );
+ void (*pf_picture_unlink) ( decoder_t *, picture_t * );
+
/* Audio output callbacks
* XXX use decoder_NewAudioBuffer/decoder_DeleteAudioBuffer */
- aout_buffer_t * ( * pf_aout_buffer_new) ( decoder_t *, int );
- void ( * pf_aout_buffer_del) ( decoder_t *, aout_buffer_t * );
+ aout_buffer_t *(*pf_aout_buffer_new)( decoder_t *, int );
+ void (*pf_aout_buffer_del)( decoder_t *, aout_buffer_t * );
/* 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 * );
+ subpicture_t *(*pf_spu_buffer_new)( decoder_t * );
+ void (*pf_spu_buffer_del)( decoder_t *, subpicture_t * );
/* Input attachments
* XXX use decoder_GetInputAttachments */
*/
+/**
+ * This function will return a new picture usable by a decoder as an output
+ * buffer. You have to release it using decoder_DeletePicture or by returning
+ * it to the caller as a pf_decode_video return value.
+ */
+VLC_EXPORT( picture_t *, decoder_NewPicture, ( decoder_t * ) );
+
+/**
+ * This function will release a picture create by decoder_NewPicture.
+ */
+VLC_EXPORT( void, decoder_DeletePicture, ( decoder_t *, picture_t *p_picture ) );
+
+/**
+ * This function will increase the picture reference count.
+ * (picture_Hold is not usable.)
+ */
+VLC_EXPORT( void, decoder_LinkPicture, ( decoder_t *, picture_t * ) );
+
+/**
+ * This function will decrease the picture reference count.
+ * (picture_Release is not usable.)
+ */
+VLC_EXPORT( void, decoder_UnlinkPicture, ( decoder_t *, picture_t * ) );
+
/**
* This function will return a new audio buffer usable by a decoder as an
* output buffer. You have to release it using decoder_DeleteAudioBuffer
p_dec->fmt_out.video.i_frame_rate_base = p_context->time_base.num;
}
- p_pic = p_dec->pf_vout_buffer_new( p_dec );
+ p_pic = decoder_NewPicture( p_dec );
return p_pic;
}
/* Do not display the picture */
p_pic = (picture_t *)p_sys->p_ff_pic->opaque;
if( !b_drawpicture && p_pic )
- p_dec->pf_vout_buffer_del( p_dec, p_pic );
+ decoder_DeletePicture( p_dec, p_pic );
ffmpeg_NextPts( p_dec );
continue;
}
else
{
- p_dec->pf_vout_buffer_del( p_dec, p_pic );
+ decoder_DeletePicture( p_dec, p_pic );
}
}
if( p_ff_pic->reference != 0 )
{
- p_dec->pf_picture_link( p_dec, p_pic );
+ decoder_LinkPicture( p_dec, p_pic );
}
/* FIXME what is that, should give good value */
if( p_ff_pic->reference != 0 )
{
- p_dec->pf_picture_unlink( p_dec, p_pic );
+ decoder_UnlinkPicture( p_dec, p_pic );
}
}
}
/* Get a new picture */
- p_pic = p_dec->pf_vout_buffer_new( p_dec );
+ p_pic = decoder_NewPicture( p_dec );
if( !p_pic )
goto error;
p_sys->p_dirac->src_params.frame_rate.denominator;
/* Get a new picture */
- p_pic = p_dec->pf_vout_buffer_new( p_dec );
+ p_pic = decoder_NewPicture( p_dec );
if( p_pic == NULL ) return NULL;
p_pic->b_progressive = !p_sys->p_dirac->src_params.source_sampling;
if( p_dec->fmt_out.i_cat == VIDEO_ES )
{
/* Get a new picture */
- picture_t *p_pic = p_dec->pf_vout_buffer_new( p_dec );
+ picture_t *p_pic = decoder_NewPicture( p_dec );
if( !p_pic ) return NULL;
CopyPicture( p_pic, block_out.p_buffer );
picture_t *p_pic;
if( pp_block == NULL || !*pp_block ) return NULL;
- p_pic = p_dec->pf_vout_buffer_new( p_dec );
+ p_pic = decoder_NewPicture( p_dec );
if( p_pic == NULL )
{
msg_Err( p_dec, "cannot get picture" );
/* For some reason, libmpeg2 will put this pic twice in
* discard_picture. This can be considered a bug in libmpeg2. */
- p_dec->pf_picture_link( p_dec, p_pic );
+ decoder_LinkPicture( p_dec, p_pic );
if( p_sys->p_synchro )
{
if( p_sys->p_info->discard_fbuf &&
p_sys->p_info->discard_fbuf->id )
{
- p_dec->pf_picture_unlink( p_dec,
- p_sys->p_info->discard_fbuf->id );
+ decoder_UnlinkPicture( p_dec,
+ p_sys->p_info->discard_fbuf->id );
}
/* For still frames */
VLC_FOURCC('I','4','2','0') : VLC_FOURCC('I','4','2','2');
/* Get a new picture */
- p_pic = p_dec->pf_vout_buffer_new( p_dec );
+ p_pic = decoder_NewPicture( p_dec );
if( p_pic == NULL ) return NULL;
p_pic->i_nb_fields = p_sys->p_info->current_picture != NULL ?
p_sys->p_info->current_picture->nb_fields : 2;
- p_dec->pf_picture_link( p_dec, p_pic );
+ decoder_LinkPicture( p_dec, p_pic );
pp_buf[0] = p_pic->p[0].p_pixels;
pp_buf[1] = p_pic->p[1].p_pixels;
// p_sys->p_decoder->sync();
if( p_block->i_flags & BLOCK_FLAG_END_OF_FRAME )
{
- p_pic = p_dec->pf_vout_buffer_new( p_dec );
+ p_pic = decoder_NewPicture( p_dec );
if( !p_pic )
{
block_Release( p_block );
}
/* Get a new picture */
- p_pic = p_dec->pf_vout_buffer_new( p_dec );
+ p_pic = decoder_NewPicture( p_dec );
if( !p_pic ) goto error;
/* Decode picture */
vlc_mutex_lock( &qt_mutex );
- if( ( p_pic = p_dec->pf_vout_buffer_new( p_dec ) ) )
+ if( ( p_pic = decoder_NewPicture( p_dec ) ) )
{
p_sys->decpar.data = (Ptr)p_block->p_buffer;
p_sys->decpar.bufferSize = p_block->i_buffer;
picture_t *p_pic;
/* Get a new picture */
- p_pic = p_dec->pf_vout_buffer_new( p_dec );
+ p_pic = decoder_NewPicture( p_dec );
if( !p_pic )
{
block_Release( p_block );
vlc_mutex_lock( &rm_mutex );
- p_pic = p_dec->pf_vout_buffer_new( p_dec );
+ p_pic = decoder_NewPicture( p_dec );
if ( p_pic )
{
if( !p_free )
return;
- p_free->p_dec->pf_vout_buffer_del( p_free->p_dec, p_free->p_pic );
+ decoder_DeletePicture( p_free->p_dec, p_free->p_pic );
free(p_free);
(void)frame;
}
if( !p_schroframe )
return NULL;
- p_pic = p_dec->pf_vout_buffer_new( p_dec );
+ p_pic = decoder_NewPicture( p_dec );
if( !p_pic )
return NULL;
/ p_surface->h;
/* Get a new picture. */
- p_pic = p_dec->pf_vout_buffer_new( p_dec );
+ p_pic = decoder_NewPicture( p_dec );
if ( p_pic == NULL ) goto error;
switch ( p_surface->format->BitsPerPixel )
p_dec->fmt_out.i_codec = i_chroma;
/* Get a new picture */
- if( (p_pic = p_dec->pf_vout_buffer_new( p_dec )) )
+ if( (p_pic = decoder_NewPicture( p_dec )) )
{
tarkin_CopyPicture( p_dec, p_pic, rgb, i_stride );
return NULL;
/* Get a new picture */
- p_pic = p_dec->pf_vout_buffer_new( p_dec );
+ p_pic = decoder_NewPicture( p_dec );
if( !p_pic ) return NULL;
theora_CopyPicture( p_dec, p_pic, &yuv );
mpeg2_set_buf( p_sys->p_mpeg2dec, buf, p_pic );
p_pic->date = 0;
- p_dec->pf_picture_link( p_dec, p_pic );
+ decoder_LinkPicture( p_dec, p_pic );
if( p_sys->p_synchro )
{
if( p_sys->p_info->discard_fbuf &&
p_sys->p_info->discard_fbuf->id )
{
- p_dec->pf_picture_unlink( p_dec, p_sys->p_info->discard_fbuf->id );
+ decoder_UnlinkPicture( p_dec, p_sys->p_info->discard_fbuf->id );
}
/* For still frames */
//if( state == STATE_END && p_pic ) p_pic->b_force = true;
fflush(p_sys->f_wd_nb);
}
#endif
- p_pic = p_dec->pf_vout_buffer_new( p_dec );
+ p_pic = decoder_NewPicture( p_dec );
if( p_pic == NULL ) return NULL;
p_pic->format.i_frame_rate = p_dec->fmt_out.video.i_frame_rate;
p_pic->format.i_frame_rate_base = p_dec->fmt_out.video.i_frame_rate_base;
- p_dec->pf_picture_link( p_dec, p_pic );
+ decoder_LinkPicture( p_dec, p_pic );
pp_buf[0] = p_pic->p[0].p_pixels;
pp_buf[1] = p_pic->p[1].p_pixels;
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR;
p_dec->fmt_out.i_codec = VLC_FOURCC('I','4','2','0');
- p_pic = p_dec->pf_vout_buffer_new( p_dec );
+ p_pic = decoder_NewPicture( p_dec );
if( p_block->i_buffer == kBufferSize )
{
/*****************************************************************************
* Public functions
*****************************************************************************/
+picture_t *decoder_NewPicture( decoder_t *p_decoder )
+{
+ picture_t *p_picture = p_decoder->pf_vout_buffer_new( p_decoder );
+ if( !p_picture )
+ msg_Warn( p_decoder, "can't get output picture" );
+ return p_picture;
+}
+void decoder_DeletePicture( decoder_t *p_decoder, picture_t *p_picture )
+{
+ p_decoder->pf_vout_buffer_del( p_decoder, p_picture );
+}
+void decoder_LinkPicture( decoder_t *p_decoder, picture_t *p_picture )
+{
+ p_decoder->pf_picture_link( p_decoder, p_picture );
+}
+void decoder_UnlinkPicture( decoder_t *p_decoder, picture_t *p_picture )
+{
+ p_decoder->pf_picture_unlink( p_decoder, p_picture );
+}
+
aout_buffer_t *decoder_NewAudioBuffer( decoder_t *p_decoder, int i_size )
{
if( !p_decoder->pf_aout_buffer_new )
}
void decoder_DeleteAudioBuffer( decoder_t *p_decoder, aout_buffer_t *p_buffer )
{
- if( !p_decoder->pf_aout_buffer_del )
- return;
p_decoder->pf_aout_buffer_del( p_decoder, p_buffer );
}
date_Move
date_Set
decoder_DeleteAudioBuffer
+decoder_DeletePicture
decoder_DeleteSubpicture
decoder_GetDisplayDate
decoder_GetDisplayRate
decoder_GetInputAttachments
+decoder_LinkPicture
decoder_NewAudioBuffer
+decoder_NewPicture
decoder_NewSubpicture
decoder_SynchroChoose
decoder_SynchroDate
decoder_SynchroRelease
decoder_SynchroReset
decoder_SynchroTrash
+decoder_UnlinkPicture
decode_URI
decode_URI_duplicate
demux_PacketizerDestroy