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  <zaheerabbas at merali dot org>

* ext/lame/gstlame.c: (gst_lame_src_getcaps), (gst_lame_init):
added getcaps function so samplerate doesntget fixated to silly values
This commit is contained in:
Zaheer Abbas Merali 2004-08-12 17:22:30 +00:00
parent ca18e2eed7
commit 16f716f8bb
2 changed files with 22 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2004-08-12 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* ext/lame/gstlame.c: (gst_lame_src_getcaps), (gst_lame_init):
added getcaps function so samplerate doesntget fixated to silly values
2004-08-12 Zaheer Abbas Merali <zaheerabbas at merali dot org> 2004-08-12 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* ext/lame/gstlame.c: (gst_lame_src_link): * ext/lame/gstlame.c: (gst_lame_src_link):

View file

@ -347,6 +347,22 @@ gst_lame_class_init (GstLameClass * klass)
gstelement_class->change_state = gst_lame_change_state; 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 static GstPadLinkReturn
gst_lame_src_link (GstPad * pad, const GstCaps * caps) gst_lame_src_link (GstPad * pad, const GstCaps * caps)
{ {
@ -441,7 +457,7 @@ gst_lame_init (GstLame * lame)
(&gst_lame_src_template), "src"); (&gst_lame_src_template), "src");
gst_element_add_pad (GST_ELEMENT (lame), lame->srcpad); gst_element_add_pad (GST_ELEMENT (lame), lame->srcpad);
gst_pad_set_link_function (lame->srcpad, gst_lame_src_link); 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_FLAG_SET (lame, GST_ELEMENT_EVENT_AWARE);
GST_DEBUG ("setting up lame encoder"); GST_DEBUG ("setting up lame encoder");