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
}
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;
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) {
filter->num_samples = 0;
}
- *out = in;
-
return GST_FLOW_OK;
}
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())
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;
}
#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 };
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