Commit 080f21c3 authored by Thomas Guillem's avatar Thomas Guillem

decoder: remove b_need_packetized

When needed (fmt->b_packetized == false), create a packetizer before creating a
decoder. The fmt_in of the decoder is copied either from the fmt_out of the
packetizer, or from the fmt of CreateDecoder.
parent 27da2574
......@@ -62,9 +62,6 @@ struct decoder_t
/* Output format of decoder/packetizer */
es_format_t fmt_out;
/* Some decoders only accept packetized data (ie. not truncated) */
bool b_need_packetized;
/* Tell the decoder if it is allowed to drop frames */
bool b_frame_drop_allowed;
......
......@@ -326,8 +326,6 @@ static int OpenDecoder( vlc_object_t *p_this )
if( avctx->level != FF_LEVEL_UNKNOWN)
p_dec->fmt_in.i_level = avctx->level;
p_dec->b_need_packetized = true;
return VLC_SUCCESS;
}
......
......@@ -495,9 +495,6 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
p_dec->pf_decode_video = DecodeVideo;
if ( p_dec->fmt_in.i_codec == VLC_CODEC_VP9 )
p_dec->b_need_packetized = true;
return VLC_SUCCESS;
}
......
......@@ -348,7 +348,6 @@ static int OpenDecoder( vlc_object_t *p_this )
p_dec->fmt_out.i_codec = VLC_CODEC_YUYV;
p_dec->fmt_out.video.i_width = p_dec->fmt_in.video.i_width;
p_dec->fmt_out.video.i_height = p_dec->fmt_in.video.i_height;
p_dec->b_need_packetized = true;
/* Set callbacks */
p_dec->pf_decode_video = DecodeBlock;
......
......@@ -192,9 +192,6 @@ static int Open( vlc_object_t *p_this )
p_sys->i_buffer = p_sys->i_buffer_size = 0;
p_sys->p_buffer = NULL;
/* Faad2 can't deal with truncated data (eg. from MPEG TS) */
p_dec->b_need_packetized = true;
p_sys->b_sbr = p_sys->b_ps = false;
p_dec->pf_decode_audio = DecodeBlock;
......
......@@ -359,9 +359,6 @@ static int OpenDecoder( vlc_object_t *p_this )
/* Set callbacks */
p_dec->pf_decode_audio = DecodeBlock;
/* */
p_dec->b_need_packetized = true;
return VLC_SUCCESS;
}
......
......@@ -624,8 +624,6 @@ static int OpenDecoder( vlc_object_t *p_this )
"set state failure", VLC_EGENERIC );
p_sys->b_running = true;
/* Force packetized for now */
p_dec->b_need_packetized = true;
/* Set callbacks */
p_dec->pf_decode_video = DecodeBlock;
......
......@@ -1155,7 +1155,6 @@ int Open(vlc_object_t *p_this)
}
p_dec->fmt_out.i_cat = p_dec->fmt_in.i_cat;
p_dec->b_need_packetized = true;
return VLC_SUCCESS;
......
......@@ -560,7 +560,6 @@ static int OpenDecoder(vlc_object_t *p_this, pf_MediaCodecApi_init pf_init)
p_dec->fmt_out.i_cat = p_dec->fmt_in.i_cat;
p_dec->fmt_out.video = p_dec->fmt_in.video;
p_dec->fmt_out.audio = p_dec->fmt_in.audio;
p_dec->b_need_packetized = true;
p_sys->mime = mime;
p_sys->b_new_block = true;
......
......@@ -1248,8 +1248,6 @@ static int OpenGeneric( vlc_object_t *p_this, bool b_encode )
if(p_sys->b_error) goto error;
p_dec->b_need_packetized = true;
if (!p_sys->b_use_pts)
msg_Dbg( p_dec, "using dts timestamp mode for %s", p_sys->psz_component);
......
......@@ -662,8 +662,6 @@ static int OpenDecoder(vlc_object_t *p_this)
p_dec->fmt_out.i_codec = VLC_CODEC_I420;
}
p_dec->b_need_packetized = true;
p_dec->pf_decode_video = DecodeBlock;
msg_Info(p_dec, "Using Video Toolbox to decode '%4.4s'", (char *)&p_dec->fmt_in.i_codec);
......
......@@ -201,7 +201,6 @@ static int Open(vlc_object_t *p_this)
dec->fmt_out.video.i_width = dec->fmt_in.video.i_width;
dec->fmt_out.video.i_height = dec->fmt_in.video.i_height;
dec->fmt_out.i_codec = VLC_CODEC_I420;
dec->b_need_packetized = true;
return VLC_SUCCESS;
}
......
......@@ -116,7 +116,6 @@ static int OpenDecoder(decoder_t *dec)
goto out;
}
dec->p_sys = sys;
dec->b_need_packetized = true;
sys->opaque = var_InheritBool(dec, MMAL_OPAQUE_NAME);
bcm_host_init();
......
......@@ -142,7 +142,6 @@ static int LoadDecoder( decoder_t *p_dec, bool b_packetizer,
const es_format_t *restrict p_fmt )
{
p_dec->b_frame_drop_allowed = true;
p_dec->b_need_packetized = false;
p_dec->i_extra_picture_buffers = 0;
p_dec->pf_decode_audio = NULL;
......@@ -1597,26 +1596,27 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
p_dec->pf_get_display_date = DecoderGetDisplayDate;
p_dec->pf_get_display_rate = DecoderGetDisplayRate;
/* Find a suitable decoder/packetizer module */
if( LoadDecoder( p_dec, b_packetizer, fmt ) )
return p_dec;
/* Check if decoder requires already packetized data */
if( !b_packetizer &&
p_dec->b_need_packetized && !p_dec->fmt_in.b_packetized )
/* Load a packetizer module if the input is not already packetized */
if( !b_packetizer && !fmt->b_packetized )
{
p_owner->p_packetizer =
vlc_custom_create( p_parent, sizeof( decoder_t ), "packetizer" );
if( p_owner->p_packetizer )
{
if( LoadDecoder( p_owner->p_packetizer, true, &p_dec->fmt_in ) )
if( LoadDecoder( p_owner->p_packetizer, true, fmt ) )
{
vlc_object_release( p_owner->p_packetizer );
p_owner->p_packetizer = NULL;
}
else
fmt = &p_owner->p_packetizer->fmt_out;
}
}
/* Find a suitable decoder/packetizer module */
if( LoadDecoder( p_dec, b_packetizer, fmt ) )
return p_dec;
/* 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