diff options
Diffstat (limited to 'gst/law/alaw-encode.c')
-rw-r--r-- | gst/law/alaw-encode.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/gst/law/alaw-encode.c b/gst/law/alaw-encode.c index d13427bb..6efdb64f 100644 --- a/gst/law/alaw-encode.c +++ b/gst/law/alaw-encode.c @@ -120,30 +120,29 @@ static GstElementClass *parent_class = NULL; /*static guint gst_stereo_signals[LAST_SIGNAL] = { 0 }; */ static GstPadLinkReturn -alawenc_link (GstPad *pad, GstCaps *caps) +alawenc_link (GstPad *pad, const GstCaps *caps) { GstCaps* tempcaps; gint rate, channels; + GstStructure *structure; + gboolean ret; GstALawEnc* alawenc = GST_ALAWENC (GST_OBJECT_PARENT (pad)); - if (!GST_CAPS_IS_FIXED (caps)) - return GST_PAD_LINK_DELAYED; - - if (!gst_caps_get (caps, "rate", &rate, - "channels", &channels, - NULL)) - return GST_PAD_LINK_DELAYED; + structure = gst_caps_get_structure (caps, 0); + + ret = gst_structure_get_int (structure, "rate", &rate); + ret &= gst_structure_get_int (structure, "channels", &channels); + + if (!ret) return GST_PAD_LINK_REFUSED; - tempcaps = GST_CAPS_NEW ( - "alawenc_src_caps", - "audio/x-alaw", - "depth", GST_PROPS_INT (8), - "width", GST_PROPS_INT (8), - "signed", GST_PROPS_BOOLEAN (FALSE), - "rate", GST_PROPS_INT (rate), - "channels", GST_PROPS_INT (channels), - NULL); + tempcaps = gst_caps_new_simple ("audio/x-alaw", + "depth", G_TYPE_INT, 8, + "width", G_TYPE_INT, 8, + "signed", G_TYPE_BOOLEAN, FALSE, + "rate", G_TYPE_INT, rate, + "channels", G_TYPE_INT, channels, + NULL); return gst_pad_try_set_caps (alawenc->srcpad, tempcaps); } |