videotestsrc: clean up blink pattern

This commit is contained in:
David Schleef 2010-09-10 18:10:40 -07:00
parent ef981b53b6
commit 8e60eca315
3 changed files with 35 additions and 13 deletions

View file

@ -402,7 +402,7 @@ gst_video_test_src_set_pattern (GstVideoTestSrc * videotestsrc,
videotestsrc->make_image = gst_video_test_src_circular; videotestsrc->make_image = gst_video_test_src_circular;
break; break;
case GST_VIDEO_TEST_SRC_BLINK: case GST_VIDEO_TEST_SRC_BLINK:
videotestsrc->make_image = gst_video_test_src_black; videotestsrc->make_image = gst_video_test_src_blink;
break; break;
case GST_VIDEO_TEST_SRC_SMPTE75: case GST_VIDEO_TEST_SRC_SMPTE75:
videotestsrc->make_image = 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)); memset (GST_BUFFER_DATA (outbuf), 0, GST_BUFFER_SIZE (outbuf));
src->tmpline = g_malloc (src->width * 4); src->tmpline = g_malloc (src->width * 4);
if (src->pattern_type == GST_VIDEO_TEST_SRC_BLINK) { src->make_image (src, (void *) GST_BUFFER_DATA (outbuf),
if (src->n_frames & 0x1) { src->width, src->height);
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);
}
g_free (src->tmpline); g_free (src->tmpline);
GST_BUFFER_TIMESTAMP (outbuf) = src->timestamp_offset + src->running_time; GST_BUFFER_TIMESTAMP (outbuf) = src->timestamp_offset + src->running_time;

View file

@ -898,6 +898,35 @@ gst_video_test_src_blue (GstVideoTestSrc * v, guchar * dest, int w, int h)
gst_video_test_src_unicolor (v, dest, w, h, COLOR_BLUE); gst_video_test_src_unicolor (v, dest, w, h, COLOR_BLUE);
} }
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 void
gst_video_test_src_solid (GstVideoTestSrc * v, unsigned char *dest, int w, gst_video_test_src_solid (GstVideoTestSrc * v, unsigned char *dest, int w,
int h) int h)

View file

@ -104,6 +104,8 @@ void gst_video_test_src_blue (GstVideoTestSrc * v,
unsigned char *dest, int w, int h); unsigned char *dest, int w, int h);
void gst_video_test_src_solid (GstVideoTestSrc * v, void gst_video_test_src_solid (GstVideoTestSrc * v,
unsigned char *dest, int w, int h); 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, void gst_video_test_src_checkers1 (GstVideoTestSrc * v,
unsigned char *dest, int w, int h); unsigned char *dest, int w, int h);
void gst_video_test_src_checkers2 (GstVideoTestSrc * v, void gst_video_test_src_checkers2 (GstVideoTestSrc * v,