diff options
author | David Schleef <ds@schleef.org> | 2003-12-22 01:47:09 +0000 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2003-12-22 01:47:09 +0000 |
commit | ce51f6173ca1c37d90f8e2e316d90316583d7755 (patch) | |
tree | 270b121765a11455f5bf8166b526d7ac336dc56c /gst/law | |
parent | f43f0a9fd781bafab689e46bd936af9cb5ed2690 (diff) |
Merge CAPS branch
Original commit message from CVS:
Merge CAPS branch
Diffstat (limited to 'gst/law')
-rw-r--r-- | gst/law/alaw-decode.c | 34 | ||||
-rw-r--r-- | gst/law/alaw-encode.c | 33 | ||||
-rw-r--r-- | gst/law/alaw.c | 40 | ||||
-rw-r--r-- | gst/law/mulaw-decode.c | 37 | ||||
-rw-r--r-- | gst/law/mulaw-encode.c | 33 | ||||
-rw-r--r-- | gst/law/mulaw.c | 43 |
6 files changed, 96 insertions, 124 deletions
diff --git a/gst/law/alaw-decode.c b/gst/law/alaw-decode.c index d656fdd1..00108948 100644 --- a/gst/law/alaw-decode.c +++ b/gst/law/alaw-decode.c @@ -80,31 +80,29 @@ static gint alaw_to_s16(guint8 a_val) } static GstPadLinkReturn -alawdec_link (GstPad *pad, GstCaps *caps) +alawdec_link (GstPad *pad, const GstCaps *caps) { GstCaps* tempcaps; gint rate, channels; + GstStructure *structure; + gboolean ret; GstALawDec* alawdec = GST_ALAWDEC (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 ( - "alawdec_src_caps", - "audio/x-raw-int", - "depth", GST_PROPS_INT (16), - "width", GST_PROPS_INT (16), - "signed", GST_PROPS_BOOLEAN (TRUE), - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "rate", GST_PROPS_INT (rate), - "channels", GST_PROPS_INT (channels), - NULL); + tempcaps = gst_caps_new_simple ( "audio/x-raw-int", + "depth", G_TYPE_INT, 16, + "width", G_TYPE_INT, 16, + "signed", G_TYPE_BOOLEAN, TRUE, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "rate", G_TYPE_INT, rate, + "channels", G_TYPE_INT, channels, + NULL); return gst_pad_try_set_caps (alawdec->srcpad, tempcaps); } 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); } diff --git a/gst/law/alaw.c b/gst/law/alaw.c index 70cb12da..be0559bb 100644 --- a/gst/law/alaw.c +++ b/gst/law/alaw.c @@ -7,31 +7,23 @@ static GstCaps* alaw_factory (void) { - return - gst_caps_new ( - "test_src", - "audio/x-alaw", - gst_props_new ( - "rate", GST_PROPS_INT_RANGE (8000, 192000), - "channels", GST_PROPS_INT_RANGE (1, 2), - NULL)); + return gst_caps_new_simple ("audio/x-alaw", + "rate", GST_TYPE_INT_RANGE, 8000, 192000, + "channels", GST_TYPE_INT_RANGE, 1, 2, + NULL); } static GstCaps* linear_factory (void) { - return - gst_caps_new ( - "test_sink", - "audio/x-raw-int", - gst_props_new ( - "width", GST_PROPS_INT(16), - "depth", GST_PROPS_INT(16), - "endianness", GST_PROPS_INT(G_BYTE_ORDER), - "signed", GST_PROPS_BOOLEAN(TRUE), - "rate", GST_PROPS_INT_RANGE (8000, 192000), - "channels", GST_PROPS_INT_RANGE (1, 2), - NULL)); + return gst_caps_new_simple ("audio/x-raw-int", + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, + "rate", GST_TYPE_INT_RANGE, 8000, 192000, + "channels", GST_TYPE_INT_RANGE, 1, 2, + NULL); } GstPadTemplate *alawenc_src_template, *alawenc_sink_template; @@ -45,11 +37,11 @@ plugin_init (GstPlugin *plugin) alaw_caps = alaw_factory (); linear_caps = linear_factory (); - alawenc_src_template = gst_pad_template_new ("src",GST_PAD_SRC,GST_PAD_ALWAYS,alaw_caps, NULL); - alawenc_sink_template = gst_pad_template_new ("sink",GST_PAD_SINK,GST_PAD_ALWAYS,linear_caps, NULL); + alawenc_src_template = gst_pad_template_new ("src",GST_PAD_SRC,GST_PAD_ALWAYS,alaw_caps); + alawenc_sink_template = gst_pad_template_new ("sink",GST_PAD_SINK,GST_PAD_ALWAYS,linear_caps); - alawdec_src_template = gst_pad_template_new ("src",GST_PAD_SRC,GST_PAD_ALWAYS,linear_caps, NULL); - alawdec_sink_template = gst_pad_template_new ("sink",GST_PAD_SINK,GST_PAD_ALWAYS,alaw_caps, NULL); + alawdec_src_template = gst_pad_template_new ("src",GST_PAD_SRC,GST_PAD_ALWAYS,linear_caps); + alawdec_sink_template = gst_pad_template_new ("sink",GST_PAD_SINK,GST_PAD_ALWAYS,alaw_caps); if (!gst_element_register (plugin, "alawenc", GST_RANK_NONE, GST_TYPE_ALAWENC) || diff --git a/gst/law/mulaw-decode.c b/gst/law/mulaw-decode.c index 725dc837..d04a6ed4 100644 --- a/gst/law/mulaw-decode.c +++ b/gst/law/mulaw-decode.c @@ -59,32 +59,29 @@ static GstElementClass *parent_class = NULL; static GstPadLinkReturn -mulawdec_link (GstPad *pad, GstCaps *caps) +mulawdec_link (GstPad *pad, const GstCaps *caps) { GstCaps* tempcaps; gint rate, channels; + GstStructure *structure; + gboolean ret; GstMuLawDec* mulawdec = GST_MULAWDEC (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; - - tempcaps = GST_CAPS_NEW ( - "sinesrc_src_caps", - "audio/x-raw-int", - "depth", GST_PROPS_INT (16), - "width", GST_PROPS_INT (16), - "signed", GST_PROPS_BOOLEAN (TRUE), - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "rate", GST_PROPS_INT (rate), - "channels", GST_PROPS_INT (channels), - NULL); - + 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_simple ("audio/x-mulaw", + "depth", G_TYPE_INT, 16, + "width", G_TYPE_INT, 16, + "signed", G_TYPE_BOOLEAN, TRUE, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "rate", G_TYPE_INT, rate, + "channels", G_TYPE_INT, channels, + NULL); + return gst_pad_try_set_caps (mulawdec->srcpad, tempcaps); } diff --git a/gst/law/mulaw-encode.c b/gst/law/mulaw-encode.c index 97e861bb..b15815a1 100644 --- a/gst/law/mulaw-encode.c +++ b/gst/law/mulaw-encode.c @@ -58,33 +58,30 @@ static GstElementClass *parent_class = NULL; /*static guint gst_stereo_signals[LAST_SIGNAL] = { 0 }; */ static GstPadLinkReturn -mulawenc_link (GstPad *pad, GstCaps *caps) +mulawenc_link (GstPad *pad, const GstCaps *caps) { GstCaps* tempcaps; gint rate, channels; + GstStructure *structure; + gboolean ret; GstMuLawEnc* mulawenc = GST_MULAWENC (GST_OBJECT_PARENT (pad)); - if (!GST_CAPS_IS_FIXED (caps)) - 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; - if (!gst_caps_get (caps, "rate", &rate, - "channels", &channels, - NULL)) - return GST_PAD_LINK_DELAYED; - - tempcaps = GST_CAPS_NEW ( - "sinesrc_src_caps", - "audio/x-mulaw", - "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-mulaw", + "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 (mulawenc->srcpad, tempcaps); -} +} GType gst_mulawenc_get_type(void) { diff --git a/gst/law/mulaw.c b/gst/law/mulaw.c index f2f465a8..2aae63cd 100644 --- a/gst/law/mulaw.c +++ b/gst/law/mulaw.c @@ -7,34 +7,23 @@ static GstCaps* mulaw_factory (void) { - return - gst_caps_new ( - "test_src", - "audio/x-mulaw", - gst_props_new ( - "width", GST_PROPS_INT(8), - "depth", GST_PROPS_INT(8), - "signed", GST_PROPS_BOOLEAN(FALSE), - "rate", GST_PROPS_INT_RANGE (8000, 192000), - "channels", GST_PROPS_INT_RANGE (1, 2), - NULL)); + return gst_caps_new_simple ("audio/x-mulaw", + "rate", GST_TYPE_INT_RANGE, 8000, 192000, + "channels", GST_TYPE_INT_RANGE, 1, 2, + NULL); } static GstCaps* linear_factory (void) { - return - gst_caps_new ( - "test_sink", - "audio/x-raw-int", - gst_props_new ( - "width", GST_PROPS_INT(16), - "depth", GST_PROPS_INT(16), - "signed", GST_PROPS_BOOLEAN(TRUE), - "endianness", GST_PROPS_INT(G_BYTE_ORDER), - "rate", GST_PROPS_INT_RANGE (8000, 192000), - "channels", GST_PROPS_INT_RANGE (1, 2), - NULL)); + return gst_caps_new_simple ("audio/x-raw-int", + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, + "rate", GST_TYPE_INT_RANGE, 8000, 192000, + "channels", GST_TYPE_INT_RANGE, 1, 2, + NULL); } GstPadTemplate *mulawenc_src_template, *mulawenc_sink_template; @@ -49,14 +38,14 @@ plugin_init (GstPlugin *plugin) linear_caps = linear_factory (); mulawenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - mulaw_caps, NULL); + mulaw_caps); mulawenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - linear_caps, NULL); + linear_caps); mulawdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - linear_caps, NULL); + linear_caps); mulawdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - mulaw_caps, NULL); + mulaw_caps); if (!gst_element_register (plugin, "mulawenc", GST_RANK_NONE, GST_TYPE_MULAWENC) || |