From 79bfd0f42cba892f4771d95941a9db2a4d4c2a40 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Sat, 15 Aug 2015 11:46:13 -0300 Subject: [PATCH] audiodecoders: use default pad accept-caps handling Avoids useless check of downstream caps when handling an accept-caps query Elements: a52dec, amrnbdec, amrwbdec, mad --- ext/a52dec/gsta52dec.c | 4 ++++ ext/amrnb/amrnbdec.c | 3 +++ ext/amrwbdec/amrwbdec.c | 3 +++ ext/mad/gstmad.c | 2 ++ 4 files changed, 12 insertions(+) diff --git a/ext/a52dec/gsta52dec.c b/ext/a52dec/gsta52dec.c index 6a9267e14c..c78cfeb900 100644 --- a/ext/a52dec/gsta52dec.c +++ b/ext/a52dec/gsta52dec.c @@ -229,6 +229,10 @@ gst_a52dec_init (GstA52Dec * a52dec) a52dec->state = NULL; a52dec->samples = NULL; + gst_audio_decoder_set_use_default_pad_acceptcaps (GST_AUDIO_DECODER_CAST + (a52dec), TRUE); + GST_PAD_SET_ACCEPT_TEMPLATE (GST_AUDIO_DECODER_SINK_PAD (a52dec)); + /* retrieve and intercept base class chain. * Quite HACKish, but that's dvd specs/caps for you, * since one buffer needs to be split into 2 frames */ diff --git a/ext/amrnb/amrnbdec.c b/ext/amrnb/amrnbdec.c index e07cc6de7e..894c085970 100644 --- a/ext/amrnb/amrnbdec.c +++ b/ext/amrnb/amrnbdec.c @@ -144,6 +144,9 @@ static void gst_amrnbdec_init (GstAmrnbDec * amrnbdec) { gst_audio_decoder_set_needs_format (GST_AUDIO_DECODER (amrnbdec), TRUE); + gst_audio_decoder_set_use_default_pad_acceptcaps (GST_AUDIO_DECODER_CAST + (amrnbdec), TRUE); + GST_PAD_SET_ACCEPT_TEMPLATE (GST_AUDIO_DECODER_SINK_PAD (amrnbdec)); } static gboolean diff --git a/ext/amrwbdec/amrwbdec.c b/ext/amrwbdec/amrwbdec.c index be089e7d99..6cbce45528 100644 --- a/ext/amrwbdec/amrwbdec.c +++ b/ext/amrwbdec/amrwbdec.c @@ -107,6 +107,9 @@ static void gst_amrwbdec_init (GstAmrwbDec * amrwbdec) { gst_audio_decoder_set_needs_format (GST_AUDIO_DECODER (amrwbdec), TRUE); + gst_audio_decoder_set_use_default_pad_acceptcaps (GST_AUDIO_DECODER_CAST + (amrwbdec), TRUE); + GST_PAD_SET_ACCEPT_TEMPLATE (GST_AUDIO_DECODER_SINK_PAD (amrwbdec)); } static gboolean diff --git a/ext/mad/gstmad.c b/ext/mad/gstmad.c index 3d706a68e9..93337d2b98 100644 --- a/ext/mad/gstmad.c +++ b/ext/mad/gstmad.c @@ -144,6 +144,8 @@ gst_mad_init (GstMad * mad) dec = GST_AUDIO_DECODER (mad); gst_audio_decoder_set_tolerance (dec, 20 * GST_MSECOND); + gst_audio_decoder_set_use_default_pad_acceptcaps (dec, TRUE); + GST_PAD_SET_ACCEPT_TEMPLATE (GST_AUDIO_DECODER_SINK_PAD (dec)); mad->half = FALSE; mad->ignore_crc = TRUE; -- 2.34.1