Commit f1b80320 authored by Thomas Guillem's avatar Thomas Guillem

decoder: initialise callbacks regarding of the fmt

parent 6ab43650
......@@ -24,6 +24,8 @@
#ifndef VLC_CODEC_H
#define VLC_CODEC_H 1
#include <assert.h>
#include <vlc_block.h>
#include <vlc_es.h>
#include <vlc_picture.h>
......@@ -273,11 +275,7 @@ VLC_API void decoder_AbortPictures( decoder_t *dec, bool b_abort );
*/
static inline int decoder_QueueVideo( decoder_t *dec, picture_t *p_pic )
{
if( !dec->pf_queue_video )
{
picture_Release( p_pic );
return -1;
}
assert( dec->pf_queue_video != NULL );
return dec->pf_queue_video( dec, p_pic );
}
......@@ -292,11 +290,7 @@ static inline int decoder_QueueVideo( decoder_t *dec, picture_t *p_pic )
*/
static inline int decoder_QueueAudio( decoder_t *dec, block_t *p_aout_buf )
{
if( !dec->pf_queue_audio )
{
block_Release( p_aout_buf );
return -1;
}
assert( dec->pf_queue_audio != NULL );
return dec->pf_queue_audio( dec, p_aout_buf );
}
......@@ -311,11 +305,7 @@ static inline int decoder_QueueAudio( decoder_t *dec, block_t *p_aout_buf )
*/
static inline int decoder_QueueSub( decoder_t *dec, subpicture_t *p_spu )
{
if( !dec->pf_queue_sub )
{
subpicture_Delete( p_spu );
return -1;
}
assert( dec->pf_queue_sub != NULL );
return dec->pf_queue_sub( dec, p_spu );
}
......
......@@ -1704,9 +1704,6 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
p_dec->pf_get_attachments = DecoderGetInputAttachments;
p_dec->pf_get_display_date = DecoderGetDisplayDate;
p_dec->pf_get_display_rate = DecoderGetDisplayRate;
p_dec->pf_queue_video = DecoderQueueVideo;
p_dec->pf_queue_audio = DecoderQueueAudio;
p_dec->pf_queue_sub = DecoderQueueSpu;
/* Load a packetizer module if the input is not already packetized */
if( p_sout == NULL && !fmt->b_packetized )
......@@ -1732,6 +1729,18 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
if( LoadDecoder( p_dec, p_sout != NULL, fmt ) )
return p_dec;
switch( p_dec->fmt_out.i_cat )
{
case VIDEO_ES:
p_dec->pf_queue_video = DecoderQueueVideo;
break;
case AUDIO_ES:
p_dec->pf_queue_audio = DecoderQueueAudio;
break;
case SPU_ES:
p_dec->pf_queue_sub = DecoderQueueSpu;
break;
}
/* Copy ourself the input replay gain */
if( fmt->i_cat == AUDIO_ES )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment