#define DEFAULT_COLOR_SPEC GST_VIDEO_TEST_SRC_BT601
#define DEFAULT_FOREGROUND_COLOR 0xffffffff
#define DEFAULT_BACKGROUND_COLOR 0xff000000
+#define DEFAULT_MOVING_SPEED 1
enum
{
PROP_YOFFSET,
PROP_FOREGROUND_COLOR,
PROP_BACKGROUND_COLOR,
+ PROP_MOVING_SPEED,
PROP_LAST
};
"chroma-zone-plate"},
{GST_VIDEO_TEST_SRC_SOLID, "Solid color", "solid-color"},
{GST_VIDEO_TEST_SRC_BALL, "Moving ball", "ball"},
+ {GST_VIDEO_TEST_SRC_MOVING_COLOR_BARS, "Moving color bars",
+ "moving-color-bars"},
{0, NULL, NULL}
};
DEFAULT_BACKGROUND_COLOR,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class, PROP_MOVING_SPEED,
+ g_param_spec_int ("moving-speed", "Move color bars with this speed",
+ "Move bars every frame with this amount of pixels (negative is inverse direction)",
+ G_MININT32, G_MAXINT32, DEFAULT_MOVING_SPEED,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
gstbasesrc_class->get_caps = gst_video_test_src_getcaps;
gstbasesrc_class->set_caps = gst_video_test_src_setcaps;
gstbasesrc_class->is_seekable = gst_video_test_src_is_seekable;
src->timestamp_offset = DEFAULT_TIMESTAMP_OFFSET;
src->foreground_color = DEFAULT_FOREGROUND_COLOR;
src->background_color = DEFAULT_BACKGROUND_COLOR;
+ src->moving_speed = DEFAULT_MOVING_SPEED;
/* we operate in time */
gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
case GST_VIDEO_TEST_SRC_BALL:
videotestsrc->make_image = gst_video_test_src_ball;
break;
+ case GST_VIDEO_TEST_SRC_MOVING_COLOR_BARS:
+ videotestsrc->make_image = gst_video_test_src_moving_color_bars;
+ break;
default:
g_assert_not_reached ();
}
case PROP_BACKGROUND_COLOR:
src->background_color = g_value_get_uint (value);
break;
+ case PROP_MOVING_SPEED:
+ src->moving_speed = g_value_get_int (value);
default:
break;
}
case PROP_BACKGROUND_COLOR:
g_value_set_uint (value, src->background_color);
break;
+ case PROP_MOVING_SPEED:
+ g_value_set_int (value, src->moving_speed);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
* @GST_VIDEO_TEST_SRC_GAMUT: Gamut checking pattern
* @GST_VIDEO_TEST_SRC_CHROMA_ZONE_PLATE: Chroma zone plate
* @GST_VIDEO_TEST_SRC_BALL: Moving ball
+ * @GST_VIDEO_TEST_SRC_MOVING_COLOR_BARS: Moving color bars
*
* The test pattern to produce.
*
GST_VIDEO_TEST_SRC_GAMUT,
GST_VIDEO_TEST_SRC_CHROMA_ZONE_PLATE,
GST_VIDEO_TEST_SRC_SOLID,
- GST_VIDEO_TEST_SRC_BALL
+ GST_VIDEO_TEST_SRC_BALL,
+ GST_VIDEO_TEST_SRC_MOVING_COLOR_BARS
} GstVideoTestSrcPattern;
/**
gint zoneplate_t;
+ /* moving color bars */
+ gint moving_offset;
+ gint moving_speed;
+
void (*make_image) (GstVideoTestSrc *v, unsigned char *dest, int w, int h);
};
v->zoneplate_t++;
}
+void
+gst_video_test_src_moving_color_bars (GstVideoTestSrc * v, unsigned char *dest,
+ int w, int h)
+{
+ int i, j;
+ paintinfo pi = { NULL, };
+ paintinfo *p = π
+ struct fourcc_list_struct *fourcc;
+ int offset;
+
+ videotestsrc_setup_paintinfo (v, p, w, h);
+
+ fourcc = v->fourcc;
+ if (fourcc == NULL)
+ return;
+
+ fourcc->paint_setup (p, dest);
+
+ offset = v->moving_offset;
+ v->moving_offset += v->moving_speed;
+ if (v->moving_offset >= w) {
+ v->moving_offset -= w;
+ } else if (v->moving_offset < 0) {
+ v->moving_offset += w;
+ }
+
+ /* color bars */
+ for (i = 0; i < 7; i++) {
+ int w1, w2 = 0;
+ int x1 = i * w / 7 + offset;
+ int x2 = (i + 1) * w / 7 + offset;
+
+ if (x1 > w) {
+ x1 -= w;
+ x2 -= w;
+ }
+
+ if (x2 > w) {
+ w1 = w - x1;
+ w2 = (x2 - x1) - w1;
+ } else {
+ w1 = x2 - x1;
+ }
+
+ p->color = p->colors + i;
+ for (j = 0; j < h; j++) {
+ if (x2 > w) {
+ p->paint_hline (p, 0, j, w2);
+ }
+ p->paint_hline (p, x1, j, w1);
+ }
+ }
+}
+
static void
paint_setup_I420 (paintinfo * p, unsigned char *dest)
unsigned char *dest, int w, int h);
void gst_video_test_src_ball (GstVideoTestSrc * v,
unsigned char *dest, int w, int h);
+void gst_video_test_src_moving_color_bars (GstVideoTestSrc * v,
+ unsigned char *dest, int w, int h);
extern struct fourcc_list_struct fourcc_list[];
extern int n_fourccs;