From 8e60eca3150541bae2755b30e99d433e93727b26 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Fri, 10 Sep 2010 18:10:40 -0700 Subject: [PATCH] videotestsrc: clean up blink pattern --- gst/videotestsrc/gstvideotestsrc.c | 17 ++++------------- gst/videotestsrc/videotestsrc.c | 29 +++++++++++++++++++++++++++++ gst/videotestsrc/videotestsrc.h | 2 ++ 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c index 5bbbb3195f..4b6d199da3 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 1e4d13d111..c6c906cd29 100644 --- a/gst/videotestsrc/videotestsrc.c +++ b/gst/videotestsrc/videotestsrc.c @@ -898,6 +898,35 @@ gst_video_test_src_blue (GstVideoTestSrc * v, guchar * dest, int w, int h) gst_video_test_src_unicolor (v, dest, w, h, COLOR_BLUE); } +void +gst_video_test_src_blink (GstVideoTestSrc * v, unsigned char *dest, int w, + int h) +{ + int i; + paintinfo pi = { NULL, }; + paintinfo *p = π + 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 fd56ecd771..f4be9a3bbb 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,