summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThijs Vermeir <thijsvermeir@gmail.com>2010-09-16 17:14:20 +0200
committerThijs Vermeir <thijsvermeir@gmail.com>2010-09-16 17:14:20 +0200
commit8d14994bb5a2dfdd32bb1b8f2ac3935e45a14e4a (patch)
tree67aba59f240e333a661e7b80f4a5c07ad61f827d
parent2a868b70ec6492b8c28ffc53ab5bc5b653670bf1 (diff)
videotestsrc: add bar pattern
Simple bar with foreground color on the background color
-rw-r--r--gst/videotestsrc/gstvideotestsrc.c4
-rw-r--r--gst/videotestsrc/gstvideotestsrc.h4
-rw-r--r--gst/videotestsrc/videotestsrc.c27
-rw-r--r--gst/videotestsrc/videotestsrc.h2
4 files changed, 36 insertions, 1 deletions
diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c
index bf6443ca9..227e0a927 100644
--- a/gst/videotestsrc/gstvideotestsrc.c
+++ b/gst/videotestsrc/gstvideotestsrc.c
@@ -135,6 +135,7 @@ gst_video_test_src_pattern_get_type (void)
{GST_VIDEO_TEST_SRC_SOLID, "Solid color", "solid-color"},
{GST_VIDEO_TEST_SRC_BALL, "Moving ball", "ball"},
{GST_VIDEO_TEST_SRC_SMPTE100, "SMPTE 100% color bars", "smpte100"},
+ {GST_VIDEO_TEST_SRC_BAR, "Bar", "bar"},
{0, NULL, NULL}
};
@@ -424,6 +425,9 @@ gst_video_test_src_set_pattern (GstVideoTestSrc * videotestsrc,
case GST_VIDEO_TEST_SRC_SMPTE100:
videotestsrc->make_image = gst_video_test_src_smpte100;
break;
+ case GST_VIDEO_TEST_SRC_BAR:
+ videotestsrc->make_image = gst_video_test_src_bar;
+ break;
default:
g_assert_not_reached ();
}
diff --git a/gst/videotestsrc/gstvideotestsrc.h b/gst/videotestsrc/gstvideotestsrc.h
index ea564cafc..ae63281ea 100644
--- a/gst/videotestsrc/gstvideotestsrc.h
+++ b/gst/videotestsrc/gstvideotestsrc.h
@@ -58,6 +58,7 @@ G_BEGIN_DECLS
* @GST_VIDEO_TEST_SRC_CHROMA_ZONE_PLATE: Chroma zone plate
* @GST_VIDEO_TEST_SRC_BALL: Moving ball
* @GST_VIDEO_TEST_SRC_SMPTE100: SMPTE test pattern (100% color bars)
+ * @GST_VIDEO_TEST_SRC_BAR: Bar with foreground color
*
* The test pattern to produce.
*
@@ -98,7 +99,8 @@ typedef enum {
GST_VIDEO_TEST_SRC_CHROMA_ZONE_PLATE,
GST_VIDEO_TEST_SRC_SOLID,
GST_VIDEO_TEST_SRC_BALL,
- GST_VIDEO_TEST_SRC_SMPTE100
+ GST_VIDEO_TEST_SRC_SMPTE100,
+ GST_VIDEO_TEST_SRC_BAR
} GstVideoTestSrcPattern;
/**
diff --git a/gst/videotestsrc/videotestsrc.c b/gst/videotestsrc/videotestsrc.c
index f7a8af667..1ffe07403 100644
--- a/gst/videotestsrc/videotestsrc.c
+++ b/gst/videotestsrc/videotestsrc.c
@@ -888,6 +888,33 @@ gst_video_test_src_smpte100 (GstVideoTestSrc * v, unsigned char *dest, int w,
}
void
+gst_video_test_src_bar (GstVideoTestSrc * v, unsigned char *dest, int w, int h)
+{
+ int j;
+ paintinfo pi = { NULL, };
+ paintinfo *p = &pi;
+ struct fourcc_list_struct *fourcc;
+
+ videotestsrc_setup_paintinfo (v, p, w, h);
+ fourcc = v->fourcc;
+ if (fourcc == NULL)
+ return;
+
+ fourcc->paint_setup (p, dest);
+
+ for (j = 0; j < h; j++) {
+ /* use fixed size for now */
+ int x2 = w / 7;
+
+ p->color = &p->foreground_color;
+ p->paint_tmpline (p, 0, x2);
+ p->color = &p->background_color;
+ p->paint_tmpline (p, x2, (w - x2));
+ videotestsrc_convert_tmpline (p, j);
+ }
+}
+
+void
gst_video_test_src_snow (GstVideoTestSrc * v, unsigned char *dest, int w, int h)
{
int i;
diff --git a/gst/videotestsrc/videotestsrc.h b/gst/videotestsrc/videotestsrc.h
index fbfb79443..bea918ccb 100644
--- a/gst/videotestsrc/videotestsrc.h
+++ b/gst/videotestsrc/videotestsrc.h
@@ -139,6 +139,8 @@ void gst_video_test_src_ball (GstVideoTestSrc * v,
unsigned char *dest, int w, int h);
void gst_video_test_src_smpte100 (GstVideoTestSrc * v,
unsigned char *dest, int w, int h);
+void gst_video_test_src_bar (GstVideoTestSrc * v,
+ unsigned char *dest, int w, int h);
extern struct fourcc_list_struct fourcc_list[];
extern int n_fourccs;