From 06df982d4fa29cb85d49425a57a45f38b7922692 Mon Sep 17 00:00:00 2001 From: Zaheer Abbas Merali Date: Thu, 12 Aug 2004 17:22:30 +0000 Subject: [PATCH] ext/lame/gstlame.c: added getcaps function so samplerate doesntget fixated to silly values Original commit message from CVS: 2004-08-12 Zaheer Abbas Merali * ext/lame/gstlame.c: (gst_lame_src_getcaps), (gst_lame_init): added getcaps function so samplerate doesntget fixated to silly values --- ext/lame/gstlame.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/ext/lame/gstlame.c b/ext/lame/gstlame.c index ca0687464..9fc1917ba 100644 --- a/ext/lame/gstlame.c +++ b/ext/lame/gstlame.c @@ -347,6 +347,22 @@ gst_lame_class_init (GstLameClass * klass) gstelement_class->change_state = gst_lame_change_state; } +static GstCaps * +gst_lame_src_getcaps (GstPad * pad) +{ + GstLame *lame; + GstCaps *caps; + + lame = GST_LAME (gst_pad_get_parent (pad)); + caps = gst_caps_new_simple ("audio/mpeg", + "mpegversion", G_TYPE_INT, 1, + "layer", G_TYPE_INT, 3, + "rate", G_TYPE_INT, lame->samplerate, + "channels", G_TYPE_INT, lame->num_channels, NULL); + + return caps; +} + static GstPadLinkReturn gst_lame_src_link (GstPad * pad, const GstCaps * caps) { @@ -441,7 +457,7 @@ gst_lame_init (GstLame * lame) (&gst_lame_src_template), "src"); gst_element_add_pad (GST_ELEMENT (lame), lame->srcpad); gst_pad_set_link_function (lame->srcpad, gst_lame_src_link); - + gst_pad_set_getcaps_function (lame->srcpad, gst_lame_src_getcaps); GST_FLAG_SET (lame, GST_ELEMENT_EVENT_AWARE); GST_DEBUG ("setting up lame encoder"); -- 2.34.1