summaryrefslogtreecommitdiffstats
path: root/gst/videobox
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2005-06-02 10:03:23 +0000
committerWim Taymans <wim.taymans@gmail.com>2005-06-02 10:03:23 +0000
commit9cc325828029d5d746c1d13a0ea729900a7d3ef4 (patch)
tree725570e3cfc118541b3526ee7d2c690c5d6b6fa5 /gst/videobox
parenta5d8b514c5895a5b72336545ce0b0dacd460ad9e (diff)
gst/: Bufferalloc changes.
Original commit message from CVS: * gst/effectv/gstquark.c: (gst_quarktv_chain): * gst/goom/gstgoom.c: (gst_goom_chain): * gst/videobox/Makefile.am: * gst/videobox/gstvideobox.c: (gst_video_box_class_init), (gst_video_box_init), (gst_video_box_sink_setcaps), (gst_video_box_chain): * gst/videofilter/gstvideofilter.c: (gst_videofilter_chain): * gst/videorate/gstvideorate.c: (gst_videorate_class_init), (gst_videorate_getcaps), (gst_videorate_setcaps), (gst_videorate_init), (gst_videorate_event), (gst_videorate_chain), (gst_videorate_change_state): Bufferalloc changes.
Diffstat (limited to 'gst/videobox')
-rw-r--r--gst/videobox/Makefile.am2
-rw-r--r--gst/videobox/gstvideobox.c60
2 files changed, 27 insertions, 35 deletions
diff --git a/gst/videobox/Makefile.am b/gst/videobox/Makefile.am
index 37da9aae..a857cb54 100644
--- a/gst/videobox/Makefile.am
+++ b/gst/videobox/Makefile.am
@@ -2,7 +2,7 @@
plugin_LTLIBRARIES = libgstvideobox.la
libgstvideobox_la_SOURCES = gstvideobox.c
-libgstvideobox_la_CFLAGS = $(GST_CFLAGS)
+libgstvideobox_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_LIBS_CFLAGS)
libgstvideobox_la_LIBADD =
libgstvideobox_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
diff --git a/gst/videobox/gstvideobox.c b/gst/videobox/gstvideobox.c
index bfe738c3..ea668374 100644
--- a/gst/videobox/gstvideobox.c
+++ b/gst/videobox/gstvideobox.c
@@ -129,9 +129,8 @@ static void gst_video_box_set_property (GObject * object, guint prop_id,
static void gst_video_box_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static GstPadLinkReturn
-gst_video_box_sink_link (GstPad * pad, const GstCaps * caps);
-static void gst_video_box_chain (GstPad * pad, GstData * _data);
+static gboolean gst_video_box_sink_setcaps (GstPad * pad, GstCaps * caps);
+static GstFlowReturn gst_video_box_chain (GstPad * pad, GstBuffer * buffer);
static GstElementStateReturn gst_video_box_change_state (GstElement * element);
@@ -207,6 +206,9 @@ gst_video_box_class_init (GstVideoBoxClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
+ gobject_class->set_property = gst_video_box_set_property;
+ gobject_class->get_property = gst_video_box_get_property;
+
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FILL_TYPE,
g_param_spec_enum ("fill", "Fill", "How to fill the borders",
GST_TYPE_VIDEO_BOX_FILL, DEFAULT_FILL_TYPE,
@@ -235,9 +237,6 @@ gst_video_box_class_init (GstVideoBoxClass * klass)
"Alpha value of the border", 0.0, 1.0, DEFAULT_BORDER_ALPHA,
G_PARAM_READWRITE));
- gobject_class->set_property = gst_video_box_set_property;
- gobject_class->get_property = gst_video_box_get_property;
-
gstelement_class->change_state = gst_video_box_change_state;
}
@@ -250,7 +249,7 @@ gst_video_box_init (GstVideoBox * video_box)
(&gst_video_box_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (video_box), video_box->sinkpad);
gst_pad_set_chain_function (video_box->sinkpad, gst_video_box_chain);
- gst_pad_set_link_function (video_box->sinkpad, gst_video_box_sink_link);
+ gst_pad_set_setcaps_function (video_box->sinkpad, gst_video_box_sink_setcaps);
video_box->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get
@@ -264,8 +263,6 @@ gst_video_box_init (GstVideoBox * video_box)
video_box->fill_type = DEFAULT_FILL_TYPE;
video_box->alpha = DEFAULT_ALPHA;
video_box->border_alpha = DEFAULT_BORDER_ALPHA;
-
- GST_FLAG_SET (video_box, GST_ELEMENT_EVENT_AWARE);
}
/* do we need this function? */
@@ -374,20 +371,20 @@ gst_video_box_get_property (GObject * object, guint prop_id, GValue * value,
}
}
-static GstPadLinkReturn
-gst_video_box_sink_link (GstPad * pad, const GstCaps * caps)
+static gboolean
+gst_video_box_sink_setcaps (GstPad * pad, GstCaps * caps)
{
GstVideoBox *video_box;
GstStructure *structure;
gboolean ret;
- video_box = GST_VIDEO_BOX (gst_pad_get_parent (pad));
+ video_box = GST_VIDEO_BOX (GST_PAD_PARENT (pad));
structure = gst_caps_get_structure (caps, 0);
ret = gst_structure_get_int (structure, "width", &video_box->in_width);
ret &= gst_structure_get_int (structure, "height", &video_box->in_height);
- return GST_PAD_LINK_OK;
+ return ret;
}
#define ROUND_UP_2(x) (((x)+1)&~1)
@@ -603,29 +600,16 @@ gst_video_box_ayuv (GstVideoBox * video_box, guint8 * src, guint8 * dest)
}
}
-static void
-gst_video_box_chain (GstPad * pad, GstData * _data)
+static GstFlowReturn
+gst_video_box_chain (GstPad * pad, GstBuffer * buffer)
{
- GstBuffer *buffer;
GstVideoBox *video_box;
GstBuffer *outbuf;
gint new_width, new_height;
+ GstFlowReturn ret;
video_box = GST_VIDEO_BOX (gst_pad_get_parent (pad));
- if (GST_IS_EVENT (_data)) {
- GstEvent *event = GST_EVENT (_data);
-
- switch (GST_EVENT_TYPE (event)) {
- default:
- gst_pad_event_default (pad, event);
- break;
- }
- return;
- }
-
- buffer = GST_BUFFER (_data);
-
new_width =
video_box->in_width - (video_box->box_left + video_box->box_right);
new_height =
@@ -665,14 +649,20 @@ gst_video_box_chain (GstPad * pad, GstData * _data)
}
if (video_box->use_alpha) {
- outbuf = gst_pad_alloc_buffer (video_box->srcpad,
- GST_BUFFER_OFFSET_NONE, new_width * new_height * 4);
+ ret = gst_pad_alloc_buffer (video_box->srcpad,
+ GST_BUFFER_OFFSET_NONE, new_width * new_height * 4,
+ GST_RPAD_CAPS (video_box->srcpad), &outbuf);
+ if (ret != GST_FLOW_OK)
+ goto done;
gst_video_box_ayuv (video_box,
GST_BUFFER_DATA (buffer), GST_BUFFER_DATA (outbuf));
} else {
- outbuf = gst_pad_alloc_buffer (video_box->srcpad,
- GST_BUFFER_OFFSET_NONE, GST_VIDEO_I420_SIZE (new_width, new_height));
+ ret = gst_pad_alloc_buffer (video_box->srcpad,
+ GST_BUFFER_OFFSET_NONE, GST_VIDEO_I420_SIZE (new_width, new_height),
+ GST_RPAD_CAPS (video_box->srcpad), &outbuf);
+ if (ret != GST_FLOW_OK)
+ goto done;
gst_video_box_i420 (video_box,
GST_BUFFER_DATA (buffer), GST_BUFFER_DATA (outbuf));
@@ -680,10 +670,12 @@ gst_video_box_chain (GstPad * pad, GstData * _data)
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buffer);
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buffer);
+ ret = gst_pad_push (video_box->srcpad, outbuf);
+done:
gst_buffer_unref (buffer);
- gst_pad_push (video_box->srcpad, GST_DATA (outbuf));
+ return ret;
}
static GstElementStateReturn