summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2003-12-07 22:23:47 +0000
committerDavid Schleef <ds@schleef.org>2003-12-07 22:23:47 +0000
commit38bcf22a6ad1239af696acea7ddbb3f1bd95307e (patch)
tree97b6c0ce5f56827918a7d5f9bbe4f7bf7f523d62
parent466370d8237846158836c87537e92a64b6ac2d87 (diff)
downloadgstreamer-plugins-bad-38bcf22a6ad1239af696acea7ddbb3f1bd95307e.tar.gz
Convert to new caps
Original commit message from CVS: Convert to new caps
-rw-r--r--gst/cdxaparse/gstcdxaparse.c32
-rw-r--r--gst/chart/gstchart.c112
-rw-r--r--gst/deinterlace/gstdeinterlace.c53
3 files changed, 70 insertions, 127 deletions
diff --git a/gst/cdxaparse/gstcdxaparse.c b/gst/cdxaparse/gstcdxaparse.c
index e98406eb9..c8771dac6 100644
--- a/gst/cdxaparse/gstcdxaparse.c
+++ b/gst/cdxaparse/gstcdxaparse.c
@@ -58,27 +58,23 @@ enum {
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (sink_templ,
+static GstStaticPadTemplate sink_templ =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "cdxaparse_sink",
- "video/x-cdxa",
- NULL
- )
-)
+ GST_STATIC_CAPS ( "video/x-cdxa" )
+);
-GST_PAD_TEMPLATE_FACTORY (src_templ,
+static GstStaticPadTemplate src_templ =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "cdxaparse_src",
- "video/mpeg",
- "systemstream", GST_PROPS_BOOLEAN (TRUE)
+ GST_STATIC_CAPS ( "video/mpeg, "
+ "systemstream = (boolean) TRUE"
)
-)
+);
static void gst_cdxa_parse_base_init (gpointer g_class);
static void gst_cdxa_parse_class_init (GstCDXAParseClass *klass);
@@ -120,8 +116,10 @@ gst_cdxa_parse_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 (src_templ));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (sink_templ));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&src_templ));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&sink_templ));
gst_element_class_set_details (element_class, &gst_cdxa_parse_details);
}
@@ -145,11 +143,11 @@ gst_cdxa_parse_init (GstCDXAParse *cdxa_parse)
GST_FLAG_SET (cdxa_parse, GST_ELEMENT_EVENT_AWARE);
cdxa_parse->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_templ), "sink");
+ gst_static_pad_template_get (&sink_templ), "sink");
gst_element_add_pad (GST_ELEMENT (cdxa_parse), cdxa_parse->sinkpad);
cdxa_parse->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (src_templ), "src");
+ gst_static_pad_template_get (&src_templ), "src");
gst_element_add_pad (GST_ELEMENT (cdxa_parse), cdxa_parse->srcpad);
gst_element_set_loop_function (GST_ELEMENT (cdxa_parse), gst_cdxa_parse_loop);
diff --git a/gst/chart/gstchart.c b/gst/chart/gstchart.c
index f100d96ac..2406db0dc 100644
--- a/gst/chart/gstchart.c
+++ b/gst/chart/gstchart.c
@@ -50,7 +50,7 @@ struct _GstChart {
gint height;
gint samplerate;
- gfloat framerate; /* desired frame rate */
+ gdouble framerate; /* desired frame rate */
gint samples_between_frames; /* number of samples between start of successive frames */
gint samples_since_last_frame; /* number of samples between start of successive frames */
};
@@ -81,29 +81,26 @@ 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 ("chartsrc",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_16
- )
+ GST_STATIC_CAPS ( GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_16)
);
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
+static GstStaticPadTemplate sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW ("chartsink",
- "audio/x-raw-int",
- "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 (8000, 96000),
- "channels", GST_PROPS_INT (1)
- )
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 8000, 96000 ], "
+ "channels = (int) 1")
);
static void gst_chart_base_init (gpointer g_class);
@@ -116,9 +113,9 @@ static void gst_chart_get_property (GObject *object, guint prop_id, GValue *valu
static void gst_chart_chain (GstPad *pad, GstData *_data);
static GstPadLinkReturn
- gst_chart_sinkconnect (GstPad *pad, GstCaps *caps);
+ gst_chart_sinkconnect (GstPad *pad, const GstCaps2 *caps);
static GstPadLinkReturn
- gst_chart_srcconnect (GstPad *pad, GstCaps *caps);
+ gst_chart_srcconnect (GstPad *pad, const GstCaps2 *caps);
static GstElementClass *parent_class = NULL;
@@ -149,8 +146,8 @@ gst_chart_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 (src_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&src_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sink_factory));
gst_element_class_set_details (element_class, &gst_chart_details);
}
@@ -174,10 +171,10 @@ gst_chart_init (GstChart *chart)
{
/* create the sink and src pads */
chart->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_factory),
+ gst_static_pad_template_get (&sink_factory),
"sink");
chart->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (src_factory),
+ gst_static_pad_template_get (&src_factory),
"src");
gst_element_add_pad (GST_ELEMENT (chart), chart->sinkpad);
gst_element_add_pad (GST_ELEMENT (chart), chart->srcpad);
@@ -202,12 +199,16 @@ gst_chart_init (GstChart *chart)
}
static GstPadLinkReturn
-gst_chart_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_chart_sinkconnect (GstPad *pad, const GstCaps2 *caps)
{
GstChart *chart;
+ GstStructure *structure;
+
chart = GST_CHART (gst_pad_get_parent (pad));
- gst_caps_get_int (caps, "rate", &chart->samplerate);
+ structure = gst_caps2_get_nth_cap (caps, 0);
+
+ gst_structure_get_int (structure, "rate", &chart->samplerate);
chart->samples_between_frames = chart->samplerate / chart->framerate;
GST_DEBUG ("CHART: new sink caps: rate %d",
@@ -218,50 +219,25 @@ gst_chart_sinkconnect (GstPad *pad, GstCaps *caps)
}
static GstPadLinkReturn
-gst_chart_srcconnect (GstPad *pad, GstCaps *caps)
+gst_chart_srcconnect (GstPad *pad, const GstCaps2*caps)
{
GstChart *chart;
+ GstStructure *structure;
+
chart = GST_CHART (gst_pad_get_parent (pad));
- if (gst_caps_has_property_typed (caps, "framerate",
- GST_PROPS_FLOAT_TYPE)) {
- gst_caps_get_float (caps, "framerate", &chart->framerate);
+ structure = gst_caps2_get_nth_cap (caps, 0);
+
+ if (gst_structure_get_double (structure, "framerate", &chart->framerate)) {
chart->samples_between_frames = chart->samplerate / chart->framerate;
}
- if (gst_caps_has_property_typed (caps, "width",
- GST_PROPS_INT_TYPE)) {
- gst_caps_get_int (caps, "width", &chart->width);
- }
- if (gst_caps_has_property_typed (caps, "height",
- GST_PROPS_INT_TYPE)) {
- gst_caps_get_int (caps, "height", &chart->height);
- }
+ gst_structure_get_int (structure, "width", &chart->width);
+ gst_structure_get_int (structure, "height", &chart->height);
GST_DEBUG ("CHART: new src caps: framerate %f, %dx%d",
chart->framerate, chart->width, chart->height);
- if (!GST_CAPS_IS_FIXED (caps)) {
- GstPadLinkReturn ret;
- GstCaps *newcaps;
- newcaps = GST_CAPS_NEW ("chartsrc",
- "video/x-raw-rgb",
- "bpp", GST_PROPS_INT (chart->bpp),
- "depth", GST_PROPS_INT (chart->depth),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "red_mask", GST_PROPS_INT (R_MASK_16),
- "green_mask", GST_PROPS_INT (G_MASK_16),
- "blue_mask", GST_PROPS_INT (B_MASK_16),
- "width", GST_PROPS_INT (chart->width),
- "height", GST_PROPS_INT (chart->height),
- "framerate", GST_PROPS_FLOAT (chart->framerate));
- ret = gst_pad_try_set_caps (chart->srcpad, newcaps);
- if (ret > 0) {
- return GST_PAD_LINK_DONE;
- }
- return ret;
- }
-
return GST_PAD_LINK_OK;
}
@@ -367,28 +343,6 @@ gst_chart_chain (GstPad *pad, GstData *_data)
/* set timestamp */
GST_BUFFER_TIMESTAMP (bufout) = chart->next_time;
- /* Check if we need to renegotiate size. */
- if (!GST_PAD_CAPS (chart->srcpad)) {
- GstCaps *newcaps;
- GST_DEBUG ("making new pad");
- newcaps = GST_CAPS_NEW ("chartsrc",
- "video/x-raw-rgb",
- "bpp", GST_PROPS_INT (chart->bpp),
- "depth", GST_PROPS_INT (chart->depth),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "red_mask", GST_PROPS_INT (R_MASK_16),
- "green_mask", GST_PROPS_INT (G_MASK_16),
- "blue_mask", GST_PROPS_INT (B_MASK_16),
- "width", GST_PROPS_INT (chart->width),
- "height", GST_PROPS_INT (chart->height),
- "framerate", GST_PROPS_FLOAT (chart->framerate));
- if (gst_pad_try_set_caps (chart->srcpad, newcaps) <= 0) {
- gst_element_error (GST_ELEMENT (chart),
- "chart: could not negotiate format");
- return;
- }
- }
-
GST_DEBUG ("CHART: outputting buffer");
/* output buffer */
GST_BUFFER_FLAG_SET (bufout, GST_BUFFER_READONLY);
diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c
index 7411b5433..e58e1dbf7 100644
--- a/gst/deinterlace/gstdeinterlace.c
+++ b/gst/deinterlace/gstdeinterlace.c
@@ -24,6 +24,7 @@
#endif
#include <string.h>
#include <gst/gst.h>
+#include <gst/video/video.h>
#include "gstdeinterlace.h"
/* elementfactory information */
@@ -49,33 +50,21 @@ enum {
ARG_EDGE_DETECT,
};
-GST_PAD_TEMPLATE_FACTORY (deinterlace_src_factory,
+static GstStaticPadTemplate deinterlace_src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "deinterlace_src",
- "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
- "width", GST_PROPS_INT_POSITIVE,
- "height", GST_PROPS_INT_POSITIVE,
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
- )
-)
-
-GST_PAD_TEMPLATE_FACTORY (deinterlace_sink_factory,
+ GST_STATIC_CAPS ( GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420"))
+);
+
+static GstStaticPadTemplate deinterlace_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "deinterlace_src",
- "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
- "width", GST_PROPS_INT_POSITIVE,
- "height", GST_PROPS_INT_POSITIVE,
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
- )
-)
+ GST_STATIC_CAPS ( GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420"))
+);
static GType gst_deinterlace_get_type (void);
@@ -120,9 +109,9 @@ gst_deinterlace_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 (deinterlace_src_factory));
+ gst_static_pad_template_get (&deinterlace_src_factory));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (deinterlace_sink_factory));
+ gst_static_pad_template_get (&deinterlace_sink_factory));
gst_element_class_set_details (element_class, &deinterlace_details);
}
@@ -156,17 +145,17 @@ gst_deinterlace_class_init (GstDeInterlaceClass *klass)
}
static GstPadLinkReturn
-gst_deinterlace_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_deinterlace_sinkconnect (GstPad *pad, const GstCaps2 *caps)
{
GstDeInterlace *filter;
+ GstStructure *structure;
filter = GST_DEINTERLACE(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_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
if (filter->picsize != (filter->width*filter->height)) {
if (filter->src)
@@ -174,18 +163,20 @@ gst_deinterlace_sinkconnect (GstPad *pad, GstCaps *caps)
filter->picsize = filter->width*filter->height;
filter->src = g_malloc(filter->picsize);
}
- return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
gst_deinterlace_init (GstDeInterlace *filter)
{
- filter->sinkpad = gst_pad_new_from_template(deinterlace_sink_factory (),"sink");
+ filter->sinkpad = gst_pad_new_from_template(
+ gst_static_pad_template_get(&deinterlace_sink_factory),"sink");
gst_pad_set_chain_function(filter->sinkpad,gst_deinterlace_chain);
gst_pad_set_link_function(filter->sinkpad,gst_deinterlace_sinkconnect);
gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template(deinterlace_src_factory (),"src");
+ filter->srcpad = gst_pad_new_from_template(
+ gst_static_pad_template_get(&deinterlace_src_factory),"src");
gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad);
filter->show_deinterlaced_area_only = FALSE;