audiodecoders: use default pad accept-caps handling

Avoids useless check of downstream caps when handling an
accept-caps query

Elements: flacdec, speexdec, wavpackdec, mulawdec, alawdec
This commit is contained in:
Thiago Santos 2015-08-15 09:16:23 -03:00
parent 16fbd4f86f
commit 65676c22ee
5 changed files with 15 additions and 0 deletions

View file

@ -179,6 +179,9 @@ static void
gst_flac_dec_init (GstFlacDec * flacdec) gst_flac_dec_init (GstFlacDec * flacdec)
{ {
gst_audio_decoder_set_needs_format (GST_AUDIO_DECODER (flacdec), TRUE); gst_audio_decoder_set_needs_format (GST_AUDIO_DECODER (flacdec), TRUE);
gst_audio_decoder_set_use_default_pad_acceptcaps (GST_AUDIO_DECODER_CAST
(flacdec), TRUE);
GST_PAD_SET_ACCEPT_TEMPLATE (GST_AUDIO_DECODER_SINK_PAD (flacdec));
} }
static gboolean static gboolean

View file

@ -156,6 +156,9 @@ static void
gst_speex_dec_init (GstSpeexDec * dec) gst_speex_dec_init (GstSpeexDec * dec)
{ {
gst_audio_decoder_set_needs_format (GST_AUDIO_DECODER (dec), TRUE); gst_audio_decoder_set_needs_format (GST_AUDIO_DECODER (dec), TRUE);
gst_audio_decoder_set_use_default_pad_acceptcaps (GST_AUDIO_DECODER_CAST
(dec), TRUE);
GST_PAD_SET_ACCEPT_TEMPLATE (GST_AUDIO_DECODER_SINK_PAD (dec));
dec->enh = DEFAULT_ENH; dec->enh = DEFAULT_ENH;

View file

@ -142,6 +142,9 @@ gst_wavpack_dec_init (GstWavpackDec * dec)
dec->stream_reader = gst_wavpack_stream_reader_new (); dec->stream_reader = gst_wavpack_stream_reader_new ();
gst_audio_decoder_set_needs_format (GST_AUDIO_DECODER (dec), TRUE); gst_audio_decoder_set_needs_format (GST_AUDIO_DECODER (dec), TRUE);
gst_audio_decoder_set_use_default_pad_acceptcaps (GST_AUDIO_DECODER_CAST
(dec), TRUE);
GST_PAD_SET_ACCEPT_TEMPLATE (GST_AUDIO_DECODER_SINK_PAD (dec));
gst_wavpack_dec_reset (dec); gst_wavpack_dec_reset (dec);
} }

View file

@ -224,4 +224,7 @@ static void
gst_alaw_dec_init (GstALawDec * alawdec) gst_alaw_dec_init (GstALawDec * alawdec)
{ {
gst_audio_decoder_set_needs_format (GST_AUDIO_DECODER (alawdec), TRUE); gst_audio_decoder_set_needs_format (GST_AUDIO_DECODER (alawdec), TRUE);
gst_audio_decoder_set_use_default_pad_acceptcaps (GST_AUDIO_DECODER_CAST
(alawdec), TRUE);
GST_PAD_SET_ACCEPT_TEMPLATE (GST_AUDIO_DECODER_SINK_PAD (alawdec));
} }

View file

@ -169,4 +169,7 @@ static void
gst_mulawdec_init (GstMuLawDec * mulawdec) gst_mulawdec_init (GstMuLawDec * mulawdec)
{ {
gst_audio_decoder_set_needs_format (GST_AUDIO_DECODER (mulawdec), TRUE); gst_audio_decoder_set_needs_format (GST_AUDIO_DECODER (mulawdec), TRUE);
gst_audio_decoder_set_use_default_pad_acceptcaps (GST_AUDIO_DECODER_CAST
(mulawdec), TRUE);
GST_PAD_SET_ACCEPT_TEMPLATE (GST_AUDIO_DECODER_SINK_PAD (mulawdec));
} }