mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
videotestsrc: add all colors mode
This commit is contained in:
parent
06fd6f2f63
commit
9bbfc3c848
4 changed files with 35 additions and 1 deletions
|
@ -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 ();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue