ext/ffmpeg/gstffmpegenc.c: Fix pad_link function to handle formats that ffmpeg returns as multiple caps structures.

Original commit message from CVS:
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect):
Fix pad_link function to handle formats that ffmpeg returns
as multiple caps structures.
* gst/videofilter/gstvideofilter.c: (gst_videofilter_chain):
Only complain if source buffer is _smaller_ than expected.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_init),
(gst_videoscale_handle_src_event): Resize navigation events
when passing them upstream.
* gst/videotestsrc/gstvideotestsrc.c:
* gst/videotestsrc/gstvideotestsrc.h:
* gst/videotestsrc/videotestsrc.c:
* gst/videotestsrc/videotestsrc.h:
Rewrite many of the buffer painting functions to handle odd
sizes (for many formats, size%4!=0 or size%8!=0).  Most have
been verified to work with my video card.
* testsuite/gst-lint:  Add check for elements calling
gst_pad_get_caps() instead of gst_pad_get_allowed_caps().
This commit is contained in:
David Schleef 2004-01-09 01:53:31 +00:00
parent 649bc0982e
commit 899b633288
9 changed files with 187 additions and 220 deletions

View file

@ -1,3 +1,23 @@
2004-01-08 David Schleef <ds@schleef.org>
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_connect):
Fix pad_link function to handle formats that ffmpeg returns
as multiple caps structures.
* gst/videofilter/gstvideofilter.c: (gst_videofilter_chain):
Only complain if source buffer is _smaller_ than expected.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_init),
(gst_videoscale_handle_src_event): Resize navigation events
when passing them upstream.
* gst/videotestsrc/gstvideotestsrc.c:
* gst/videotestsrc/gstvideotestsrc.h:
* gst/videotestsrc/videotestsrc.c:
* gst/videotestsrc/videotestsrc.h:
Rewrite many of the buffer painting functions to handle odd
sizes (for many formats, size%4!=0 or size%8!=0). Most have
been verified to work with my video card.
* testsuite/gst-lint: Add check for elements calling
gst_pad_get_caps() instead of gst_pad_get_allowed_caps().
2004-01-08 David Schleef <ds@schleef.org>
* gst/videodrop/gstvideodrop.c: (gst_videodrop_getcaps),

View file

@ -322,7 +322,12 @@ gst_videofilter_chain (GstPad *pad, GstData *_data)
size, videofilter->from_buf_size,
videofilter->to_buf_size);
g_return_if_fail (size == videofilter->from_buf_size);
g_return_if_fail (size >= videofilter->from_buf_size);
if (size > videofilter->from_buf_size) {
GST_INFO("buffer size %ld larger than expected (%d)",
size, videofilter->from_buf_size);
}
outbuf = gst_buffer_new();
/* FIXME: handle bufferpools */

View file

@ -97,6 +97,7 @@ gst_videoscale_sink_template_factory(void)
static void gst_videoscale_base_init (gpointer g_class);
static void gst_videoscale_class_init (GstVideoscaleClass *klass);
static void gst_videoscale_init (GstVideoscale *videoscale);
static gboolean gst_videoscale_handle_src_event (GstPad *pad, GstEvent *event);
static void gst_videoscale_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void gst_videoscale_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
@ -286,6 +287,7 @@ gst_videoscale_init (GstVideoscale *videoscale)
gst_videoscale_src_template_factory(),
"src");
gst_element_add_pad(GST_ELEMENT(videoscale),videoscale->srcpad);
gst_pad_set_event_function (videoscale->srcpad, gst_videoscale_handle_src_event);
gst_pad_set_link_function(videoscale->srcpad,gst_videoscale_link);
gst_pad_set_getcaps_function(videoscale->srcpad,gst_videoscale_getcaps);
@ -296,6 +298,38 @@ gst_videoscale_init (GstVideoscale *videoscale)
/*videoscale->method = GST_VIDEOSCALE_POINT_SAMPLE; */
}
static gboolean
gst_videoscale_handle_src_event (GstPad *pad, GstEvent *event)
{
GstVideoscale *videoscale;
double a;
GstStructure *structure;
GstEvent *new_event;
videoscale = GST_VIDEOSCALE (gst_pad_get_parent (pad));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_NAVIGATION:
structure = gst_structure_copy (event->event_data.structure.structure);
if (gst_structure_get_double (event->event_data.structure.structure,
"pointer_x", &a)) {
gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE,
a*videoscale->from_width/videoscale->to_width, NULL);
}
if (gst_structure_get_double (event->event_data.structure.structure,
"pointer_y", &a)) {
gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE,
a*videoscale->from_height/videoscale->to_height, NULL);
}
new_event = gst_event_new (GST_EVENT_NAVIGATION);
new_event->event_data.structure.structure = structure;
gst_pad_send_event (gst_pad_get_peer (videoscale->sinkpad), new_event);
break;
default:
break;
}
return TRUE;
}
static void
gst_videoscale_chain (GstPad *pad, GstData *_data)

View file

@ -48,10 +48,6 @@ enum
enum
{
ARG_0,
ARG_WIDTH,
ARG_HEIGHT,
ARG_FOURCC,
ARG_RATE,
ARG_TYPE,
ARG_SYNC,
/* FILL ME */
@ -155,18 +151,6 @@ gst_videotestsrc_class_init (GstVideotestsrcClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH,
g_param_spec_int ("width", "width", "Default width",
1, G_MAXINT, 320, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT,
g_param_spec_int ("height", "height", "Default height",
1, G_MAXINT, 240, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FOURCC,
g_param_spec_string ("fourcc", "fourcc", "fourcc",
NULL, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RATE,
g_param_spec_double ("fps", "FPS", "Default frame rate",
0., G_MAXDOUBLE, 30., G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TYPE,
g_param_spec_enum ("pattern", "Pattern", "Type of test pattern to generate",
GST_TYPE_VIDEOTESTSRC_PATTERN, 1, G_PARAM_READWRITE));
@ -361,9 +345,6 @@ gst_videotestsrc_init (GstVideotestsrc * videotestsrc)
gst_videotestsrc_set_pattern(videotestsrc, GST_VIDEOTESTSRC_SMPTE);
videotestsrc->sync = TRUE;
videotestsrc->default_width = 320;
videotestsrc->default_height = 240;
videotestsrc->default_rate = 30.;
}
@ -431,7 +412,8 @@ gst_videotestsrc_get (GstPad * pad)
return NULL;
}
newsize = (videotestsrc->width * videotestsrc->height * videotestsrc->bpp) >> 3;
newsize = gst_videotestsrc_get_size (videotestsrc, videotestsrc->width,
videotestsrc->height);
g_return_val_if_fail (newsize > 0, NULL);
GST_DEBUG ("size=%ld %dx%d", newsize, videotestsrc->width, videotestsrc->height);
@ -494,7 +476,6 @@ gst_videotestsrc_set_property (GObject * object, guint prop_id, const GValue * v
GParamSpec * pspec)
{
GstVideotestsrc *src;
const char *format;
/* it's not null if we got it, but it might not be ours */
g_return_if_fail (GST_IS_VIDEOTESTSRC (object));
@ -502,24 +483,6 @@ gst_videotestsrc_set_property (GObject * object, guint prop_id, const GValue * v
GST_DEBUG ("gst_videotestsrc_set_property");
switch (prop_id) {
case ARG_WIDTH:
src->default_width = g_value_get_int (value);
break;
case ARG_HEIGHT:
src->default_height = g_value_get_int (value);
break;
case ARG_FOURCC:
format = g_value_get_string (value);
if(paintrect_find_name (format) != NULL){
src->forced_format = g_strdup(format);
GST_DEBUG ("forcing format to \"%s\"\n", format);
}else{
GST_DEBUG ("unknown format \"%s\"\n", format);
}
break;
case ARG_RATE:
src->default_rate = g_value_get_double (value);
break;
case ARG_TYPE:
gst_videotestsrc_set_pattern (src, g_value_get_enum (value));
break;
@ -541,18 +504,6 @@ gst_videotestsrc_get_property (GObject * object, guint prop_id, GValue * value,
src = GST_VIDEOTESTSRC (object);
switch (prop_id) {
case ARG_WIDTH:
g_value_set_int (value, src->default_width);
break;
case ARG_HEIGHT:
g_value_set_int (value, src->default_height);
break;
case ARG_FOURCC:
g_value_set_string (value, src->forced_format);
break;
case ARG_RATE:
g_value_set_double (value, src->default_rate);
break;
case ARG_TYPE:
g_value_set_enum (value, src->type);
break;

View file

@ -53,16 +53,12 @@ struct _GstVideotestsrc {
GstPad *sinkpad,*srcpad;
/* parameters */
gint default_width;
gint default_height;
gboolean sync;
double default_rate;
/* video state */
char *format_name;
gint width;
gint height;
char *forced_format;
struct fourcc_list_struct *fourcc;
/* private */

View file

@ -287,10 +287,12 @@ static void paint_setup_UYVY (paintinfo * p, char *dest);
static void paint_setup_YVYU (paintinfo * p, char *dest);
static void paint_setup_IYU2 (paintinfo * p, char *dest);
static void paint_setup_Y800 (paintinfo * p, char *dest);
#if 0
static void paint_setup_IMC1 (paintinfo * p, char *dest);
static void paint_setup_IMC2 (paintinfo * p, char *dest);
static void paint_setup_IMC3 (paintinfo * p, char *dest);
static void paint_setup_IMC4 (paintinfo * p, char *dest);
#endif
static void paint_setup_YUV9 (paintinfo * p, char *dest);
static void paint_setup_YVU9 (paintinfo * p, char *dest);
static void paint_setup_xRGB8888 (paintinfo * p, char *dest);
@ -306,7 +308,9 @@ static void paint_hline_I420 (paintinfo * p, int x, int y, int w);
static void paint_hline_YUY2 (paintinfo * p, int x, int y, int w);
static void paint_hline_IYU2 (paintinfo * p, int x, int y, int w);
static void paint_hline_Y800 (paintinfo * p, int x, int y, int w);
#if 0
static void paint_hline_IMC1 (paintinfo * p, int x, int y, int w);
#endif
static void paint_hline_YUV9 (paintinfo * p, int x, int y, int w);
static void paint_hline_str4 (paintinfo * p, int x, int y, int w);
static void paint_hline_str3 (paintinfo * p, int x, int y, int w);
@ -352,6 +356,7 @@ struct fourcc_list_struct fourcc_list[] = {
{"I420", "I420", 12, paint_setup_I420, paint_hline_I420},
/* NV12 */
/* NV21 */
#if 0
/* IMC1 */
{"IMC1", "IMC1", 16, paint_setup_IMC1, paint_hline_IMC1},
/* IMC2 */
@ -360,6 +365,7 @@ struct fourcc_list_struct fourcc_list[] = {
{"IMC3", "IMC3", 16, paint_setup_IMC3, paint_hline_IMC1},
/* IMC4 */
{"IMC4", "IMC4", 12, paint_setup_IMC4, paint_hline_IMC1},
#endif
/* CLPL */
/* Y41B */
/* Y42B */
@ -506,6 +512,24 @@ GstStructure *paint_get_structure(struct fourcc_list_struct *format)
}
}
int
gst_videotestsrc_get_size (GstVideotestsrc * v, int w, int h)
{
paintinfo pi = { 0 };
paintinfo *p = &pi;
struct fourcc_list_struct *fourcc;
p->width = w;
p->height = h;
fourcc = v->fourcc;
if (fourcc == NULL)
return 0;
fourcc->paint_setup (p, NULL);
return (unsigned long)p->endptr;
}
void
gst_videotestsrc_smpte (GstVideotestsrc * v, unsigned char *dest, int w, int h)
{
@ -673,12 +697,20 @@ gst_videotestsrc_black (GstVideotestsrc * v, unsigned char *dest, int w, int h)
}
}
#define ROUND_UP_2(x) (((x)+1)&~1)
#define ROUND_UP_4(x) (((x)+3)&~3)
#define ROUND_UP_8(x) (((x)+7)&~7)
static void
paint_setup_I420 (paintinfo * p, char *dest)
{
p->yp = dest;
p->up = dest + p->width * p->height;
p->vp = dest + p->width * p->height + p->width * p->height / 4;
p->ystride = ROUND_UP_4(p->width);
p->up = p->yp + p->ystride * ROUND_UP_2(p->height);
p->ustride = ROUND_UP_8(p->width)/2;
p->vp = p->up + p->ustride * ROUND_UP_2 (p->height) / 2;
p->vstride = ROUND_UP_8(p->ystride)/2;
p->endptr = p->vp + p->vstride * ROUND_UP_2 (p->height) / 2;
}
static void
@ -686,8 +718,8 @@ paint_hline_I420 (paintinfo * p, int x, int y, int w)
{
int x1 = x / 2;
int x2 = (x + w) / 2;
int offset = y * p->width;
int offset1 = (y / 2) * (p->width / 2);
int offset = y * p->ystride;
int offset1 = (y / 2) * p->ustride;
memset (p->yp + offset + x, p->color->Y, w);
memset (p->up + offset1 + x1, p->color->U, x2 - x1);
@ -698,8 +730,12 @@ static void
paint_setup_YV12 (paintinfo * p, char *dest)
{
p->yp = dest;
p->up = dest + p->width * p->height + p->width * p->height / 4;
p->vp = dest + p->width * p->height;
p->ystride = ROUND_UP_4(p->width);
p->vp = p->yp + p->ystride * ROUND_UP_2(p->height);
p->vstride = ROUND_UP_8(p->ystride)/2;
p->up = p->vp + p->vstride * ROUND_UP_2(p->height) / 2;
p->ustride = ROUND_UP_8(p->ystride)/2;
p->endptr = p->up + p->ustride * ROUND_UP_2(p->height) / 2;
}
static void
@ -708,6 +744,8 @@ paint_setup_YUY2 (paintinfo * p, char *dest)
p->yp = dest;
p->up = dest + 1;
p->vp = dest + 3;
p->ystride = ROUND_UP_2(p->width) * 2;
p->endptr = dest + p->ystride * p->height;
}
static void
@ -716,6 +754,8 @@ paint_setup_UYVY (paintinfo * p, char *dest)
p->yp = dest + 1;
p->up = dest;
p->vp = dest + 2;
p->ystride = ROUND_UP_2(p->width) * 2;
p->endptr = dest + p->ystride * p->height;
}
static void
@ -724,6 +764,8 @@ paint_setup_YVYU (paintinfo * p, char *dest)
p->yp = dest;
p->up = dest + 3;
p->vp = dest + 1;
p->ystride = ROUND_UP_2(p->width * 2);
p->endptr = dest + p->ystride * p->height;
}
static void
@ -733,7 +775,7 @@ paint_hline_YUY2 (paintinfo * p, int x, int y, int w)
int x2 = (x + w) / 2;
int offset;
offset = y * p->width * 2;
offset = y * p->ystride;
memset_str2 (p->yp + offset + x * 2, p->color->Y, w);
memset_str4 (p->up + offset + x1 * 4, p->color->U, x2 - x1);
memset_str4 (p->vp + offset + x1 * 4, p->color->V, x2 - x1);
@ -742,9 +784,12 @@ paint_hline_YUY2 (paintinfo * p, int x, int y, int w)
static void
paint_setup_IYU2 (paintinfo * p, char *dest)
{
/* untested */
p->yp = dest + 1;
p->up = dest + 0;
p->vp = dest + 2;
p->ystride = ROUND_UP_4(p->width * 3);
p->endptr = dest + p->ystride * p->height;
}
static void
@ -752,7 +797,7 @@ paint_hline_IYU2 (paintinfo * p, int x, int y, int w)
{
int offset;
offset = y * p->width * 3;
offset = y * p->ystride;
memset_str3 (p->yp + offset + x * 3, p->color->Y, w);
memset_str3 (p->up + offset + x * 3, p->color->U, w);
memset_str3 (p->vp + offset + x * 3, p->color->V, w);
@ -761,17 +806,21 @@ paint_hline_IYU2 (paintinfo * p, int x, int y, int w)
static void
paint_setup_Y800 (paintinfo * p, char *dest)
{
/* untested */
p->yp = dest;
p->ystride = ROUND_UP_4 (p->width);
p->endptr = dest + p->ystride * p->height;
}
static void
paint_hline_Y800 (paintinfo * p, int x, int y, int w)
{
int offset = y * p->width;
int offset = y * p->ystride;
memset (p->yp + offset + x, p->color->Y, w);
}
#if 0
static void
paint_setup_IMC1 (paintinfo * p, char *dest)
{
@ -816,21 +865,33 @@ paint_hline_IMC1 (paintinfo * p, int x, int y, int w)
memset (p->up + offset1 + x1, p->color->U, x2 - x1);
memset (p->vp + offset1 + x1, p->color->V, x2 - x1);
}
#endif
static void
paint_setup_YVU9 (paintinfo * p, char *dest)
{
int h = ROUND_UP_4(p->height);
p->yp = dest;
p->vp = dest + p->width * p->height;
p->up = dest + p->width * p->height + (p->width/4) * (p->height/4);
p->ystride = ROUND_UP_4(p->width);
p->vp = p->yp + p->ystride * ROUND_UP_4(p->height);
p->vstride = ROUND_UP_4(p->ystride/4);
p->up = p->vp + p->vstride * ROUND_UP_4(h/4);
p->ustride = ROUND_UP_4(p->ystride/4);
p->endptr = p->up + p->ustride * ROUND_UP_4(h/4);
}
static void
paint_setup_YUV9 (paintinfo * p, char *dest)
{
/* untested */
int h = ROUND_UP_4(p->height);
p->yp = dest;
p->up = dest + p->width * p->height;
p->vp = dest + p->width * p->height + (p->width/4) * (p->height/4);
p->ystride = ROUND_UP_4(p->width);
p->up = p->yp + p->ystride * h;
p->ustride = ROUND_UP_4(p->ystride/4);
p->vp = p->up + p->ustride * ROUND_UP_4(h/4);
p->vstride = ROUND_UP_4(p->ystride/4);
p->endptr = p->vp + p->vstride * ROUND_UP_4(h/4);
}
static void
@ -838,8 +899,8 @@ paint_hline_YUV9 (paintinfo * p, int x, int y, int w)
{
int x1 = x / 4;
int x2 = (x + w) / 4;
int offset = y * p->width;
int offset1 = (y / 4) * (p->width / 4);
int offset = y * p->ystride;
int offset1 = (y / 4) * p->ustride;
memset (p->yp + offset + x, p->color->Y, w);
memset (p->up + offset1 + x1, p->color->U, x2 - x1);
@ -852,6 +913,8 @@ paint_setup_xRGB8888 (paintinfo * p, char *dest)
p->yp = dest + 1;
p->up = dest + 2;
p->vp = dest + 3;
p->ystride = p->width*4;
p->endptr = p->dest + p->ystride * p->height;
}
static void
@ -860,6 +923,8 @@ paint_setup_xBGR8888 (paintinfo * p, char *dest)
p->yp = dest + 3;
p->up = dest + 2;
p->vp = dest + 1;
p->ystride = p->width*4;
p->endptr = p->dest + p->ystride * p->height;
}
static void
@ -868,6 +933,8 @@ paint_setup_RGBx8888 (paintinfo * p, char *dest)
p->yp = dest + 0;
p->up = dest + 1;
p->vp = dest + 2;
p->ystride = p->width*4;
p->endptr = p->dest + p->ystride * p->height;
}
static void
@ -876,6 +943,8 @@ paint_setup_BGRx8888 (paintinfo * p, char *dest)
p->yp = dest + 2;
p->up = dest + 1;
p->vp = dest + 0;
p->ystride = p->width*4;
p->endptr = p->dest + p->ystride * p->height;
}
static void
@ -884,7 +953,8 @@ paint_setup_RGB888 (paintinfo * p, char *dest)
p->yp = dest + 0;
p->up = dest + 1;
p->vp = dest + 2;
p->stride = (p->width*3 + 1)&(~0x3);
p->ystride = ROUND_UP_4(p->width*3);
p->endptr = p->dest + p->ystride * p->height;
}
static void
@ -893,13 +963,14 @@ paint_setup_BGR888 (paintinfo * p, char *dest)
p->yp = dest + 2;
p->up = dest + 1;
p->vp = dest + 0;
p->stride = (p->width*3 + 1)&(~0x3);
p->ystride = ROUND_UP_4(p->width*3);
p->endptr = p->dest + p->ystride * p->height;
}
static void
paint_hline_str4 (paintinfo * p, int x, int y, int w)
{
int offset = y * p->width * 4;
int offset = y * p->ystride;
memset_str4 (p->yp + offset + x * 4, p->color->R, w);
memset_str4 (p->up + offset + x * 4, p->color->G, w);
@ -909,7 +980,7 @@ paint_hline_str4 (paintinfo * p, int x, int y, int w)
static void
paint_hline_str3 (paintinfo * p, int x, int y, int w)
{
int offset = y * p->stride;
int offset = y * p->ystride;
memset_str3 (p->yp + offset + x * 3, p->color->R, w);
memset_str3 (p->up + offset + x * 3, p->color->G, w);
@ -920,13 +991,14 @@ static void
paint_setup_RGB565 (paintinfo * p, char *dest)
{
p->yp = dest;
p->stride = (p->width*2 + 1)&(~0x3);
p->ystride = ROUND_UP_4(p->width*2);
p->endptr = p->dest + p->ystride * p->height;
}
static void
paint_hline_RGB565 (paintinfo * p, int x, int y, int w)
{
int offset = y * p->stride;
int offset = y * p->ystride;
unsigned int a,b;
a = (p->color->R&0xf8) | (p->color->G>>5);
@ -945,13 +1017,14 @@ static void
paint_setup_xRGB1555 (paintinfo * p, char *dest)
{
p->yp = dest;
p->stride = (p->width*2 + 1)&(~0x3);
p->ystride = ROUND_UP_4(p->width*2);
p->endptr = p->dest + p->ystride * p->height;
}
static void
paint_hline_xRGB1555 (paintinfo * p, int x, int y, int w)
{
int offset = y * p->stride;
int offset = y * p->ystride;
unsigned int a,b;
a = ((p->color->R>>1)&0x7c) | (p->color->G>>6);
@ -966,143 +1039,3 @@ paint_hline_xRGB1555 (paintinfo * p, int x, int y, int w)
#endif
}
#if 0
#ifdef unused
static void
gst_videotestsrc_smpte_RGB (GstVideotestsrc * v, unsigned char *dest, int w, int h)
{
int i;
int y1, y2;
y1 = h * 2 / 3;
y2 = h * 0.75;
/* color bars */
for (i = 0; i < 7; i++) {
int x1 = i * w / 7;
int x2 = (i + 1) * w / 7;
unsigned char col[2];
col[0] = (g_colors[i] & 0xe0) | (b_colors[i] >> 3);
col[1] = (r_colors[i] & 0xf8) | (g_colors[i] >> 5);
paint_rect2 (dest, w * 2, x1, 0, x2 - x1, y1, col);
}
/* inverse blue bars */
for (i = 0; i < 7; i++) {
int x1 = i * w / 7;
int x2 = (i + 1) * w / 7;
unsigned char col[2];
int k;
if (i & 1) {
k = 7;
} else {
k = 6 - i;
}
col[0] = (g_colors[k] & 0xe0) | (b_colors[k] >> 3);
col[1] = (r_colors[k] & 0xf8) | (g_colors[k] >> 5);
paint_rect2 (dest, w * 2, x1, y1, x2 - x1, y2 - y1, col);
}
/* -I, white, Q regions */
for (i = 0; i < 3; i++) {
int x1 = i * w / 6;
int x2 = (i + 1) * w / 6;
unsigned char col[2];
int k;
if (i == 0) {
k = 8;
} else if (i == 1) {
k = 0;
} else {
k = 9;
}
col[0] = (g_colors[k] & 0xe0) | (b_colors[k] >> 3);
col[1] = (r_colors[k] & 0xf8) | (g_colors[k] >> 5);
paint_rect2 (dest, w * 2, x1, y2, x2 - x1, h - y2, col);
}
{
int x1 = w / 2;
int x2 = w - 1;
paint_rect_random (dest, w * 2, x1 * 2, y2, (x2 - x1) * 2, h - y2);
}
}
#endif
static void
gst_videotestsrc_smpte_RGB (GstVideotestsrc * v, unsigned char *dest, int w, int h)
{
int i;
int y1, y2;
y1 = h * 2 / 3;
y2 = h * 0.75;
/* color bars */
for (i = 0; i < 7; i++) {
int x1 = i * w / 7;
int x2 = (i + 1) * w / 7;
unsigned char col[2];
col[0] = 0;
col[1] = r_colors[i];
col[2] = g_colors[i];
col[3] = b_colors[i];
paint_rect4 (dest, w * 4, x1, 0, x2 - x1, y1, col);
}
/* inverse blue bars */
for (i = 0; i < 7; i++) {
int x1 = i * w / 7;
int x2 = (i + 1) * w / 7;
unsigned char col[2];
int k;
if (i & 1) {
k = 7;
} else {
k = 6 - i;
}
col[0] = 0;
col[1] = r_colors[k];
col[2] = g_colors[k];
col[3] = b_colors[k];
paint_rect4 (dest, w * 4, x1, y1, x2 - x1, y2 - y1, col);
}
/* -I, white, Q regions */
for (i = 0; i < 3; i++) {
int x1 = i * w / 6;
int x2 = (i + 1) * w / 6;
unsigned char col[2];
int k;
if (i == 0) {
k = 8;
} else if (i == 1) {
k = 0;
} else {
k = 9;
}
col[0] = 0;
col[1] = r_colors[k];
col[2] = g_colors[k];
col[3] = b_colors[k];
paint_rect4 (dest, w * 4, x1, y2, x2 - x1, h - y2, col);
}
{
int x1 = w / 2;
int x2 = w - 1;
paint_rect_random (dest, w * 4, x1 * 4, y2, (x2 - x1) * 4, h - y2);
}
}
#endif

View file

@ -30,11 +30,14 @@ struct paintinfo_struct
{
unsigned char *dest;
unsigned char *yp, *up, *vp;
unsigned char *endptr;
int ystride;
int ustride;
int vstride;
int width;
int height;
struct vts_color_struct *color;
void (*paint_hline) (paintinfo * p, int x, int y, int w);
int stride;
};
struct fourcc_list_struct
@ -56,6 +59,7 @@ struct fourcc_list_struct * paintrect_find_name (const char *name);
struct fourcc_list_struct *paintinfo_find_by_structure(
const GstStructure *structure);
GstStructure *paint_get_structure(struct fourcc_list_struct *format);
int gst_videotestsrc_get_size (GstVideotestsrc * v, int w, int h);
void gst_videotestsrc_smpte (GstVideotestsrc * v, unsigned char *dest, int w, int h);
void gst_videotestsrc_snow (GstVideotestsrc * v, unsigned char *dest, int w, int h);
void gst_videotestsrc_black (GstVideotestsrc * v, unsigned char *dest, int w, int h);

View file

@ -40,6 +40,7 @@ sub check_bad_casts();
sub check_old_plugin();
sub check_signal_new();
sub check_gnuc_const();
sub check_caps();
sub m_check_plugindir();
sub m_check_interfaces();
@ -74,6 +75,7 @@ foreach $filename (<FIND>) {
check_old_plugin();
check_signal_new();
check_gnuc_const();
check_caps();
}
open FIND, "find . -name \"Makefile.am\" -print|";
@ -435,3 +437,13 @@ sub check_gnuc_const()
}
}
#
# Check caps usage
#
sub check_caps()
{
if (grep { /gst_pad_get_caps/ } @lines) {
print "E: elements should not call gst_pad_get_caps(), use gst_pad_get_allowed_caps()\n";
}
}

View file

@ -40,6 +40,7 @@ sub check_bad_casts();
sub check_old_plugin();
sub check_signal_new();
sub check_gnuc_const();
sub check_caps();
sub m_check_plugindir();
sub m_check_interfaces();
@ -74,6 +75,7 @@ foreach $filename (<FIND>) {
check_old_plugin();
check_signal_new();
check_gnuc_const();
check_caps();
}
open FIND, "find . -name \"Makefile.am\" -print|";
@ -435,3 +437,13 @@ sub check_gnuc_const()
}
}
#
# Check caps usage
#
sub check_caps()
{
if (grep { /gst_pad_get_caps/ } @lines) {
print "E: elements should not call gst_pad_get_caps(), use gst_pad_get_allowed_caps()\n";
}
}