From: David Schleef Date: Sat, 11 Sep 2010 01:10:40 +0000 (-0700) Subject: videotestsrc: clean up blink pattern X-Git-Tag: RELEASE-0.10.31~207 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8e60eca3150541bae2755b30e99d433e93727b26;p=platform%2Fupstream%2Fgst-plugins-base.git videotestsrc: clean up blink pattern --- diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c index 5bbbb31..4b6d199 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 1e4d13d..c6c906c 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 = π + 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 fd56ecd..f4be9a3 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,