Commit 22146571 authored by Wim Taymans's avatar Wim Taymans

update for videofilter changes.

parent 4b8975f8
......@@ -156,17 +156,17 @@ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ AYUV, ARGB, BGRA, ABGR, RGBA }"));
g_static_mutex_unlock (&alpha->lock); \
} G_STMT_END
static gboolean gst_alpha_get_unit_size (GstBaseTransform * btrans,
GstCaps * caps, gsize * size);
static GstCaps *gst_alpha_transform_caps (GstBaseTransform * btrans,
GstPadDirection direction, GstCaps * caps, GstCaps * filter);
static gboolean gst_alpha_set_caps (GstBaseTransform * btrans,
GstCaps * incaps, GstCaps * outcaps);
static GstFlowReturn gst_alpha_transform (GstBaseTransform * btrans,
GstBuffer * in, GstBuffer * out);
static void gst_alpha_before_transform (GstBaseTransform * btrans,
GstBuffer * buf);
static gboolean gst_alpha_set_info (GstVideoFilter * filter,
GstCaps * incaps, GstVideoInfo * in_info, GstCaps * outcaps,
GstVideoInfo * out_info);
static GstFlowReturn gst_alpha_transform_frame (GstVideoFilter * filter,
GstVideoFrame * in_frame, GstVideoFrame * out_frame);
static void gst_alpha_init_params (GstAlpha * alpha);
static gboolean gst_alpha_set_process_function (GstAlpha * alpha);
......@@ -204,6 +204,7 @@ gst_alpha_class_init (GstAlphaClass * klass)
GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
GstBaseTransformClass *btrans_class = (GstBaseTransformClass *) klass;
GstVideoFilterClass *vfilter_class = (GstVideoFilterClass *) klass;
GST_DEBUG_CATEGORY_INIT (gst_alpha_debug, "alpha", 0,
"alpha - Element for adding alpha channel to streams");
......@@ -269,12 +270,13 @@ gst_alpha_class_init (GstAlphaClass * klass)
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_alpha_src_template));
btrans_class->transform = GST_DEBUG_FUNCPTR (gst_alpha_transform);
btrans_class->before_transform =
GST_DEBUG_FUNCPTR (gst_alpha_before_transform);
btrans_class->get_unit_size = GST_DEBUG_FUNCPTR (gst_alpha_get_unit_size);
btrans_class->transform_caps = GST_DEBUG_FUNCPTR (gst_alpha_transform_caps);
btrans_class->set_caps = GST_DEBUG_FUNCPTR (gst_alpha_set_caps);
vfilter_class->set_info = GST_DEBUG_FUNCPTR (gst_alpha_set_info);
vfilter_class->transform_frame =
GST_DEBUG_FUNCPTR (gst_alpha_transform_frame);
}
static void
......@@ -434,25 +436,6 @@ gst_alpha_get_property (GObject * object, guint prop_id, GValue * value,
}
}
static gboolean
gst_alpha_get_unit_size (GstBaseTransform * btrans,
GstCaps * caps, gsize * size)
{
GstVideoInfo info;
if (!gst_video_info_from_caps (&info, caps))
return FALSE;
*size = info.size;
GST_DEBUG_OBJECT (btrans,
"unit size = %" G_GSIZE_FORMAT " for format %s w %d height %d", *size,
GST_VIDEO_INFO_NAME (&info), GST_VIDEO_INFO_WIDTH (&info),
GST_VIDEO_INFO_HEIGHT (&info));
return TRUE;
}
static GstCaps *
gst_alpha_transform_caps (GstBaseTransform * btrans,
GstPadDirection direction, GstCaps * caps, GstCaps * filter)
......@@ -518,34 +501,28 @@ gst_alpha_transform_caps (GstBaseTransform * btrans,
}
static gboolean
gst_alpha_set_caps (GstBaseTransform * btrans,
GstCaps * incaps, GstCaps * outcaps)
gst_alpha_set_info (GstVideoFilter * filter,
GstCaps * incaps, GstVideoInfo * in_info, GstCaps * outcaps,
GstVideoInfo * out_info)
{
GstAlpha *alpha = GST_ALPHA (btrans);
GstVideoInfo in_info, out_info;
GstAlpha *alpha = GST_ALPHA (filter);
gboolean passthrough;
if (!gst_video_info_from_caps (&in_info, incaps) ||
!gst_video_info_from_caps (&out_info, outcaps))
goto invalid_format;
GST_ALPHA_LOCK (alpha);
alpha->in_sdtv = in_info.colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_BT601;
alpha->out_sdtv = out_info.colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_BT601;
alpha->in_sdtv = in_info->colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_BT601;
alpha->out_sdtv = out_info->colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_BT601;
passthrough = alpha->prefer_passthrough &&
GST_VIDEO_INFO_FORMAT (&in_info) == GST_VIDEO_INFO_FORMAT (&out_info)
GST_VIDEO_INFO_FORMAT (in_info) == GST_VIDEO_INFO_FORMAT (out_info)
&& alpha->in_sdtv == alpha->out_sdtv && alpha->method == ALPHA_METHOD_SET
&& alpha->alpha == 1.0;
GST_DEBUG_OBJECT (alpha,
"Setting caps %" GST_PTR_FORMAT " -> %" GST_PTR_FORMAT
" (passthrough: %d)", incaps, outcaps, passthrough);
gst_base_transform_set_passthrough (btrans, passthrough);
alpha->in_info = in_info;
alpha->out_info = out_info;
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM_CAST (filter),
passthrough);
if (!gst_alpha_set_process_function (alpha) && !passthrough)
goto no_process;
......@@ -557,13 +534,6 @@ gst_alpha_set_caps (GstBaseTransform * btrans,
return TRUE;
/* ERRORS */
invalid_format:
{
GST_WARNING_OBJECT (alpha,
"Failed to parse caps %" GST_PTR_FORMAT " -> %" GST_PTR_FORMAT, incaps,
outcaps);
return FALSE;
}
no_process:
{
GST_WARNING_OBJECT (alpha,
......@@ -2325,8 +2295,8 @@ gst_alpha_init_params (GstAlpha * alpha)
const GstVideoFormatInfo *in_info, *out_info;
const gint *matrix;
in_info = alpha->in_info.finfo;
out_info = alpha->out_info.finfo;
in_info = GST_VIDEO_FILTER (alpha)->in_info.finfo;
out_info = GST_VIDEO_FILTER (alpha)->out_info.finfo;
/* RGB->RGB: convert to SDTV YUV, chroma keying, convert back
* YUV->RGB: chroma keying, convert to RGB
......@@ -2390,13 +2360,18 @@ gst_alpha_init_params (GstAlpha * alpha)
static gboolean
gst_alpha_set_process_function (GstAlpha * alpha)
{
GstVideoInfo *in_info, *out_info;
alpha->process = NULL;
in_info = &GST_VIDEO_FILTER_CAST (alpha)->in_info;
out_info = &GST_VIDEO_FILTER_CAST (alpha)->out_info;
switch (alpha->method) {
case ALPHA_METHOD_SET:
switch (GST_VIDEO_INFO_FORMAT (&alpha->out_info)) {
switch (GST_VIDEO_INFO_FORMAT (out_info)) {
case GST_VIDEO_FORMAT_AYUV:
switch (GST_VIDEO_INFO_FORMAT (&alpha->in_info)) {
switch (GST_VIDEO_INFO_FORMAT (in_info)) {
case GST_VIDEO_FORMAT_AYUV:
alpha->process = gst_alpha_set_ayuv_ayuv;
break;
......@@ -2434,7 +2409,7 @@ gst_alpha_set_process_function (GstAlpha * alpha)
case GST_VIDEO_FORMAT_ABGR:
case GST_VIDEO_FORMAT_RGBA:
case GST_VIDEO_FORMAT_BGRA:
switch (GST_VIDEO_INFO_FORMAT (&alpha->in_info)) {
switch (GST_VIDEO_INFO_FORMAT (in_info)) {
case GST_VIDEO_FORMAT_AYUV:
alpha->process = gst_alpha_set_ayuv_argb;
break;
......@@ -2476,9 +2451,9 @@ gst_alpha_set_process_function (GstAlpha * alpha)
case ALPHA_METHOD_GREEN:
case ALPHA_METHOD_BLUE:
case ALPHA_METHOD_CUSTOM:
switch (GST_VIDEO_INFO_FORMAT (&alpha->out_info)) {
switch (GST_VIDEO_INFO_FORMAT (out_info)) {
case GST_VIDEO_FORMAT_AYUV:
switch (GST_VIDEO_INFO_FORMAT (&alpha->in_info)) {
switch (GST_VIDEO_INFO_FORMAT (in_info)) {
case GST_VIDEO_FORMAT_AYUV:
alpha->process = gst_alpha_chroma_key_ayuv_ayuv;
break;
......@@ -2516,7 +2491,7 @@ gst_alpha_set_process_function (GstAlpha * alpha)
case GST_VIDEO_FORMAT_ABGR:
case GST_VIDEO_FORMAT_RGBA:
case GST_VIDEO_FORMAT_BGRA:
switch (GST_VIDEO_INFO_FORMAT (&alpha->in_info)) {
switch (GST_VIDEO_INFO_FORMAT (in_info)) {
case GST_VIDEO_FORMAT_AYUV:
alpha->process = gst_alpha_chroma_key_ayuv_argb;
break;
......@@ -2575,26 +2550,17 @@ gst_alpha_before_transform (GstBaseTransform * btrans, GstBuffer * buf)
}
static GstFlowReturn
gst_alpha_transform (GstBaseTransform * btrans, GstBuffer * in, GstBuffer * out)
gst_alpha_transform_frame (GstVideoFilter * filter, GstVideoFrame * in_frame,
GstVideoFrame * out_frame)
{
GstAlpha *alpha = GST_ALPHA (btrans);
GstVideoFrame in_frame, out_frame;
GstAlpha *alpha = GST_ALPHA (filter);
GST_ALPHA_LOCK (alpha);
if (G_UNLIKELY (!alpha->process))
goto not_negotiated;
if (!gst_video_frame_map (&in_frame, &alpha->in_info, in, GST_MAP_READ))
goto invalid_in;
if (!gst_video_frame_map (&out_frame, &alpha->out_info, out, GST_MAP_WRITE))
goto invalid_out;
alpha->process (&in_frame, &out_frame, alpha);
gst_video_frame_unmap (&out_frame);
gst_video_frame_unmap (&in_frame);
alpha->process (in_frame, out_frame, alpha);
GST_ALPHA_UNLOCK (alpha);
......@@ -2607,19 +2573,6 @@ not_negotiated:
GST_ALPHA_UNLOCK (alpha);
return GST_FLOW_NOT_NEGOTIATED;
}
invalid_in:
{
GST_ERROR_OBJECT (alpha, "Invalid input frame");
GST_ALPHA_UNLOCK (alpha);
return GST_FLOW_OK;
}
invalid_out:
{
GST_ERROR_OBJECT (alpha, "Invalid output frame");
gst_video_frame_unmap (&in_frame);
GST_ALPHA_UNLOCK (alpha);
return GST_FLOW_OK;
}
}
static gboolean
......
......@@ -71,7 +71,6 @@ struct _GstAlpha
/* caps */
GStaticMutex lock;
GstVideoInfo in_info, out_info;
gboolean in_sdtv, out_sdtv;
/* properties */
......
......@@ -62,10 +62,12 @@ G_DEFINE_TYPE (GstAlphaColor, gst_alpha_color, GST_TYPE_VIDEO_FILTER);
static GstCaps *gst_alpha_color_transform_caps (GstBaseTransform * btrans,
GstPadDirection direction, GstCaps * caps, GstCaps * filter);
static gboolean gst_alpha_color_set_caps (GstBaseTransform * btrans,
GstCaps * incaps, GstCaps * outcaps);
static GstFlowReturn gst_alpha_color_transform_ip (GstBaseTransform * btrans,
GstBuffer * inbuf);
static gboolean gst_alpha_color_set_info (GstVideoFilter * filter,
GstCaps * incaps, GstVideoInfo * in_info, GstCaps * outcaps,
GstVideoInfo * out_info);
static GstFlowReturn gst_alpha_color_transform_frame_ip (GstVideoFilter *
filter, GstVideoFrame * frame);
static void
gst_alpha_color_class_init (GstAlphaColorClass * klass)
......@@ -73,6 +75,7 @@ gst_alpha_color_class_init (GstAlphaColorClass * klass)
GstElementClass *gstelement_class = (GstElementClass *) klass;
GstBaseTransformClass *gstbasetransform_class =
(GstBaseTransformClass *) klass;
GstVideoFilterClass *gstvideofilter_class = (GstVideoFilterClass *) klass;
GST_DEBUG_CATEGORY_INIT (alpha_color_debug, "alphacolor", 0,
"ARGB<->AYUV colorspace conversion preserving the alpha channels");
......@@ -89,10 +92,10 @@ gst_alpha_color_class_init (GstAlphaColorClass * klass)
gstbasetransform_class->transform_caps =
GST_DEBUG_FUNCPTR (gst_alpha_color_transform_caps);
gstbasetransform_class->set_caps =
GST_DEBUG_FUNCPTR (gst_alpha_color_set_caps);
gstbasetransform_class->transform_ip =
GST_DEBUG_FUNCPTR (gst_alpha_color_transform_ip);
gstvideofilter_class->set_info = GST_DEBUG_FUNCPTR (gst_alpha_color_set_info);
gstvideofilter_class->transform_frame_ip =
GST_DEBUG_FUNCPTR (gst_alpha_color_transform_frame_ip);
}
static void
......@@ -471,32 +474,25 @@ transform_rgba_argb (GstVideoFrame * frame, const gint * matrix)
#define transform_bgra_abgr transform_rgba_argb
static gboolean
gst_alpha_color_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
GstCaps * outcaps)
gst_alpha_color_set_info (GstVideoFilter * filter, GstCaps * incaps,
GstVideoInfo * in_info, GstCaps * outcaps, GstVideoInfo * out_info)
{
GstAlphaColor *alpha = GST_ALPHA_COLOR (btrans);
gboolean ret;
GstVideoInfo in_info, out_info;
GstAlphaColor *alpha = GST_ALPHA_COLOR (filter);
gboolean in_sdtv, out_sdtv;
alpha->process = NULL;
alpha->matrix = NULL;
ret = gst_video_info_from_caps (&in_info, incaps);
ret &= gst_video_info_from_caps (&out_info, outcaps);
if (!ret)
goto invalid_caps;
if (GST_VIDEO_INFO_WIDTH (&in_info) != GST_VIDEO_INFO_WIDTH (&out_info) ||
GST_VIDEO_INFO_HEIGHT (&in_info) != GST_VIDEO_INFO_HEIGHT (&out_info))
if (GST_VIDEO_INFO_WIDTH (in_info) != GST_VIDEO_INFO_WIDTH (out_info) ||
GST_VIDEO_INFO_HEIGHT (in_info) != GST_VIDEO_INFO_HEIGHT (out_info))
goto invalid_caps;
in_sdtv = in_info.colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_BT601;
out_sdtv = out_info.colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_BT601;
in_sdtv = in_info->colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_BT601;
out_sdtv = out_info->colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_BT601;
switch (GST_VIDEO_INFO_FORMAT (&in_info)) {
switch (GST_VIDEO_INFO_FORMAT (in_info)) {
case GST_VIDEO_FORMAT_ARGB:
switch (GST_VIDEO_INFO_FORMAT (&out_info)) {
switch (GST_VIDEO_INFO_FORMAT (out_info)) {
case GST_VIDEO_FORMAT_ARGB:
alpha->process = NULL;
alpha->matrix = NULL;
......@@ -526,7 +522,7 @@ gst_alpha_color_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
}
break;
case GST_VIDEO_FORMAT_BGRA:
switch (GST_VIDEO_INFO_FORMAT (&out_info)) {
switch (GST_VIDEO_INFO_FORMAT (out_info)) {
case GST_VIDEO_FORMAT_BGRA:
alpha->process = NULL;
alpha->matrix = NULL;
......@@ -556,7 +552,7 @@ gst_alpha_color_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
}
break;
case GST_VIDEO_FORMAT_ABGR:
switch (GST_VIDEO_INFO_FORMAT (&out_info)) {
switch (GST_VIDEO_INFO_FORMAT (out_info)) {
case GST_VIDEO_FORMAT_ABGR:
alpha->process = NULL;
alpha->matrix = NULL;
......@@ -586,7 +582,7 @@ gst_alpha_color_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
}
break;
case GST_VIDEO_FORMAT_RGBA:
switch (GST_VIDEO_INFO_FORMAT (&out_info)) {
switch (GST_VIDEO_INFO_FORMAT (out_info)) {
case GST_VIDEO_FORMAT_RGBA:
alpha->process = NULL;
alpha->matrix = NULL;
......@@ -616,7 +612,7 @@ gst_alpha_color_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
}
break;
case GST_VIDEO_FORMAT_AYUV:
switch (GST_VIDEO_INFO_FORMAT (&out_info)) {
switch (GST_VIDEO_INFO_FORMAT (out_info)) {
case GST_VIDEO_FORMAT_AYUV:
if (in_sdtv == out_sdtv) {
alpha->process = transform_ayuv_ayuv;
......@@ -664,9 +660,9 @@ gst_alpha_color_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
break;
}
if (GST_VIDEO_INFO_FORMAT (&in_info) == GST_VIDEO_INFO_FORMAT (&out_info)
if (GST_VIDEO_INFO_FORMAT (in_info) == GST_VIDEO_INFO_FORMAT (out_info)
&& in_sdtv == out_sdtv)
gst_base_transform_set_passthrough (btrans, TRUE);
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (filter), TRUE);
else if (!alpha->process)
goto no_process;
......@@ -686,24 +682,19 @@ no_process:
}
static GstFlowReturn
gst_alpha_color_transform_ip (GstBaseTransform * btrans, GstBuffer * inbuf)
gst_alpha_color_transform_frame_ip (GstVideoFilter * filter,
GstVideoFrame * frame)
{
GstAlphaColor *alpha = GST_ALPHA_COLOR (btrans);
GstVideoFrame frame;
GstAlphaColor *alpha = GST_ALPHA_COLOR (filter);
if (gst_base_transform_is_passthrough (btrans))
if (gst_base_transform_is_passthrough (GST_BASE_TRANSFORM (filter)))
return GST_FLOW_OK;
if (G_UNLIKELY (!alpha->process))
goto not_negotiated;
if (!gst_video_frame_map (&frame, &alpha->in_info, inbuf, GST_MAP_READWRITE))
goto invalid_buffer;
/* Transform in place */
alpha->process (&frame, alpha->matrix);
gst_video_frame_unmap (&frame);
alpha->process (frame, alpha->matrix);
return GST_FLOW_OK;
......@@ -713,11 +704,6 @@ not_negotiated:
GST_ERROR_OBJECT (alpha, "Not negotiated yet");
return GST_FLOW_NOT_NEGOTIATED;
}
invalid_buffer:
{
GST_ERROR_OBJECT (alpha, "Invalid buffer received");
return GST_FLOW_ERROR;
}
}
static gboolean
......
......@@ -42,10 +42,8 @@ struct _GstAlphaColor
GstVideoFilter parent;
/*< private >*/
/* caps */
GstVideoInfo in_info, out_info;
void (*process) (GstVideoFrame * frame, const gint * matrix);
const gint *matrix;
};
......
......@@ -55,19 +55,22 @@ G_DEFINE_TYPE (GstNavigationtest, gst_navigationtest, GST_TYPE_VIDEO_FILTER);
static gboolean
gst_navigationtest_src_event (GstBaseTransform * trans, GstEvent * event)
{
GstVideoInfo *info;
GstNavigationtest *navtest;
const gchar *type;
navtest = GST_NAVIGATIONTEST (trans);
info = &GST_VIDEO_FILTER (trans)->in_info;
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_NAVIGATION:
{
const GstStructure *s = gst_event_get_structure (event);
gint fps_n, fps_d;
fps_n = GST_VIDEO_INFO_FPS_N (&navtest->info);
fps_d = GST_VIDEO_INFO_FPS_D (&navtest->info);
fps_n = GST_VIDEO_INFO_FPS_N (info);
fps_d = GST_VIDEO_INFO_FPS_D (info);
type = gst_structure_get_string (s, "event");
if (g_str_equal (type, "mouse-move")) {
......@@ -115,53 +118,6 @@ gst_navigationtest_src_event (GstBaseTransform * trans, GstEvent * event)
#define GST_VIDEO_I420_SIZE(w,h) (GST_VIDEO_I420_V_OFFSET(w,h)+(GST_VIDEO_I420_V_ROWSTRIDE(w)*GST_ROUND_UP_2(h)/2))
static gboolean
gst_navigationtest_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
gsize * size)
{
GstNavigationtest *navtest;
GstStructure *structure;
gboolean ret = FALSE;
gint width, height;
navtest = GST_NAVIGATIONTEST (btrans);
structure = gst_caps_get_structure (caps, 0);
if (gst_structure_get_int (structure, "width", &width) &&
gst_structure_get_int (structure, "height", &height)) {
*size = GST_VIDEO_I420_SIZE (width, height);
ret = TRUE;
GST_DEBUG_OBJECT (navtest,
"our frame size is %" G_GSIZE_FORMAT " bytes (%dx%d)", *size, width,
height);
}
return ret;
}
static gboolean
gst_navigationtest_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
GstCaps * outcaps)
{
GstNavigationtest *navtest = GST_NAVIGATIONTEST (btrans);
GstVideoInfo info;
if (!gst_video_info_from_caps (&info, incaps))
goto invalid_caps;
navtest->info = info;
return TRUE;
/* ERRORS */
invalid_caps:
{
GST_ERROR_OBJECT (navtest, "invalid caps");
return FALSE;
}
}
static void
draw_box_planar411 (GstVideoFrame * frame, int x, int y,
guint8 colory, guint8 coloru, guint8 colorv)
......@@ -215,53 +171,30 @@ draw_box_planar411 (GstVideoFrame * frame, int x, int y,
}
static GstFlowReturn
gst_navigationtest_transform (GstBaseTransform * trans, GstBuffer * in,
GstBuffer * out)
gst_navigationtest_transform_frame (GstVideoFilter * filter,
GstVideoFrame * in_frame, GstVideoFrame * out_frame)
{
GstNavigationtest *navtest = GST_NAVIGATIONTEST (trans);
GstNavigationtest *navtest = GST_NAVIGATIONTEST (filter);
GSList *walk;
GstVideoFrame in_frame, out_frame;
if (!gst_video_frame_map (&in_frame, &navtest->info, in, GST_MAP_READ))
goto invalid_in;
if (!gst_video_frame_map (&out_frame, &navtest->info, out, GST_MAP_WRITE))
goto invalid_out;
gst_video_frame_copy (&out_frame, &in_frame);
gst_video_frame_copy (out_frame, in_frame);
walk = navtest->clicks;
while (walk) {
ButtonClick *click = walk->data;
walk = g_slist_next (walk);
draw_box_planar411 (&out_frame,
draw_box_planar411 (out_frame,
rint (click->x), rint (click->y), click->cy, click->cu, click->cv);
if (--click->images_left < 1) {
navtest->clicks = g_slist_remove (navtest->clicks, click);
g_free (click);
}
}
draw_box_planar411 (&out_frame,
draw_box_planar411 (out_frame,
rint (navtest->x), rint (navtest->y), 0, 128, 128);
gst_video_frame_unmap (&out_frame);
gst_video_frame_unmap (&in_frame);
return GST_FLOW_OK;
/* ERRORS */
invalid_in:
{
GST_ERROR_OBJECT (navtest, "received invalid input buffer");
return GST_FLOW_OK;
}
invalid_out:
{
GST_ERROR_OBJECT (navtest, "received invalid output buffer");
gst_video_frame_unmap (&in_frame);
return GST_FLOW_OK;
}
}
static GstStateChangeReturn
......@@ -295,11 +228,11 @@ gst_navigationtest_class_init (GstNavigationtestClass * klass)
{
GstElementClass *element_class;
GstBaseTransformClass *trans_class;
GstVideoFilterClass *vfilter_class;
element_class = (GstElementClass *) klass;
trans_class = (GstBaseTransformClass *) klass;
parent_class = g_type_class_peek_parent (klass);
vfilter_class = (GstVideoFilterClass *) klass;
element_class->change_state =
GST_DEBUG_FUNCPTR (gst_navigationtest_change_state);
......@@ -314,11 +247,10 @@ gst_navigationtest_class_init (GstNavigationtestClass * klass)
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_navigationtest_src_template));
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_navigationtest_set_caps);
trans_class->get_unit_size =
GST_DEBUG_FUNCPTR (gst_navigationtest_get_unit_size);
trans_class->transform = GST_DEBUG_FUNCPTR (gst_navigationtest_transform);
trans_class->src_event = GST_DEBUG_FUNCPTR (gst_navigationtest_src_event);
vfilter_class->transform_frame =
GST_DEBUG_FUNCPTR (gst_navigationtest_transform_frame);
}
static void
......
......@@ -50,8 +50,6 @@ struct _GstNavigationtest
{
GstVideoFilter videofilter;
GstVideoInfo info;
gdouble x, y;
GSList *clicks;
};
......
......@@ -87,28 +87,6 @@ GST_STATIC_PAD_TEMPLATE ("sink",
G_DEFINE_TYPE (GstAgingTV, gst_agingtv, GST_TYPE_VIDEO_FILTER);
static gboolean
gst_agingtv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
GstCaps * outcaps)
{
GstAgingTV *filter = GST_AGINGTV (btrans);
GstVideoInfo info;
if (!gst_video_info_from_caps (&info, incaps))
goto invalid_caps;
filter->info = info;
return TRUE;
/* ERRORS */
invalid_caps:
{
GST_ERROR_OBJECT (filter, "could not parse caps");
return GST_FLOW_ERROR;
}
}
static void
coloraging (guint32 * src, guint32 * dest, gint video_area, gint * c)
{
......@@ -321,19 +299,19 @@ gst_agingtv_start (GstBaseTransform * trans)
}
static GstFlowReturn
gst_agingtv_transform (GstBaseTransform * trans, GstBuffer * in,