diff options
author | David Schleef <ds@schleef.org> | 2003-12-09 09:27:44 +0000 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2003-12-09 09:27:44 +0000 |
commit | dc48c15d6cba08cfbd483a32ed5bafbc713bd8ae (patch) | |
tree | a2dff914fdc56bd883c29b813690217fb85ddf85 | |
parent | 6e632b821c61ff7e757a5ab8b2c34786b7408daa (diff) | |
download | gst-plugins-bad-dc48c15d6cba08cfbd483a32ed5bafbc713bd8ae.tar.gz gst-plugins-bad-dc48c15d6cba08cfbd483a32ed5bafbc713bd8ae.tar.bz2 gst-plugins-bad-dc48c15d6cba08cfbd483a32ed5bafbc713bd8ae.zip |
Convert to new caps
Original commit message from CVS:
Convert to new caps
-rw-r--r-- | gst/mixmatrix/mixmatrix.c | 41 | ||||
-rw-r--r-- | gst/modplug/gstmodplug.cc | 117 | ||||
-rw-r--r-- | gst/modplug/gstmodplug.h | 2 | ||||
-rw-r--r-- | gst/mpeg1sys/gstmpeg1systemencode.c | 50 | ||||
-rw-r--r-- | gst/mpeg1videoparse/gstmp1videoparse.c | 63 | ||||
-rw-r--r-- | gst/mpegaudioparse/gstmpegaudioparse.c | 76 | ||||
-rw-r--r-- | gst/overlay/gstoverlay.c | 123 | ||||
-rw-r--r-- | gst/overlay/gstoverlay.h | 2 | ||||
-rw-r--r-- | gst/passthrough/gstpassthrough.c | 90 | ||||
-rw-r--r-- | gst/playondemand/gstplayondemand.c | 87 | ||||
-rw-r--r-- | gst/y4m/gsty4mencode.c | 49 |
11 files changed, 283 insertions, 417 deletions
diff --git a/gst/mixmatrix/mixmatrix.c b/gst/mixmatrix/mixmatrix.c index bcaea0fd..90e04346 100644 --- a/gst/mixmatrix/mixmatrix.c +++ b/gst/mixmatrix/mixmatrix.c @@ -43,7 +43,7 @@ typedef struct _GstMixMatrixClass GstMixMatrixClass; struct _GstMixMatrix { GstElement element; - GstCaps *caps; + GstCaps2 *caps; gint samplerate; gint grpsize; @@ -88,27 +88,23 @@ enum { ARG_MATRIXPTR, }; -GST_PAD_TEMPLATE_FACTORY (mixmatrix_sink_factory, +#if 0 +static GstStaticPadTemplate mixmatrix_sink_factory = +GST_STATIC_PAD_TEMPLATE ( "sink%d", GST_PAD_SINK, GST_PAD_REQUEST, - gst_caps_new ( - "float_src", - "audio/x-raw-float", - GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS - ) + GST_STATIC_CAPS ( GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS ) ); -GST_PAD_TEMPLATE_FACTORY (mixmatrix_src_factory, +static GstStaticPadTemplate mixmatrix_src_factory = +GST_STATIC_PAD_TEMPLATE ( "src%d", GST_PAD_SRC, GST_PAD_REQUEST, - gst_caps_new ( - "float_sink", - "audio/x-raw-float", - GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS - ) + GST_STATIC_CAPS ( GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS ) ); +#endif static void gst_mixmatrix_class_init (GstMixMatrixClass *klass); static void gst_mixmatrix_base_init (GstMixMatrixClass *klass); @@ -118,7 +114,7 @@ static void gst_mixmatrix_set_property (GObject *object, guint prop_id, const GV static void gst_mixmatrix_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static GstPad * gst_mixmatrix_request_new_pad (GstElement *element, GstPadTemplate *temp, const gchar *name); -static GstPadLinkReturn gst_mixmatrix_connect (GstPad *pad, GstCaps *caps); +static GstPadLinkReturn gst_mixmatrix_connect (GstPad *pad, const GstCaps2 *caps); static void gst_mixmatrix_loop (GstElement *element); @@ -324,24 +320,22 @@ gst_mixmatrix_set_all_caps (GstMixMatrix *mix) */ static GstPadLinkReturn -gst_mixmatrix_connect (GstPad *pad, GstCaps *caps) +gst_mixmatrix_connect (GstPad *pad, const GstCaps2 *caps) { GstMixMatrix *mix = GST_MIXMATRIX(GST_PAD_PARENT(pad)); gint i; - if (!GST_CAPS_IS_FIXED(caps) || GST_PAD_IS_SRC (pad)) { - return GST_PAD_LINK_DELAYED; - } - for (i=0;i<mix->srcpadalloc;i++) { if (mix->srcpads[i]) { - if (GST_PAD_CAPS(mix->srcpads[i]) == NULL) - if (gst_pad_try_set_caps(mix->srcpads[i], gst_caps_ref (caps)) <= 0) + if (GST_PAD_CAPS(mix->srcpads[i]) == NULL) { + if (gst_pad_try_set_caps(mix->srcpads[i], caps) <= 0) { return GST_PAD_LINK_REFUSED; + } + } } } - mix->caps = caps; + mix->caps = gst_caps2_copy(caps); return GST_PAD_LINK_OK; } @@ -509,9 +503,6 @@ plugin_init (GstPlugin *plugin) if (!gst_library_load ("gstbytestream")) return FALSE; - sinktempl = mixmatrix_sink_factory (); - srctempl = mixmatrix_src_factory (); - return gst_element_register (plugin, "mixmatrix", GST_RANK_NONE, GST_TYPE_MIXMATRIX); } diff --git a/gst/modplug/gstmodplug.cc b/gst/modplug/gstmodplug.cc index a5dc19c7..a6a4f2c9 100644 --- a/gst/modplug/gstmodplug.cc +++ b/gst/modplug/gstmodplug.cc @@ -66,32 +66,24 @@ enum { ARG_SURROUND, ARG_SURROUND_DEPTH, ARG_SURROUND_DELAY, - ARG_OVERSAMP, - ARG_METADATA, - ARG_STREAMINFO + ARG_OVERSAMP }; -GST_PAD_TEMPLATE_FACTORY (modplug_src_template_factory, +static GstStaticPadTemplate modplug_src_template_factory = +GST_STATIC_PAD_TEMPLATE ( "src", GST_PAD_SRC, GST_PAD_ALWAYS, - gst_caps_new ( - "modplug_src", - "audio/x-raw-int", - GST_AUDIO_INT_PAD_TEMPLATE_PROPS - ) -) + GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS) +); -GST_PAD_TEMPLATE_FACTORY (modplug_sink_template_factory, +static GstStaticPadTemplate modplug_sink_template_factory = +GST_STATIC_PAD_TEMPLATE ( "sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "modplug_sink", - "audio/x-mod", - NULL - ) -) + GST_STATIC_CAPS ("audio/x-mod") +); enum { MODPLUG_STATE_NEED_TUNE = 1, @@ -111,7 +103,7 @@ static void gst_modplug_get_property (GObject *object, GValue *value, GParamSpec *pspec ); static GstPadLinkReturn - gst_modplug_srclink (GstPad *pad, GstCaps *caps); + gst_modplug_srclink (GstPad *pad, const GstCaps2 *caps); static void gst_modplug_loop (GstElement *element); static void gst_modplug_setup (GstModPlug *modplug); static const GstFormat * @@ -156,9 +148,9 @@ gst_modplug_base_init (GstModPlugClass *klass) GstElementClass *element_class = GST_ELEMENT_CLASS (klass); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (modplug_sink_template_factory)); + gst_static_pad_template_get (&modplug_sink_template_factory)); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (modplug_src_template_factory)); + gst_static_pad_template_get (&modplug_src_template_factory)); gst_element_class_set_details (element_class, &modplug_details); } @@ -221,14 +213,6 @@ gst_modplug_class_init (GstModPlugClass *klass) g_param_spec_boolean("noise_reduction", "noise_reduction", "noise_reduction", TRUE, (GParamFlags)G_PARAM_READWRITE )); - g_object_class_install_property (gobject_class, ARG_METADATA, - g_param_spec_boxed ("metadata", "Metadata", "Metadata", - GST_TYPE_CAPS, G_PARAM_READABLE)); - - g_object_class_install_property (gobject_class, ARG_STREAMINFO, - g_param_spec_boxed ("streaminfo", "Streaminfo", "Streaminfo", - GST_TYPE_CAPS, G_PARAM_READABLE)); - gobject_class->set_property = gst_modplug_set_property; gobject_class->get_property = gst_modplug_get_property; @@ -238,10 +222,10 @@ gst_modplug_class_init (GstModPlugClass *klass) static void gst_modplug_init (GstModPlug *modplug) { - modplug->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (modplug_sink_template_factory), "sink"); + modplug->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get (&modplug_sink_template_factory), "sink"); gst_element_add_pad (GST_ELEMENT(modplug), modplug->sinkpad); - modplug->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (modplug_src_template_factory), "src"); + modplug->srcpad = gst_pad_new_from_template (gst_static_pad_template_get (&modplug_src_template_factory), "src"); gst_element_add_pad (GST_ELEMENT(modplug), modplug->srcpad); gst_pad_set_link_function (modplug->srcpad, gst_modplug_srclink); @@ -395,20 +379,18 @@ gst_modplug_src_event (GstPad *pad, GstEvent *event) return res; } -static GstCaps* +#if 0 +static GstCaps2* gst_modplug_get_streaminfo (GstModPlug *modplug) { - GstCaps *caps; - GstProps *props; - GstPropsEntry *entry; + GstCaps2 *caps; props = gst_props_empty_new (); - entry = gst_props_entry_new ("Patterns", GST_PROPS_INT ((gint)modplug->mSoundFile->GetNumPatterns())); + entry = gst_props_entry_new ("Patterns", G_TYPE_INT ((gint)modplug->mSoundFile->GetNumPatterns())); gst_props_add_entry (props, (GstPropsEntry *) entry); - caps = gst_caps_new ("mad_streaminfo", "application/x-gst-streaminfo", - props); + caps = gst_caps2_new_simple ("application/x-gst-streaminfo", NULL); return caps; } @@ -434,15 +416,15 @@ gst_modplug_update_metadata (GstModPlug *modplug) props = gst_props_empty_new (); title = modplug->mSoundFile->GetTitle(); - entry = gst_props_entry_new ("Title", GST_PROPS_STRING (title)); + entry = gst_props_entry_new ("Title", G_TYPE_STRING (title)); gst_props_add_entry (props, entry); - modplug->metadata = gst_caps_new ("modplug_metadata", - "application/x-gst-metadata", - props); + modplug->metadata = gst_caps2_new_simple ("application/x-gst-metadata", + NULL); g_object_notify (G_OBJECT (modplug), "metadata"); } +#endif static GstPadLinkReturn @@ -464,17 +446,14 @@ modplug_negotiate (GstModPlug *modplug) } if ((ret = gst_pad_try_set_caps (modplug->srcpad, - GST_CAPS_NEW ( - "modplug_src", - "audio/x-raw-int", - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "signed", GST_PROPS_BOOLEAN (sign), - "width", GST_PROPS_INT (modplug->bitsPerSample), - "depth", GST_PROPS_INT (modplug->bitsPerSample), - "rate", GST_PROPS_INT (modplug->frequency), - "channels", GST_PROPS_INT (modplug->channel), - NULL) - )) <= 0) { + gst_caps2_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, sign, + "width", G_TYPE_INT, modplug->bitsPerSample, + "depth", G_TYPE_INT, modplug->bitsPerSample, + "rate", G_TYPE_INT, modplug->frequency, + "channels", G_TYPE_INT, modplug->channel, + NULL))) <= 0) { return ret; } @@ -485,23 +464,20 @@ modplug_negotiate (GstModPlug *modplug) static GstPadLinkReturn -gst_modplug_srclink (GstPad *pad, GstCaps *caps) +gst_modplug_srclink (GstPad *pad, const GstCaps2 *caps) { GstModPlug *modplug; + GstStructure *structure; + gint depth; modplug = GST_MODPLUG (gst_pad_get_parent (pad)); - if (gst_caps_has_property_typed (caps, "depth", GST_PROPS_INT_TYPE)) { - gint depth; - gst_caps_get_int (caps, "depth", &depth); - modplug->_16bit = (depth == 16); - } - if (gst_caps_has_property_typed (caps, "channels", GST_PROPS_INT_TYPE)) { - gst_caps_get_int (caps, "channels", &modplug->channel); - } - if (gst_caps_has_property_typed (caps, "rate", GST_PROPS_INT_TYPE)) { - gst_caps_get_int (caps, "rate", &modplug->frequency); - } + structure = gst_caps2_get_nth_cap (caps, 0); + + gst_structure_get_int (structure, "depth", &depth); + modplug->_16bit = (depth == 16); + gst_structure_get_int (structure, "channels", &modplug->channel); + gst_structure_get_int (structure, "rate", &modplug->frequency); return modplug_negotiate(modplug); } @@ -611,8 +587,8 @@ gst_modplug_loop (GstElement *element) modplug->audiobuffer = (guchar *) g_malloc (modplug->length); - gst_modplug_update_metadata (modplug); - gst_modplug_update_info (modplug); + //gst_modplug_update_metadata (modplug); + //gst_modplug_update_info (modplug); modplug->state = MODPLUG_STATE_PLAY_TUNE; } @@ -691,8 +667,6 @@ gst_modplug_change_state (GstElement *element) modplug->bs = gst_bytestream_new (modplug->sinkpad); modplug->song_size = 0; modplug->state = MODPLUG_STATE_NEED_TUNE; - modplug->metadata = NULL; - modplug->streaminfo = NULL; break; case GST_STATE_PAUSED_TO_PLAYING: break; @@ -709,7 +683,6 @@ gst_modplug_change_state (GstElement *element) if (modplug->audiobuffer) g_free (modplug->audiobuffer); modplug->buffer_in = NULL; modplug->audiobuffer = NULL; - gst_caps_unref (modplug->streaminfo); modplug->state = MODPLUG_STATE_NEED_TUNE; break; case GST_STATE_READY_TO_NULL: @@ -810,12 +783,6 @@ gst_modplug_get_property (GObject *object, guint id, GValue *value, GParamSpec * case ARG_NOISE_REDUCTION: g_value_set_boolean (value, modplug->noise_reduction); break; - case ARG_METADATA: - g_value_set_boxed (value, modplug->metadata); - break; - case ARG_STREAMINFO: - g_value_set_boxed (value, modplug->streaminfo); - break; default: break; } diff --git a/gst/modplug/gstmodplug.h b/gst/modplug/gstmodplug.h index d6202e69..95a71443 100644 --- a/gst/modplug/gstmodplug.h +++ b/gst/modplug/gstmodplug.h @@ -44,8 +44,6 @@ struct _GstModPlug { GstElement element; GstPad *sinkpad, *srcpad; guint8 *buffer_in; - GstCaps *metadata; - GstCaps *streaminfo; GstByteStream *bs; const gchar *songname; diff --git a/gst/mpeg1sys/gstmpeg1systemencode.c b/gst/mpeg1sys/gstmpeg1systemencode.c index 40eb41cb..94f01d1d 100644 --- a/gst/mpeg1sys/gstmpeg1systemencode.c +++ b/gst/mpeg1sys/gstmpeg1systemencode.c @@ -49,39 +49,31 @@ enum { /* FILL ME */ }; -GST_PAD_TEMPLATE_FACTORY (src_factory, +static GstStaticPadTemplate src_factory = +GST_STATIC_PAD_TEMPLATE ( "src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "src_video", - "video/mpeg", - "systemstream", GST_PROPS_BOOLEAN (TRUE) - ) -) -GST_PAD_TEMPLATE_FACTORY (video_sink_factory, + GST_STATIC_CAPS ("video/mpeg, " + "systemstream = (boolean) TRUE") +); +static GstStaticPadTemplate video_sink_factory = +GST_STATIC_PAD_TEMPLATE ( "video_%d", GST_PAD_SINK, GST_PAD_REQUEST, - GST_CAPS_NEW ( - "sink_video", - "video/mpeg", - "mpegversion", GST_PROPS_INT (1), - "systemstream", GST_PROPS_BOOLEAN (FALSE) - /* we don't care about width/height/framerate */ - ) -) + GST_STATIC_CAPS ("video/mpeg, " + "mpegversion = (int) 1, " + "systemstream = (boolean) FALSE") +); -GST_PAD_TEMPLATE_FACTORY (audio_sink_factory, +static GstStaticPadTemplate audio_sink_factory = +GST_STATIC_PAD_TEMPLATE ( "audio_%d", GST_PAD_SINK, GST_PAD_REQUEST, - GST_CAPS_NEW ( - "sink_audio", - "audio/mpeg", - NULL /* well, "don't care" */ - ) -) + GST_STATIC_CAPS ("audio/mpeg") +); static void gst_system_encode_class_init (GstMPEG1SystemEncodeClass *klass); static void gst_system_encode_base_init (GstMPEG1SystemEncodeClass *klass); @@ -128,11 +120,11 @@ gst_system_encode_base_init (GstMPEG1SystemEncodeClass *klass) GstElementClass *element_class = GST_ELEMENT_CLASS (klass); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (src_factory)); + gst_static_pad_template_get (&src_factory)); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (audio_sink_factory)); + gst_static_pad_template_get (&audio_sink_factory)); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (video_sink_factory)); + gst_static_pad_template_get (&video_sink_factory)); gst_element_class_set_details (element_class, &system_encode_details); } @@ -157,7 +149,7 @@ static void gst_system_encode_init (GstMPEG1SystemEncode *system_encode) { system_encode->srcpad = gst_pad_new_from_template ( - GST_PAD_TEMPLATE_GET (src_factory), "src"); + gst_static_pad_template_get (&src_factory), "src"); gst_element_add_pad (GST_ELEMENT (system_encode), system_encode->srcpad); system_encode->video_buffer = mpeg1mux_buffer_new (BUFFER_TYPE_VIDEO, 0xE0); @@ -195,7 +187,7 @@ gst_system_encode_request_new_pad (GstElement *element, GstPadTemplate *templ, c } system_encode = GST_SYSTEM_ENCODE (element); - if (templ == GST_PAD_TEMPLATE_GET (audio_sink_factory)) { + if (templ == gst_static_pad_template_get (&audio_sink_factory)) { name = g_strdup_printf ("audio_%02d", system_encode->num_audio_pads); g_print ("%s\n", name); newpad = gst_pad_new_from_template (templ, name); @@ -205,7 +197,7 @@ gst_system_encode_request_new_pad (GstElement *element, GstPadTemplate *templ, c system_encode->num_audio_pads++; system_encode->which_streams |= STREAMS_AUDIO; } - else if (templ == GST_PAD_TEMPLATE_GET (video_sink_factory)) { + else if (templ == gst_static_pad_template_get (&video_sink_factory)) { name = g_strdup_printf ("video_%02d", system_encode->num_video_pads); g_print ("%s\n", name); newpad = gst_pad_new_from_template (templ, name); diff --git a/gst/mpeg1videoparse/gstmp1videoparse.c b/gst/mpeg1videoparse/gstmp1videoparse.c index 3f5aa3dd..c37ce61f 100644 --- a/gst/mpeg1videoparse/gstmp1videoparse.c +++ b/gst/mpeg1videoparse/gstmp1videoparse.c @@ -43,32 +43,30 @@ static GstElementDetails mpeg1videoparse_details = GST_ELEMENT_DETAILS ( "Wim Taymans <wim.taymans@chello.be>" ); -GST_PAD_TEMPLATE_FACTORY (src_factory, +static GstStaticPadTemplate src_factory = +GST_STATIC_PAD_TEMPLATE ( "src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "mp1videoparse_src", - "video/mpeg", - "mpegversion", GST_PROPS_INT (1), - "systemstream", GST_PROPS_BOOLEAN (FALSE), - "width", GST_PROPS_INT_RANGE (16, 4096), - "height", GST_PROPS_INT_RANGE (16, 4096), - "pixel_width", GST_PROPS_INT_RANGE (1, 255), - "pixel_height", GST_PROPS_INT_RANGE (1, 255), - "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT) + GST_STATIC_CAPS ("video/mpeg, " + "mpegversion = (int) 1, " + "systemstream = (boolean) false, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ], " + "pixel_width = (int) [ 1, 255 ], " + "pixel_height = (int) [ 1, 255 ], " + "framerate = (double) [ 0, MAX ]" ) ); -GST_PAD_TEMPLATE_FACTORY (sink_factory, +static GstStaticPadTemplate sink_factory = +GST_STATIC_PAD_TEMPLATE ( "sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "mp1videoparse_sink", - "video/mpeg", - "mpegversion", GST_PROPS_INT (1), - "systemstream", GST_PROPS_BOOLEAN (FALSE) + GST_STATIC_CAPS ("video/mpeg, " + "mpegversion = (int) 1, " + "systemstream = (boolean) false" ) ); @@ -124,9 +122,9 @@ gst_mp1videoparse_base_init (Mp1VideoParseClass *klass) GstElementClass *element_class = GST_ELEMENT_CLASS (klass); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (src_factory)); + gst_static_pad_template_get (&src_factory)); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (sink_factory)); + gst_static_pad_template_get (&sink_factory)); gst_element_class_set_details (element_class, &mpeg1videoparse_details); } @@ -146,12 +144,12 @@ static void gst_mp1videoparse_init (Mp1VideoParse *mp1videoparse) { mp1videoparse->sinkpad = gst_pad_new_from_template ( - GST_PAD_TEMPLATE_GET (sink_factory), "sink"); + gst_static_pad_template_get (&sink_factory), "sink"); gst_element_add_pad(GST_ELEMENT(mp1videoparse),mp1videoparse->sinkpad); gst_pad_set_chain_function(mp1videoparse->sinkpad,gst_mp1videoparse_chain); mp1videoparse->srcpad = gst_pad_new_from_template ( - GST_PAD_TEMPLATE_GET (src_factory), "src"); + gst_static_pad_template_get (&src_factory), "src"); gst_element_add_pad(GST_ELEMENT(mp1videoparse),mp1videoparse->srcpad); mp1videoparse->partialbuf = NULL; @@ -189,7 +187,7 @@ mp1videoparse_parse_seq (Mp1VideoParse *mp1videoparse, GstBuffer *buf) fps_table[fps_idx] != mp1videoparse->fps || width != mp1videoparse->width || height != mp1videoparse->height) { - GstCaps *caps; + GstCaps2 *caps; gint p_w, p_h; mp1videoparse->asr = asr_table[asr_idx]; @@ -200,17 +198,16 @@ mp1videoparse_parse_seq (Mp1VideoParse *mp1videoparse, GstBuffer *buf) p_w = (asr_table[asr_idx] < 1.0) ? (100 / asr_table[asr_idx]) : 1; p_h = (asr_table[asr_idx] > 1.0) ? (100 * asr_table[asr_idx]) : 1; - caps = GST_CAPS_NEW ("mp1videoparse_src", - "video/mpeg", - "systemstream", GST_PROPS_BOOLEAN (FALSE), - "mpegversion", GST_PROPS_INT (1), - "width", GST_PROPS_INT (width), - "height", GST_PROPS_INT (height), - "framerate", GST_PROPS_FLOAT (fps_table[fps_idx]), - "pixel_width", GST_PROPS_INT (p_w), - "pixel_height", GST_PROPS_INT (p_h)); - - gst_caps_debug (caps, "New mpeg1videoparse caps"); + caps = gst_caps2_new_simple ("video/mpeg", + "systemstream", G_TYPE_BOOLEAN, FALSE, + "mpegversion", G_TYPE_INT, 1, + "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, + "framerate", G_TYPE_DOUBLE, fps_table[fps_idx], + "pixel_width", G_TYPE_INT, p_w, + "pixel_height", G_TYPE_INT, p_h, NULL); + + GST_DEBUG_CAPS ("New mpeg1videoparse caps", caps); if (gst_pad_try_set_caps (mp1videoparse->srcpad, caps) <= 0) { gst_element_error (GST_ELEMENT (mp1videoparse), diff --git a/gst/mpegaudioparse/gstmpegaudioparse.c b/gst/mpegaudioparse/gstmpegaudioparse.c index 3a1c067d..26536767 100644 --- a/gst/mpegaudioparse/gstmpegaudioparse.c +++ b/gst/mpegaudioparse/gstmpegaudioparse.c @@ -32,40 +32,27 @@ static GstElementDetails mp3parse_details = { "Erik Walthinsen <omega@cse.ogi.edu>" }; -static GstPadTemplate* -mp3_src_factory (void) -{ - return - gst_pad_template_new ( - "src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - gst_caps_new ( - "mp3parse_src", - "audio/mpeg", - gst_props_new ( - "mpegversion", GST_PROPS_INT (1), - "layer", GST_PROPS_INT_RANGE (1, 3), - "rate", GST_PROPS_INT_RANGE (8000, 48000), - "channels", GST_PROPS_INT_RANGE (1, 2), - NULL)), - NULL); -} - -static GstPadTemplate* -mp3_sink_factory (void) -{ - return - gst_pad_template_new ( - "sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - gst_caps_new ( - "mp3parse_sink", - "audio/mpeg", - NULL), - NULL); -}; +#if 0 +static GstStaticPadTemplate mp3_src_template = +GST_STATIC_PAD_TEMPLATE ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/mpeg, " + "mpegversion = (int) 1, " + "layer = (int) [ 1, 3 ], " + "rate = (int) [ 8000, 48000], " + "channels = (int) [ 1, 2 ]") +); + +static GstStaticPadTemplate mp3_sink_template = +GST_STATIC_PAD_TEMPLATE ( + "sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/mpeg") +); +#endif /* GstMPEGAudioParse signals and args */ enum { @@ -235,24 +222,22 @@ mp3_type_frame_length_from_header (guint32 header, guint *put_layer, #define GST_MP3_TYPEFIND_MIN_HEADERS 3 #define GST_MP3_TYPEFIND_MIN_DATA (1440 * (GST_MP3_TYPEFIND_MIN_HEADERS + 1) - 1 + 3) -static GstCaps * +static GstCaps2 * mp3_caps_create (guint layer, guint channels, guint bitrate, guint samplerate) { - GstCaps *new; + GstCaps2 *new; g_assert (layer); g_assert (samplerate); g_assert (bitrate); g_assert (channels); - new = GST_CAPS_NEW ("mp3_type_find", - "audio/mpeg", - "mpegversion", GST_PROPS_INT (1), - "layer", GST_PROPS_INT (layer), - /*"bitrate", GST_PROPS_INT (bitrate),*/ - "rate", GST_PROPS_INT (samplerate), - "channels", GST_PROPS_INT (channels)); + new = gst_caps2_new_simple ("audio/mpeg", + "mpegversion", G_TYPE_INT, 1, + "layer", G_TYPE_INT, layer, + "rate", G_TYPE_INT, samplerate, + "channels", G_TYPE_INT, channels, NULL); return new; } @@ -475,7 +460,7 @@ bpf_from_header (GstMPEGAudioParse *parse, unsigned long header) rate != parse->rate || layer != parse->layer || bitrate != parse->bit_rate) { - GstCaps *caps = mp3_caps_create (layer, channels, bitrate, rate); + GstCaps2 *caps = mp3_caps_create (layer, channels, bitrate, rate); if (gst_pad_try_set_caps(parse->srcpad, caps) <= 0) { gst_element_error (GST_ELEMENT (parse), @@ -585,9 +570,6 @@ gst_mp3parse_change_state (GstElement *element) static gboolean plugin_init (GstPlugin *plugin) { - sink_temp = mp3_sink_factory (); - src_temp = mp3_src_factory (); - return gst_element_register (plugin, "mp3parse", GST_RANK_NONE, GST_TYPE_MP3PARSE); } diff --git a/gst/overlay/gstoverlay.c b/gst/overlay/gstoverlay.c index 8410714e..8c7cb59b 100644 --- a/gst/overlay/gstoverlay.c +++ b/gst/overlay/gstoverlay.c @@ -22,6 +22,7 @@ #include "config.h" #endif #include "gstoverlay.h" +#include <gst/video/video.h> /* elementfactory information */ static GstElementDetails overlay_details = { @@ -31,61 +32,37 @@ static GstElementDetails overlay_details = { "David Schleef <ds@schleef.org>" }; -GST_PAD_TEMPLATE_FACTORY (overlay_src_factory, +static GstStaticPadTemplate overlay_src_factory = +GST_STATIC_PAD_TEMPLATE ( "src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "overlay_src", - "video/x-raw-yuv", - "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')), - "width", GST_PROPS_INT_RANGE (1, G_MAXINT), - "height", GST_PROPS_INT_RANGE (1, G_MAXINT), - "framerate",GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT) - ) -) + GST_STATIC_CAPS (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS("I420")) +); -GST_PAD_TEMPLATE_FACTORY (overlay_sink1_factory, +static GstStaticPadTemplate overlay_sink1_factory = +GST_STATIC_PAD_TEMPLATE ( "sink1", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "overlay_sink1", - "video/x-raw-yuv", - "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')), - "width", GST_PROPS_INT_RANGE (1, G_MAXINT), - "height", GST_PROPS_INT_RANGE (1, G_MAXINT), - "framerate",GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT) - ) -) + GST_STATIC_CAPS (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS("I420")) +); -GST_PAD_TEMPLATE_FACTORY (overlay_sink2_factory, +static GstStaticPadTemplate overlay_sink2_factory = +GST_STATIC_PAD_TEMPLATE ( "sink2", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "overlay_sink2", - "video/x-raw-yuv", - "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')), - "width", GST_PROPS_INT_RANGE (1, G_MAXINT), - "height", GST_PROPS_INT_RANGE (1, G_MAXINT), - "framerate",GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT) - ) -) + GST_STATIC_CAPS (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS("I420")) +); -GST_PAD_TEMPLATE_FACTORY (overlay_sink3_factory, +static GstStaticPadTemplate overlay_sink3_factory = +GST_STATIC_PAD_TEMPLATE ( "sink3", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "overlay_sink2", - "video/x-raw-yuv", - "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')), - "width", GST_PROPS_INT_RANGE (1, G_MAXINT), - "height", GST_PROPS_INT_RANGE (1, G_MAXINT), - "framerate",GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT) - ) -) + GST_STATIC_CAPS (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS("I420")) +); /* OVERLAY signals and args */ enum { @@ -140,13 +117,13 @@ gst_overlay_base_init (GstOverlayClass *klass) GstElementClass *element_class = GST_ELEMENT_CLASS (klass); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (overlay_sink1_factory)); + gst_static_pad_template_get (&overlay_sink1_factory)); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (overlay_sink2_factory)); + gst_static_pad_template_get (&overlay_sink2_factory)); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (overlay_sink3_factory)); + gst_static_pad_template_get (&overlay_sink3_factory)); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (overlay_src_factory)); + gst_static_pad_template_get (&overlay_src_factory)); gst_element_class_set_details (element_class, &overlay_details); } @@ -167,28 +144,28 @@ gst_overlay_class_init (GstOverlayClass *klass) } #if 0 -static GstCaps *gst_overlay_getcaps(GstPad *pad) +static GstCaps2 *gst_overlay_getcaps(GstPad *pad) { - GstCaps *caps; + GstCaps2 *caps; GstOverlay *overlay; overlay = GST_OVERLAY (gst_pad_get_parent (pad)); if(overlay->width && overlay->height){ - caps = GST_CAPS_NEW ( + caps = GST_STATIC_CAPS ( "overlay_sink2", "video/raw", - "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')), - "width", GST_PROPS_INT (overlay->width), - "height", GST_PROPS_INT (overlay->height) + "format", GST_TYPE_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')), + "width", G_TYPE_INT (overlay->width), + "height", G_TYPE_INT (overlay->height) ); }else{ - caps = GST_CAPS_NEW ( + caps = GST_STATIC_CAPS ( "overlay_sink2", "video/raw", - "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')), - "width", GST_PROPS_INT_RANGE (0, 4096), - "height", GST_PROPS_INT_RANGE (0, 4096) + "format", GST_TYPE_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')), + "width", G_TYPE_INT_RANGE (0, 4096), + "height", G_TYPE_INT_RANGE (0, 4096) ); } @@ -197,43 +174,43 @@ static GstCaps *gst_overlay_getcaps(GstPad *pad) #endif static gboolean -gst_overlay_sinkconnect (GstPad *pad, GstCaps *caps) +gst_overlay_sinkconnect (GstPad *pad, const GstCaps2 *caps) { GstOverlay *overlay; + GstStructure *structure; overlay = GST_OVERLAY (gst_pad_get_parent (pad)); - if (!GST_CAPS_IS_FIXED (caps)) - return GST_PAD_LINK_DELAYED; + structure = gst_caps2_get_nth_cap (caps, 0); - gst_caps_get_int (caps, "width", &overlay->width); - gst_caps_get_int (caps, "height", &overlay->height); - gst_caps_get_float (caps, "framerate", &overlay->framerate); + gst_structure_get_int (structure, "width", &overlay->width); + gst_structure_get_int (structure, "height", &overlay->height); + gst_structure_get_double (structure, "framerate", &overlay->framerate); /* forward to the next plugin */ - return gst_pad_try_set_caps(overlay->srcpad, gst_caps_copy_1(caps)); + return gst_pad_try_set_caps(overlay->srcpad, caps); } static void gst_overlay_init (GstOverlay *overlay) { overlay->sinkpad1 = gst_pad_new_from_template ( - GST_PAD_TEMPLATE_GET (overlay_sink1_factory), "sink1"); + gst_static_pad_template_get (&overlay_sink1_factory), "sink1"); gst_pad_set_link_function (overlay->sinkpad1, gst_overlay_sinkconnect); gst_element_add_pad (GST_ELEMENT (overlay), overlay->sinkpad1); overlay->sinkpad2 = gst_pad_new_from_template ( - GST_PAD_TEMPLATE_GET (overlay_sink2_factory), "sink2"); + gst_static_pad_template_get (&overlay_sink2_factory), "sink2"); gst_pad_set_link_function (overlay->sinkpad2, gst_overlay_sinkconnect); gst_element_add_pad (GST_ELEMENT (overlay), overlay->sinkpad2); overlay->sinkpad3 = gst_pad_new_from_template ( - GST_PAD_TEMPLATE_GET (overlay_sink3_factory), "sink3"); + gst_static_pad_template_get (&overlay_sink3_factory), "sink3"); gst_pad_set_link_function (overlay->sinkpad3, gst_overlay_sinkconnect); gst_element_add_pad (GST_ELEMENT (overlay), overlay->sinkpad3); overlay->srcpad = gst_pad_new_from_template ( - GST_PAD_TEMPLATE_GET (overlay_src_factory), "src"); + gst_static_pad_template_get (&overlay_src_factory), "src"); gst_element_add_pad (GST_ELEMENT (overlay), overlay->srcpad); gst_element_set_loop_function (GST_ELEMENT (overlay), gst_overlay_loop); @@ -318,22 +295,6 @@ gst_overlay_loop (GstElement *element) out = gst_buffer_new_and_alloc (size); - if (!GST_PAD_CAPS (overlay->srcpad)) { - if (!gst_pad_try_set_caps (overlay->srcpad, - GST_CAPS_NEW ( - "overlay_srccaps", - "video/x-raw-yuv", - "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')), - "width", GST_PROPS_INT (overlay->width), - "height", GST_PROPS_INT (overlay->height), - "framerate",GST_PROPS_FLOAT (overlay->framerate) - ))) - { - gst_element_error (element, "cannot set caps"); - return; - } - } - gst_overlay_blend_i420 (GST_BUFFER_DATA (out), GST_BUFFER_DATA (in1), GST_BUFFER_DATA (in2), diff --git a/gst/overlay/gstoverlay.h b/gst/overlay/gstoverlay.h index 784c367b..523656e0 100644 --- a/gst/overlay/gstoverlay.h +++ b/gst/overlay/gstoverlay.h @@ -57,7 +57,7 @@ struct _GstOverlay { gint border; gint depth; - gfloat framerate; + gdouble framerate; }; struct _GstOverlayClass { diff --git a/gst/passthrough/gstpassthrough.c b/gst/passthrough/gstpassthrough.c index 9942a758..4f0b1a1d 100644 --- a/gst/passthrough/gstpassthrough.c +++ b/gst/passthrough/gstpassthrough.c @@ -50,39 +50,27 @@ enum { ARG_SILENT }; -static GstPadTemplate* -passthrough_sink_factory (void) -{ - static GstPadTemplate *template = NULL; - - if (! template) { - template = gst_pad_template_new - ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - gst_caps_append (gst_caps_new ("sink_int", "audio/x-raw-int", - GST_AUDIO_INT_PAD_TEMPLATE_PROPS), - gst_caps_new ("sink_float", "audio/x-raw-float", - GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS)), - NULL); - } - return template; -} - -static GstPadTemplate* -passthrough_src_factory (void) -{ - static GstPadTemplate *template = NULL; - - if (! template) - template = gst_pad_template_new - ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - gst_caps_append (gst_caps_new ("src_float", "audio/x-raw-float", - GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS), - gst_caps_new ("src_int", "audio/x-raw-float", - GST_AUDIO_INT_PAD_TEMPLATE_PROPS)), - NULL); - - return template; -} +static GstStaticPadTemplate passthrough_sink_template = +GST_STATIC_PAD_TEMPLATE ( + "sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ( + GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; " + GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS + ) +); + +static GstStaticPadTemplate passthrough_src_template = +GST_STATIC_PAD_TEMPLATE ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ( + GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; " + GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS + ) +); static void passthrough_class_init (GstPassthroughClass *klass); static void passthrough_base_init (GstPassthroughClass *klass); @@ -91,7 +79,7 @@ static void passthrough_init (GstPassthrough *filter); static void passthrough_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static void passthrough_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static GstPadLinkReturn passthrough_connect_sink (GstPad *pad, GstCaps *caps); +static GstPadLinkReturn passthrough_connect_sink (GstPad *pad, const GstCaps2 *caps); static void passthrough_chain (GstPad *pad, GstData *_data); static void inline passthrough_fast_float_chain (gfloat* data, guint numsamples); @@ -111,10 +99,11 @@ passthrough_get_bufferpool (GstPad *pad) } static GstPadLinkReturn -passthrough_connect_sink (GstPad *pad, GstCaps *caps) +passthrough_connect_sink (GstPad *pad, const GstCaps2 *caps) { const gchar *mimetype; GstPassthrough *filter; + GstStructure *structure; g_return_val_if_fail (pad != NULL, GST_PAD_LINK_DELAYED); g_return_val_if_fail (caps != NULL, GST_PAD_LINK_DELAYED); @@ -123,18 +112,19 @@ passthrough_connect_sink (GstPad *pad, GstCaps *caps) g_return_val_if_fail (filter != NULL, GST_PAD_LINK_REFUSED); g_return_val_if_fail (GST_IS_PASSTHROUGH (filter), GST_PAD_LINK_REFUSED); - mimetype = gst_caps_get_mime(caps); + structure = gst_caps2_get_nth_cap (caps, 0); - gst_caps_get_int (caps, "rate", &filter->rate); - gst_caps_get_int (caps, "channels", &filter->channels); - gst_caps_get_int (caps, "width", &filter->width); - gst_caps_get_int (caps, "endianness", &filter->endianness); + mimetype = gst_structure_get_name (structure); + gst_structure_get_int (structure, "rate", &filter->rate); + gst_structure_get_int (structure, "channels", &filter->channels); + gst_structure_get_int (structure, "width", &filter->width); + gst_structure_get_int (structure, "endianness", &filter->endianness); if (strcmp (mimetype, "audio/x-raw-int") == 0) { filter->format = GST_PASSTHROUGH_FORMAT_INT; - gst_caps_get_int (caps, "depth", &filter->depth); - gst_caps_get_boolean (caps, "signed", &filter->is_signed); + gst_structure_get_int (structure, "depth", &filter->depth); + gst_structure_get_boolean (structure, "signed", &filter->is_signed); if (! filter->silent) { g_print ("Passthrough : channels %d, rate %d\n", filter->channels, filter->rate); @@ -150,9 +140,7 @@ passthrough_connect_sink (GstPad *pad, GstCaps *caps) } } - if (GST_CAPS_IS_FIXED (caps)) - return gst_pad_try_set_caps (filter->srcpad, caps); - return GST_PAD_LINK_DELAYED; + return gst_pad_try_set_caps (filter->srcpad, caps); } GType @@ -182,8 +170,10 @@ passthrough_base_init (GstPassthroughClass *klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, passthrough_src_factory ()); - gst_element_class_add_pad_template (element_class, passthrough_sink_factory ()); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&passthrough_src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&passthrough_sink_template)); gst_element_class_set_details (element_class, &passthrough_details); } @@ -209,9 +199,11 @@ passthrough_class_init (GstPassthroughClass *klass) static void passthrough_init (GstPassthrough *filter) { - filter->srcpad = gst_pad_new_from_template (passthrough_src_factory (),"src"); + filter->srcpad = gst_pad_new_from_template ( + gst_static_pad_template_get (&passthrough_src_template), "src"); gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad); - filter->sinkpad = gst_pad_new_from_template (passthrough_sink_factory (),"sink"); + filter->sinkpad = gst_pad_new_from_template ( + gst_static_pad_template_get (&passthrough_sink_template), "sink"); gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad); gst_pad_set_link_function (filter->sinkpad, passthrough_connect_sink); diff --git a/gst/playondemand/gstplayondemand.c b/gst/playondemand/gstplayondemand.c index 0c06bbd2..8ad1abc9 100644 --- a/gst/playondemand/gstplayondemand.c +++ b/gst/playondemand/gstplayondemand.c @@ -41,7 +41,6 @@ #define GST_POD_BUFPOOL_NUM 6 -/* element factory information */ static GstElementDetails play_on_demand_details = { "Play On Demand", "Filter/Editor/Audio", @@ -50,40 +49,27 @@ static GstElementDetails play_on_demand_details = { }; -static GstPadTemplate* -play_on_demand_sink_factory (void) -{ - static GstPadTemplate *template = NULL; - - if (!template) { - template = gst_pad_template_new - ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - gst_caps_append(gst_caps_new ("sink_int", "audio/x-raw-int", - GST_AUDIO_INT_PAD_TEMPLATE_PROPS), - gst_caps_new ("sink_float", "audio/x-raw-float", - GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS)), - NULL); - } - return template; -} - - -static GstPadTemplate* -play_on_demand_src_factory (void) -{ - static GstPadTemplate *template = NULL; - - if (!template) - template = gst_pad_template_new - ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - gst_caps_append (gst_caps_new ("src_float", "audio/x-raw-float", - GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS), - gst_caps_new ("src_int", "audio/x-raw-int", - GST_AUDIO_INT_PAD_TEMPLATE_PROPS)), - NULL); - - return template; -} +static GstStaticPadTemplate play_on_demand_sink_template = +GST_STATIC_PAD_TEMPLATE ( + "sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ( + GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; " + GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS + ) +); + +static GstStaticPadTemplate play_on_demand_src_template = +GST_STATIC_PAD_TEMPLATE ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ( + GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; " + GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS + ) +); /* GObject functionality */ @@ -96,7 +82,7 @@ static void play_on_demand_dispose (GObject *object); /* GStreamer functionality */ static GstBufferPool* play_on_demand_get_bufferpool (GstPad *pad); -static GstPadLinkReturn play_on_demand_pad_link (GstPad *pad, GstCaps *caps); +static GstPadLinkReturn play_on_demand_pad_link (GstPad *pad, const GstCaps2 *caps); static void play_on_demand_loop (GstElement *elem); static void play_on_demand_set_clock (GstElement *elem, GstClock *clock); @@ -164,8 +150,10 @@ play_on_demand_base_init (GstPlayOnDemandClass *klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template(element_class, play_on_demand_src_factory()); - gst_element_class_add_pad_template(element_class, play_on_demand_sink_factory()); + gst_element_class_add_pad_template(element_class, + gst_static_pad_template_get(&play_on_demand_src_template)); + gst_element_class_add_pad_template(element_class, + gst_static_pad_template_get(&play_on_demand_sink_template)); gst_element_class_set_details(element_class, &play_on_demand_details); } @@ -243,8 +231,10 @@ play_on_demand_class_init (GstPlayOnDemandClass *klass) static void play_on_demand_init (GstPlayOnDemand *filter) { - filter->srcpad = gst_pad_new_from_template(play_on_demand_src_factory(), "src"); - filter->sinkpad = gst_pad_new_from_template(play_on_demand_sink_factory(), "sink"); + filter->srcpad = gst_pad_new_from_template( + gst_static_pad_template_get(&play_on_demand_src_template), "src"); + filter->sinkpad = gst_pad_new_from_template( + gst_static_pad_template_get(&play_on_demand_sink_template), "sink"); gst_pad_set_bufferpool_function(filter->sinkpad, play_on_demand_get_bufferpool); gst_pad_set_link_function(filter->sinkpad, play_on_demand_pad_link); @@ -385,32 +375,33 @@ play_on_demand_get_bufferpool (GstPad *pad) } static GstPadLinkReturn -play_on_demand_pad_link (GstPad *pad, GstCaps *caps) +play_on_demand_pad_link (GstPad *pad, const GstCaps2 *caps) { const gchar *mimetype; GstPlayOnDemand *filter; + GstStructure *structure; g_return_val_if_fail(caps != NULL, GST_PAD_LINK_DELAYED); g_return_val_if_fail(pad != NULL, GST_PAD_LINK_DELAYED); filter = GST_PLAYONDEMAND(GST_PAD_PARENT(pad)); - mimetype = gst_caps_get_mime(caps); - gst_caps_get_int(caps, "rate", &filter->rate); - gst_caps_get_int(caps, "channels", &filter->channels); + structure = gst_caps2_get_nth_cap (caps, 0); + + mimetype = gst_structure_get_name (structure); + gst_structure_get_int (structure, "rate", &filter->rate); + gst_structure_get_int (structure, "channels", &filter->channels); if (strcmp(mimetype, "audio/x-raw-int") == 0) { filter->format = GST_PLAYONDEMAND_FORMAT_INT; - gst_caps_get_int (caps, "width", &filter->width); + gst_structure_get_int (structure, "width", &filter->width); } else if (strcmp(mimetype, "audio/x-raw-float") == 0) { filter->format = GST_PLAYONDEMAND_FORMAT_FLOAT; } play_on_demand_resize_buffer(filter); - if (GST_CAPS_IS_FIXED (caps)) - return gst_pad_try_set_caps (filter->srcpad, caps); - return GST_PAD_LINK_DELAYED; + return gst_pad_try_set_caps (filter->srcpad, caps); } inline static void diff --git a/gst/y4m/gsty4mencode.c b/gst/y4m/gsty4mencode.c index 4da88e38..4f6276ed 100644 --- a/gst/y4m/gsty4mencode.c +++ b/gst/y4m/gsty4mencode.c @@ -44,28 +44,23 @@ enum { ARG_0 }; -GST_PAD_TEMPLATE_FACTORY (y4mencode_src_factory, +static GstStaticPadTemplate y4mencode_src_factory = +GST_STATIC_PAD_TEMPLATE ( "src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "test_src", - "application/x-yuv4mpeg", - "y4mversion", GST_PROPS_INT (1) + GST_STATIC_CAPS ("application/x-yuv4mpeg, " + "y4mversion = (int) 1" ) -) +); -GST_PAD_TEMPLATE_FACTORY (y4mencode_sink_factory, +static GstStaticPadTemplate y4mencode_sink_factory = +GST_STATIC_PAD_TEMPLATE ( "sink", GST_PAD_SINK, GST_PAD_ALWAYS, - gst_caps_new ( - "test_src", - "video/x-raw-yuv", - GST_VIDEO_YUV_PAD_TEMPLATE_PROPS ( - GST_PROPS_FOURCC (GST_STR_FOURCC ("I420"))) - ) -) + GST_STATIC_CAPS (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420")) +); static void gst_y4mencode_base_init (gpointer g_class); static void gst_y4mencode_class_init (GstY4mEncodeClass *klass); @@ -119,9 +114,9 @@ gst_y4mencode_base_init (gpointer g_class) GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (y4mencode_src_factory)); + gst_static_pad_template_get (&y4mencode_src_factory)); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (y4mencode_sink_factory)); + gst_static_pad_template_get (&y4mencode_sink_factory)); gst_element_class_set_details (element_class, &y4mencode_details); } static void @@ -142,12 +137,12 @@ gst_y4mencode_class_init (GstY4mEncodeClass *klass) } static GstPadLinkReturn -gst_y4mencode_sinkconnect (GstPad *pad, GstCaps *caps) +gst_y4mencode_sinkconnect (GstPad *pad, const GstCaps2 *caps) { GstY4mEncode *filter; gint idx = -1, i; - gfloat fps; - float framerates[] = { + gdouble fps; + gdouble framerates[] = { 00.000, 23.976, 24.000, /* 24fps movie */ 25.000, /* PAL */ @@ -155,22 +150,22 @@ gst_y4mencode_sinkconnect (GstPad *pad, GstCaps *caps) 50.000, 59.940, 60.000 }; + GstStructure *structure; filter = GST_Y4MENCODE (gst_pad_get_parent (pad)); - if (!GST_CAPS_IS_FIXED (caps)) - return GST_PAD_LINK_DELAYED; + structure = gst_caps2_get_nth_cap (caps, 0); - gst_caps_get_int (caps, "width", &filter->width); - gst_caps_get_int (caps, "height", &filter->height); - gst_caps_get_float (caps, "framerate", &fps); + gst_structure_get_int (structure, "width", &filter->width); + gst_structure_get_int (structure, "height", &filter->height); + gst_structure_get_double (structure, "framerate", &fps); /* find fps idx */ for (i = 1; i < 9; i++) { if (idx == -1) { idx = i; } else { - gfloat old_diff = fabs(framerates[idx] - fps), + gdouble old_diff = fabs(framerates[idx] - fps), new_diff = fabs(framerates[i] - fps); if (new_diff < old_diff) { @@ -187,13 +182,13 @@ static void gst_y4mencode_init (GstY4mEncode *filter) { filter->sinkpad = gst_pad_new_from_template( - GST_PAD_TEMPLATE_GET (y4mencode_sink_factory), "sink"); + gst_static_pad_template_get (&y4mencode_sink_factory), "sink"); gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad); gst_pad_set_chain_function (filter->sinkpad, gst_y4mencode_chain); gst_pad_set_link_function (filter->sinkpad, gst_y4mencode_sinkconnect); filter->srcpad = gst_pad_new_from_template( - GST_PAD_TEMPLATE_GET (y4mencode_src_factory), "src"); + gst_static_pad_template_get (&y4mencode_src_factory), "src"); gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad); filter->init = TRUE; |