#include "gstquark.h"
#include "gsteffectv.h"
-#include <gst/controller/gstcontroller.h>
-
/* number of frames of time-buffer. It should be as a configurable paramater */
/* This number also must be 2^n just for the speed. */
#define PLANES 16
);
static gboolean
-gst_quarktv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
- GstCaps * outcaps)
+gst_quarktv_set_info (GstVideoFilter * vfilter, GstCaps * incaps,
+ GstVideoInfo * in_info, GstCaps * outcaps, GstVideoInfo * out_info)
{
- GstQuarkTV *filter = GST_QUARKTV (btrans);
- GstVideoInfo info;
+ GstQuarkTV *filter = GST_QUARKTV (vfilter);
gint 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);
gst_quarktv_planetable_clear (filter);
filter->area = width * height;
return TRUE;
-
- /* ERRORS */
-invalid_caps:
- {
- GST_DEBUG_OBJECT (filter, "invalid caps received");
- return FALSE;
- }
}
static GstFlowReturn
-gst_quarktv_transform (GstBaseTransform * trans, GstBuffer * in,
- GstBuffer * out)
+gst_quarktv_transform_frame (GstVideoFilter * vfilter, GstVideoFrame * in_frame,
+ GstVideoFrame * out_frame)
{
- GstQuarkTV *filter = GST_QUARKTV (trans);
+ GstQuarkTV *filter = GST_QUARKTV (vfilter);
gint area;
guint32 *src, *dest;
GstClockTime timestamp;
GstBuffer **planetable;
gint planes, current_plane;
- GstVideoFrame in_frame, out_frame;
- timestamp = GST_BUFFER_TIMESTAMP (in);
+ timestamp = GST_BUFFER_TIMESTAMP (in_frame->buffer);
timestamp =
- 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));
if (GST_CLOCK_TIME_IS_VALID (timestamp))
- gst_object_sync_values (G_OBJECT (filter), timestamp);
+ gst_object_sync_values (GST_OBJECT (filter), timestamp);
if (G_UNLIKELY (filter->planetable == NULL))
- return GST_FLOW_WRONG_STATE;
-
- if (!gst_video_frame_map (&in_frame, &filter->info, in, GST_MAP_READ))
- goto invalid_in;
+ return GST_FLOW_FLUSHING;
- 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);
GST_OBJECT_LOCK (filter);
area = filter->area;
if (planetable[current_plane])
gst_buffer_unref (planetable[current_plane]);
- planetable[current_plane] = gst_buffer_ref (in);
+ planetable[current_plane] = gst_buffer_ref (in_frame->buffer);
/* For each pixel */
while (--area) {
filter->current_plane = planes - 1;
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 void
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_quarktv_set_property;
gobject_class->get_property = gst_quarktv_get_property;
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_quarktv_src_template));
- trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_quarktv_set_caps);
- trans_class->transform = GST_DEBUG_FUNCPTR (gst_quarktv_transform);
trans_class->start = GST_DEBUG_FUNCPTR (gst_quarktv_start);
+
+ vfilter_class->set_info = GST_DEBUG_FUNCPTR (gst_quarktv_set_info);
+ vfilter_class->transform_frame =
+ GST_DEBUG_FUNCPTR (gst_quarktv_transform_frame);
}
static void
{
filter->planes = PLANES;
filter->current_plane = filter->planes - 1;
-
- gst_pad_use_fixed_caps (GST_BASE_TRANSFORM_SRC_PAD (filter));
- gst_pad_use_fixed_caps (GST_BASE_TRANSFORM_SINK_PAD (filter));
}