summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--gst/level/gstlevel.c9
-rw-r--r--gst/videobox/gstvideobox.c49
3 files changed, 33 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index dc992bd2..5654887c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-07-15 Wim Taymans <wim@fluendo.com>
+
+ * gst/level/gstlevel.c: (gst_level_transform):
+ * gst/videobox/gstvideobox.c: (gst_video_box_class_init),
+ (gst_video_box_get_size), (gst_video_box_transform):
+ Port to new base class.
+
2005-07-14 Wim Taymans <wim@fluendo.com>
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
diff --git a/gst/level/gstlevel.c b/gst/level/gstlevel.c
index 12cc8208..06fc37a2 100644
--- a/gst/level/gstlevel.c
+++ b/gst/level/gstlevel.c
@@ -85,7 +85,7 @@ static void gst_level_get_property (GObject * object, guint prop_id,
static gboolean gst_level_set_caps (GstBaseTransform * trans, GstCaps * in,
GstCaps * out);
static GstFlowReturn gst_level_transform (GstBaseTransform * trans,
- GstBuffer * in, GstBuffer ** out);
+ GstBuffer * in, GstBuffer * out);
static void
@@ -345,7 +345,7 @@ gst_level_message_append_channel (GstMessage * m, gdouble rms, gdouble peak,
}
static GstFlowReturn
-gst_level_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer ** out)
+gst_level_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
{
GstLevel *filter;
gpointer in_data;
@@ -361,8 +361,7 @@ gst_level_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer ** out)
in_data = GST_BUFFER_DATA (in);
num_samples = GST_BUFFER_SIZE (in) / (filter->width / 8);
- g_return_val_if_fail (num_samples % filter->channels == 0,
- GST_FLOW_UNEXPECTED);
+ g_return_val_if_fail (num_samples % filter->channels == 0, GST_FLOW_ERROR);
for (i = 0; i < filter->channels; ++i) {
switch (filter->width) {
@@ -446,8 +445,6 @@ gst_level_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer ** out)
filter->num_samples = 0;
}
- *out = in;
-
return GST_FLOW_OK;
}
diff --git a/gst/videobox/gstvideobox.c b/gst/videobox/gstvideobox.c
index ec23d3d7..daf51a37 100644
--- a/gst/videobox/gstvideobox.c
+++ b/gst/videobox/gstvideobox.c
@@ -129,8 +129,9 @@ static GstCaps *gst_video_box_transform_caps (GstBaseTransform * trans,
GstPad * pad, GstCaps * from);
static gboolean gst_video_box_set_caps (GstBaseTransform * trans,
GstCaps * in, GstCaps * out);
+static guint gst_video_box_get_size (GstBaseTransform * trans);
static GstFlowReturn gst_video_box_transform (GstBaseTransform * trans,
- GstBuffer * in, GstBuffer ** out);
+ GstBuffer * in, GstBuffer * out);
#define GST_TYPE_VIDEO_BOX_FILL (gst_video_box_fill_get_type())
@@ -208,6 +209,7 @@ gst_video_box_class_init (GstVideoBoxClass * klass)
trans_class->transform_caps = gst_video_box_transform_caps;
trans_class->set_caps = gst_video_box_set_caps;
+ trans_class->get_size = gst_video_box_get_size;
trans_class->transform = gst_video_box_transform;
}
@@ -388,6 +390,22 @@ gst_video_box_set_caps (GstBaseTransform * trans, GstCaps * in, GstCaps * out)
#define GST_VIDEO_I420_SIZE(w,h) (GST_VIDEO_I420_V_OFFSET(w,h)+(GST_VIDEO_I420_V_ROWSTRIDE(w)*ROUND_UP_2(h)/2))
+static guint
+gst_video_box_get_size (GstBaseTransform * trans)
+{
+ guint size;
+ GstVideoBox *video_box;
+
+ video_box = GST_VIDEO_BOX (trans);
+
+ if (video_box->use_alpha) {
+ size = video_box->out_height * video_box->out_height * 4;
+ } else {
+ size = GST_VIDEO_I420_SIZE (video_box->out_width, video_box->out_height);
+ }
+ return size;
+}
+
static int yuv_colors_Y[] = { 16, 150, 29 };
static int yuv_colors_U[] = { 128, 46, 255 };
static int yuv_colors_V[] = { 128, 21, 107 };
@@ -588,40 +606,19 @@ gst_video_box_ayuv (GstVideoBox * video_box, guint8 * src, guint8 * dest)
static GstFlowReturn
gst_video_box_transform (GstBaseTransform * trans, GstBuffer * in,
- GstBuffer ** out)
+ GstBuffer * out)
{
GstVideoBox *video_box;
- GstFlowReturn ret;
video_box = GST_VIDEO_BOX (trans);
if (video_box->use_alpha) {
- ret = gst_pad_alloc_buffer (trans->srcpad,
- GST_BUFFER_OFFSET_NONE,
- video_box->out_height * video_box->out_height * 4,
- GST_PAD_CAPS (trans->srcpad), out);
- if (ret != GST_FLOW_OK)
- goto done;
-
- gst_video_box_ayuv (video_box,
- GST_BUFFER_DATA (in), GST_BUFFER_DATA (*out));
+ gst_video_box_ayuv (video_box, GST_BUFFER_DATA (in), GST_BUFFER_DATA (out));
} else {
- ret = gst_pad_alloc_buffer (trans->srcpad,
- GST_BUFFER_OFFSET_NONE,
- GST_VIDEO_I420_SIZE (video_box->out_width, video_box->out_height),
- GST_PAD_CAPS (trans->srcpad), out);
- if (ret != GST_FLOW_OK)
- goto done;
-
- gst_video_box_i420 (video_box,
- GST_BUFFER_DATA (in), GST_BUFFER_DATA (*out));
+ gst_video_box_i420 (video_box, GST_BUFFER_DATA (in), GST_BUFFER_DATA (out));
}
- gst_buffer_stamp (*out, in);
-
-done:
- gst_buffer_unref (in);
- return ret;
+ return GST_FLOW_OK;
}
static gboolean