mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:06:12 +00:00
add link function. fixes @148986
Original commit message from CVS: add link function. fixes @148986
This commit is contained in:
parent
9fc1ef7493
commit
c18babeef1
2 changed files with 53 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2004-08-02 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
|
patch from: Benjamin Otte
|
||||||
|
|
||||||
|
* ext/lame/gstlame.c: (gst_lame_src_link), (gst_lame_init):
|
||||||
|
add link function to lame. Fixes #148986.
|
||||||
|
|
||||||
2004-08-02 Johan Dahlin <johan@gnome.org>
|
2004-08-02 Johan Dahlin <johan@gnome.org>
|
||||||
|
|
||||||
* gst/multipart/multipartmux.c (gst_multipart_mux_next_buffer):
|
* gst/multipart/multipartmux.c (gst_multipart_mux_next_buffer):
|
||||||
|
|
|
@ -346,6 +346,51 @@ gst_lame_class_init (GstLameClass * klass)
|
||||||
gstelement_class->change_state = gst_lame_change_state;
|
gstelement_class->change_state = gst_lame_change_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GstPadLinkReturn
|
||||||
|
gst_lame_src_link (GstPad * pad, const GstCaps * caps)
|
||||||
|
{
|
||||||
|
GstLame *lame;
|
||||||
|
gint out_samplerate;
|
||||||
|
GstStructure *structure;
|
||||||
|
GstCaps *othercaps, *channelcaps;
|
||||||
|
GstPadLinkReturn result;
|
||||||
|
|
||||||
|
lame = GST_LAME (gst_pad_get_parent (pad));
|
||||||
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
|
|
||||||
|
if (!gst_structure_get_int (structure, "rate", &out_samplerate) ||
|
||||||
|
!gst_structure_get_int (structure, "channels", &lame->num_channels))
|
||||||
|
g_return_val_if_reached (GST_PAD_LINK_REFUSED);
|
||||||
|
|
||||||
|
if (lame_set_out_samplerate (lame->lgf, out_samplerate) != 0)
|
||||||
|
return GST_PAD_LINK_REFUSED;
|
||||||
|
|
||||||
|
/* we don't do channel conversion */
|
||||||
|
channelcaps = gst_caps_new_simple ("audio/x-raw-int", "chnnels", G_TYPE_INT,
|
||||||
|
lame->num_channels, NULL);
|
||||||
|
othercaps = gst_caps_intersect (gst_pad_get_pad_template_caps (lame->sinkpad),
|
||||||
|
channelcaps);
|
||||||
|
gst_caps_free (channelcaps);
|
||||||
|
|
||||||
|
result = gst_pad_try_set_caps_nonfixed (lame->sinkpad, othercaps);
|
||||||
|
|
||||||
|
if (GST_PAD_LINK_FAILED (result))
|
||||||
|
return result;
|
||||||
|
|
||||||
|
caps = gst_pad_get_negotiated_caps (lame->sinkpad);
|
||||||
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
|
if (!gst_structure_get_int (structure, "rate", &lame->samplerate))
|
||||||
|
g_return_val_if_reached (GST_PAD_LINK_REFUSED);
|
||||||
|
|
||||||
|
if (!gst_lame_setup (lame)) {
|
||||||
|
GST_ELEMENT_ERROR (lame, CORE, NEGOTIATION, (NULL),
|
||||||
|
("could not initialize encoder (wrong parameters?)"));
|
||||||
|
return GST_PAD_LINK_REFUSED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static GstPadLinkReturn
|
static GstPadLinkReturn
|
||||||
gst_lame_sink_link (GstPad * pad, const GstCaps * caps)
|
gst_lame_sink_link (GstPad * pad, const GstCaps * caps)
|
||||||
{
|
{
|
||||||
|
@ -394,6 +439,7 @@ gst_lame_init (GstLame * lame)
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get
|
gst_pad_new_from_template (gst_static_pad_template_get
|
||||||
(&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_FLAG_SET (lame, GST_ELEMENT_EVENT_AWARE);
|
GST_FLAG_SET (lame, GST_ELEMENT_EVENT_AWARE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue