Commit 1c820ca4 authored by Zhao Zhili's avatar Zhao Zhili Committed by Thomas Guillem

codec: spudec: prepare to put pf_packetize and pf_decode into a union

Signed-off-by: Thomas Guillem's avatarThomas Guillem <thomas@gllm.fr>
parent f0db636b
......@@ -69,13 +69,7 @@ static block_t * Reassemble( decoder_t *, block_t * );
static int Decode ( decoder_t *, block_t * );
static block_t * Packetize ( decoder_t *, block_t ** );
/*****************************************************************************
* DecoderOpen
*****************************************************************************
* Tries to launch a decoder and return score so that the interface is able
* to chose.
*****************************************************************************/
static int DecoderOpen( vlc_object_t *p_this )
static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
{
decoder_t *p_dec = (decoder_t*)p_this;
decoder_sys_t *p_sys;
......@@ -85,43 +79,35 @@ static int DecoderOpen( vlc_object_t *p_this )
p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
p_sys->b_packetizer = false;
p_sys->b_packetizer = b_packetizer;
p_sys->b_disabletrans = var_InheritBool( p_dec, "dvdsub-transparency" );
p_sys->i_spu_size = 0;
p_sys->i_spu = 0;
p_sys->p_block = NULL;
p_dec->fmt_out.i_codec = VLC_CODEC_SPU;
p_dec->pf_decode = Decode;
p_dec->pf_packetize = NULL;
if( b_packetizer )
{
p_dec->pf_packetize = Packetize;
es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
p_dec->fmt_out.i_codec = VLC_CODEC_SPU;
}
else
{
p_dec->fmt_out.i_codec = VLC_CODEC_SPU;
p_dec->pf_decode = Decode;
}
return VLC_SUCCESS;
}
/*****************************************************************************
* PacketizerOpen
*****************************************************************************
* Tries to launch a decoder and return score so that the interface is able
* to chose.
*****************************************************************************/
static int PacketizerOpen( vlc_object_t *p_this )
static int DecoderOpen( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
if( DecoderOpen( p_this ) )
{
return VLC_EGENERIC;
}
decoder_sys_t *p_sys = p_dec->p_sys;
p_dec->pf_packetize = Packetize;
p_sys->b_packetizer = true;
es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
p_dec->fmt_out.i_codec = VLC_CODEC_SPU;
return OpenCommon( p_this, false );
}
return VLC_SUCCESS;
static int PacketizerOpen( vlc_object_t *p_this )
{
return OpenCommon( p_this, true );
}
/*****************************************************************************
......
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