audiodecoders: use default pad accept-caps handling

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

Elements: dtsdec, faad, gsmdec, mpg123audiodec, opusdec,
          sbcdec, adpcmdec, sirendec
This commit is contained in:
Thiago Santos 2015-08-15 12:58:40 -03:00
parent a5ed877783
commit 56b822f9f6
8 changed files with 25 additions and 0 deletions

View file

@ -209,6 +209,10 @@ gst_dtsdec_init (GstDtsDec * dtsdec)
dtsdec->request_channels = DCA_CHANNEL;
dtsdec->dynamic_range_compression = FALSE;
gst_audio_decoder_set_use_default_pad_acceptcaps (GST_AUDIO_DECODER_CAST
(dtsdec), TRUE);
GST_PAD_SET_ACCEPT_TEMPLATE (GST_AUDIO_DECODER_SINK_PAD (dtsdec));
/* retrieve and intercept base class chain.
* Quite HACKish, but that's dvd specs for you,
* since one buffer needs to be split into 2 frames */

View file

@ -175,6 +175,9 @@ gst_faad_class_init (GstFaadClass * klass)
static void
gst_faad_init (GstFaad * faad)
{
gst_audio_decoder_set_use_default_pad_acceptcaps (GST_AUDIO_DECODER_CAST
(faad), TRUE);
GST_PAD_SET_ACCEPT_TEMPLATE (GST_AUDIO_DECODER_SINK_PAD (faad));
gst_faad_reset (faad);
}

View file

@ -105,6 +105,9 @@ static void
gst_gsmdec_init (GstGSMDec * gsmdec)
{
gst_audio_decoder_set_needs_format (GST_AUDIO_DECODER (gsmdec), TRUE);
gst_audio_decoder_set_use_default_pad_acceptcaps (GST_AUDIO_DECODER_CAST
(gsmdec), TRUE);
GST_PAD_SET_ACCEPT_TEMPLATE (GST_AUDIO_DECODER_SINK_PAD (gsmdec));
}
static gboolean

View file

@ -197,6 +197,9 @@ gst_mpg123_audio_dec_init (GstMpg123AudioDec * mpg123_decoder)
{
mpg123_decoder->handle = NULL;
gst_audio_decoder_set_needs_format (GST_AUDIO_DECODER (mpg123_decoder), TRUE);
gst_audio_decoder_set_use_default_pad_acceptcaps (GST_AUDIO_DECODER_CAST
(mpg123_decoder), TRUE);
GST_PAD_SET_ACCEPT_TEMPLATE (GST_AUDIO_DECODER_SINK_PAD (mpg123_decoder));
}

View file

@ -167,6 +167,9 @@ gst_opus_dec_init (GstOpusDec * dec)
dec->apply_gain = DEFAULT_APPLY_GAIN;
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_opus_dec_reset (dec);
}

View file

@ -236,6 +236,9 @@ static void
gst_sbc_dec_init (GstSbcDec * dec)
{
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->samples_per_frame = 0;
dec->frame_len = 0;

View file

@ -456,6 +456,9 @@ static void
adpcmdec_init (ADPCMDec * dec)
{
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));
}
static void

View file

@ -96,6 +96,9 @@ static void
gst_siren_dec_init (GstSirenDec * dec)
{
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));
}
static gboolean