summaryrefslogtreecommitdiffstats
path: root/ext/faad/gstfaad.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>2004-04-29 00:00:25 +0000
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>2004-04-29 00:00:25 +0000
commit8b8776f69c49dee77073e805b6d23fed1054c960 (patch)
treeff88cd5f14ff8beee0dcb800c5d5d5442641a6eb /ext/faad/gstfaad.c
parent48892c24ed168126c3390d917421b0c17300dc23 (diff)
downloadgst-plugins-bad-8b8776f69c49dee77073e805b6d23fed1054c960.tar.gz
gst-plugins-bad-8b8776f69c49dee77073e805b6d23fed1054c960.tar.bz2
gst-plugins-bad-8b8776f69c49dee77073e805b6d23fed1054c960.zip
New DTS decoder.
Original commit message from CVS: * configure.ac: * ext/Makefile.am: * ext/dts/Makefile.am: * ext/dts/gstdtsdec.c: (gst_dtsdec_get_type), (gst_dtsdec_base_init), (gst_dtsdec_class_init), (gst_dtsdec_init), (gst_dtsdec_channels), (gst_dtsdec_renegotiate), (gst_dtsdec_handle_event), (gst_dtsdec_update_streaminfo), (gst_dtsdec_loop), (gst_dtsdec_change_state), (gst_dtsdec_set_property), (gst_dtsdec_get_property), (plugin_init): * ext/dts/gstdtsdec.h: New DTS decoder. * ext/faad/gstfaad.c: (gst_faad_sinkconnect), (gst_faad_srcconnect): Add ESDS atom handling (.m4a).
Diffstat (limited to 'ext/faad/gstfaad.c')
-rw-r--r--ext/faad/gstfaad.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/ext/faad/gstfaad.c b/ext/faad/gstfaad.c
index 719fb89d..6c526c32 100644
--- a/ext/faad/gstfaad.c
+++ b/ext/faad/gstfaad.c
@@ -146,8 +146,33 @@ gst_faad_init (GstFaad * faad)
static GstPadLinkReturn
gst_faad_sinkconnect (GstPad * pad, const GstCaps * caps)
{
- /* oh, we really don't care what's in here. We'll
- * get AAC audio (MPEG-2/4) anyway, so why bother? */
+ GstFaad *faad = GST_FAAD (gst_pad_get_parent (pad));
+ GstStructure *str = gst_caps_get_structure (caps, 0);
+ const GValue *value;
+ GstBuffer *buf;
+
+ if ((value = gst_structure_get_value (str, "codec_data"))) {
+ GstPadLinkReturn ret;
+ gulong samplerate;
+ guchar channels;
+
+ buf = g_value_get_boxed (value);
+ if (faacDecInit2 (faad->handle, GST_BUFFER_DATA (buf),
+ GST_BUFFER_SIZE (buf), &samplerate, &channels) < 0)
+ return GST_PAD_LINK_REFUSED;
+
+ faad->samplerate = samplerate;
+ faad->channels = channels;
+
+ ret = gst_pad_renegotiate (faad->srcpad);
+ if (ret == GST_PAD_LINK_DELAYED)
+ ret = GST_PAD_LINK_OK;
+
+ return ret;
+ }
+
+ /* if there's no decoderspecificdata, it's all fine. We cannot know
+ * much more at this point... */
return GST_PAD_LINK_OK;
}
@@ -229,7 +254,7 @@ gst_faad_srcconnect (GstPad * pad, const GstCaps * caps)
{
GstStructure *structure;
const gchar *mimetype;
- gint fmt = 0;
+ gint fmt = -1;
gint depth, rate, channels;
GstFaad *faad = GST_FAAD (gst_pad_get_parent (pad));
@@ -282,7 +307,7 @@ gst_faad_srcconnect (GstPad * pad, const GstCaps * caps)
}
}
- if (fmt) {
+ if (fmt != -1) {
faacDecConfiguration *conf;
conf = faacDecGetCurrentConfiguration (faad->handle);