summaryrefslogtreecommitdiff
path: root/gst/effectv/gstop.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst/effectv/gstop.c')
-rw-r--r--gst/effectv/gstop.c70
1 files changed, 19 insertions, 51 deletions
diff --git a/gst/effectv/gstop.c b/gst/effectv/gstop.c
index 7d89ea1c4..6d01395bd 100644
--- a/gst/effectv/gstop.c
+++ b/gst/effectv/gstop.c
@@ -199,20 +199,21 @@ image_y_over (guint32 * src, guint8 * diff, gint y_threshold, gint video_area)
}
static GstFlowReturn
-gst_optv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
+gst_optv_transform_frame (GstVideoFilter * vfilter, GstVideoFrame * in_frame,
+ GstVideoFrame * out_frame)
{
- GstOpTV *filter = GST_OPTV (trans);
+ GstOpTV *filter = GST_OPTV (vfilter);
guint32 *src, *dest;
- GstVideoFrame in_frame, out_frame;
gint8 *p;
guint8 *diff;
gint x, y, width, height;
GstClockTime timestamp, stream_time;
guint8 phase;
- timestamp = GST_BUFFER_TIMESTAMP (in);
+ timestamp = GST_BUFFER_TIMESTAMP (in_frame->buffer);
stream_time =
- gst_segment_to_stream_time (&trans->segment, GST_FORMAT_TIME, timestamp);
+ gst_segment_to_stream_time (&GST_BASE_TRANSFORM (vfilter)->segment,
+ GST_FORMAT_TIME, timestamp);
GST_DEBUG_OBJECT (filter, "sync to %" GST_TIME_FORMAT,
GST_TIME_ARGS (timestamp));
@@ -223,17 +224,11 @@ gst_optv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
if (G_UNLIKELY (filter->opmap[0] == NULL))
return GST_FLOW_NOT_NEGOTIATED;
- if (!gst_video_frame_map (&in_frame, &filter->info, in, GST_MAP_READ))
- goto invalid_in;
-
- if (!gst_video_frame_map (&out_frame, &filter->info, out, GST_MAP_WRITE))
- goto invalid_out;
-
- src = GST_VIDEO_FRAME_PLANE_DATA (&in_frame, 0);
- dest = GST_VIDEO_FRAME_PLANE_DATA (&out_frame, 0);
+ src = GST_VIDEO_FRAME_PLANE_DATA (in_frame, 0);
+ dest = GST_VIDEO_FRAME_PLANE_DATA (out_frame, 0);
- width = GST_VIDEO_FRAME_WIDTH (&in_frame);
- height = GST_VIDEO_FRAME_HEIGHT (&in_frame);
+ width = GST_VIDEO_FRAME_WIDTH (in_frame);
+ height = GST_VIDEO_FRAME_HEIGHT (in_frame);
GST_OBJECT_LOCK (filter);
switch (filter->mode) {
@@ -266,40 +261,18 @@ gst_optv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
}
GST_OBJECT_UNLOCK (filter);
- gst_video_frame_unmap (&in_frame);
- gst_video_frame_unmap (&out_frame);
-
return GST_FLOW_OK;
-
- /* ERRORS */
-invalid_in:
- {
- GST_DEBUG_OBJECT (filter, "invalid input frame");
- return GST_FLOW_ERROR;
- }
-invalid_out:
- {
- GST_DEBUG_OBJECT (filter, "invalid output frame");
- gst_video_frame_unmap (&in_frame);
- return GST_FLOW_ERROR;
- }
}
static gboolean
-gst_optv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
- GstCaps * outcaps)
+gst_optv_set_info (GstVideoFilter * vfilter, GstCaps * incaps,
+ GstVideoInfo * in_info, GstCaps * outcaps, GstVideoInfo * out_info)
{
- GstOpTV *filter = GST_OPTV (btrans);
- GstVideoInfo info;
+ GstOpTV *filter = GST_OPTV (vfilter);
gint i, width, height;
- if (!gst_video_info_from_caps (&info, incaps))
- goto invalid_caps;
-
- filter->info = info;
-
- width = GST_VIDEO_INFO_WIDTH (&info);
- height = GST_VIDEO_INFO_HEIGHT (&info);
+ width = GST_VIDEO_INFO_WIDTH (in_info);
+ height = GST_VIDEO_INFO_HEIGHT (in_info);
for (i = 0; i < 4; i++) {
if (filter->opmap[i])
@@ -313,13 +286,6 @@ gst_optv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
filter->diff = g_new (guint8, width * height);
return TRUE;
-
- /* ERRORS */
-invalid_caps:
- {
- GST_DEBUG_OBJECT (filter, "invalid caps received");
- return FALSE;
- }
}
static gboolean
@@ -406,6 +372,7 @@ gst_optv_class_init (GstOpTVClass * klass)
GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
GstBaseTransformClass *trans_class = (GstBaseTransformClass *) klass;
+ GstVideoFilterClass *vfilter_class = (GstVideoFilterClass *) klass;
gobject_class->set_property = gst_optv_set_property;
gobject_class->get_property = gst_optv_get_property;
@@ -438,10 +405,11 @@ gst_optv_class_init (GstOpTVClass * klass)
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_optv_src_template));
- trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_optv_set_caps);
- trans_class->transform = GST_DEBUG_FUNCPTR (gst_optv_transform);
trans_class->start = GST_DEBUG_FUNCPTR (gst_optv_start);
+ vfilter_class->set_info = GST_DEBUG_FUNCPTR (gst_optv_set_info);
+ vfilter_class->transform_frame = GST_DEBUG_FUNCPTR (gst_optv_transform_frame);
+
initPalette ();
}