summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2010-09-10 18:10:40 -0700
committerDavid Schleef <ds@schleef.org>2010-09-14 13:21:54 -0700
commit8e60eca3150541bae2755b30e99d433e93727b26 (patch)
tree21fe0dc716f6eb6969ccf292d536436c1fe24a32
parentef981b53b67ca3ae70152730a6da811724388a1b (diff)
videotestsrc: clean up blink pattern
-rw-r--r--gst/videotestsrc/gstvideotestsrc.c17
-rw-r--r--gst/videotestsrc/videotestsrc.c29
-rw-r--r--gst/videotestsrc/videotestsrc.h2
3 files changed, 35 insertions, 13 deletions
diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c
index 5bbbb3195..4b6d199da 100644
--- a/gst/videotestsrc/gstvideotestsrc.c
+++ b/gst/videotestsrc/gstvideotestsrc.c
@@ -402,7 +402,7 @@ gst_video_test_src_set_pattern (GstVideoTestSrc * videotestsrc,
videotestsrc->make_image = gst_video_test_src_circular;
break;
case GST_VIDEO_TEST_SRC_BLINK:
- videotestsrc->make_image = gst_video_test_src_black;
+ videotestsrc->make_image = gst_video_test_src_blink;
break;
case GST_VIDEO_TEST_SRC_SMPTE75:
videotestsrc->make_image = gst_video_test_src_smpte75;
@@ -874,18 +874,9 @@ gst_video_test_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
memset (GST_BUFFER_DATA (outbuf), 0, GST_BUFFER_SIZE (outbuf));
src->tmpline = g_malloc (src->width * 4);
- if (src->pattern_type == GST_VIDEO_TEST_SRC_BLINK) {
- if (src->n_frames & 0x1) {
- gst_video_test_src_white (src, (void *) GST_BUFFER_DATA (outbuf),
- src->width, src->height);
- } else {
- gst_video_test_src_black (src, (void *) GST_BUFFER_DATA (outbuf),
- src->width, src->height);
- }
- } else {
- src->make_image (src, (void *) GST_BUFFER_DATA (outbuf),
- src->width, src->height);
- }
+ src->make_image (src, (void *) GST_BUFFER_DATA (outbuf),
+ src->width, src->height);
+
g_free (src->tmpline);
GST_BUFFER_TIMESTAMP (outbuf) = src->timestamp_offset + src->running_time;
diff --git a/gst/videotestsrc/videotestsrc.c b/gst/videotestsrc/videotestsrc.c
index 1e4d13d11..c6c906cd2 100644
--- a/gst/videotestsrc/videotestsrc.c
+++ b/gst/videotestsrc/videotestsrc.c
@@ -899,6 +899,35 @@ gst_video_test_src_blue (GstVideoTestSrc * v, guchar * dest, int w, int h)
}
void
+gst_video_test_src_blink (GstVideoTestSrc * v, unsigned char *dest, int w,
+ int h)
+{
+ int i;
+ paintinfo pi = { NULL, };
+ paintinfo *p = &pi;
+ struct fourcc_list_struct *fourcc;
+
+ videotestsrc_setup_paintinfo (v, p, w, h);
+
+ fourcc = v->fourcc;
+ if (fourcc == NULL)
+ return;
+
+ fourcc->paint_setup (p, dest);
+
+ if (v->n_frames & 1) {
+ p->color = &p->foreground_color;
+ } else {
+ p->color = &p->background_color;
+ }
+
+ for (i = 0; i < h; i++) {
+ p->paint_tmpline (p, 0, w);
+ p->convert_tmpline (p, i);
+ }
+}
+
+void
gst_video_test_src_solid (GstVideoTestSrc * v, unsigned char *dest, int w,
int h)
{
diff --git a/gst/videotestsrc/videotestsrc.h b/gst/videotestsrc/videotestsrc.h
index fd56ecd77..f4be9a3bb 100644
--- a/gst/videotestsrc/videotestsrc.h
+++ b/gst/videotestsrc/videotestsrc.h
@@ -104,6 +104,8 @@ void gst_video_test_src_blue (GstVideoTestSrc * v,
unsigned char *dest, int w, int h);
void gst_video_test_src_solid (GstVideoTestSrc * v,
unsigned char *dest, int w, int h);
+void gst_video_test_src_blink (GstVideoTestSrc * v,
+ unsigned char *dest, int w, int h);
void gst_video_test_src_checkers1 (GstVideoTestSrc * v,
unsigned char *dest, int w, int h);
void gst_video_test_src_checkers2 (GstVideoTestSrc * v,