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 /ext/flac | |
parent | f43f0a9fd781bafab689e46bd936af9cb5ed2690 (diff) |
Merge CAPS branch
Original commit message from CVS:
Merge CAPS branch
Diffstat (limited to 'ext/flac')
-rw-r--r-- | ext/flac/gstflacdec.c | 57 | ||||
-rw-r--r-- | ext/flac/gstflacenc.c | 56 | ||||
-rw-r--r-- | ext/flac/gstflactag.c | 52 |
3 files changed, 63 insertions, 102 deletions
diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c index 104552d6..62b39bbc 100644 --- a/ext/flac/gstflacdec.c +++ b/ext/flac/gstflacdec.c @@ -124,31 +124,22 @@ flacdec_get_type(void) { static GstCaps* flac_caps_factory (void) { - return - gst_caps_new ( - "flac_flac", - "audio/x-flac", - /*gst_props_new ( - "rate", GST_PROPS_INT_RANGE (11025, 48000), - "channels", GST_PROPS_INT_RANGE (1, 2), - NULL)*/ NULL); + return gst_caps_new_simple ("audio/x-flac", NULL); + /* "rate", GST_PROPS_INT_RANGE (11025, 48000), + * "channels", GST_PROPS_INT_RANGE (1, 2), */ } static GstCaps* raw_caps_factory (void) { - return - gst_caps_new ( - "flac_raw", - "audio/x-raw-int", - gst_props_new ( - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "signed", GST_PROPS_BOOLEAN (TRUE), - "width", GST_PROPS_INT (16), - "depth", GST_PROPS_INT (16), - "rate", GST_PROPS_INT_RANGE (11025, 48000), - "channels", GST_PROPS_INT_RANGE (1, 2), - NULL)); + return gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", GST_TYPE_INT_RANGE, 11025, 48000, + "channels", GST_TYPE_INT_RANGE, 1, 2, + NULL); } static void @@ -160,12 +151,10 @@ gst_flacdec_base_init (gpointer g_class) raw_caps = raw_caps_factory (); flac_caps = flac_caps_factory (); - sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, - GST_PAD_ALWAYS, - flac_caps, NULL); + sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, flac_caps); src_template = gst_pad_template_new ("src", GST_PAD_SRC, - GST_PAD_ALWAYS, - raw_caps, NULL); + GST_PAD_ALWAYS, raw_caps); gst_element_class_add_pad_template (element_class, sink_template); gst_element_class_add_pad_template (element_class, src_template); gst_element_class_set_details (element_class, &flacdec_details); @@ -485,16 +474,14 @@ gst_flacdec_write (const FLAC__SeekableStreamDecoder *decoder, if (!GST_PAD_CAPS (flacdec->srcpad)) { gst_pad_try_set_caps (flacdec->srcpad, - GST_CAPS_NEW ( - "flac_caps", - "audio/x-raw-int", - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "signed", GST_PROPS_BOOLEAN (TRUE), - "width", GST_PROPS_INT (depth), - "depth", GST_PROPS_INT (depth), - "rate", GST_PROPS_INT (frame->header.sample_rate), - "channels", GST_PROPS_INT (channels) - )); + gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, + "width", G_TYPE_INT, depth, + "depth", G_TYPE_INT, depth, + "rate", G_TYPE_INT, frame->header.sample_rate, + "channels", G_TYPE_INT, channels, + NULL)); flacdec->depth = depth; flacdec->channels = channels; diff --git a/ext/flac/gstflacenc.c b/ext/flac/gstflacenc.c index 29425c95..637b8a62 100644 --- a/ext/flac/gstflacenc.c +++ b/ext/flac/gstflacenc.c @@ -68,7 +68,7 @@ static void gst_flacenc_class_init (FlacEncClass *klass); static void gst_flacenc_dispose (GObject *object); static GstPadLinkReturn - gst_flacenc_sinkconnect (GstPad *pad, GstCaps *caps); + gst_flacenc_sinkconnect (GstPad *pad, const GstCaps *caps); static void gst_flacenc_chain (GstPad *pad, GstData *_data); static gboolean gst_flacenc_update_quality (FlacEnc *flacenc, gint quality); @@ -179,31 +179,22 @@ gst_flacenc_quality_get_type (void) static GstCaps* flac_caps_factory (void) { - return - gst_caps_new ( - "flac_flac", - "audio/x-flac", - /* gst_props_new ( - "rate", GST_PROPS_INT_RANGE (11025, 48000), - "channels", GST_PROPS_INT_RANGE (1, 2), - NULL) */NULL); + return gst_caps_new_simple ("audio/x-flac", NULL); + /* "rate", GST_PROPS_INT_RANGE (11025, 48000), + * "channels", GST_PROPS_INT_RANGE (1, 2), */ } static GstCaps* raw_caps_factory (void) { - return - gst_caps_new ( - "flac_raw", - "audio/x-raw-int", - gst_props_new ( - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "signed", GST_PROPS_BOOLEAN (TRUE), - "width", GST_PROPS_INT (16), - "depth", GST_PROPS_INT (16), - "rate", GST_PROPS_INT_RANGE (11025, 48000), - "channels", GST_PROPS_INT_RANGE (1, 2), - NULL)); + return gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", GST_TYPE_INT_RANGE, 11025, 48000, + "channels", GST_TYPE_INT_RANGE, 1, 2, + NULL); } static void @@ -217,10 +208,10 @@ gst_flacenc_base_init (gpointer g_class) sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - raw_caps, NULL); + raw_caps); src_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - flac_caps, NULL); + flac_caps); gst_element_class_add_pad_template (element_class, sink_template); gst_element_class_add_pad_template (element_class, src_template); gst_element_class_set_details (element_class, &flacenc_details); @@ -354,24 +345,23 @@ gst_flacenc_dispose (GObject *object) } static GstPadLinkReturn -gst_flacenc_sinkconnect (GstPad *pad, GstCaps *caps) +gst_flacenc_sinkconnect (GstPad *pad, const GstCaps *caps) { GstPadLinkReturn ret; FlacEnc *flacenc; + GstStructure *structure; flacenc = GST_FLACENC (gst_pad_get_parent (pad)); - if (!GST_CAPS_IS_FIXED (caps)) - return GST_PAD_LINK_DELAYED; + structure = gst_caps_get_structure (caps, 0); - gst_caps_get_int (caps, "channels", &flacenc->channels); - gst_caps_get_int (caps, "depth", &flacenc->depth); - gst_caps_get_int (caps, "rate", &flacenc->sample_rate); + gst_structure_get_int (structure, "channels", &flacenc->channels); + gst_structure_get_int (structure, "depth", &flacenc->depth); + gst_structure_get_int (structure, "rate", &flacenc->sample_rate); - caps = GST_CAPS_NEW ("flacenc_srccaps", - "audio/x-flac", - "channels", GST_PROPS_INT (flacenc->channels), - "rate", GST_PROPS_INT (flacenc->sample_rate)); + caps = gst_caps_new_simple ("audio/x-flac", + "channels", G_TYPE_INT, flacenc->channels, + "rate", G_TYPE_INT, flacenc->sample_rate, NULL); ret = gst_pad_try_set_caps (flacenc->srcpad, caps); if (ret <= 0) { return ret; diff --git a/ext/flac/gstflactag.c b/ext/flac/gstflactag.c index 39d31729..5a155f24 100644 --- a/ext/flac/gstflactag.c +++ b/ext/flac/gstflactag.c @@ -100,32 +100,21 @@ enum { /* FILL ME */ }; -GST_PAD_TEMPLATE_FACTORY (flac_tag_src_template_factory, +static GstStaticPadTemplate flac_tag_src_template = +GST_STATIC_PAD_TEMPLATE ( "src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "flac_tag_tag_src", - "audio/x-flac", - NULL - ), - GST_CAPS_NEW ( - "flac_tag_tag_src", - "application/x-gst-tags", - NULL - ) -) - -GST_PAD_TEMPLATE_FACTORY (flac_tag_sink_template_factory, + GST_STATIC_CAPS ("audio/x-flac; application/x-gst-tags") +); + +static GstStaticPadTemplate flac_tag_sink_template = +GST_STATIC_PAD_TEMPLATE ( "sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "flac_tag_data_sink", - "audio/x-flac", - NULL - ) -) + GST_STATIC_CAPS ("audio/x-flac") +); static void gst_flac_tag_base_init (gpointer g_class); @@ -181,9 +170,9 @@ gst_flac_tag_base_init (gpointer g_class) gst_element_class_set_details (element_class, &gst_flac_tag_details); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (flac_tag_sink_template_factory)); + gst_static_pad_template_get (&flac_tag_sink_template)); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (flac_tag_src_template_factory)); + gst_static_pad_template_get (&flac_tag_src_template)); } @@ -207,25 +196,20 @@ caps_nego (GstFlacTag *tag) { /* do caps nego */ GstCaps *caps; - capsnego: - caps = GST_CAPS_NEW ("flac_tag_data_src", "audio/x-flac", NULL); + + caps = gst_caps_new_simple ("audio/x-flac", NULL); if (gst_pad_try_set_caps (tag->srcpad, caps) != GST_PAD_LINK_REFUSED) { tag->only_output_tags = FALSE; GST_LOG_OBJECT (tag, "normal operation, using audio/x-flac output"); } else { - if (gst_pad_try_set_caps (tag->srcpad, - GST_CAPS_NEW ("flac_tag_tag_src", "application/x-gst-tags", NULL)) + if (gst_pad_try_set_caps (tag->srcpad, gst_caps_new_simple ( + "application/x-gst-tags", NULL)) != GST_PAD_LINK_REFUSED) { tag->only_output_tags = TRUE; GST_LOG_OBJECT (tag, "fast operation, just outputting tags"); printf ("output tags only\n"); } else { - caps = gst_pad_template_get_caps (GST_PAD_TEMPLATE_GET (flac_tag_src_template_factory)); - if (gst_pad_recover_caps_error (tag->srcpad, caps)) { - goto capsnego; - } else { - return FALSE; - } + return FALSE; } } return TRUE; @@ -251,12 +235,12 @@ gst_flac_tag_init (GstFlacTag *tag) { /* create the sink and src pads */ tag->sinkpad = gst_pad_new_from_template( - GST_PAD_TEMPLATE_GET (flac_tag_sink_template_factory), "sink"); + gst_static_pad_template_get (&flac_tag_sink_template), "sink"); gst_element_add_pad (GST_ELEMENT (tag), tag->sinkpad); gst_pad_set_chain_function (tag->sinkpad, GST_DEBUG_FUNCPTR (gst_flac_tag_chain)); tag->srcpad = gst_pad_new_from_template( - GST_PAD_TEMPLATE_GET (flac_tag_src_template_factory), "src"); + gst_static_pad_template_get (&flac_tag_src_template), "src"); gst_element_add_pad (GST_ELEMENT (tag), tag->srcpad); tag->buffer = NULL; |