diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c index a98611b970..ce98cb4803 100644 --- a/gst/videotestsrc/gstvideotestsrc.c +++ b/gst/videotestsrc/gstvideotestsrc.c @@ -152,6 +152,7 @@ gst_video_test_src_pattern_get_type (void) {GST_VIDEO_TEST_SRC_PINWHEEL, "Pinwheel", "pinwheel"}, {GST_VIDEO_TEST_SRC_SPOKES, "Spokes", "spokes"}, {GST_VIDEO_TEST_SRC_GRADIENT, "Gradient", "gradient"}, + {GST_VIDEO_TEST_SRC_COLORS, "Colors", "colors"}, {0, NULL, NULL} }; @@ -428,6 +429,9 @@ gst_video_test_src_set_pattern (GstVideoTestSrc * videotestsrc, case GST_VIDEO_TEST_SRC_GRADIENT: videotestsrc->make_image = gst_video_test_src_gradient; break; + case GST_VIDEO_TEST_SRC_COLORS: + videotestsrc->make_image = gst_video_test_src_colors; + break; default: g_assert_not_reached (); } diff --git a/gst/videotestsrc/gstvideotestsrc.h b/gst/videotestsrc/gstvideotestsrc.h index c43c2e1e88..c0dfaa4199 100644 --- a/gst/videotestsrc/gstvideotestsrc.h +++ b/gst/videotestsrc/gstvideotestsrc.h @@ -64,6 +64,8 @@ G_BEGIN_DECLS * @GST_VIDEO_TEST_SRC_BAR: Bar with foreground color * @GST_VIDEO_TEST_SRC_PINWHEEL: Pinwheel * @GST_VIDEO_TEST_SRC_SPOKES: Spokes + * @GST_VIDEO_TEST_SRC_GRADIENT: Gradient + * @GST_VIDEO_TEST_SRC_COLORS: All colors * * The test pattern to produce. * @@ -108,7 +110,8 @@ typedef enum { GST_VIDEO_TEST_SRC_BAR, GST_VIDEO_TEST_SRC_PINWHEEL, GST_VIDEO_TEST_SRC_SPOKES, - GST_VIDEO_TEST_SRC_GRADIENT + GST_VIDEO_TEST_SRC_GRADIENT, + GST_VIDEO_TEST_SRC_COLORS } GstVideoTestSrcPattern; typedef struct _GstVideoTestSrc GstVideoTestSrc; diff --git a/gst/videotestsrc/videotestsrc.c b/gst/videotestsrc/videotestsrc.c index debbca06c5..f082ed1ddd 100644 --- a/gst/videotestsrc/videotestsrc.c +++ b/gst/videotestsrc/videotestsrc.c @@ -1362,3 +1362,29 @@ gst_video_test_src_gradient (GstVideoTestSrc * v, GstVideoFrame * frame) videotestsrc_convert_tmpline (p, frame, j); } } + +void +gst_video_test_src_colors (GstVideoTestSrc * v, GstVideoFrame * frame) +{ + int i; + int j; + paintinfo pi = PAINT_INFO_INIT; + paintinfo *p = π + struct vts_color_struct color; + int w = frame->info.width, h = frame->info.height; + + videotestsrc_setup_paintinfo (v, p, w, h); + + color = p->colors[COLOR_BLACK]; + p->color = &color; + + for (j = 0; j < h; j++) { + for (i = 0; i < w; i++) { + p->tmpline[i * 4 + 0] = 0xff; + p->tmpline[i * 4 + 1] = ((i * 4096) / w) % 256; + p->tmpline[i * 4 + 2] = (((j * 16) / h) << 4) | ((i * 16) / w); + p->tmpline[i * 4 + 3] = ((j * 4096) / h) % 256; + } + videotestsrc_convert_tmpline (p, frame, j); + } +} diff --git a/gst/videotestsrc/videotestsrc.h b/gst/videotestsrc/videotestsrc.h index 9a23b9a262..977e5043da 100644 --- a/gst/videotestsrc/videotestsrc.h +++ b/gst/videotestsrc/videotestsrc.h @@ -83,5 +83,6 @@ void gst_video_test_src_bar (GstVideoTestSrc * v, GstVideoFrame *fra void gst_video_test_src_pinwheel (GstVideoTestSrc * v, GstVideoFrame * frame); void gst_video_test_src_spokes (GstVideoTestSrc * v, GstVideoFrame * frame); void gst_video_test_src_gradient (GstVideoTestSrc * v, GstVideoFrame * frame); +void gst_video_test_src_colors (GstVideoTestSrc * v, GstVideoFrame * frame); #endif