mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
effectv: Use controller where possible, optimize a bit and make properties threadsafe
This commit is contained in:
parent
ca6566ea66
commit
f8b7308c21
12 changed files with 201 additions and 61 deletions
|
@ -101,10 +101,12 @@ gst_agingtv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
|
||||||
structure = gst_caps_get_structure (incaps, 0);
|
structure = gst_caps_get_structure (incaps, 0);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
||||||
gst_structure_get_int (structure, "height", &filter->height)) {
|
gst_structure_get_int (structure, "height", &filter->height)) {
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -262,6 +264,7 @@ gst_agingtv_get_property (GObject * object, guint prop_id,
|
||||||
{
|
{
|
||||||
GstAgingTV *agingtv = GST_AGINGTV (object);
|
GstAgingTV *agingtv = GST_AGINGTV (object);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (agingtv);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_SCRATCH_LINES:
|
case PROP_SCRATCH_LINES:
|
||||||
g_value_set_uint (value, agingtv->scratch_lines);
|
g_value_set_uint (value, agingtv->scratch_lines);
|
||||||
|
@ -278,6 +281,7 @@ gst_agingtv_get_property (GObject * object, guint prop_id,
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (agingtv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -323,12 +327,10 @@ gst_agingtv_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
GstBuffer * out)
|
GstBuffer * out)
|
||||||
{
|
{
|
||||||
GstAgingTV *agingtv = GST_AGINGTV (trans);
|
GstAgingTV *agingtv = GST_AGINGTV (trans);
|
||||||
gint width = agingtv->width;
|
gint width, height, video_size;
|
||||||
gint height = agingtv->height;
|
|
||||||
gint video_size = width * height;
|
|
||||||
guint32 *src = (guint32 *) GST_BUFFER_DATA (in);
|
guint32 *src = (guint32 *) GST_BUFFER_DATA (in);
|
||||||
guint32 *dest = (guint32 *) GST_BUFFER_DATA (out);
|
guint32 *dest = (guint32 *) GST_BUFFER_DATA (out);
|
||||||
gint area_scale = width * height / 64 / 480;
|
gint area_scale;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
GstClockTime timestamp, stream_time;
|
GstClockTime timestamp, stream_time;
|
||||||
|
|
||||||
|
@ -342,6 +344,12 @@ gst_agingtv_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
if (GST_CLOCK_TIME_IS_VALID (stream_time))
|
if (GST_CLOCK_TIME_IS_VALID (stream_time))
|
||||||
gst_object_sync_values (G_OBJECT (agingtv), stream_time);
|
gst_object_sync_values (G_OBJECT (agingtv), stream_time);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (agingtv);
|
||||||
|
width = agingtv->width;
|
||||||
|
height = agingtv->height;
|
||||||
|
video_size = width * height;
|
||||||
|
|
||||||
|
area_scale = width * height / 64 / 480;
|
||||||
if (area_scale <= 0)
|
if (area_scale <= 0)
|
||||||
area_scale = 1;
|
area_scale = 1;
|
||||||
|
|
||||||
|
@ -355,6 +363,7 @@ gst_agingtv_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
pits (dest, width, height, area_scale, &agingtv->pits_interval);
|
pits (dest, width, height, area_scale, &agingtv->pits_interval);
|
||||||
if (area_scale > 1 && agingtv->dusts)
|
if (area_scale > 1 && agingtv->dusts)
|
||||||
dusts (dest, width, height, &agingtv->dust_interval, area_scale);
|
dusts (dest, width, height, &agingtv->dust_interval, area_scale);
|
||||||
|
GST_OBJECT_UNLOCK (agingtv);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -416,7 +425,4 @@ gst_agingtv_init (GstAgingTV * agingtv, GstAgingTVClass * klass)
|
||||||
agingtv->color_aging = DEFAULT_COLOR_AGING;
|
agingtv->color_aging = DEFAULT_COLOR_AGING;
|
||||||
agingtv->pits = DEFAULT_PITS;
|
agingtv->pits = DEFAULT_PITS;
|
||||||
agingtv->dusts = DEFAULT_DUSTS;
|
agingtv->dusts = DEFAULT_DUSTS;
|
||||||
|
|
||||||
gst_pad_use_fixed_caps (GST_BASE_TRANSFORM_SINK_PAD (agingtv));
|
|
||||||
gst_pad_use_fixed_caps (GST_BASE_TRANSFORM_SRC_PAD (agingtv));
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,7 @@ gst_dicetv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
|
||||||
structure = gst_caps_get_structure (incaps, 0);
|
structure = gst_caps_get_structure (incaps, 0);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
||||||
gst_structure_get_int (structure, "height", &filter->height)) {
|
gst_structure_get_int (structure, "height", &filter->height)) {
|
||||||
g_free (filter->dicemap);
|
g_free (filter->dicemap);
|
||||||
|
@ -111,6 +112,7 @@ gst_dicetv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
gst_dicetv_create_map (filter);
|
gst_dicetv_create_map (filter);
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -122,8 +124,10 @@ gst_dicetv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
|
||||||
guint32 *src, *dest;
|
guint32 *src, *dest;
|
||||||
gint i, map_x, map_y, map_i, base, dx, dy, di;
|
gint i, map_x, map_y, map_i, base, dx, dy, di;
|
||||||
gint video_width, g_cube_bits, g_cube_size;
|
gint video_width, g_cube_bits, g_cube_size;
|
||||||
|
gint g_map_height, g_map_width;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
GstClockTime timestamp, stream_time;
|
GstClockTime timestamp, stream_time;
|
||||||
|
const guint8 *dicemap;
|
||||||
|
|
||||||
src = (guint32 *) GST_BUFFER_DATA (in);
|
src = (guint32 *) GST_BUFFER_DATA (in);
|
||||||
dest = (guint32 *) GST_BUFFER_DATA (out);
|
dest = (guint32 *) GST_BUFFER_DATA (out);
|
||||||
|
@ -138,16 +142,21 @@ gst_dicetv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
|
||||||
if (GST_CLOCK_TIME_IS_VALID (stream_time))
|
if (GST_CLOCK_TIME_IS_VALID (stream_time))
|
||||||
gst_object_sync_values (G_OBJECT (filter), stream_time);
|
gst_object_sync_values (G_OBJECT (filter), stream_time);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
video_width = filter->width;
|
video_width = filter->width;
|
||||||
g_cube_bits = filter->g_cube_bits;
|
g_cube_bits = filter->g_cube_bits;
|
||||||
g_cube_size = filter->g_cube_size;
|
g_cube_size = filter->g_cube_size;
|
||||||
|
g_map_height = filter->g_map_height;
|
||||||
|
g_map_width = filter->g_map_width;
|
||||||
|
|
||||||
|
dicemap = filter->dicemap;
|
||||||
|
|
||||||
map_i = 0;
|
map_i = 0;
|
||||||
for (map_y = 0; map_y < filter->g_map_height; map_y++) {
|
for (map_y = 0; map_y < g_map_height; map_y++) {
|
||||||
for (map_x = 0; map_x < filter->g_map_width; map_x++) {
|
for (map_x = 0; map_x < g_map_width; map_x++) {
|
||||||
base = (map_y << g_cube_bits) * video_width + (map_x << g_cube_bits);
|
base = (map_y << g_cube_bits) * video_width + (map_x << g_cube_bits);
|
||||||
|
|
||||||
switch (filter->dicemap[map_i]) {
|
switch (dicemap[map_i]) {
|
||||||
case DICE_UP:
|
case DICE_UP:
|
||||||
for (dy = 0; dy < g_cube_size; dy++) {
|
for (dy = 0; dy < g_cube_size; dy++) {
|
||||||
i = base + dy * video_width;
|
i = base + dy * video_width;
|
||||||
|
@ -196,6 +205,7 @@ gst_dicetv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
|
||||||
map_i++;
|
map_i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -231,8 +241,10 @@ gst_dicetv_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_CUBE_BITS:
|
case PROP_CUBE_BITS:
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
filter->g_cube_bits = g_value_get_int (value);
|
filter->g_cube_bits = g_value_get_int (value);
|
||||||
gst_dicetv_create_map (filter);
|
gst_dicetv_create_map (filter);
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
@ -310,7 +322,4 @@ gst_dicetv_init (GstDiceTV * filter, GstDiceTVClass * klass)
|
||||||
filter->g_cube_size = 0;
|
filter->g_cube_size = 0;
|
||||||
filter->g_map_height = 0;
|
filter->g_map_height = 0;
|
||||||
filter->g_map_width = 0;
|
filter->g_map_width = 0;
|
||||||
|
|
||||||
gst_pad_use_fixed_caps (GST_BASE_TRANSFORM_SINK_PAD (filter));
|
|
||||||
gst_pad_use_fixed_caps (GST_BASE_TRANSFORM_SRC_PAD (filter));
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,7 @@ gst_edgetv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
|
||||||
structure = gst_caps_get_structure (incaps, 0);
|
structure = gst_caps_get_structure (incaps, 0);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (edgetv);
|
||||||
if (gst_structure_get_int (structure, "width", &edgetv->width) &&
|
if (gst_structure_get_int (structure, "width", &edgetv->width) &&
|
||||||
gst_structure_get_int (structure, "height", &edgetv->height)) {
|
gst_structure_get_int (structure, "height", &edgetv->height)) {
|
||||||
guint map_size;
|
guint map_size;
|
||||||
|
@ -94,6 +95,7 @@ gst_edgetv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
edgetv->map = (guint32 *) g_malloc0 (map_size);
|
edgetv->map = (guint32 *) g_malloc0 (map_size);
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (edgetv);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -106,16 +108,26 @@ gst_edgetv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
|
||||||
guint32 *src, *dest;
|
guint32 *src, *dest;
|
||||||
guint32 p, q;
|
guint32 p, q;
|
||||||
guint32 v0, v1, v2, v3;
|
guint32 v0, v1, v2, v3;
|
||||||
|
gint height, width, map_height, map_width;
|
||||||
|
gint video_width_margin;
|
||||||
|
guint32 *map;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
|
||||||
src = (guint32 *) GST_BUFFER_DATA (in);
|
src = (guint32 *) GST_BUFFER_DATA (in);
|
||||||
dest = (guint32 *) GST_BUFFER_DATA (out);
|
dest = (guint32 *) GST_BUFFER_DATA (out);
|
||||||
|
|
||||||
src += filter->width * 4 + 4;
|
GST_OBJECT_LOCK (filter);
|
||||||
dest += filter->width * 4 + 4;
|
map = filter->map;
|
||||||
|
height = filter->height;
|
||||||
|
width = filter->width;
|
||||||
|
map_height = filter->map_height;
|
||||||
|
map_width = filter->map_width;
|
||||||
|
video_width_margin = filter->video_width_margin;
|
||||||
|
src += width * 4 + 4;
|
||||||
|
dest += width * 4 + 4;
|
||||||
|
|
||||||
for (y = 1; y < filter->map_height - 1; y++) {
|
for (y = 1; y < map_height - 1; y++) {
|
||||||
for (x = 1; x < filter->map_width - 1; x++) {
|
for (x = 1; x < map_width - 1; x++) {
|
||||||
p = *src;
|
p = *src;
|
||||||
q = *(src - 4);
|
q = *(src - 4);
|
||||||
|
|
||||||
|
@ -138,7 +150,7 @@ gst_edgetv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
|
||||||
v2 = (r << 17) | (g << 9) | b;
|
v2 = (r << 17) | (g << 9) | b;
|
||||||
|
|
||||||
/* difference between the current pixel and upper neighbor. */
|
/* difference between the current pixel and upper neighbor. */
|
||||||
q = *(src - filter->width * 4);
|
q = *(src - width * 4);
|
||||||
r = ((p & 0xff0000) - (q & 0xff0000)) >> 16;
|
r = ((p & 0xff0000) - (q & 0xff0000)) >> 16;
|
||||||
g = ((p & 0xff00) - (q & 0xff00)) >> 8;
|
g = ((p & 0xff00) - (q & 0xff00)) >> 8;
|
||||||
b = (p & 0xff) - (q & 0xff);
|
b = (p & 0xff) - (q & 0xff);
|
||||||
|
@ -156,10 +168,10 @@ gst_edgetv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
|
||||||
b = 255;
|
b = 255;
|
||||||
v3 = (r << 17) | (g << 9) | b;
|
v3 = (r << 17) | (g << 9) | b;
|
||||||
|
|
||||||
v0 = filter->map[(y - 1) * filter->map_width * 2 + x * 2];
|
v0 = map[(y - 1) * map_width * 2 + x * 2];
|
||||||
v1 = filter->map[y * filter->map_width * 2 + (x - 1) * 2 + 1];
|
v1 = map[y * map_width * 2 + (x - 1) * 2 + 1];
|
||||||
filter->map[y * filter->map_width * 2 + x * 2] = v2;
|
map[y * map_width * 2 + x * 2] = v2;
|
||||||
filter->map[y * filter->map_width * 2 + x * 2 + 1] = v3;
|
map[y * map_width * 2 + x * 2 + 1] = v3;
|
||||||
r = v0 + v1;
|
r = v0 + v1;
|
||||||
g = r & 0x01010100;
|
g = r & 0x01010100;
|
||||||
dest[0] = r | (g - (g >> 8));
|
dest[0] = r | (g - (g >> 8));
|
||||||
|
@ -170,23 +182,24 @@ gst_edgetv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
|
||||||
dest[3] = v3;
|
dest[3] = v3;
|
||||||
r = v2 + v1;
|
r = v2 + v1;
|
||||||
g = r & 0x01010100;
|
g = r & 0x01010100;
|
||||||
dest[filter->width] = r | (g - (g >> 8));
|
dest[width] = r | (g - (g >> 8));
|
||||||
r = v2 + v3;
|
r = v2 + v3;
|
||||||
g = r & 0x01010100;
|
g = r & 0x01010100;
|
||||||
dest[filter->width + 1] = r | (g - (g >> 8));
|
dest[width + 1] = r | (g - (g >> 8));
|
||||||
dest[filter->width + 2] = v3;
|
dest[width + 2] = v3;
|
||||||
dest[filter->width + 3] = v3;
|
dest[width + 3] = v3;
|
||||||
dest[filter->width * 2] = v2;
|
dest[width * 2] = v2;
|
||||||
dest[filter->width * 2 + 1] = v2;
|
dest[width * 2 + 1] = v2;
|
||||||
dest[filter->width * 3] = v2;
|
dest[width * 3] = v2;
|
||||||
dest[filter->width * 3 + 1] = v2;
|
dest[width * 3 + 1] = v2;
|
||||||
|
|
||||||
src += 4;
|
src += 4;
|
||||||
dest += 4;
|
dest += 4;
|
||||||
}
|
}
|
||||||
src += filter->width * 3 + 8 + filter->video_width_margin;
|
src += width * 3 + 8 + video_width_margin;
|
||||||
dest += filter->width * 3 + 8 + filter->video_width_margin;
|
dest += width * 3 + 8 + video_width_margin;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,8 +206,9 @@ gst_optv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
gint8 *p;
|
gint8 *p;
|
||||||
guint8 *diff;
|
guint8 *diff;
|
||||||
gint x, y;
|
gint x, y, width, height;
|
||||||
GstClockTime timestamp, stream_time;
|
GstClockTime timestamp, stream_time;
|
||||||
|
guint8 phase;
|
||||||
|
|
||||||
timestamp = GST_BUFFER_TIMESTAMP (in);
|
timestamp = GST_BUFFER_TIMESTAMP (in);
|
||||||
stream_time =
|
stream_time =
|
||||||
|
@ -225,6 +226,7 @@ gst_optv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
|
||||||
if (G_UNLIKELY (filter->opmap[0] == NULL))
|
if (G_UNLIKELY (filter->opmap[0] == NULL))
|
||||||
return GST_FLOW_NOT_NEGOTIATED;
|
return GST_FLOW_NOT_NEGOTIATED;
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
switch (filter->mode) {
|
switch (filter->mode) {
|
||||||
default:
|
default:
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -245,13 +247,17 @@ gst_optv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
|
||||||
|
|
||||||
diff = filter->diff;
|
diff = filter->diff;
|
||||||
image_y_over (src, diff, filter->threshold, filter->width * filter->height);
|
image_y_over (src, diff, filter->threshold, filter->width * filter->height);
|
||||||
|
height = filter->height;
|
||||||
|
width = filter->width;
|
||||||
|
phase = filter->phase;
|
||||||
|
|
||||||
for (y = 0; y < filter->height; y++) {
|
for (y = 0; y < height; y++) {
|
||||||
for (x = 0; x < filter->width; x++) {
|
for (x = 0; x < width; x++) {
|
||||||
*dest++ = palette[(((guint8) (*p + filter->phase)) ^ *diff++) & 255];
|
*dest++ = palette[(((guint8) (*p + phase)) ^ *diff++) & 255];
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -266,6 +272,7 @@ gst_optv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
|
||||||
structure = gst_caps_get_structure (incaps, 0);
|
structure = gst_caps_get_structure (incaps, 0);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
||||||
gst_structure_get_int (structure, "height", &filter->height)) {
|
gst_structure_get_int (structure, "height", &filter->height)) {
|
||||||
gint i;
|
gint i;
|
||||||
|
@ -283,6 +290,7 @@ gst_optv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -325,6 +333,7 @@ gst_optv_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||||
{
|
{
|
||||||
GstOpTV *filter = GST_OPTV (object);
|
GstOpTV *filter = GST_OPTV (object);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_MODE:
|
case PROP_MODE:
|
||||||
filter->mode = g_value_get_enum (value);
|
filter->mode = g_value_get_enum (value);
|
||||||
|
@ -339,6 +348,7 @@ gst_optv_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
#include "gstquark.h"
|
#include "gstquark.h"
|
||||||
#include "gsteffectv.h"
|
#include "gsteffectv.h"
|
||||||
|
|
||||||
|
#include <gst/controller/gstcontroller.h>
|
||||||
#include <gst/video/video.h>
|
#include <gst/video/video.h>
|
||||||
|
|
||||||
/* number of frames of time-buffer. It should be as a configurable paramater */
|
/* number of frames of time-buffer. It should be as a configurable paramater */
|
||||||
|
@ -91,12 +92,14 @@ gst_quarktv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
|
||||||
structure = gst_caps_get_structure (incaps, 0);
|
structure = gst_caps_get_structure (incaps, 0);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
||||||
gst_structure_get_int (structure, "height", &filter->height)) {
|
gst_structure_get_int (structure, "height", &filter->height)) {
|
||||||
gst_quarktv_planetable_clear (filter);
|
gst_quarktv_planetable_clear (filter);
|
||||||
filter->area = filter->width * filter->height;
|
filter->area = filter->width * filter->height;
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -109,27 +112,41 @@ gst_quarktv_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
gint area;
|
gint area;
|
||||||
guint32 *src, *dest;
|
guint32 *src, *dest;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
GstClockTime timestamp;
|
||||||
|
GstBuffer **planetable;
|
||||||
|
gint planes, current_plane;
|
||||||
|
|
||||||
area = filter->area;
|
timestamp = GST_BUFFER_TIMESTAMP (in);
|
||||||
src = (guint32 *) GST_BUFFER_DATA (in);
|
timestamp =
|
||||||
dest = (guint32 *) GST_BUFFER_DATA (out);
|
gst_segment_to_stream_time (&trans->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);
|
||||||
|
|
||||||
if (G_UNLIKELY (filter->planetable == NULL))
|
if (G_UNLIKELY (filter->planetable == NULL))
|
||||||
return GST_FLOW_WRONG_STATE;
|
return GST_FLOW_WRONG_STATE;
|
||||||
|
|
||||||
if (filter->planetable[filter->current_plane])
|
GST_OBJECT_LOCK (filter);
|
||||||
gst_buffer_unref (filter->planetable[filter->current_plane]);
|
area = filter->area;
|
||||||
|
src = (guint32 *) GST_BUFFER_DATA (in);
|
||||||
|
dest = (guint32 *) GST_BUFFER_DATA (out);
|
||||||
|
planetable = filter->planetable;
|
||||||
|
planes = filter->planes;
|
||||||
|
current_plane = filter->current_plane;
|
||||||
|
|
||||||
filter->planetable[filter->current_plane] = gst_buffer_ref (in);
|
if (planetable[current_plane])
|
||||||
|
gst_buffer_unref (planetable[current_plane]);
|
||||||
|
planetable[current_plane] = gst_buffer_ref (in);
|
||||||
|
|
||||||
/* For each pixel */
|
/* For each pixel */
|
||||||
while (--area) {
|
while (--area) {
|
||||||
GstBuffer *rand;
|
GstBuffer *rand;
|
||||||
|
|
||||||
/* pick a random buffer */
|
/* pick a random buffer */
|
||||||
rand =
|
rand = planetable[(current_plane + (fastrand () >> 24)) % planes];
|
||||||
filter->planetable[(filter->current_plane +
|
|
||||||
(fastrand () >> 24)) % filter->planes];
|
|
||||||
|
|
||||||
/* Copy the pixel from the random buffer to dest */
|
/* Copy the pixel from the random buffer to dest */
|
||||||
dest[area] =
|
dest[area] =
|
||||||
|
@ -138,7 +155,8 @@ gst_quarktv_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
|
|
||||||
filter->current_plane--;
|
filter->current_plane--;
|
||||||
if (filter->current_plane < 0)
|
if (filter->current_plane < 0)
|
||||||
filter->current_plane = filter->planes - 1;
|
filter->current_plane = planes - 1;
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -194,6 +212,7 @@ gst_quarktv_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||||
{
|
{
|
||||||
GstQuarkTV *filter = GST_QUARKTV (object);
|
GstQuarkTV *filter = GST_QUARKTV (object);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_PLANES:
|
case PROP_PLANES:
|
||||||
{
|
{
|
||||||
|
@ -227,6 +246,7 @@ gst_quarktv_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -274,7 +294,7 @@ gst_quarktv_class_init (GstQuarkTVClass * klass)
|
||||||
g_object_class_install_property (gobject_class, PROP_PLANES,
|
g_object_class_install_property (gobject_class, PROP_PLANES,
|
||||||
g_param_spec_int ("planes", "Planes",
|
g_param_spec_int ("planes", "Planes",
|
||||||
"Number of planes", 0, 64, PLANES,
|
"Number of planes", 0, 64, PLANES,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
|
||||||
|
|
||||||
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_quarktv_set_caps);
|
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_quarktv_set_caps);
|
||||||
trans_class->transform = GST_DEBUG_FUNCPTR (gst_quarktv_transform);
|
trans_class->transform = GST_DEBUG_FUNCPTR (gst_quarktv_transform);
|
||||||
|
|
|
@ -327,8 +327,6 @@ gst_radioactv_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
guint8 *diff, *p;
|
guint8 *diff, *p;
|
||||||
guint32 *palette;
|
guint32 *palette;
|
||||||
|
|
||||||
palette = &palettes[COLORS * filter->color];
|
|
||||||
|
|
||||||
timestamp = GST_BUFFER_TIMESTAMP (in);
|
timestamp = GST_BUFFER_TIMESTAMP (in);
|
||||||
stream_time =
|
stream_time =
|
||||||
gst_segment_to_stream_time (&trans->segment, GST_FORMAT_TIME, timestamp);
|
gst_segment_to_stream_time (&trans->segment, GST_FORMAT_TIME, timestamp);
|
||||||
|
@ -342,6 +340,8 @@ gst_radioactv_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
src = (guint32 *) GST_BUFFER_DATA (in);
|
src = (guint32 *) GST_BUFFER_DATA (in);
|
||||||
dest = (guint32 *) GST_BUFFER_DATA (out);
|
dest = (guint32 *) GST_BUFFER_DATA (out);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
|
palette = &palettes[COLORS * filter->color];
|
||||||
diff = filter->diff;
|
diff = filter->diff;
|
||||||
|
|
||||||
if (filter->mode == 3 && filter->trigger)
|
if (filter->mode == 3 && filter->trigger)
|
||||||
|
@ -395,6 +395,7 @@ gst_radioactv_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
filter->snaptime = filter->interval;
|
filter->snaptime = filter->interval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -409,11 +410,12 @@ gst_radioactv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
|
||||||
structure = gst_caps_get_structure (incaps, 0);
|
structure = gst_caps_get_structure (incaps, 0);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
||||||
gst_structure_get_int (structure, "height", &filter->height)) {
|
gst_structure_get_int (structure, "height", &filter->height)) {
|
||||||
filter->buf_width_blocks = filter->width / 32;
|
filter->buf_width_blocks = filter->width / 32;
|
||||||
if (filter->buf_width_blocks > 255)
|
if (filter->buf_width_blocks > 255)
|
||||||
return FALSE;
|
goto out;
|
||||||
|
|
||||||
filter->buf_width = filter->buf_width_blocks * 32;
|
filter->buf_width = filter->buf_width_blocks * 32;
|
||||||
filter->buf_height = filter->height;
|
filter->buf_height = filter->height;
|
||||||
|
@ -450,6 +452,8 @@ gst_radioactv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
out:
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -502,6 +506,7 @@ gst_radioactv_set_property (GObject * object, guint prop_id,
|
||||||
{
|
{
|
||||||
GstRadioacTV *filter = GST_RADIOACTV (object);
|
GstRadioacTV *filter = GST_RADIOACTV (object);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_MODE:
|
case PROP_MODE:
|
||||||
filter->mode = g_value_get_enum (value);
|
filter->mode = g_value_get_enum (value);
|
||||||
|
@ -521,6 +526,7 @@ gst_radioactv_set_property (GObject * object, guint prop_id,
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -65,6 +65,7 @@
|
||||||
#include "gstrev.h"
|
#include "gstrev.h"
|
||||||
|
|
||||||
#include <gst/video/video.h>
|
#include <gst/video/video.h>
|
||||||
|
#include <gst/controller/gstcontroller.h>
|
||||||
|
|
||||||
#define THE_COLOR 0xffffffff
|
#define THE_COLOR 0xffffffff
|
||||||
|
|
||||||
|
@ -108,10 +109,12 @@ gst_revtv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
|
||||||
structure = gst_caps_get_structure (incaps, 0);
|
structure = gst_caps_get_structure (incaps, 0);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
||||||
gst_structure_get_int (structure, "height", &filter->height)) {
|
gst_structure_get_int (structure, "height", &filter->height)) {
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -125,18 +128,34 @@ gst_revtv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
|
||||||
guint32 *nsrc;
|
guint32 *nsrc;
|
||||||
gint y, x, R, G, B, yval;
|
gint y, x, R, G, B, yval;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
gint linespace, vscale;
|
||||||
|
GstClockTime timestamp, stream_time;
|
||||||
|
|
||||||
|
timestamp = GST_BUFFER_TIMESTAMP (in);
|
||||||
|
stream_time =
|
||||||
|
gst_segment_to_stream_time (&trans->segment, GST_FORMAT_TIME, timestamp);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (filter, "sync to %" GST_TIME_FORMAT,
|
||||||
|
GST_TIME_ARGS (timestamp));
|
||||||
|
|
||||||
|
if (GST_CLOCK_TIME_IS_VALID (stream_time))
|
||||||
|
gst_object_sync_values (G_OBJECT (filter), stream_time);
|
||||||
|
|
||||||
src = (guint32 *) GST_BUFFER_DATA (in);
|
src = (guint32 *) GST_BUFFER_DATA (in);
|
||||||
dest = (guint32 *) GST_BUFFER_DATA (out);
|
dest = (guint32 *) GST_BUFFER_DATA (out);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
width = filter->width;
|
width = filter->width;
|
||||||
height = filter->height;
|
height = filter->height;
|
||||||
|
|
||||||
/* Clear everything to black */
|
/* Clear everything to black */
|
||||||
memset (dest, 0, width * height * sizeof (guint32));
|
memset (dest, 0, width * height * sizeof (guint32));
|
||||||
|
|
||||||
|
linespace = filter->linespace;
|
||||||
|
vscale = filter->vscale;
|
||||||
|
|
||||||
/* draw the offset lines */
|
/* draw the offset lines */
|
||||||
for (y = 0; y < height; y += filter->linespace) {
|
for (y = 0; y < height; y += linespace) {
|
||||||
for (x = 0; x <= width; x++) {
|
for (x = 0; x <= width; x++) {
|
||||||
nsrc = src + (y * width) + x;
|
nsrc = src + (y * width) + x;
|
||||||
|
|
||||||
|
@ -145,13 +164,14 @@ gst_revtv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
|
||||||
G = ((*nsrc) & 0xff00) >> (8 - 2);
|
G = ((*nsrc) & 0xff00) >> (8 - 2);
|
||||||
B = (*nsrc) & 0xff;
|
B = (*nsrc) & 0xff;
|
||||||
|
|
||||||
yval = y - ((short) (R + G + B) / filter->vscale);
|
yval = y - ((short) (R + G + B) / vscale);
|
||||||
|
|
||||||
if (yval > 0) {
|
if (yval > 0) {
|
||||||
dest[x + (yval * width)] = THE_COLOR;
|
dest[x + (yval * width)] = THE_COLOR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -162,6 +182,7 @@ gst_revtv_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||||
{
|
{
|
||||||
GstRevTV *filter = GST_REVTV (object);
|
GstRevTV *filter = GST_REVTV (object);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_DELAY:
|
case PROP_DELAY:
|
||||||
filter->vgrabtime = g_value_get_int (value);
|
filter->vgrabtime = g_value_get_int (value);
|
||||||
|
@ -173,8 +194,10 @@ gst_revtv_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||||
filter->vscale = g_value_get_int (value);
|
filter->vscale = g_value_get_int (value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -226,13 +249,15 @@ gst_revtv_class_init (GstRevTVClass * klass)
|
||||||
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DELAY,
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DELAY,
|
||||||
g_param_spec_int ("delay", "Delay", "Delay in frames between updates",
|
g_param_spec_int ("delay", "Delay", "Delay in frames between updates",
|
||||||
1, 100, 1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
1, 100, 1,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_LINESPACE,
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_LINESPACE,
|
||||||
g_param_spec_int ("linespace", "Linespace", "Control line spacing",
|
g_param_spec_int ("linespace", "Linespace", "Control line spacing", 1,
|
||||||
1, 100, 6, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
100, 6,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_GAIN,
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_GAIN,
|
||||||
g_param_spec_int ("gain", "Gain", "Control gain",
|
g_param_spec_int ("gain", "Gain", "Control gain", 1, 200, 50,
|
||||||
1, 200, 50, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
|
||||||
|
|
||||||
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_revtv_set_caps);
|
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_revtv_set_caps);
|
||||||
trans_class->transform = GST_DEBUG_FUNCPTR (gst_revtv_transform);
|
trans_class->transform = GST_DEBUG_FUNCPTR (gst_revtv_transform);
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
#include "gsteffectv.h"
|
#include "gsteffectv.h"
|
||||||
|
|
||||||
#include <gst/video/video.h>
|
#include <gst/video/video.h>
|
||||||
|
#include <gst/controller/gstcontroller.h>
|
||||||
|
|
||||||
#define DEFAULT_MODE 0
|
#define DEFAULT_MODE 0
|
||||||
|
|
||||||
|
@ -316,10 +317,22 @@ gst_rippletv_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
gint width, height;
|
gint width, height;
|
||||||
gint *p, *q, *r;
|
gint *p, *q, *r;
|
||||||
gint8 *vp;
|
gint8 *vp;
|
||||||
|
GstClockTime timestamp, stream_time;
|
||||||
|
|
||||||
|
timestamp = GST_BUFFER_TIMESTAMP (in);
|
||||||
|
stream_time =
|
||||||
|
gst_segment_to_stream_time (&trans->segment, GST_FORMAT_TIME, timestamp);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (filter, "sync to %" GST_TIME_FORMAT,
|
||||||
|
GST_TIME_ARGS (timestamp));
|
||||||
|
|
||||||
|
if (GST_CLOCK_TIME_IS_VALID (stream_time))
|
||||||
|
gst_object_sync_values (G_OBJECT (filter), stream_time);
|
||||||
|
|
||||||
src = (guint32 *) GST_BUFFER_DATA (in);
|
src = (guint32 *) GST_BUFFER_DATA (in);
|
||||||
dest = (guint32 *) GST_BUFFER_DATA (out);
|
dest = (guint32 *) GST_BUFFER_DATA (out);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
/* impact from the motion or rain drop */
|
/* impact from the motion or rain drop */
|
||||||
if (filter->mode)
|
if (filter->mode)
|
||||||
raindrop (filter);
|
raindrop (filter);
|
||||||
|
@ -433,6 +446,7 @@ gst_rippletv_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
dest += filter->width;
|
dest += filter->width;
|
||||||
vp += 2;
|
vp += 2;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -447,6 +461,7 @@ gst_rippletv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
|
||||||
structure = gst_caps_get_structure (incaps, 0);
|
structure = gst_caps_get_structure (incaps, 0);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
||||||
gst_structure_get_int (structure, "height", &filter->height)) {
|
gst_structure_get_int (structure, "height", &filter->height)) {
|
||||||
|
|
||||||
|
@ -475,6 +490,7 @@ gst_rippletv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -527,6 +543,7 @@ gst_rippletv_set_property (GObject * object, guint prop_id,
|
||||||
{
|
{
|
||||||
GstRippleTV *filter = GST_RIPPLETV (object);
|
GstRippleTV *filter = GST_RIPPLETV (object);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_RESET:{
|
case PROP_RESET:{
|
||||||
memset (filter->map, 0,
|
memset (filter->map, 0,
|
||||||
|
@ -540,6 +557,7 @@ gst_rippletv_set_property (GObject * object, guint prop_id,
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -589,12 +607,12 @@ gst_rippletv_class_init (GstRippleTVClass * klass)
|
||||||
g_object_class_install_property (gobject_class, PROP_RESET,
|
g_object_class_install_property (gobject_class, PROP_RESET,
|
||||||
g_param_spec_boolean ("reset", "Reset",
|
g_param_spec_boolean ("reset", "Reset",
|
||||||
"Reset all current ripples", FALSE,
|
"Reset all current ripples", FALSE,
|
||||||
G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_MODE,
|
g_object_class_install_property (gobject_class, PROP_MODE,
|
||||||
g_param_spec_enum ("mode", "Mode",
|
g_param_spec_enum ("mode", "Mode",
|
||||||
"Mode", GST_TYPE_RIPPLETV_MODE, DEFAULT_MODE,
|
"Mode", GST_TYPE_RIPPLETV_MODE, DEFAULT_MODE,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
|
||||||
|
|
||||||
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_rippletv_set_caps);
|
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_rippletv_set_caps);
|
||||||
trans_class->transform = GST_DEBUG_FUNCPTR (gst_rippletv_transform);
|
trans_class->transform = GST_DEBUG_FUNCPTR (gst_rippletv_transform);
|
||||||
|
|
|
@ -86,6 +86,7 @@ gst_shagadelictv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
|
||||||
structure = gst_caps_get_structure (incaps, 0);
|
structure = gst_caps_get_structure (incaps, 0);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
||||||
gst_structure_get_int (structure, "height", &filter->height)) {
|
gst_structure_get_int (structure, "height", &filter->height)) {
|
||||||
gint area = filter->width * filter->height;
|
gint area = filter->width * filter->height;
|
||||||
|
@ -99,6 +100,7 @@ gst_shagadelictv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
gst_shagadelic_initialize (filter);
|
gst_shagadelic_initialize (filter);
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -176,6 +178,7 @@ gst_shagadelictv_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
src = (guint32 *) GST_BUFFER_DATA (in);
|
src = (guint32 *) GST_BUFFER_DATA (in);
|
||||||
dest = (guint32 *) GST_BUFFER_DATA (out);
|
dest = (guint32 *) GST_BUFFER_DATA (out);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
width = filter->width;
|
width = filter->width;
|
||||||
height = filter->height;
|
height = filter->height;
|
||||||
|
|
||||||
|
@ -210,6 +213,7 @@ gst_shagadelictv_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
filter->ry += filter->rvy;
|
filter->ry += filter->rvy;
|
||||||
filter->bx += filter->bvx;
|
filter->bx += filter->bvx;
|
||||||
filter->by += filter->bvy;
|
filter->by += filter->bvy;
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,6 +95,7 @@ gst_streaktv_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
gint plane = filter->plane;
|
gint plane = filter->plane;
|
||||||
guint stride_mask, stride_shift, stride;
|
guint stride_mask, stride_shift, stride;
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
if (filter->feedback) {
|
if (filter->feedback) {
|
||||||
stride_mask = 0xfcfcfcfc;
|
stride_mask = 0xfcfcfcfc;
|
||||||
stride = 8;
|
stride = 8;
|
||||||
|
@ -136,6 +137,7 @@ gst_streaktv_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
|
|
||||||
plane++;
|
plane++;
|
||||||
filter->plane = plane & (PLANES - 1);
|
filter->plane = plane & (PLANES - 1);
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -150,6 +152,7 @@ gst_streaktv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
|
||||||
structure = gst_caps_get_structure (incaps, 0);
|
structure = gst_caps_get_structure (incaps, 0);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
||||||
gst_structure_get_int (structure, "height", &filter->height)) {
|
gst_structure_get_int (structure, "height", &filter->height)) {
|
||||||
gint i;
|
gint i;
|
||||||
|
@ -165,6 +168,7 @@ gst_streaktv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "gstvertigo.h"
|
#include "gstvertigo.h"
|
||||||
|
|
||||||
#include <gst/video/video.h>
|
#include <gst/video/video.h>
|
||||||
|
#include <gst/controller/gstcontroller.h>
|
||||||
|
|
||||||
GST_BOILERPLATE (GstVertigoTV, gst_vertigotv, GstVideoFilter,
|
GST_BOILERPLATE (GstVertigoTV, gst_vertigotv, GstVideoFilter,
|
||||||
GST_TYPE_VIDEO_FILTER);
|
GST_TYPE_VIDEO_FILTER);
|
||||||
|
@ -86,6 +87,7 @@ gst_vertigotv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
|
||||||
structure = gst_caps_get_structure (incaps, 0);
|
structure = gst_caps_get_structure (incaps, 0);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
||||||
gst_structure_get_int (structure, "height", &filter->height)) {
|
gst_structure_get_int (structure, "height", &filter->height)) {
|
||||||
gint area = filter->width * filter->height;
|
gint area = filter->width * filter->height;
|
||||||
|
@ -99,6 +101,7 @@ gst_vertigotv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -160,10 +163,23 @@ gst_vertigotv_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
guint32 v;
|
guint32 v;
|
||||||
gint x, y, ox, oy, i, width, height, area;
|
gint x, y, ox, oy, i, width, height, area;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
GstClockTime timestamp, stream_time;
|
||||||
|
|
||||||
|
timestamp = GST_BUFFER_TIMESTAMP (in);
|
||||||
|
stream_time =
|
||||||
|
gst_segment_to_stream_time (&trans->segment, GST_FORMAT_TIME, timestamp);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (filter, "sync to %" GST_TIME_FORMAT,
|
||||||
|
GST_TIME_ARGS (timestamp));
|
||||||
|
|
||||||
|
if (GST_CLOCK_TIME_IS_VALID (stream_time))
|
||||||
|
gst_object_sync_values (G_OBJECT (filter), stream_time);
|
||||||
|
|
||||||
src = (guint32 *) GST_BUFFER_DATA (in);
|
src = (guint32 *) GST_BUFFER_DATA (in);
|
||||||
dest = (guint32 *) GST_BUFFER_DATA (out);
|
dest = (guint32 *) GST_BUFFER_DATA (out);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
|
|
||||||
width = filter->width;
|
width = filter->width;
|
||||||
height = filter->height;
|
height = filter->height;
|
||||||
area = width * height;
|
area = width * height;
|
||||||
|
@ -198,6 +214,7 @@ gst_vertigotv_transform (GstBaseTransform * trans, GstBuffer * in,
|
||||||
p = filter->current_buffer;
|
p = filter->current_buffer;
|
||||||
filter->current_buffer = filter->alt_buffer;
|
filter->current_buffer = filter->alt_buffer;
|
||||||
filter->alt_buffer = p;
|
filter->alt_buffer = p;
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -218,6 +235,7 @@ gst_vertigotv_set_property (GObject * object, guint prop_id,
|
||||||
{
|
{
|
||||||
GstVertigoTV *filter = GST_VERTIGOTV (object);
|
GstVertigoTV *filter = GST_VERTIGOTV (object);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_SPEED:
|
case PROP_SPEED:
|
||||||
filter->phase_increment = g_value_get_float (value);
|
filter->phase_increment = g_value_get_float (value);
|
||||||
|
@ -228,6 +246,7 @@ gst_vertigotv_set_property (GObject * object, guint prop_id,
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -93,6 +93,7 @@ gst_warptv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
|
|
||||||
structure = gst_caps_get_structure (incaps, 0);
|
structure = gst_caps_get_structure (incaps, 0);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (filter);
|
||||||
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
if (gst_structure_get_int (structure, "width", &filter->width) &&
|
||||||
gst_structure_get_int (structure, "height", &filter->height)) {
|
gst_structure_get_int (structure, "height", &filter->height)) {
|
||||||
g_free (filter->disttable);
|
g_free (filter->disttable);
|
||||||
|
@ -106,6 +107,7 @@ gst_warptv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
initDistTable (filter);
|
initDistTable (filter);
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (filter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -168,8 +170,7 @@ static GstFlowReturn
|
||||||
gst_warptv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
|
gst_warptv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
|
||||||
{
|
{
|
||||||
GstWarpTV *warptv = GST_WARPTV (trans);
|
GstWarpTV *warptv = GST_WARPTV (trans);
|
||||||
int width = warptv->width;
|
gint width, height;
|
||||||
int height = warptv->height;
|
|
||||||
guint32 *src = (guint32 *) GST_BUFFER_DATA (in);
|
guint32 *src = (guint32 *) GST_BUFFER_DATA (in);
|
||||||
guint32 *dest = (guint32 *) GST_BUFFER_DATA (out);
|
guint32 *dest = (guint32 *) GST_BUFFER_DATA (out);
|
||||||
gint xw, yw, cw;
|
gint xw, yw, cw;
|
||||||
|
@ -178,6 +179,10 @@ gst_warptv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
|
||||||
gint32 *ctable;
|
gint32 *ctable;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (warptv);
|
||||||
|
width = warptv->width;
|
||||||
|
height = warptv->height;
|
||||||
|
|
||||||
xw = (gint) (sin ((warptv->tval + 100) * M_PI / 128) * 30);
|
xw = (gint) (sin ((warptv->tval + 100) * M_PI / 128) * 30);
|
||||||
yw = (gint) (sin ((warptv->tval) * M_PI / 256) * -35);
|
yw = (gint) (sin ((warptv->tval) * M_PI / 256) * -35);
|
||||||
cw = (gint) (sin ((warptv->tval - 70) * M_PI / 64) * 50);
|
cw = (gint) (sin ((warptv->tval - 70) * M_PI / 64) * 50);
|
||||||
|
@ -221,6 +226,7 @@ gst_warptv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
|
||||||
}
|
}
|
||||||
|
|
||||||
warptv->tval = (warptv->tval + 1) & 511;
|
warptv->tval = (warptv->tval + 1) & 511;
|
||||||
|
GST_OBJECT_UNLOCK (warptv);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue