mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 04:31:06 +00:00
quarktv: Clean up the quarktv element
This commit is contained in:
parent
b3bb4fa7ef
commit
c116c301af
1 changed files with 32 additions and 79 deletions
|
@ -1,8 +1,11 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* Copyright (C) <2009> Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||
*
|
||||
* EffecTV:
|
||||
* Copyright (C) 2001 FUKUCHI Kentarou
|
||||
* Copyright (C) 2001-2002 FUKUCHI Kentarou
|
||||
*
|
||||
* QuarkTV - motion disolver.
|
||||
*
|
||||
* EffecTV is free software. This library is free software;
|
||||
* you can redistribute it and/or
|
||||
|
@ -68,20 +71,15 @@ struct _GstQuarkTVClass
|
|||
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
ARG_PLANES
|
||||
PROP_0,
|
||||
PROP_PLANES
|
||||
};
|
||||
|
||||
GType gst_quarktv_get_type (void);
|
||||
GST_BOILERPLATE (GstQuarkTV, gst_quarktv, GstVideoFilter,
|
||||
GST_TYPE_VIDEO_FILTER);
|
||||
|
||||
static void gst_quarktv_planetable_clear (GstQuarkTV * filter);
|
||||
|
||||
static const GstElementDetails quarktv_details =
|
||||
GST_ELEMENT_DETAILS ("QuarkTV effect",
|
||||
"Filter/Effect/Video",
|
||||
"Motion dissolver",
|
||||
"FUKUCHI, Kentarou <fukuchi@users.sourceforge.net>");
|
||||
|
||||
static GstStaticPadTemplate gst_quarktv_src_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
|
@ -96,8 +94,6 @@ static GstStaticPadTemplate gst_quarktv_sink_template =
|
|||
GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx "; " GST_VIDEO_CAPS_RGBx)
|
||||
);
|
||||
|
||||
static GstVideoFilterClass *parent_class = NULL;
|
||||
|
||||
static gboolean
|
||||
gst_quarktv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||
GstCaps * outcaps)
|
||||
|
@ -122,13 +118,11 @@ static gboolean
|
|||
gst_quarktv_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
|
||||
guint * size)
|
||||
{
|
||||
GstQuarkTV *filter;
|
||||
GstQuarkTV *filter = GST_QUARKTV (btrans);
|
||||
GstStructure *structure;
|
||||
gboolean ret = FALSE;
|
||||
gint width, height;
|
||||
|
||||
filter = GST_QUARKTV (btrans);
|
||||
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
|
||||
if (gst_structure_get_int (structure, "width", &width) &&
|
||||
|
@ -142,10 +136,10 @@ gst_quarktv_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static inline guint32
|
||||
static inline guint
|
||||
fastrand (void)
|
||||
{
|
||||
static unsigned int fastrand_val;
|
||||
static guint fastrand_val;
|
||||
|
||||
return (fastrand_val = fastrand_val * 1103515245 + 12345);
|
||||
}
|
||||
|
@ -154,15 +148,11 @@ static GstFlowReturn
|
|||
gst_quarktv_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||
GstBuffer * out)
|
||||
{
|
||||
GstQuarkTV *filter;
|
||||
GstQuarkTV *filter = GST_QUARKTV (trans);
|
||||
gint area;
|
||||
guint32 *dest;
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
|
||||
filter = GST_QUARKTV (trans);
|
||||
|
||||
gst_buffer_copy_metadata (out, in, GST_BUFFER_COPY_TIMESTAMPS);
|
||||
|
||||
area = filter->area;
|
||||
dest = (guint32 *) GST_BUFFER_DATA (out);
|
||||
|
||||
|
@ -218,11 +208,9 @@ gst_quarktv_change_state (GstElement * element, GstStateChange transition)
|
|||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||
{
|
||||
filter->planetable =
|
||||
(GstBuffer **) g_malloc0 (filter->planes * sizeof (GstBuffer *));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -232,12 +220,10 @@ gst_quarktv_change_state (GstElement * element, GstStateChange transition)
|
|||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||
{
|
||||
gst_quarktv_planetable_clear (filter);
|
||||
g_free (filter->planetable);
|
||||
filter->planetable = NULL;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -250,14 +236,10 @@ static void
|
|||
gst_quarktv_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstQuarkTV *filter;
|
||||
|
||||
g_return_if_fail (GST_IS_QUARKTV (object));
|
||||
|
||||
filter = GST_QUARKTV (object);
|
||||
GstQuarkTV *filter = GST_QUARKTV (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_PLANES:
|
||||
case PROP_PLANES:
|
||||
{
|
||||
gint new_n_planes = g_value_get_int (value);
|
||||
GstBuffer **new_planetable;
|
||||
|
@ -266,7 +248,7 @@ gst_quarktv_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
/* If the number of planes changed, copy across any existing planes */
|
||||
if (new_n_planes != filter->planes) {
|
||||
new_planetable =
|
||||
(GstBuffer **) g_malloc (new_n_planes * sizeof (GstBuffer *));
|
||||
(GstBuffer **) g_malloc0 (new_n_planes * sizeof (GstBuffer *));
|
||||
|
||||
for (i = 0; (i < new_n_planes) && (i < filter->planes); i++) {
|
||||
new_planetable[i] = filter->planetable[i];
|
||||
|
@ -280,8 +262,8 @@ gst_quarktv_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
filter->current_plane = filter->planes - 1;
|
||||
filter->planes = new_n_planes;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -292,14 +274,10 @@ static void
|
|||
gst_quarktv_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstQuarkTV *filter;
|
||||
|
||||
g_return_if_fail (GST_IS_QUARKTV (object));
|
||||
|
||||
filter = GST_QUARKTV (object);
|
||||
GstQuarkTV *filter = GST_QUARKTV (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_PLANES:
|
||||
case PROP_PLANES:
|
||||
g_value_set_int (value, filter->planes);
|
||||
break;
|
||||
default:
|
||||
|
@ -313,7 +291,9 @@ gst_quarktv_base_init (gpointer g_class)
|
|||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
|
||||
gst_element_class_set_details (element_class, &quarktv_details);
|
||||
gst_element_class_set_details_simple (element_class, "QuarkTV effect",
|
||||
"Filter/Effect/Video",
|
||||
"Motion dissolver", "FUKUCHI, Kentarou <fukuchi@users.sourceforge.net>");
|
||||
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_quarktv_sink_template));
|
||||
|
@ -322,20 +302,19 @@ gst_quarktv_base_init (gpointer g_class)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_quarktv_class_init (gpointer klass, gpointer class_data)
|
||||
gst_quarktv_class_init (GstQuarkTVClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *element_class;
|
||||
GstBaseTransformClass *trans_class;
|
||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||
GstElementClass *element_class = (GstElementClass *) klass;
|
||||
GstBaseTransformClass *trans_class = (GstBaseTransformClass *) klass;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
element_class = (GstElementClass *) klass;
|
||||
trans_class = (GstBaseTransformClass *) klass;
|
||||
gobject_class->set_property = gst_quarktv_set_property;
|
||||
gobject_class->get_property = gst_quarktv_get_property;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_quarktv_set_property);
|
||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_quarktv_get_property);
|
||||
g_object_class_install_property (gobject_class, PROP_PLANES,
|
||||
g_param_spec_int ("planes", "Planes",
|
||||
"Number of planes", 0, 64, PLANES,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
element_class->change_state = GST_DEBUG_FUNCPTR (gst_quarktv_change_state);
|
||||
|
||||
|
@ -345,34 +324,8 @@ gst_quarktv_class_init (gpointer klass, gpointer class_data)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_quarktv_init (GTypeInstance * instance, gpointer g_class)
|
||||
gst_quarktv_init (GstQuarkTV * filter, GstQuarkTVClass * klass)
|
||||
{
|
||||
GstQuarkTV *filter = GST_QUARKTV (instance);
|
||||
|
||||
filter->planes = PLANES;
|
||||
filter->current_plane = filter->planes - 1;
|
||||
}
|
||||
|
||||
GType
|
||||
gst_quarktv_get_type (void)
|
||||
{
|
||||
static GType quarktv_type = 0;
|
||||
|
||||
if (!quarktv_type) {
|
||||
static const GTypeInfo quarktv_info = {
|
||||
sizeof (GstQuarkTVClass),
|
||||
gst_quarktv_base_init,
|
||||
NULL,
|
||||
gst_quarktv_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof (GstQuarkTV),
|
||||
0,
|
||||
gst_quarktv_init,
|
||||
};
|
||||
|
||||
quarktv_type = g_type_register_static (GST_TYPE_VIDEO_FILTER,
|
||||
"GstQuarkTV", &quarktv_info, 0);
|
||||
}
|
||||
return quarktv_type;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue