summaryrefslogtreecommitdiff
path: root/gst/effectv
diff options
context:
space:
mode:
authorStefan Sauer <ensonic@users.sf.net>2011-11-25 13:13:47 +0100
committerStefan Sauer <ensonic@users.sf.net>2011-11-25 13:13:47 +0100
commitebefb140b99ac169babb3a3e18fe11f20524bec1 (patch)
treefe55a23521931d6ec2ed6f03d02c64256ee32db1 /gst/effectv
parentc1d38ea8d4b8bbd12b031f9a1d422788da79d93c (diff)
downloadgstreamer-plugins-good-ebefb140b99ac169babb3a3e18fe11f20524bec1.tar.gz
effectv: repair color modes in radioactv by taking rgb,bgr into account
Diffstat (limited to 'gst/effectv')
-rw-r--r--gst/effectv/gstradioac.c27
-rw-r--r--gst/effectv/gstradioac.h2
2 files changed, 22 insertions, 7 deletions
diff --git a/gst/effectv/gstradioac.c b/gst/effectv/gstradioac.c
index fc3f9afc5..9886d569f 100644
--- a/gst/effectv/gstradioac.c
+++ b/gst/effectv/gstradioac.c
@@ -134,6 +134,7 @@ enum
#define RATIO 0.95
static guint32 palettes[COLORS * PATTERN];
+static gint swap_tab[] = { 2, 1, 0, 3 };
GST_BOILERPLATE (GstRadioacTV, gst_radioactv, GstVideoFilter,
GST_TYPE_VIDEO_FILTER);
@@ -165,18 +166,20 @@ makePalette (void)
#define DELTA (255/(COLORS/2-1))
+ /* red, gree, blue */
for (i = 0; i < COLORS / 2; i++) {
palettes[i] = i * DELTA;
palettes[COLORS + i] = (i * DELTA) << 8;
palettes[COLORS * 2 + i] = (i * DELTA) << 16;
}
for (i = 0; i < COLORS / 2; i++) {
- palettes[+i + COLORS / 2] = 255 | (i * DELTA) << 16 | (i * DELTA) << 8;
+ palettes[i + COLORS / 2] = 255 | (i * DELTA) << 16 | (i * DELTA) << 8;
palettes[COLORS + i + COLORS / 2] =
(255 << 8) | (i * DELTA) << 16 | i * DELTA;
palettes[COLORS * 2 + i + COLORS / 2] =
(255 << 16) | (i * DELTA) << 8 | i * DELTA;
}
+ /* white */
for (i = 0; i < COLORS; i++) {
palettes[COLORS * 3 + i] = (255 * i / COLORS) * 0x10101;
}
@@ -341,7 +344,19 @@ gst_radioactv_transform (GstBaseTransform * trans, GstBuffer * in,
dest = (guint32 *) GST_BUFFER_DATA (out);
GST_OBJECT_LOCK (filter);
- palette = &palettes[COLORS * filter->color];
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+ if (filter->format == GST_VIDEO_FORMAT_RGBx) {
+ palette = &palettes[COLORS * filter->color];
+ } else {
+ palette = &palettes[COLORS * swap_tab[filter->color]];
+ }
+#else
+ if (filter->format == GST_VIDEO_FORMAT_xBGR) {
+ palette = &palettes[COLORS * filter->color];
+ } else {
+ palette = &palettes[COLORS * swap_tab[filter->color]];
+ }
+#endif
diff = filter->diff;
if (filter->mode == 3 && filter->trigger)
@@ -405,14 +420,12 @@ gst_radioactv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
GstCaps * outcaps)
{
GstRadioacTV *filter = GST_RADIOACTV (btrans);
- GstStructure *structure;
gboolean ret = FALSE;
- structure = gst_caps_get_structure (incaps, 0);
-
GST_OBJECT_LOCK (filter);
- if (gst_structure_get_int (structure, "width", &filter->width) &&
- gst_structure_get_int (structure, "height", &filter->height)) {
+
+ if (gst_video_format_parse_caps (incaps, &filter->format, &filter->width,
+ &filter->height)) {
filter->buf_width_blocks = filter->width / 32;
if (filter->buf_width_blocks > 255)
goto out;
diff --git a/gst/effectv/gstradioac.h b/gst/effectv/gstradioac.h
index 34ad8ed72..64a425d11 100644
--- a/gst/effectv/gstradioac.h
+++ b/gst/effectv/gstradioac.h
@@ -29,6 +29,7 @@
#include <gst/gst.h>
+#include <gst/video/video.h>
#include <gst/video/gstvideofilter.h>
G_BEGIN_DECLS
@@ -53,6 +54,7 @@ struct _GstRadioacTV
/* < private > */
gint width, height;
+ GstVideoFormat format;
gint mode;
gint color;