Commit 2ea4f5b3 authored by Julien Moutte Moutte's avatar Julien Moutte Moutte

VideoFilter inherits from

Original commit message from CVS:
2005-11-23  Julien MOUTTE  <julien@moutte.net>

* ext/cairo/gsttimeoverlay.c:
(gst_timeoverlay_update_font_height),
(gst_timeoverlay_set_caps), (gst_timeoverlay_get_unit_size),
(gst_timeoverlay_transform), (gst_timeoverlay_base_init),
(gst_timeoverlay_class_init), (gst_timeoverlay_init),
(gst_timeoverlay_get_type):
* ext/cairo/gsttimeoverlay.h:
* gst/debug/Makefile.am:
* gst/debug/gstnavigationtest.c:
(gst_navigationtest_handle_src_event),
(gst_navigationtest_get_unit_size),
(gst_navigationtest_set_caps),
(gst_navigationtest_transform),
(gst_navigationtest_change_state),
(gst_navigationtest_base_init), (gst_navigationtest_class_init),
(gst_navigationtest_init), (gst_navigationtest_get_type),
(plugin_init):
* gst/debug/gstnavigationtest.h:
* gst/effectv/Makefile.am:
* gst/effectv/gstaging.c: (gst_agingtv_set_caps),
(gst_agingtv_get_unit_size), (gst_agingtv_transform),
(gst_agingtv_base_init), (gst_agingtv_class_init),
(gst_agingtv_init), (gst_agingtv_get_type):
* gst/effectv/gstdice.c: (gst_dicetv_set_caps),
(gst_dicetv_get_unit_size), (gst_dicetv_transform),
(gst_dicetv_base_init), (gst_dicetv_class_init),
(gst_dicetv_init),
(gst_dicetv_get_type):
* gst/effectv/gstedge.c: (gst_edgetv_set_caps),
(gst_edgetv_get_unit_size), (gst_edgetv_transform),
(gst_edgetv_base_init), (gst_edgetv_class_init),
(gst_edgetv_init),
(gst_edgetv_get_type):
* gst/effectv/gsteffectv.c:
* gst/effectv/gsteffectv.h:
* gst/effectv/gstquark.c: (gst_quarktv_set_caps),
(gst_quarktv_get_unit_size), (fastrand),
(gst_quarktv_transform),
(gst_quarktv_change_state), (gst_quarktv_base_init),
(gst_quarktv_class_init), (gst_quarktv_init),
(gst_quarktv_get_type):
* gst/effectv/gstrev.c: (gst_revtv_set_caps),
(gst_revtv_get_unit_size), (gst_revtv_transform),
(gst_revtv_base_init), (gst_revtv_class_init), (gst_revtv_init),
(gst_revtv_get_type):
* gst/effectv/gstshagadelic.c: (gst_shagadelictv_set_caps),
(gst_shagadelictv_get_unit_size), (gst_shagadelictv_transform),
(gst_shagadelictv_base_init), (gst_shagadelictv_class_init),
(gst_shagadelictv_init), (gst_shagadelictv_get_type):
* gst/effectv/gstvertigo.c: (gst_vertigotv_set_caps),
(gst_vertigotv_get_unit_size), (gst_vertigotv_transform),
(gst_vertigotv_base_init), (gst_vertigotv_class_init),
(gst_vertigotv_init), (gst_vertigotv_get_type):
* gst/effectv/gstwarp.c: (gst_warptv_set_caps),
(gst_warptv_get_unit_size), (gst_warptv_transform),
(gst_warptv_base_init), (gst_warptv_class_init),
(gst_warptv_init),
(gst_warptv_get_type):
* gst/videofilter/Makefile.am:
* gst/videofilter/gstvideobalance.c:
* gst/videofilter/gstvideobalance.h:
* gst/videofilter/gstvideofilter.c: (gst_videofilter_get_type),
(gst_videofilter_class_init), (gst_videofilter_init):
* gst/videofilter/gstvideofilter.h:
* gst/videofilter/gstvideoflip.c: (gst_videoflip_set_caps),
(gst_videoflip_transform_caps), (gst_videoflip_get_unit_size),
(gst_videoflip_flip), (gst_videoflip_transform),
(gst_videoflip_handle_src_event), (gst_videoflip_set_property),
(gst_videoflip_base_init), (gst_videoflip_class_init),
(gst_videoflip_init), (plugin_init), (gst_videoflip_get_type):
* gst/videofilter/gstvideoflip.h: VideoFilter inherits from
BaseTransform, it's just a place holder for now and every video
effect plugin has been ported to use BaseTransform features
directly. QuarkTV was fixed too (was broken), navigationtest
works
and best for the end, videoflip converts navigation events
depending
on flip method ! Fixes #320953
parent 48520a45
2005-11-23 Julien MOUTTE <julien@moutte.net>
* ext/cairo/gsttimeoverlay.c: (gst_timeoverlay_update_font_height),
(gst_timeoverlay_set_caps), (gst_timeoverlay_get_unit_size),
(gst_timeoverlay_transform), (gst_timeoverlay_base_init),
(gst_timeoverlay_class_init), (gst_timeoverlay_init),
(gst_timeoverlay_get_type):
* ext/cairo/gsttimeoverlay.h:
* gst/debug/Makefile.am:
* gst/debug/gstnavigationtest.c:
(gst_navigationtest_handle_src_event),
(gst_navigationtest_get_unit_size), (gst_navigationtest_set_caps),
(gst_navigationtest_transform), (gst_navigationtest_change_state),
(gst_navigationtest_base_init), (gst_navigationtest_class_init),
(gst_navigationtest_init), (gst_navigationtest_get_type),
(plugin_init):
* gst/debug/gstnavigationtest.h:
* gst/effectv/Makefile.am:
* gst/effectv/gstaging.c: (gst_agingtv_set_caps),
(gst_agingtv_get_unit_size), (gst_agingtv_transform),
(gst_agingtv_base_init), (gst_agingtv_class_init),
(gst_agingtv_init), (gst_agingtv_get_type):
* gst/effectv/gstdice.c: (gst_dicetv_set_caps),
(gst_dicetv_get_unit_size), (gst_dicetv_transform),
(gst_dicetv_base_init), (gst_dicetv_class_init), (gst_dicetv_init),
(gst_dicetv_get_type):
* gst/effectv/gstedge.c: (gst_edgetv_set_caps),
(gst_edgetv_get_unit_size), (gst_edgetv_transform),
(gst_edgetv_base_init), (gst_edgetv_class_init), (gst_edgetv_init),
(gst_edgetv_get_type):
* gst/effectv/gsteffectv.c:
* gst/effectv/gsteffectv.h:
* gst/effectv/gstquark.c: (gst_quarktv_set_caps),
(gst_quarktv_get_unit_size), (fastrand), (gst_quarktv_transform),
(gst_quarktv_change_state), (gst_quarktv_base_init),
(gst_quarktv_class_init), (gst_quarktv_init),
(gst_quarktv_get_type):
* gst/effectv/gstrev.c: (gst_revtv_set_caps),
(gst_revtv_get_unit_size), (gst_revtv_transform),
(gst_revtv_base_init), (gst_revtv_class_init), (gst_revtv_init),
(gst_revtv_get_type):
* gst/effectv/gstshagadelic.c: (gst_shagadelictv_set_caps),
(gst_shagadelictv_get_unit_size), (gst_shagadelictv_transform),
(gst_shagadelictv_base_init), (gst_shagadelictv_class_init),
(gst_shagadelictv_init), (gst_shagadelictv_get_type):
* gst/effectv/gstvertigo.c: (gst_vertigotv_set_caps),
(gst_vertigotv_get_unit_size), (gst_vertigotv_transform),
(gst_vertigotv_base_init), (gst_vertigotv_class_init),
(gst_vertigotv_init), (gst_vertigotv_get_type):
* gst/effectv/gstwarp.c: (gst_warptv_set_caps),
(gst_warptv_get_unit_size), (gst_warptv_transform),
(gst_warptv_base_init), (gst_warptv_class_init), (gst_warptv_init),
(gst_warptv_get_type):
* gst/videofilter/Makefile.am:
* gst/videofilter/gstvideobalance.c:
* gst/videofilter/gstvideobalance.h:
* gst/videofilter/gstvideofilter.c: (gst_videofilter_get_type),
(gst_videofilter_class_init), (gst_videofilter_init):
* gst/videofilter/gstvideofilter.h:
* gst/videofilter/gstvideoflip.c: (gst_videoflip_set_caps),
(gst_videoflip_transform_caps), (gst_videoflip_get_unit_size),
(gst_videoflip_flip), (gst_videoflip_transform),
(gst_videoflip_handle_src_event), (gst_videoflip_set_property),
(gst_videoflip_base_init), (gst_videoflip_class_init),
(gst_videoflip_init), (plugin_init), (gst_videoflip_get_type):
* gst/videofilter/gstvideoflip.h: VideoFilter inherits from
BaseTransform, it's just a place holder for now and every video
effect plugin has been ported to use BaseTransform features
directly. QuarkTV was fixed too (was broken), navigationtest works
and best for the end, videoflip converts navigation events depending
on flip method ! Fixes #320953
2005-11-23 Jan Schmidt <thaytan@mad.scientist.com>
* ext/aalib/gstaasink.c: (gst_aasink_fixate):
......
This diff is collapsed.
......@@ -21,13 +21,11 @@
#ifndef __GST_TIMEOVERLAY_H__
#define __GST_TIMEOVERLAY_H__
#include <gst/gst.h>
#include <cairo.h>
#include "gstvideofilter.h"
G_BEGIN_DECLS
#define GST_TYPE_TIMEOVERLAY \
......@@ -47,6 +45,8 @@ typedef struct _GstTimeoverlayClass GstTimeoverlayClass;
struct _GstTimeoverlay {
GstVideofilter videofilter;
gint width, height;
cairo_surface_t *surface;
cairo_t *cr;
int text_height;
......@@ -62,4 +62,3 @@ GType gst_timeoverlay_get_type(void);
G_END_DECLS
#endif /* __GST_TIMEOVERLAY_H__ */
......@@ -14,8 +14,12 @@ libgstefence_la_LIBADD = $(GST_LIBS)
libgstefence_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstnavigationtest_la_SOURCES = gstnavigationtest.c
libgstnavigationtest_la_CFLAGS = $(GST_CFLAGS) -I$(top_srcdir)/gst/videofilter
libgstnavigationtest_la_LIBADD = $(GST_LIBS) $(top_builddir)/gst/videofilter/libgstvideofilter-@GST_MAJORMINOR@.la
libgstnavigationtest_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
-I$(top_srcdir)/gst/videofilter
libgstnavigationtest_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) \
$(GST_PLUGINS_BASE_LIBS) \
$(top_builddir)/gst/videofilter/libgstvideofilter-@GST_MAJORMINOR@.la
libgstnavigationtest_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstdebug_la_SOURCES = \
......
This diff is collapsed.
......@@ -21,12 +21,8 @@
#ifndef __GST_NAVIGATIONTEST_H__
#define __GST_NAVIGATIONTEST_H__
#include <gst/gst.h>
#include "gstvideofilter.h"
G_BEGIN_DECLS
#define GST_TYPE_NAVIGATIONTEST \
......@@ -43,11 +39,21 @@ G_BEGIN_DECLS
typedef struct _GstNavigationtest GstNavigationtest;
typedef struct _GstNavigationtestClass GstNavigationtestClass;
typedef struct
{
gdouble x;
gdouble y;
gint images_left;
guint8 cy, cu, cv;
} ButtonClick;
struct _GstNavigationtest {
GstVideofilter videofilter;
double x;
double y;
gint width, height;
GValue framerate;
gdouble x, y;
GSList *clicks;
};
......@@ -61,4 +67,3 @@ GType gst_navigationtest_get_type(void);
G_END_DECLS
#endif /* __GST_NAVIGATIONTEST_H__ */
......@@ -5,10 +5,12 @@ libgsteffectv_la_SOURCES = \
gstshagadelic.c gstvertigo.c gstrev.c gstquark.c
libgsteffectv_la_CFLAGS = \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \
$(GST_CFLAGS) \
-I$(top_srcdir)/gst/videofilter
libgsteffectv_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) \
$(GST_BASE_LIBS) \
$(GST_LIBS) \
$(top_builddir)/gst/videofilter/libgstvideofilter-@GST_MAJORMINOR@.la
libgsteffectv_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
......
......@@ -37,11 +37,13 @@
#include "config.h"
#endif
#include <gst/gst.h>
#include <gstvideofilter.h>
#include <string.h>
#include <math.h>
#include <gst/video/video.h>
#define GST_TYPE_AGINGTV \
(gst_agingtv_get_type())
#define GST_AGINGTV(obj) \
......@@ -89,128 +91,69 @@ struct _GstAgingTVClass
GstVideofilterClass parent_class;
};
/* GstAgingTV signals and args */
enum
{
/* FILL ME */
LAST_SIGNAL
};
enum
{
ARG_0
/* FILL ME */
};
GType gst_agingtv_get_type (void);
static void gst_agingtv_base_init (gpointer g_class);
static void gst_agingtv_class_init (gpointer g_class, gpointer class_data);
static void gst_agingtv_init (GTypeInstance * instance, gpointer g_class);
static void gst_agingtv_setup (GstVideofilter * videofilter);
static GstElementDetails agingtv_details = GST_ELEMENT_DETAILS ("AgingTV",
"Filter/Effect/Video",
"AgingTV adds age to video input using scratches and dust",
"Sam Lantinga <slouken@devolution.com>");
static void gst_agingtv_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_agingtv_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void gst_agingtv_rgb32 (GstVideofilter * videofilter, void *d, void *s);
static GstStaticPadTemplate gst_agingtv_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx)
);
GType
gst_agingtv_get_type (void)
{
static GType agingtv_type = 0;
static GstStaticPadTemplate gst_agingtv_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx)
);
if (!agingtv_type) {
static const GTypeInfo agingtv_info = {
sizeof (GstAgingTVClass),
gst_agingtv_base_init,
NULL,
gst_agingtv_class_init,
NULL,
NULL,
sizeof (GstAgingTV),
0,
gst_agingtv_init,
};
static GstVideofilterClass *parent_class = NULL;
agingtv_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
"GstAgingTV", &agingtv_info, 0);
}
return agingtv_type;
}
static GstVideofilterFormat gst_agingtv_formats[] = {
{"RGB ", 32, gst_agingtv_rgb32, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000,
0xff000000}
};
static void
gst_agingtv_base_init (gpointer g_class)
static gboolean
gst_agingtv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
GstCaps * outcaps)
{
static GstElementDetails agingtv_details = GST_ELEMENT_DETAILS ("AgingTV",
"Filter/Effect/Video",
"AgingTV adds age to video input using scratches and dust",
"Sam Lantinga <slouken@devolution.com>");
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstVideofilterClass *videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
int i;
GstAgingTV *filter = GST_AGINGTV (btrans);
GstStructure *structure;
gboolean ret = FALSE;
gst_element_class_set_details (element_class, &agingtv_details);
structure = gst_caps_get_structure (incaps, 0);
for (i = 0; i < G_N_ELEMENTS (gst_agingtv_formats); i++) {
gst_videofilter_class_add_format (videofilter_class,
gst_agingtv_formats + i);
if (gst_structure_get_int (structure, "width", &filter->width) &&
gst_structure_get_int (structure, "height", &filter->height)) {
ret = TRUE;
}
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
return ret;
}
static void
gst_agingtv_class_init (gpointer g_class, gpointer class_data)
{
GObjectClass *gobject_class;
GstVideofilterClass *videofilter_class;
gobject_class = G_OBJECT_CLASS (g_class);
videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
gobject_class->set_property = gst_agingtv_set_property;
gobject_class->get_property = gst_agingtv_get_property;
#if 0
g_object_class_install_property (gobject_class, ARG_METHOD,
g_param_spec_enum ("method", "method", "method",
GST_TYPE_AGINGTV_METHOD, GST_AGINGTV_METHOD_1, G_PARAM_READWRITE));
#endif
videofilter_class->setup = gst_agingtv_setup;
}
static void
gst_agingtv_init (GTypeInstance * instance, gpointer g_class)
static gboolean
gst_agingtv_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
guint * size)
{
GstAgingTV *agingtv = GST_AGINGTV (instance);
GstVideofilter *videofilter;
GST_DEBUG ("gst_agingtv_init");
videofilter = GST_VIDEOFILTER (agingtv);
/* do stuff */
}
GstAgingTV *filter;
GstStructure *structure;
gboolean ret = FALSE;
gint width, height;
static void
gst_agingtv_setup (GstVideofilter * videofilter)
{
GstAgingTV *agingtv;
int width = gst_videofilter_get_input_width (videofilter);
int height = gst_videofilter_get_input_height (videofilter);
filter = GST_AGINGTV (btrans);
g_return_if_fail (GST_IS_AGINGTV (videofilter));
agingtv = GST_AGINGTV (videofilter);
structure = gst_caps_get_structure (caps, 0);
/* if any setup needs to be done, do it here */
if (gst_structure_get_int (structure, "width", &width) &&
gst_structure_get_int (structure, "height", &height)) {
*size = width * height * 32 / 8;
ret = TRUE;
GST_DEBUG_OBJECT (filter, "our frame size is %d bytes (%dx%d)", *size,
width, height);
}
agingtv->width = width;
agingtv->height = height;
return ret;
}
static unsigned int
......@@ -359,69 +302,89 @@ pits (guint32 * dest, gint width, gint height, gint area_scale,
}
}
static void
gst_agingtv_rgb32 (GstVideofilter * videofilter, void *d, void *s)
static GstFlowReturn
gst_agingtv_transform (GstBaseTransform * trans, GstBuffer * in,
GstBuffer * out)
{
GstAgingTV *agingtv;
int width = gst_videofilter_get_input_width (videofilter);
int height = gst_videofilter_get_input_height (videofilter);
GstAgingTV *agingtv = GST_AGINGTV (trans);
gint width = agingtv->width;
gint height = agingtv->height;
int video_size = width * height;
guint32 *src = s;
guint32 *dest = d;
guint32 *src = (guint32 *) GST_BUFFER_DATA (in);
guint32 *dest = (guint32 *) GST_BUFFER_DATA (out);
gint area_scale = width * height / 64 / 480;
GstFlowReturn ret = GST_FLOW_OK;
gst_buffer_stamp (out, in);
if (area_scale <= 0)
area_scale = 1;
g_return_if_fail (GST_IS_AGINGTV (videofilter));
agingtv = GST_AGINGTV (videofilter);
coloraging (src, dest, video_size);
scratching (agingtv->scratches, agingtv->scratch_lines, dest, width, height);
pits (dest, width, height, area_scale, agingtv->pits_interval);
if (area_scale > 1)
dusts (dest, width, height, agingtv->dust_interval, area_scale);
return ret;
}
static void
gst_agingtv_set_property (GObject * object, guint prop_id, const GValue * value,
GParamSpec * pspec)
gst_agingtv_base_init (gpointer g_class)
{
GstAgingTV *src;
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
g_return_if_fail (GST_IS_AGINGTV (object));
src = GST_AGINGTV (object);
gst_element_class_set_details (element_class, &agingtv_details);
GST_DEBUG ("gst_agingtv_set_property");
switch (prop_id) {
#if 0
case ARG_METHOD:
src->method = g_value_get_enum (value);
break;
#endif
default:
break;
}
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_agingtv_sink_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_agingtv_src_template));
}
static void
gst_agingtv_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
gst_agingtv_class_init (gpointer klass, gpointer class_data)
{
GstAgingTV *src;
GObjectClass *gobject_class;
GstElementClass *element_class;
GstBaseTransformClass *trans_class;
g_return_if_fail (GST_IS_AGINGTV (object));
src = GST_AGINGTV (object);
gobject_class = (GObjectClass *) klass;
element_class = (GstElementClass *) klass;
trans_class = (GstBaseTransformClass *) klass;
switch (prop_id) {
#if 0
case ARG_METHOD:
g_value_set_enum (value, src->method);
break;
#endif
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
parent_class = g_type_class_peek_parent (klass);
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_agingtv_set_caps);
trans_class->get_unit_size = GST_DEBUG_FUNCPTR (gst_agingtv_get_unit_size);
trans_class->transform = GST_DEBUG_FUNCPTR (gst_agingtv_transform);
}
static void
gst_agingtv_init (GTypeInstance * instance, gpointer g_class)
{
}
GType
gst_agingtv_get_type (void)
{
static GType agingtv_type = 0;
if (!agingtv_type) {
static const GTypeInfo agingtv_info = {
sizeof (GstAgingTVClass),
gst_agingtv_base_init,
NULL,
gst_agingtv_class_init,
NULL,
NULL,
sizeof (GstAgingTV),
0,
gst_agingtv_init,
};
agingtv_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
"GstAgingTV", &agingtv_info, 0);
}
return agingtv_type;
}
This diff is collapsed.
......@@ -24,10 +24,13 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include <gst/gst.h>
#include <gstvideofilter.h>
#include <string.h>
#include <gst/video/video.h>
#define GST_TYPE_EDGETV \
(gst_edgetv_get_type())
#define GST_EDGETV(obj) \
......@@ -57,146 +60,97 @@ struct _GstEdgeTVClass
GstVideofilterClass parent_class;
};
/* Filter signals and args */
enum
{
/* FILL ME */
LAST_SIGNAL
};
GType gst_edgetv_get_type (void);
enum
{
ARG_0
};
static void gst_edgetv_base_init (gpointer g_class);
static void gst_edgetv_class_init (gpointer g_class, gpointer class_data);
static void gst_edgetv_init (GTypeInstance * instance, gpointer g_class);
static GstElementDetails gst_edgetv_details = GST_ELEMENT_DETAILS ("EdgeTV",
"Filter/Effect/Video",
"Apply edge detect on video",
"Wim Taymans <wim.taymans@chello.be>");
static void gst_edgetv_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_edgetv_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstStaticPadTemplate gst_edgetv_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx)
);
static void gst_edgetv_setup (GstVideofilter * videofilter);
static void gst_edgetv_rgb32 (GstVideofilter * videofilter, void *d, void *s);
static GstStaticPadTemplate gst_edgetv_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx)
);
/*static guint gst_edgetv_signals[LAST_SIGNAL] = { 0 }; */
static GstVideofilterClass *parent_class = NULL;
GType
gst_edgetv_get_type (void)
static gboolean
gst_edgetv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
GstCaps * outcaps)
{
static GType edgetv_type = 0;
if (!edgetv_type) {
static const GTypeInfo edgetv_info = {
sizeof (GstEdgeTVClass),
gst_edgetv_base_init,
NULL,
(GClassInitFunc) gst_edgetv_class_init,
NULL,
NULL,
sizeof (GstEdgeTV),
0,
(GInstanceInitFunc) gst_edgetv_init,
};
edgetv_type =
g_type_register_static (GST_TYPE_VIDEOFILTER, "GstEdgeTV", &edgetv_info,
0);
GstEdgeTV *edgetv = GST_EDGETV (btrans);
GstStructure *structure;
gboolean ret = FALSE;
structure = gst_caps_get_structure (incaps, 0);
if (gst_structure_get_int (structure, "width", &edgetv->width) &&
gst_structure_get_int (structure, "height", &edgetv->height)) {
edgetv->map_width = edgetv->width / 4;
edgetv->map_height = edgetv->height / 4;
edgetv->video_width_margin = edgetv->width % 4;
g_free (edgetv->map);
edgetv->map =
(guint32 *) g_malloc (edgetv->map_width * edgetv->map_height *
sizeof (guint32) * 2);
memset (edgetv->map, 0,
edgetv->map_width * edgetv->map_height * sizeof (guint32) * 2);
ret = TRUE;
}
return edgetv_type;
}
static GstVideofilterFormat gst_edgetv_formats[] = {
{"RGB ", 32, gst_edgetv_rgb32, 24, G_BIG_ENDIAN, 0x0000ff00, 0x00ff0000,
0xff000000}
};
static void
gst_edgetv_base_init (gpointer g_class)
{
/* elementfactory information */
static GstElementDetails gst_edgetv_details = GST_ELEMENT_DETAILS ("EdgeTV",
"Filter/Effect/Video",
"Apply edge detect on video",
"Wim Taymans <wim.taymans@chello.be>");
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstVideofilterClass *videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
int i;
gst_element_class_set_details (element_class, &gst_edgetv_details);
for (i = 0; i < G_N_ELEMENTS (gst_edgetv_formats); i++) {
gst_videofilter_class_add_format (videofilter_class,
gst_edgetv_formats + i);
}
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
return ret;
}
static void
gst_edgetv_class_init (gpointer g_class, gpointer class_data)
static gboolean
gst_edgetv_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
guint * size)
{
GObjectClass *gobject_class;
GstVideofilterClass *videofilter_class;
gobject_class = G_OBJECT_CLASS (g_class);
videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
GstEdgeTV *filter;
GstStructure *structure;
gboolean ret = FALSE;
gint width, height;
gobject_class->set_property = gst_edgetv_set_property;
gobject_class->get_property = gst_edgetv_get_property;
filter = GST_EDGETV (btrans);
videofilter_class->setup = gst_edgetv_setup;
}
structure = gst_caps_get_structure (caps, 0);
static void
gst_edgetv_init (GTypeInstance * instance, gpointer g_class)
{
GstEdgeTV *edgetv = GST_EDGETV (instance);
if (gst_structure_get_int (structure, "width", &width) &&
gst_structure_get_int (structure, "height", &height)) {
*size = width * height * 32 / 8;
ret = TRUE;
GST_DEBUG_OBJECT (filter, "our frame size is %d bytes (%dx%d)", *size,
width, height);
}
edgetv->map = NULL;
return ret;
}
static void
gst_edgetv_setup (GstVideofilter * videofilter)
{
GstEdgeTV *edgetv;
int width = gst_videofilter_get_input_width (videofilter);
int height = gst_videofilter_get_input_height (videofilter);
g_return_if_fail (GST_IS_EDGETV (videofilter));
edgetv = GST_EDGETV (videofilter);