mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-04 05:22:30 +00:00
Significant improvements to videotestsrc. More modular, handles RGB formats.
Original commit message from CVS: Significant improvements to videotestsrc. More modular, handles RGB formats.
This commit is contained in:
parent
695c3d18d9
commit
4a2b1b2947
5 changed files with 1090 additions and 746 deletions
|
@ -3,10 +3,11 @@ plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
|
||||||
plugin_LTLIBRARIES = libgstvideotestsrc.la
|
plugin_LTLIBRARIES = libgstvideotestsrc.la
|
||||||
|
|
||||||
libgstvideotestsrc_la_SOURCES = \
|
libgstvideotestsrc_la_SOURCES = \
|
||||||
gstvideotestsrc.c
|
gstvideotestsrc.c \
|
||||||
|
videotestsrc.c
|
||||||
|
|
||||||
libgstvideotestsrc_la_CFLAGS = -O2 $(FOMIT_FRAME_POINTER) -funroll-all-loops -finline-functions -ffast-math $(GST_CFLAGS)
|
libgstvideotestsrc_la_CFLAGS = -O2 $(FOMIT_FRAME_POINTER) -funroll-all-loops -finline-functions -ffast-math $(GST_CFLAGS)
|
||||||
libgstvideotestsrc_la_LIBADD =
|
libgstvideotestsrc_la_LIBADD =
|
||||||
libgstvideotestsrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
libgstvideotestsrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||||
|
|
||||||
noinst_HEADERS = gstvideotestsrc.h
|
noinst_HEADERS = gstvideotestsrc.h videotestsrc.h
|
||||||
|
|
|
@ -20,32 +20,11 @@
|
||||||
|
|
||||||
/*#define DEBUG_ENABLED */
|
/*#define DEBUG_ENABLED */
|
||||||
#include <gstvideotestsrc.h>
|
#include <gstvideotestsrc.h>
|
||||||
|
#include <videotestsrc.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
typedef struct paintinfo_struct paintinfo;
|
|
||||||
struct paintinfo_struct
|
|
||||||
{
|
|
||||||
unsigned char *dest;
|
|
||||||
unsigned char *yp, *up, *vp;
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
int Y, U, V;
|
|
||||||
void (*paint_hline) (paintinfo * p, int x, int y, int w);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct fourcc_list_struct
|
|
||||||
{
|
|
||||||
char *fourcc;
|
|
||||||
int bitspp;
|
|
||||||
void (*paint_setup) (paintinfo * p, char *dest);
|
|
||||||
void (*paint_hline) (paintinfo * p, int x, int y, int w);
|
|
||||||
};
|
|
||||||
static struct fourcc_list_struct fourcc_list[];
|
|
||||||
static int n_fourccs;
|
|
||||||
|
|
||||||
static int paintrect_find_fourcc (int find_fourcc);
|
|
||||||
|
|
||||||
|
|
||||||
/* elementfactory information */
|
/* elementfactory information */
|
||||||
|
@ -76,21 +55,9 @@ enum
|
||||||
/* FILL ME */
|
/* FILL ME */
|
||||||
};
|
};
|
||||||
|
|
||||||
GST_PAD_TEMPLATE_FACTORY (videotestsrc_src_template_factory,
|
|
||||||
"src",
|
|
||||||
GST_PAD_SRC,
|
|
||||||
GST_PAD_ALWAYS,
|
|
||||||
GST_CAPS_NEW ("videotestsrc_src",
|
|
||||||
"video/raw",
|
|
||||||
"width", GST_PROPS_INT_RANGE (0, G_MAXINT),
|
|
||||||
"height", GST_PROPS_INT_RANGE (0, G_MAXINT)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
static void gst_videotestsrc_class_init (GstVideotestsrcClass * klass);
|
static void gst_videotestsrc_class_init (GstVideotestsrcClass * klass);
|
||||||
static void gst_videotestsrc_init (GstVideotestsrc * videotestsrc);
|
static void gst_videotestsrc_init (GstVideotestsrc * videotestsrc);
|
||||||
static GstElementStateReturn gst_videotestsrc_change_state (GstElement * element);
|
static GstElementStateReturn gst_videotestsrc_change_state (GstElement * element);
|
||||||
static void gst_videotestsrc_set_clock (GstElement *element, GstClock *clock);
|
|
||||||
|
|
||||||
static void gst_videotestsrc_set_property (GObject * object, guint prop_id,
|
static void gst_videotestsrc_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec);
|
const GValue * value, GParamSpec * pspec);
|
||||||
|
@ -101,16 +68,27 @@ static GstBuffer *gst_videotestsrc_get (GstPad * pad);
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
|
|
||||||
static void gst_videotestsrc_setup (GstVideotestsrc * v);
|
static GstCaps * gst_videotestsrc_get_capslist (void);
|
||||||
static void random_chars (unsigned char *dest, int nbytes);
|
|
||||||
static void gst_videotestsrc_smpte_yuv (GstVideotestsrc * v, unsigned char *dest, int w, int h);
|
|
||||||
static void gst_videotestsrc_smpte_RGB (GstVideotestsrc * v, unsigned char *dest, int w, int h);
|
|
||||||
#if 0
|
|
||||||
static void gst_videotestsrc_colors_yuv (GstVideotestsrc * v, unsigned char *dest, int w, int h);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static GType
|
static GstPadTemplate *
|
||||||
|
videotestsrc_src_template_factory(void)
|
||||||
|
{
|
||||||
|
static GstPadTemplate *templ = NULL;
|
||||||
|
|
||||||
|
if(!templ){
|
||||||
|
GstCaps *caps = GST_CAPS_NEW("ack","video/raw",
|
||||||
|
"width", GST_PROPS_INT_RANGE (0, G_MAXINT),
|
||||||
|
"height", GST_PROPS_INT_RANGE (0, G_MAXINT));
|
||||||
|
|
||||||
|
caps = gst_caps_intersect(caps, gst_videotestsrc_get_capslist ());
|
||||||
|
|
||||||
|
templ = GST_PAD_TEMPLATE_NEW("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
|
||||||
|
}
|
||||||
|
return templ;
|
||||||
|
}
|
||||||
|
|
||||||
|
GType
|
||||||
gst_videotestsrc_get_type (void)
|
gst_videotestsrc_get_type (void)
|
||||||
{
|
{
|
||||||
static GType videotestsrc_type = 0;
|
static GType videotestsrc_type = 0;
|
||||||
|
@ -161,17 +139,6 @@ gst_videotestsrc_class_init (GstVideotestsrcClass * klass)
|
||||||
gobject_class->get_property = gst_videotestsrc_get_property;
|
gobject_class->get_property = gst_videotestsrc_get_property;
|
||||||
|
|
||||||
gstelement_class->change_state = gst_videotestsrc_change_state;
|
gstelement_class->change_state = gst_videotestsrc_change_state;
|
||||||
gstelement_class->set_clock = gst_videotestsrc_set_clock;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_videotestsrc_set_clock (GstElement *element, GstClock *clock)
|
|
||||||
{
|
|
||||||
GstVideotestsrc *v;
|
|
||||||
|
|
||||||
v = GST_VIDEOTESTSRC (element);
|
|
||||||
|
|
||||||
gst_object_replace ((GstObject **)&v->clock, (GstObject *)clock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstPadLinkReturn
|
static GstPadLinkReturn
|
||||||
|
@ -182,38 +149,30 @@ gst_videotestsrc_srcconnect (GstPad * pad, GstCaps * caps)
|
||||||
GST_DEBUG (0, "gst_videotestsrc_srcconnect");
|
GST_DEBUG (0, "gst_videotestsrc_srcconnect");
|
||||||
videotestsrc = GST_VIDEOTESTSRC (gst_pad_get_parent (pad));
|
videotestsrc = GST_VIDEOTESTSRC (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
#if 0
|
gst_caps_debug(caps,"moo");
|
||||||
if (!GST_CAPS_IS_FIXED (caps)) {
|
|
||||||
|
videotestsrc->fourcc = paintinfo_find_by_caps(caps);
|
||||||
|
if(!videotestsrc->fourcc){
|
||||||
return GST_PAD_LINK_DELAYED;
|
return GST_PAD_LINK_DELAYED;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
gst_caps_get_fourcc_int (caps, "format", &videotestsrc->format);
|
printf ("videotestsrc: using fourcc element %p %s\n",
|
||||||
|
videotestsrc->fourcc, videotestsrc->fourcc->name);
|
||||||
|
|
||||||
gst_caps_get_int (caps, "width", &videotestsrc->width);
|
gst_caps_get_int (caps, "width", &videotestsrc->width);
|
||||||
gst_caps_get_int (caps, "height", &videotestsrc->height);
|
gst_caps_get_int (caps, "height", &videotestsrc->height);
|
||||||
|
|
||||||
GST_DEBUG (0, "format is 0x%08x\n", videotestsrc->format);
|
#if 0
|
||||||
|
/* FIXME */
|
||||||
printf ("videotestsrc: caps FOURCC 0x%08x, forced FOURCC 0x%08x\n",
|
|
||||||
videotestsrc->format, videotestsrc->forced_format);
|
|
||||||
|
|
||||||
if (videotestsrc->forced_format && videotestsrc->format != videotestsrc->forced_format) {
|
if (videotestsrc->forced_format && videotestsrc->format != videotestsrc->forced_format) {
|
||||||
return GST_PAD_LINK_REFUSED;
|
return GST_PAD_LINK_REFUSED;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
printf ("videotestsrc: using FOURCC 0x%08x\n", videotestsrc->format);
|
videotestsrc->make_image = gst_videotestsrc_smpte;
|
||||||
|
videotestsrc->make_image = gst_videotestsrc_snow;
|
||||||
if (videotestsrc->format == GST_MAKE_FOURCC ('R', 'G', 'B', ' ')) {
|
/* videotestsrc->make_image = gst_videotestsrc_colors_yuv; */
|
||||||
videotestsrc->make_image = gst_videotestsrc_smpte_RGB;
|
videotestsrc->bpp = videotestsrc->fourcc->bitspp;
|
||||||
videotestsrc->bpp = 16;
|
|
||||||
} else {
|
|
||||||
int index;
|
|
||||||
|
|
||||||
index = paintrect_find_fourcc (videotestsrc->format);
|
|
||||||
videotestsrc->make_image = gst_videotestsrc_smpte_yuv;
|
|
||||||
/* videotestsrc->make_image = gst_videotestsrc_colors_yuv; */
|
|
||||||
videotestsrc->bpp = fourcc_list[index].bitspp;
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_DEBUG (0, "size %d x %d", videotestsrc->width, videotestsrc->height);
|
GST_DEBUG (0, "size %d x %d", videotestsrc->width, videotestsrc->height);
|
||||||
|
|
||||||
|
@ -251,16 +210,9 @@ gst_videotestsrc_get_capslist (void)
|
||||||
if (capslist)
|
if (capslist)
|
||||||
return capslist;
|
return capslist;
|
||||||
|
|
||||||
for (i = 0; i < n_fourccs; i++) {
|
for(i=0;i<n_fourccs;i++){
|
||||||
char *s = fourcc_list[i].fourcc;
|
caps = paint_get_caps(fourcc_list + i);
|
||||||
int fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]);
|
capslist = gst_caps_append(capslist, caps);
|
||||||
|
|
||||||
caps = GST_CAPS_NEW ("videotestsrc_filter",
|
|
||||||
"video/raw",
|
|
||||||
"format", GST_PROPS_FOURCC (fourcc),
|
|
||||||
"width", GST_PROPS_INT (640),
|
|
||||||
"height", GST_PROPS_INT (480));
|
|
||||||
capslist = gst_caps_append (capslist, caps);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return capslist;
|
return capslist;
|
||||||
|
@ -270,18 +222,24 @@ static GstCaps *
|
||||||
gst_videotestsrc_getcaps (GstPad * pad, GstCaps * caps)
|
gst_videotestsrc_getcaps (GstPad * pad, GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstVideotestsrc *vts;
|
GstVideotestsrc *vts;
|
||||||
|
GstCaps *caps1;
|
||||||
|
GstCaps *caps2;
|
||||||
|
|
||||||
vts = GST_VIDEOTESTSRC (gst_pad_get_parent (pad));
|
vts = GST_VIDEOTESTSRC (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
if (vts->forced_format != 0) {
|
if (vts->forced_format != NULL) {
|
||||||
return GST_CAPS_NEW ("videotestsrc_filter",
|
struct fourcc_list_struct *fourcc;
|
||||||
"video/raw",
|
fourcc = paintrect_find_name (vts->forced_format);
|
||||||
"format", GST_PROPS_FOURCC (vts->forced_format),
|
caps1 = paint_get_caps(fourcc);
|
||||||
"width", GST_PROPS_INT (640),
|
|
||||||
"height", GST_PROPS_INT (480));
|
|
||||||
} else {
|
} else {
|
||||||
return gst_caps_ref (gst_videotestsrc_get_capslist ());
|
caps1 = gst_videotestsrc_get_capslist ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
caps2 = GST_CAPS_NEW("ack","video/raw",
|
||||||
|
"width", GST_PROPS_INT (640),
|
||||||
|
"height", GST_PROPS_INT (480));
|
||||||
|
|
||||||
|
return gst_caps_intersect(caps1,caps2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -314,7 +272,6 @@ gst_videotestsrc_get (GstPad * pad)
|
||||||
GstVideotestsrc *videotestsrc;
|
GstVideotestsrc *videotestsrc;
|
||||||
gulong newsize;
|
gulong newsize;
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
GstClockTimeDiff jitter = 0;
|
|
||||||
|
|
||||||
GST_DEBUG (0, "gst_videotestsrc_get");
|
GST_DEBUG (0, "gst_videotestsrc_get");
|
||||||
|
|
||||||
|
@ -338,22 +295,11 @@ gst_videotestsrc_get (GstPad * pad)
|
||||||
}
|
}
|
||||||
g_return_val_if_fail (GST_BUFFER_DATA (buf) != NULL, NULL);
|
g_return_val_if_fail (GST_BUFFER_DATA (buf) != NULL, NULL);
|
||||||
|
|
||||||
|
videotestsrc->timestamp += videotestsrc->interval;
|
||||||
|
GST_BUFFER_TIMESTAMP (buf) = videotestsrc->timestamp;
|
||||||
|
|
||||||
videotestsrc->make_image (videotestsrc, (void *) GST_BUFFER_DATA (buf),
|
videotestsrc->make_image (videotestsrc, (void *) GST_BUFFER_DATA (buf),
|
||||||
videotestsrc->width, videotestsrc->height);
|
videotestsrc->width, videotestsrc->height);
|
||||||
|
|
||||||
do {
|
|
||||||
GstClockID id;
|
|
||||||
|
|
||||||
videotestsrc->timestamp += videotestsrc->interval;
|
|
||||||
GST_BUFFER_TIMESTAMP (buf) = videotestsrc->timestamp;
|
|
||||||
|
|
||||||
if (videotestsrc->clock) {
|
|
||||||
id = gst_clock_new_single_shot_id (videotestsrc->clock, GST_BUFFER_TIMESTAMP (buf));
|
|
||||||
gst_element_clock_wait (GST_ELEMENT (videotestsrc), id, &jitter);
|
|
||||||
gst_clock_id_free (id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (jitter > 100 * GST_MSECOND);
|
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
@ -363,7 +309,6 @@ gst_videotestsrc_set_property (GObject * object, guint prop_id, const GValue * v
|
||||||
GParamSpec * pspec)
|
GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GstVideotestsrc *src;
|
GstVideotestsrc *src;
|
||||||
const gchar *s;
|
|
||||||
|
|
||||||
/* it's not null if we got it, but it might not be ours */
|
/* it's not null if we got it, but it might not be ours */
|
||||||
g_return_if_fail (GST_IS_VIDEOTESTSRC (object));
|
g_return_if_fail (GST_IS_VIDEOTESTSRC (object));
|
||||||
|
@ -378,11 +323,8 @@ gst_videotestsrc_set_property (GObject * object, guint prop_id, const GValue * v
|
||||||
src->height = g_value_get_int (value);
|
src->height = g_value_get_int (value);
|
||||||
break;
|
break;
|
||||||
case ARG_FOURCC:
|
case ARG_FOURCC:
|
||||||
s = g_value_get_string (value);
|
src->forced_format = g_strdup(g_value_get_string (value));
|
||||||
if (strlen (s) == 4) {
|
printf ("forcing FOURCC to \"%s\"\n", src->forced_format);
|
||||||
src->forced_format = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]);
|
|
||||||
printf ("forcing FOURCC to 0x%08x\n", src->forced_format);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case ARG_RATE:
|
case ARG_RATE:
|
||||||
src->rate = g_value_get_int (value);
|
src->rate = g_value_get_int (value);
|
||||||
|
@ -449,629 +391,3 @@ GstPluginDesc plugin_desc = {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Non-GST specific stuff */
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_videotestsrc_setup (GstVideotestsrc * v)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned char
|
|
||||||
random_char (void)
|
|
||||||
{
|
|
||||||
static unsigned int state;
|
|
||||||
|
|
||||||
state *= 1103515245;
|
|
||||||
state += 12345;
|
|
||||||
return (state >> 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
random_chars (unsigned char *dest, int nbytes)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
static unsigned int state;
|
|
||||||
|
|
||||||
for (i = 0; i < nbytes; i++) {
|
|
||||||
state *= 1103515245;
|
|
||||||
state += 12345;
|
|
||||||
dest[i] = (state >> 16);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
memset_str2 (unsigned char *dest, unsigned char val, int n)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
|
||||||
*dest = val;
|
|
||||||
dest += 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
memset_str3 (unsigned char *dest, unsigned char val, int n)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
|
||||||
*dest = val;
|
|
||||||
dest += 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
memset_str4 (unsigned char *dest, unsigned char val, int n)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
|
||||||
*dest = val;
|
|
||||||
dest += 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
paint_rect_random (unsigned char *dest, int stride, int x, int y, int w, int h)
|
|
||||||
{
|
|
||||||
unsigned char *d = dest + stride * y + x;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < h; i++) {
|
|
||||||
random_chars (d, w);
|
|
||||||
d += stride;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
paint_rect (unsigned char *dest, int stride, int x, int y, int w, int h, unsigned char color)
|
|
||||||
{
|
|
||||||
unsigned char *d = dest + stride * y + x;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < h; i++) {
|
|
||||||
memset (d, color, w);
|
|
||||||
d += stride;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
|
||||||
paint_rect_s2 (unsigned char *dest, int stride, int x, int y, int w, int h, unsigned char col)
|
|
||||||
{
|
|
||||||
unsigned char *d = dest + stride * y + x * 2;
|
|
||||||
unsigned char *dp;
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
for (i = 0; i < h; i++) {
|
|
||||||
dp = d;
|
|
||||||
for (j = 0; j < w; j++) {
|
|
||||||
*dp = col;
|
|
||||||
dp += 2;
|
|
||||||
}
|
|
||||||
d += stride;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
paint_rect2 (unsigned char *dest, int stride, int x, int y, int w, int h, unsigned char *col)
|
|
||||||
{
|
|
||||||
unsigned char *d = dest + stride * y + x * 2;
|
|
||||||
unsigned char *dp;
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
for (i = 0; i < h; i++) {
|
|
||||||
dp = d;
|
|
||||||
for (j = 0; j < w; j++) {
|
|
||||||
*dp++ = col[0];
|
|
||||||
*dp++ = col[1];
|
|
||||||
}
|
|
||||||
d += stride;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static void
|
|
||||||
paint_rect3 (unsigned char *dest, int stride, int x, int y, int w, int h, unsigned char *col)
|
|
||||||
{
|
|
||||||
unsigned char *d = dest + stride * y + x * 3;
|
|
||||||
unsigned char *dp;
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
for (i = 0; i < h; i++) {
|
|
||||||
dp = d;
|
|
||||||
for (j = 0; j < w; j++) {
|
|
||||||
*dp++ = col[0];
|
|
||||||
*dp++ = col[1];
|
|
||||||
*dp++ = col[2];
|
|
||||||
}
|
|
||||||
d += stride;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
paint_rect_s4 (unsigned char *dest, int stride, int x, int y, int w, int h, unsigned char col)
|
|
||||||
{
|
|
||||||
unsigned char *d = dest + stride * y + x * 4;
|
|
||||||
unsigned char *dp;
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
for (i = 0; i < h; i++) {
|
|
||||||
dp = d;
|
|
||||||
for (j = 0; j < w; j++) {
|
|
||||||
*dp = col;
|
|
||||||
dp += 4;
|
|
||||||
}
|
|
||||||
d += stride;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
enum {
|
|
||||||
COLOR_WHITE = 0,
|
|
||||||
COLOR_YELLOW,
|
|
||||||
COLOR_CYAN,
|
|
||||||
COLOR_GREEN,
|
|
||||||
COLOR_MAGENTA,
|
|
||||||
COLOR_RED,
|
|
||||||
COLOR_BLUE,
|
|
||||||
COLOR_BLACK,
|
|
||||||
COLOR_NEG_I,
|
|
||||||
COLOR_POS_Q,
|
|
||||||
COLOR_SUPER_BLACK,
|
|
||||||
COLOR_DARK_GREY,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* wht yel cya grn mag red blu blk -I Q, superblack, dark grey */
|
|
||||||
static int y_colors[] = { 255, 226, 179, 150, 105, 76, 29, 16, 16, 16, 0, 32 };
|
|
||||||
static int u_colors[] = { 128, 0, 170, 46, 212, 85, 255, 128, 198, 235, 128, 128 };
|
|
||||||
static int v_colors[] = { 128, 155, 0, 21, 235, 255, 107, 128, 21, 198, 128, 128 };
|
|
||||||
|
|
||||||
static void paint_setup_I420 (paintinfo * p, char *dest);
|
|
||||||
static void paint_setup_YV12 (paintinfo * p, char *dest);
|
|
||||||
static void paint_setup_YUY2 (paintinfo * p, char *dest);
|
|
||||||
static void paint_setup_UYVY (paintinfo * p, char *dest);
|
|
||||||
static void paint_setup_YVYU (paintinfo * p, char *dest);
|
|
||||||
static void paint_setup_Y800 (paintinfo * p, char *dest);
|
|
||||||
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);
|
|
||||||
|
|
||||||
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_Y800 (paintinfo * p, int x, int y, int w);
|
|
||||||
static void paint_hline_IMC1 (paintinfo * p, int x, int y, int w);
|
|
||||||
|
|
||||||
static struct fourcc_list_struct fourcc_list[] = {
|
|
||||||
/* packed */
|
|
||||||
{"YUY2", 16, paint_setup_YUY2, paint_hline_YUY2},
|
|
||||||
{"UYVY", 16, paint_setup_UYVY, paint_hline_YUY2},
|
|
||||||
{"Y422", 16, paint_setup_UYVY, paint_hline_YUY2},
|
|
||||||
{"UYNV", 16, paint_setup_UYVY, paint_hline_YUY2},
|
|
||||||
{"YVYU", 16, paint_setup_YVYU, paint_hline_YUY2},
|
|
||||||
|
|
||||||
/* interlaced */
|
|
||||||
/*{ "IUYV", 16, paint_setup_YVYU, paint_hline_YUY2 }, */
|
|
||||||
|
|
||||||
/* inverted */
|
|
||||||
/*{ "cyuv", 16, paint_setup_YVYU, paint_hline_YUY2 }, */
|
|
||||||
|
|
||||||
/*{ "Y41P", 12, paint_setup_YVYU, paint_hline_YUY2 }, */
|
|
||||||
|
|
||||||
/* interlaced */
|
|
||||||
/*{ "IY41", 12, paint_setup_YVYU, paint_hline_YUY2 }, */
|
|
||||||
|
|
||||||
/*{ "Y211", 8, paint_setup_YVYU, paint_hline_YUY2 }, */
|
|
||||||
|
|
||||||
/*{ "Y41T", 12, paint_setup_YVYU, paint_hline_YUY2 }, */
|
|
||||||
/*{ "Y42P", 16, paint_setup_YVYU, paint_hline_YUY2 }, */
|
|
||||||
/*{ "CLJR", 8, paint_setup_YVYU, paint_hline_YUY2 }, */
|
|
||||||
/*{ "IYU1", 12, paint_setup_YVYU, paint_hline_YUY2 }, */
|
|
||||||
/*{ "IYU2", 24, paint_setup_YVYU, paint_hline_YUY2 }, */
|
|
||||||
|
|
||||||
/* planar */
|
|
||||||
/* YVU9 */
|
|
||||||
/* YUV9 */
|
|
||||||
/* IF09 */
|
|
||||||
/* YV12 */
|
|
||||||
{"YV12", 12, paint_setup_YV12, paint_hline_I420},
|
|
||||||
/* I420 */
|
|
||||||
{"I420", 12, paint_setup_I420, paint_hline_I420},
|
|
||||||
/* IYUV (same as I420) */
|
|
||||||
{"IYUV", 12, paint_setup_I420, paint_hline_I420},
|
|
||||||
/* NV12 */
|
|
||||||
/* NV21 */
|
|
||||||
/* IMC1 */
|
|
||||||
{"IMC1", 16, paint_setup_IMC1, paint_hline_IMC1},
|
|
||||||
/* IMC2 */
|
|
||||||
{"IMC2", 12, paint_setup_IMC2, paint_hline_IMC1},
|
|
||||||
/* IMC3 */
|
|
||||||
{"IMC3", 16, paint_setup_IMC3, paint_hline_IMC1},
|
|
||||||
/* IMC4 */
|
|
||||||
{"IMC4", 12, paint_setup_IMC4, paint_hline_IMC1},
|
|
||||||
/* CLPL */
|
|
||||||
/* Y41B */
|
|
||||||
/* Y42B */
|
|
||||||
/* Y800 grayscale */
|
|
||||||
{"Y800", 8, paint_setup_Y800, paint_hline_Y800},
|
|
||||||
/* Y8 same as Y800 */
|
|
||||||
{"Y8 ", 8, paint_setup_Y800, paint_hline_Y800},
|
|
||||||
|
|
||||||
/*{ "IYU2", 24, paint_setup_YVYU, paint_hline_YUY2 }, */
|
|
||||||
};
|
|
||||||
static int n_fourccs = sizeof (fourcc_list) / sizeof (fourcc_list[0]);
|
|
||||||
|
|
||||||
static int
|
|
||||||
paintrect_find_fourcc (int find_fourcc)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < n_fourccs; i++) {
|
|
||||||
char *s;
|
|
||||||
int fourcc;
|
|
||||||
|
|
||||||
s = fourcc_list[i].fourcc;
|
|
||||||
fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]);
|
|
||||||
if (find_fourcc == fourcc) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_videotestsrc_smpte_yuv (GstVideotestsrc * v, unsigned char *dest, int w, int h)
|
|
||||||
{
|
|
||||||
int index;
|
|
||||||
int i;
|
|
||||||
int y1, y2;
|
|
||||||
int j;
|
|
||||||
paintinfo pi;
|
|
||||||
paintinfo *p = π
|
|
||||||
|
|
||||||
p->width = w;
|
|
||||||
p->height = h;
|
|
||||||
index = paintrect_find_fourcc (v->format);
|
|
||||||
if (index < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
fourcc_list[index].paint_setup (p, dest);
|
|
||||||
p->paint_hline = fourcc_list[index].paint_hline;
|
|
||||||
|
|
||||||
y1 = 2 * h / 3;
|
|
||||||
y2 = h * 0.75;
|
|
||||||
|
|
||||||
/* color bars */
|
|
||||||
for (i = 0; i < 7; i++) {
|
|
||||||
int x1 = i * w / 7;
|
|
||||||
int x2 = (i + 1) * w / 7;
|
|
||||||
|
|
||||||
p->Y = y_colors[i];
|
|
||||||
p->U = u_colors[i];
|
|
||||||
p->V = v_colors[i];
|
|
||||||
for (j = 0; j < y1; j++) {
|
|
||||||
p->paint_hline (p, x1, j, (x2 - x1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* inverse blue bars */
|
|
||||||
for (i = 0; i < 7; i++) {
|
|
||||||
int x1 = i * w / 7;
|
|
||||||
int x2 = (i + 1) * w / 7;
|
|
||||||
int k;
|
|
||||||
|
|
||||||
if (i & 1) {
|
|
||||||
k = 7;
|
|
||||||
} else {
|
|
||||||
k = 6 - i;
|
|
||||||
}
|
|
||||||
p->Y = y_colors[k];
|
|
||||||
p->U = u_colors[k];
|
|
||||||
p->V = v_colors[k];
|
|
||||||
for (j = y1; j < y2; j++) {
|
|
||||||
p->paint_hline (p, x1, j, (x2 - x1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -I, white, Q regions */
|
|
||||||
for (i = 0; i < 3; i++) {
|
|
||||||
int x1 = i * w / 6;
|
|
||||||
int x2 = (i + 1) * w / 6;
|
|
||||||
int k;
|
|
||||||
|
|
||||||
if (i == 0) {
|
|
||||||
k = 8;
|
|
||||||
} else if (i == 1) {
|
|
||||||
k = 0;
|
|
||||||
} else
|
|
||||||
k = 9;
|
|
||||||
|
|
||||||
p->Y = y_colors[k];
|
|
||||||
p->U = u_colors[k];
|
|
||||||
p->V = v_colors[k];
|
|
||||||
|
|
||||||
for (j = y2; j < h; j++) {
|
|
||||||
p->paint_hline (p, x1, j, (x2 - x1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* superblack, black, dark grey */
|
|
||||||
for (i = 0; i < 3; i++) {
|
|
||||||
int x1 = w/2 + i * w / 12;
|
|
||||||
int x2 = w/2 + (i + 1) * w / 12;
|
|
||||||
int k;
|
|
||||||
|
|
||||||
if (i == 0) {
|
|
||||||
k = COLOR_SUPER_BLACK;
|
|
||||||
} else if (i == 1) {
|
|
||||||
k = COLOR_BLACK;
|
|
||||||
} else
|
|
||||||
k = COLOR_DARK_GREY;
|
|
||||||
|
|
||||||
p->Y = y_colors[k];
|
|
||||||
p->U = u_colors[k];
|
|
||||||
p->V = v_colors[k];
|
|
||||||
|
|
||||||
for (j = y2; j < h; j++) {
|
|
||||||
p->paint_hline (p, x1, j, (x2 - x1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
int x1 = w*3 / 4;
|
|
||||||
|
|
||||||
p->U = u_colors[0];
|
|
||||||
p->V = v_colors[0];
|
|
||||||
|
|
||||||
for (i = x1; i < w; i++) {
|
|
||||||
for (j = y2; j < h; j++) {
|
|
||||||
p->Y = random_char ();
|
|
||||||
p->paint_hline (p, i, j, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
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);
|
|
||||||
|
|
||||||
memset (p->yp + offset + x, p->Y, w);
|
|
||||||
memset (p->up + offset1 + x1, p->U, x2 - x1);
|
|
||||||
memset (p->vp + offset1 + x1, p->V, x2 - x1);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
paint_setup_YUY2 (paintinfo * p, char *dest)
|
|
||||||
{
|
|
||||||
p->yp = dest;
|
|
||||||
p->up = dest + 1;
|
|
||||||
p->vp = dest + 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
paint_setup_UYVY (paintinfo * p, char *dest)
|
|
||||||
{
|
|
||||||
p->yp = dest + 1;
|
|
||||||
p->up = dest;
|
|
||||||
p->vp = dest + 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
paint_setup_YVYU (paintinfo * p, char *dest)
|
|
||||||
{
|
|
||||||
p->yp = dest;
|
|
||||||
p->up = dest + 3;
|
|
||||||
p->vp = dest + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
paint_hline_YUY2 (paintinfo * p, int x, int y, int w)
|
|
||||||
{
|
|
||||||
int x1 = x / 2;
|
|
||||||
int x2 = (x + w) / 2;
|
|
||||||
int offset;
|
|
||||||
|
|
||||||
offset = y * p->width * 2;
|
|
||||||
memset_str2 (p->yp + offset + x * 2, p->Y, w);
|
|
||||||
memset_str4 (p->up + offset + x1 * 4, p->U, x2 - x1);
|
|
||||||
memset_str4 (p->vp + offset + x1 * 4, p->V, x2 - x1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
paint_setup_Y800 (paintinfo * p, char *dest)
|
|
||||||
{
|
|
||||||
p->yp = dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
paint_hline_Y800 (paintinfo * p, int x, int y, int w)
|
|
||||||
{
|
|
||||||
int offset = y * p->width;
|
|
||||||
|
|
||||||
memset (p->yp + offset + x, p->Y, w);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
paint_setup_IMC1 (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 / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
paint_setup_IMC2 (paintinfo * p, char *dest)
|
|
||||||
{
|
|
||||||
p->yp = dest;
|
|
||||||
p->vp = dest + p->width * p->height;
|
|
||||||
p->up = dest + p->width * p->height + p->width / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
paint_setup_IMC3 (paintinfo * p, char *dest)
|
|
||||||
{
|
|
||||||
p->yp = dest;
|
|
||||||
p->up = dest + p->width * p->height + p->width * p->height / 2;
|
|
||||||
p->vp = dest + p->width * p->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
paint_setup_IMC4 (paintinfo * p, char *dest)
|
|
||||||
{
|
|
||||||
p->yp = dest;
|
|
||||||
p->vp = dest + p->width * p->height + p->width / 2;
|
|
||||||
p->up = dest + p->width * p->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
paint_hline_IMC1 (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;
|
|
||||||
|
|
||||||
memset (p->yp + offset + x, p->Y, w);
|
|
||||||
memset (p->up + offset1 + x1, p->U, x2 - x1);
|
|
||||||
memset (p->vp + offset1 + x1, p->V, x2 - x1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* wht yel cya grn mag red blu blk -I Q */
|
|
||||||
static int r_colors[] = { 255, 255, 0, 0, 255, 255, 0, 0, 0, 0 };
|
|
||||||
static int g_colors[] = { 255, 255, 255, 255, 0, 0, 0, 0, 0, 128 };
|
|
||||||
static int b_colors[] = { 255, 0, 255, 0, 255, 0, 255, 0, 128, 255 };
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef unused
|
|
||||||
static void
|
|
||||||
gst_videotestsrc_colors_yuv (GstVideotestsrc * v, unsigned char *dest, int w, int h)
|
|
||||||
{
|
|
||||||
int index;
|
|
||||||
int i;
|
|
||||||
int j;
|
|
||||||
int k;
|
|
||||||
paintinfo pi;
|
|
||||||
paintinfo *p = π
|
|
||||||
static int static_y = 0;
|
|
||||||
|
|
||||||
p->width = w;
|
|
||||||
p->height = h;
|
|
||||||
index = paintrect_find_fourcc (v->format);
|
|
||||||
if (index < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
fourcc_list[index].paint_setup (p, dest);
|
|
||||||
p->paint_hline = fourcc_list[index].paint_hline;
|
|
||||||
|
|
||||||
/* color bars */
|
|
||||||
for (i = 0; i < 16; i++) {
|
|
||||||
int x1 = (i * w) >> 4;
|
|
||||||
int x2 = ((i + 1) * w) >> 4;
|
|
||||||
|
|
||||||
p->Y = static_y;
|
|
||||||
p->U = i * 17;
|
|
||||||
for (j = 0; j < 16; j++) {
|
|
||||||
int y1 = (j * h) >> 4;
|
|
||||||
int y2 = ((j + 1) * h) >> 4;
|
|
||||||
|
|
||||||
p->V = j * 17;
|
|
||||||
for (k = y1; k < y2; k++) {
|
|
||||||
p->paint_hline (p, x1, k, (x2 - x1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static_y += 17;
|
|
||||||
if (static_y >= 256)
|
|
||||||
static_y = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -55,10 +55,11 @@ struct _GstVideotestsrc {
|
||||||
GstPad *sinkpad,*srcpad;
|
GstPad *sinkpad,*srcpad;
|
||||||
|
|
||||||
/* video state */
|
/* video state */
|
||||||
guint32 format;
|
char *format_name;
|
||||||
gint width;
|
gint width;
|
||||||
gint height;
|
gint height;
|
||||||
gint forced_format;
|
char *forced_format;
|
||||||
|
struct fourcc_list_struct *fourcc;
|
||||||
|
|
||||||
/* private */
|
/* private */
|
||||||
gint64 timestamp;
|
gint64 timestamp;
|
||||||
|
@ -76,9 +77,7 @@ struct _GstVideotestsrcClass {
|
||||||
GstElementClass parent_class;
|
GstElementClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
static GType gst_videotestsrc_get_type(void);
|
GType gst_videotestsrc_get_type(void);
|
||||||
|
|
||||||
static void gst_videotestsrc_setup(GstVideotestsrc *);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
963
gst/videotestsrc/videotestsrc.c
Normal file
963
gst/videotestsrc/videotestsrc.c
Normal file
|
@ -0,0 +1,963 @@
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* non-GST-specific stuff */
|
||||||
|
|
||||||
|
/*#define DEBUG_ENABLED */
|
||||||
|
#include <gstvideotestsrc.h>
|
||||||
|
#include <videotestsrc.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
struct fourcc_list_struct * paintrect_find_fourcc (int find_fourcc);
|
||||||
|
struct fourcc_list_struct * paintrect_find_name (char *name);
|
||||||
|
struct fourcc_list_struct *paintinfo_find_by_caps(GstCaps *caps);
|
||||||
|
GstCaps *paint_get_caps(struct fourcc_list_struct *format);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_videotestsrc_setup (GstVideotestsrc * v)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned char
|
||||||
|
random_char (void)
|
||||||
|
{
|
||||||
|
static unsigned int state;
|
||||||
|
|
||||||
|
state *= 1103515245;
|
||||||
|
state += 12345;
|
||||||
|
return (state >> 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
random_chars (unsigned char *dest, int nbytes)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
static unsigned int state;
|
||||||
|
|
||||||
|
for (i = 0; i < nbytes; i++) {
|
||||||
|
state *= 1103515245;
|
||||||
|
state += 12345;
|
||||||
|
dest[i] = (state >> 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
memset_str2 (unsigned char *dest, unsigned char val, int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
*dest = val;
|
||||||
|
dest += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
memset_str3 (unsigned char *dest, unsigned char val, int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
*dest = val;
|
||||||
|
dest += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
memset_str4 (unsigned char *dest, unsigned char val, int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
*dest = val;
|
||||||
|
dest += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_rect_random (unsigned char *dest, int stride, int x, int y, int w, int h)
|
||||||
|
{
|
||||||
|
unsigned char *d = dest + stride * y + x;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < h; i++) {
|
||||||
|
random_chars (d, w);
|
||||||
|
d += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
static void
|
||||||
|
paint_rect (unsigned char *dest, int stride, int x, int y, int w, int h, unsigned char color)
|
||||||
|
{
|
||||||
|
unsigned char *d = dest + stride * y + x;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < h; i++) {
|
||||||
|
memset (d, color, w);
|
||||||
|
d += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_rect_s2 (unsigned char *dest, int stride, int x, int y, int w, int h, unsigned char col)
|
||||||
|
{
|
||||||
|
unsigned char *d = dest + stride * y + x * 2;
|
||||||
|
unsigned char *dp;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
for (i = 0; i < h; i++) {
|
||||||
|
dp = d;
|
||||||
|
for (j = 0; j < w; j++) {
|
||||||
|
*dp = col;
|
||||||
|
dp += 2;
|
||||||
|
}
|
||||||
|
d += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_rect2 (unsigned char *dest, int stride, int x, int y, int w, int h, unsigned char *col)
|
||||||
|
{
|
||||||
|
unsigned char *d = dest + stride * y + x * 2;
|
||||||
|
unsigned char *dp;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
for (i = 0; i < h; i++) {
|
||||||
|
dp = d;
|
||||||
|
for (j = 0; j < w; j++) {
|
||||||
|
*dp++ = col[0];
|
||||||
|
*dp++ = col[1];
|
||||||
|
}
|
||||||
|
d += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void
|
||||||
|
paint_rect3 (unsigned char *dest, int stride, int x, int y, int w, int h, unsigned char *col)
|
||||||
|
{
|
||||||
|
unsigned char *d = dest + stride * y + x * 3;
|
||||||
|
unsigned char *dp;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
for (i = 0; i < h; i++) {
|
||||||
|
dp = d;
|
||||||
|
for (j = 0; j < w; j++) {
|
||||||
|
*dp++ = col[0];
|
||||||
|
*dp++ = col[1];
|
||||||
|
*dp++ = col[2];
|
||||||
|
}
|
||||||
|
d += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void
|
||||||
|
paint_rect4 (unsigned char *dest, int stride, int x, int y, int w, int h, unsigned char *col)
|
||||||
|
{
|
||||||
|
unsigned char *d = dest + stride * y + x * 4;
|
||||||
|
unsigned char *dp;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
for (i = 0; i < h; i++) {
|
||||||
|
dp = d;
|
||||||
|
for (j = 0; j < w; j++) {
|
||||||
|
*dp++ = col[0];
|
||||||
|
*dp++ = col[1];
|
||||||
|
*dp++ = col[2];
|
||||||
|
*dp++ = col[3];
|
||||||
|
}
|
||||||
|
d += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_rect_s4 (unsigned char *dest, int stride, int x, int y, int w, int h, unsigned char col)
|
||||||
|
{
|
||||||
|
unsigned char *d = dest + stride * y + x * 4;
|
||||||
|
unsigned char *dp;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
for (i = 0; i < h; i++) {
|
||||||
|
dp = d;
|
||||||
|
for (j = 0; j < w; j++) {
|
||||||
|
*dp = col;
|
||||||
|
dp += 4;
|
||||||
|
}
|
||||||
|
d += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum {
|
||||||
|
COLOR_WHITE = 0,
|
||||||
|
COLOR_YELLOW,
|
||||||
|
COLOR_CYAN,
|
||||||
|
COLOR_GREEN,
|
||||||
|
COLOR_MAGENTA,
|
||||||
|
COLOR_RED,
|
||||||
|
COLOR_BLUE,
|
||||||
|
COLOR_BLACK,
|
||||||
|
COLOR_NEG_I,
|
||||||
|
COLOR_POS_Q,
|
||||||
|
COLOR_SUPER_BLACK,
|
||||||
|
COLOR_DARK_GREY,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct vts_color_struct vts_colors[] = {
|
||||||
|
/* 100% white */
|
||||||
|
{ 255, 128, 128, 255, 255, 255 },
|
||||||
|
/* yellow */
|
||||||
|
{ 226, 0, 155, 255, 255, 0 },
|
||||||
|
/* cyan */
|
||||||
|
{ 179, 170, 0, 0, 255, 255 },
|
||||||
|
/* green */
|
||||||
|
{ 150, 46, 21, 0, 255, 0 },
|
||||||
|
/* magenta */
|
||||||
|
{ 105, 212, 235, 255, 0, 255 },
|
||||||
|
/* red */
|
||||||
|
{ 76, 85, 255, 255, 0, 0 },
|
||||||
|
/* blue */
|
||||||
|
{ 29, 255, 107, 0, 0, 255 },
|
||||||
|
/* black */
|
||||||
|
{ 16, 128, 128, 0, 0, 0 },
|
||||||
|
/* -I */
|
||||||
|
{ 16, 198, 21, 0, 0, 128 },
|
||||||
|
/* +Q */
|
||||||
|
{ 16, 235, 198, 0, 128, 255 },
|
||||||
|
/* superblack */
|
||||||
|
{ 0, 128, 128, 0, 0, 0 },
|
||||||
|
/* 5% grey */
|
||||||
|
{ 32, 128, 128, 32, 32, 32 },
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
/* wht yel cya grn mag red blu blk -I Q, superblack, dark grey */
|
||||||
|
static int y_colors[] = { 255, 226, 179, 150, 105, 76, 29, 16, 16, 16, 0, 32 };
|
||||||
|
static int u_colors[] = { 128, 0, 170, 46, 212, 85, 255, 128, 198, 235, 128, 128 };
|
||||||
|
static int v_colors[] = { 128, 155, 0, 21, 235, 255, 107, 128, 21, 198, 128, 128 };
|
||||||
|
|
||||||
|
/* wht yel cya grn mag red blu blk -I Q superblack, dark grey */
|
||||||
|
static int r_colors[] = { 255, 255, 0, 0, 255, 255, 0, 0, 0, 0, 0, 32 };
|
||||||
|
static int g_colors[] = { 255, 255, 255, 255, 0, 0, 0, 0, 0, 128, 0, 32 };
|
||||||
|
static int b_colors[] = { 255, 0, 255, 0, 255, 0, 255, 0, 128, 255, 0, 32 };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static void paint_setup_I420 (paintinfo * p, char *dest);
|
||||||
|
static void paint_setup_YV12 (paintinfo * p, char *dest);
|
||||||
|
static void paint_setup_YUY2 (paintinfo * p, char *dest);
|
||||||
|
static void paint_setup_UYVY (paintinfo * p, char *dest);
|
||||||
|
static void paint_setup_YVYU (paintinfo * p, char *dest);
|
||||||
|
static void paint_setup_Y800 (paintinfo * p, char *dest);
|
||||||
|
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);
|
||||||
|
static void paint_setup_xRGB8888 (paintinfo * p, char *dest);
|
||||||
|
static void paint_setup_xBGR8888 (paintinfo * p, char *dest);
|
||||||
|
static void paint_setup_RGBx8888 (paintinfo * p, char *dest);
|
||||||
|
static void paint_setup_BGRx8888 (paintinfo * p, char *dest);
|
||||||
|
static void paint_setup_RGB888 (paintinfo * p, char *dest);
|
||||||
|
static void paint_setup_BGR888 (paintinfo * p, char *dest);
|
||||||
|
static void paint_setup_RGB565 (paintinfo * p, char *dest);
|
||||||
|
static void paint_setup_xRGB1555 (paintinfo * p, char *dest);
|
||||||
|
|
||||||
|
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_Y800 (paintinfo * p, int x, int y, int w);
|
||||||
|
static void paint_hline_IMC1 (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);
|
||||||
|
static void paint_hline_RGB565 (paintinfo * p, int x, int y, int w);
|
||||||
|
static void paint_hline_xRGB1555 (paintinfo * p, int x, int y, int w);
|
||||||
|
|
||||||
|
struct fourcc_list_struct fourcc_list[] = {
|
||||||
|
/* packed */
|
||||||
|
{"YUY2", "YUY2", 16, paint_setup_YUY2, paint_hline_YUY2},
|
||||||
|
{"UYVY", "UYVY", 16, paint_setup_UYVY, paint_hline_YUY2},
|
||||||
|
{"Y422", "Y422", 16, paint_setup_UYVY, paint_hline_YUY2},
|
||||||
|
{"UYNV", "UYNV", 16, paint_setup_UYVY, paint_hline_YUY2}, /* FIXME: UYNV? */
|
||||||
|
{"YVYU", "YVYU", 16, paint_setup_YVYU, paint_hline_YUY2},
|
||||||
|
|
||||||
|
/* interlaced */
|
||||||
|
/*{ "IUYV", "IUY2", 16, paint_setup_YVYU, paint_hline_YUY2 }, */
|
||||||
|
|
||||||
|
/* inverted */
|
||||||
|
/*{ "cyuv", "cyuv", 16, paint_setup_YVYU, paint_hline_YUY2 }, */
|
||||||
|
|
||||||
|
/*{ "Y41P", "Y41P", 12, paint_setup_YVYU, paint_hline_YUY2 }, */
|
||||||
|
|
||||||
|
/* interlaced */
|
||||||
|
/*{ "IY41", "IY41", 12, paint_setup_YVYU, paint_hline_YUY2 }, */
|
||||||
|
|
||||||
|
/*{ "Y211", "Y211", 8, paint_setup_YVYU, paint_hline_YUY2 }, */
|
||||||
|
|
||||||
|
/*{ "Y41T", "Y41T", 12, paint_setup_YVYU, paint_hline_YUY2 }, */
|
||||||
|
/*{ "Y42P", "Y42P", 16, paint_setup_YVYU, paint_hline_YUY2 }, */
|
||||||
|
/*{ "CLJR", "CLJR", 8, paint_setup_YVYU, paint_hline_YUY2 }, */
|
||||||
|
/*{ "IYU1", "IYU1", 12, paint_setup_YVYU, paint_hline_YUY2 }, */
|
||||||
|
/*{ "IYU2", "IYU2", 24, paint_setup_YVYU, paint_hline_YUY2 }, */
|
||||||
|
|
||||||
|
/* planar */
|
||||||
|
/* YVU9 */
|
||||||
|
/* YUV9 */
|
||||||
|
/* IF09 */
|
||||||
|
/* YV12 */
|
||||||
|
{"YV12", "YV12", 12, paint_setup_YV12, paint_hline_I420},
|
||||||
|
/* I420 */
|
||||||
|
{"I420", "I420", 12, paint_setup_I420, paint_hline_I420},
|
||||||
|
/* IYUV (same as I420) */
|
||||||
|
{"IYUV", "IYUV", 12, paint_setup_I420, paint_hline_I420},
|
||||||
|
/* NV12 */
|
||||||
|
/* NV21 */
|
||||||
|
/* IMC1 */
|
||||||
|
{"IMC1", "IMC1", 16, paint_setup_IMC1, paint_hline_IMC1},
|
||||||
|
/* IMC2 */
|
||||||
|
{"IMC2", "IMC2", 12, paint_setup_IMC2, paint_hline_IMC1},
|
||||||
|
/* IMC3 */
|
||||||
|
{"IMC3", "IMC3", 16, paint_setup_IMC3, paint_hline_IMC1},
|
||||||
|
/* IMC4 */
|
||||||
|
{"IMC4", "IMC4", 12, paint_setup_IMC4, paint_hline_IMC1},
|
||||||
|
/* CLPL */
|
||||||
|
/* Y41B */
|
||||||
|
/* Y42B */
|
||||||
|
/* Y800 grayscale */
|
||||||
|
{"Y800", "Y800", 8, paint_setup_Y800, paint_hline_Y800},
|
||||||
|
/* Y8 same as Y800 */
|
||||||
|
{"Y8 ", "Y8 ", 8, paint_setup_Y800, paint_hline_Y800},
|
||||||
|
|
||||||
|
/*{ "IYU2", 24, paint_setup_YVYU, paint_hline_YUY2 }, */
|
||||||
|
|
||||||
|
{"RGB ", "xRGB8888", 32, paint_setup_xRGB8888, paint_hline_str4, 1, 24,
|
||||||
|
0x00ff0000, 0x0000ff00, 0x000000ff },
|
||||||
|
{"RGB ", "xBGR8888", 32, paint_setup_xBGR8888, paint_hline_str4, 1, 24,
|
||||||
|
0x000000ff, 0x0000ff00, 0x00ff0000 },
|
||||||
|
{"RGB ", "RGBx8888", 32, paint_setup_RGBx8888, paint_hline_str4, 1, 24,
|
||||||
|
0xff000000, 0x00ff0000, 0x0000ff00 },
|
||||||
|
{"RGB ", "BGRx8888", 32, paint_setup_BGRx8888, paint_hline_str4, 1, 24,
|
||||||
|
0x0000ff00, 0x00ff0000, 0xff000000 },
|
||||||
|
{"RGB ", "RGB888", 24, paint_setup_RGB888, paint_hline_str3, 1, 24,
|
||||||
|
0x00ff0000, 0x0000ff00, 0x000000ff },
|
||||||
|
{"RGB ", "BGR888", 24, paint_setup_BGR888, paint_hline_str3, 1, 24,
|
||||||
|
0x000000ff, 0x0000ff00, 0x00ff0000 },
|
||||||
|
{"RGB ", "RGB565", 16, paint_setup_RGB565, paint_hline_RGB565, 1, 16,
|
||||||
|
0x0000f800, 0x000007e0, 0x0000001f },
|
||||||
|
{"RGB ", "xRGB1555", 16, paint_setup_xRGB1555, paint_hline_xRGB1555, 1, 15,
|
||||||
|
0x00007c00, 0x000003e0, 0x0000001f },
|
||||||
|
};
|
||||||
|
int n_fourccs = sizeof (fourcc_list) / sizeof (fourcc_list[0]);
|
||||||
|
|
||||||
|
struct fourcc_list_struct *paintinfo_find_by_caps(GstCaps *caps)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < n_fourccs; i++) {
|
||||||
|
GstCaps *c;
|
||||||
|
|
||||||
|
c = gst_caps_intersect(caps,paint_get_caps(fourcc_list + i));
|
||||||
|
if(c){
|
||||||
|
return fourcc_list + i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct fourcc_list_struct * paintrect_find_fourcc (int find_fourcc)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < n_fourccs; i++) {
|
||||||
|
char *s;
|
||||||
|
int fourcc;
|
||||||
|
|
||||||
|
s = fourcc_list[i].fourcc;
|
||||||
|
fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]);
|
||||||
|
if (find_fourcc == fourcc) {
|
||||||
|
/* If YUV format, it's good */
|
||||||
|
if(!fourcc_list[i].ext_caps){
|
||||||
|
return fourcc_list + i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fourcc_list + i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct fourcc_list_struct * paintrect_find_name (char *name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < n_fourccs; i++) {
|
||||||
|
if(strcmp(name,fourcc_list[i].name)==0){
|
||||||
|
return fourcc_list + i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GstCaps *paint_get_caps(struct fourcc_list_struct *format)
|
||||||
|
{
|
||||||
|
unsigned int fourcc;
|
||||||
|
GstCaps *caps;
|
||||||
|
|
||||||
|
fourcc = GST_MAKE_FOURCC (format->fourcc[0], format->fourcc[1], format->fourcc[2], format->fourcc[3]);
|
||||||
|
|
||||||
|
if(format->ext_caps){
|
||||||
|
caps = GST_CAPS_NEW ("videotestsrc_filter",
|
||||||
|
"video/raw",
|
||||||
|
"format", GST_PROPS_FOURCC (fourcc),
|
||||||
|
"bpp", GST_PROPS_INT(format->bitspp),
|
||||||
|
"depth", GST_PROPS_INT(format->depth),
|
||||||
|
"red_mask", GST_PROPS_INT(format->red_mask),
|
||||||
|
"green_mask", GST_PROPS_INT(format->green_mask),
|
||||||
|
"blue_mask", GST_PROPS_INT(format->blue_mask));
|
||||||
|
}else{
|
||||||
|
caps = GST_CAPS_NEW ("videotestsrc_filter",
|
||||||
|
"video/raw",
|
||||||
|
"format", GST_PROPS_FOURCC (fourcc));
|
||||||
|
}
|
||||||
|
|
||||||
|
return caps;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gst_videotestsrc_smpte (GstVideotestsrc * v, unsigned char *dest, int w, int h)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int y1, y2;
|
||||||
|
int j;
|
||||||
|
paintinfo pi;
|
||||||
|
paintinfo *p = π
|
||||||
|
struct fourcc_list_struct *fourcc;
|
||||||
|
|
||||||
|
p->width = w;
|
||||||
|
p->height = h;
|
||||||
|
fourcc = v->fourcc;
|
||||||
|
if (fourcc == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fourcc->paint_setup (p, dest);
|
||||||
|
p->paint_hline = fourcc->paint_hline;
|
||||||
|
|
||||||
|
y1 = 2 * h / 3;
|
||||||
|
y2 = h * 0.75;
|
||||||
|
|
||||||
|
/* color bars */
|
||||||
|
for (i = 0; i < 7; i++) {
|
||||||
|
int x1 = i * w / 7;
|
||||||
|
int x2 = (i + 1) * w / 7;
|
||||||
|
|
||||||
|
p->color = vts_colors + i;
|
||||||
|
for (j = 0; j < y1; j++) {
|
||||||
|
p->paint_hline (p, x1, j, (x2 - x1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* inverse blue bars */
|
||||||
|
for (i = 0; i < 7; i++) {
|
||||||
|
int x1 = i * w / 7;
|
||||||
|
int x2 = (i + 1) * w / 7;
|
||||||
|
int k;
|
||||||
|
|
||||||
|
if (i & 1) {
|
||||||
|
k = 7;
|
||||||
|
} else {
|
||||||
|
k = 6 - i;
|
||||||
|
}
|
||||||
|
p->color = vts_colors + k;
|
||||||
|
for (j = y1; j < y2; j++) {
|
||||||
|
p->paint_hline (p, x1, j, (x2 - x1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -I, white, Q regions */
|
||||||
|
for (i = 0; i < 3; i++) {
|
||||||
|
int x1 = i * w / 6;
|
||||||
|
int x2 = (i + 1) * w / 6;
|
||||||
|
int k;
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
k = 8;
|
||||||
|
} else if (i == 1) {
|
||||||
|
k = 0;
|
||||||
|
} else
|
||||||
|
k = 9;
|
||||||
|
|
||||||
|
p->color = vts_colors + k;
|
||||||
|
for (j = y2; j < h; j++) {
|
||||||
|
p->paint_hline (p, x1, j, (x2 - x1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* superblack, black, dark grey */
|
||||||
|
for (i = 0; i < 3; i++) {
|
||||||
|
int x1 = w/2 + i * w / 12;
|
||||||
|
int x2 = w/2 + (i + 1) * w / 12;
|
||||||
|
int k;
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
k = COLOR_SUPER_BLACK;
|
||||||
|
} else if (i == 1) {
|
||||||
|
k = COLOR_BLACK;
|
||||||
|
} else
|
||||||
|
k = COLOR_DARK_GREY;
|
||||||
|
|
||||||
|
p->color = vts_colors + k;
|
||||||
|
for (j = y2; j < h; j++) {
|
||||||
|
p->paint_hline (p, x1, j, (x2 - x1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int x1 = w*3 / 4;
|
||||||
|
struct vts_color_struct color;
|
||||||
|
|
||||||
|
color = vts_colors[COLOR_BLACK];
|
||||||
|
p->color = &color;
|
||||||
|
|
||||||
|
for (i = x1; i < w; i++) {
|
||||||
|
for (j = y2; j < h; j++) {
|
||||||
|
/* FIXME not strictly correct */
|
||||||
|
color.Y = random_char ();
|
||||||
|
color.R = color.Y;
|
||||||
|
color.G = color.Y;
|
||||||
|
color.B = color.Y;
|
||||||
|
p->paint_hline (p, i, j, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gst_videotestsrc_snow (GstVideotestsrc * v, unsigned char *dest, int w, int h)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
paintinfo pi;
|
||||||
|
paintinfo *p = π
|
||||||
|
struct fourcc_list_struct *fourcc;
|
||||||
|
struct vts_color_struct color;
|
||||||
|
|
||||||
|
p->width = w;
|
||||||
|
p->height = h;
|
||||||
|
fourcc = v->fourcc;
|
||||||
|
if (fourcc == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fourcc->paint_setup (p, dest);
|
||||||
|
p->paint_hline = fourcc->paint_hline;
|
||||||
|
|
||||||
|
color = vts_colors[COLOR_BLACK];
|
||||||
|
p->color = &color;
|
||||||
|
|
||||||
|
for (i = 0; i < w; i++) {
|
||||||
|
for (j = 0; j < h; j++) {
|
||||||
|
/* FIXME not strictly correct */
|
||||||
|
color.Y = random_char ();
|
||||||
|
color.R = color.Y;
|
||||||
|
color.G = color.Y;
|
||||||
|
color.B = color.Y;
|
||||||
|
p->paint_hline (p, i, j, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
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);
|
||||||
|
|
||||||
|
memset (p->yp + offset + x, p->color->Y, w);
|
||||||
|
memset (p->up + offset1 + x1, p->color->U, x2 - x1);
|
||||||
|
memset (p->vp + offset1 + x1, p->color->V, x2 - x1);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_setup_YUY2 (paintinfo * p, char *dest)
|
||||||
|
{
|
||||||
|
p->yp = dest;
|
||||||
|
p->up = dest + 1;
|
||||||
|
p->vp = dest + 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_setup_UYVY (paintinfo * p, char *dest)
|
||||||
|
{
|
||||||
|
p->yp = dest + 1;
|
||||||
|
p->up = dest;
|
||||||
|
p->vp = dest + 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_setup_YVYU (paintinfo * p, char *dest)
|
||||||
|
{
|
||||||
|
p->yp = dest;
|
||||||
|
p->up = dest + 3;
|
||||||
|
p->vp = dest + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_hline_YUY2 (paintinfo * p, int x, int y, int w)
|
||||||
|
{
|
||||||
|
int x1 = x / 2;
|
||||||
|
int x2 = (x + w) / 2;
|
||||||
|
int offset;
|
||||||
|
|
||||||
|
offset = y * p->width * 2;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_setup_Y800 (paintinfo * p, char *dest)
|
||||||
|
{
|
||||||
|
p->yp = dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_hline_Y800 (paintinfo * p, int x, int y, int w)
|
||||||
|
{
|
||||||
|
int offset = y * p->width;
|
||||||
|
|
||||||
|
memset (p->yp + offset + x, p->color->Y, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_setup_IMC1 (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 / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_setup_IMC2 (paintinfo * p, char *dest)
|
||||||
|
{
|
||||||
|
p->yp = dest;
|
||||||
|
p->vp = dest + p->width * p->height;
|
||||||
|
p->up = dest + p->width * p->height + p->width / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_setup_IMC3 (paintinfo * p, char *dest)
|
||||||
|
{
|
||||||
|
p->yp = dest;
|
||||||
|
p->up = dest + p->width * p->height + p->width * p->height / 2;
|
||||||
|
p->vp = dest + p->width * p->height;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_setup_IMC4 (paintinfo * p, char *dest)
|
||||||
|
{
|
||||||
|
p->yp = dest;
|
||||||
|
p->vp = dest + p->width * p->height + p->width / 2;
|
||||||
|
p->up = dest + p->width * p->height;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_hline_IMC1 (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;
|
||||||
|
|
||||||
|
memset (p->yp + offset + x, p->color->Y, w);
|
||||||
|
memset (p->up + offset1 + x1, p->color->U, x2 - x1);
|
||||||
|
memset (p->vp + offset1 + x1, p->color->V, x2 - x1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_setup_xRGB8888 (paintinfo * p, char *dest)
|
||||||
|
{
|
||||||
|
p->yp = dest + 1;
|
||||||
|
p->up = dest + 2;
|
||||||
|
p->vp = dest + 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_setup_xBGR8888 (paintinfo * p, char *dest)
|
||||||
|
{
|
||||||
|
p->yp = dest + 3;
|
||||||
|
p->up = dest + 2;
|
||||||
|
p->vp = dest + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_setup_RGBx8888 (paintinfo * p, char *dest)
|
||||||
|
{
|
||||||
|
p->yp = dest + 0;
|
||||||
|
p->up = dest + 1;
|
||||||
|
p->vp = dest + 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_setup_BGRx8888 (paintinfo * p, char *dest)
|
||||||
|
{
|
||||||
|
p->yp = dest + 2;
|
||||||
|
p->up = dest + 1;
|
||||||
|
p->vp = dest + 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_hline_str4 (paintinfo * p, int x, int y, int w)
|
||||||
|
{
|
||||||
|
int offset = y * p->width * 4;
|
||||||
|
|
||||||
|
memset_str4 (p->yp + offset + x * 4, p->color->R, w);
|
||||||
|
memset_str4 (p->up + offset + x * 4, p->color->G, w);
|
||||||
|
memset_str4 (p->vp + offset + x * 4, p->color->B, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_hline_str3 (paintinfo * p, int x, int y, int w)
|
||||||
|
{
|
||||||
|
int offset = y * p->stride;
|
||||||
|
|
||||||
|
memset_str3 (p->yp + offset + x * 3, p->color->R, w);
|
||||||
|
memset_str3 (p->up + offset + x * 3, p->color->G, w);
|
||||||
|
memset_str3 (p->vp + offset + x * 3, p->color->B, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_setup_RGB565 (paintinfo * p, char *dest)
|
||||||
|
{
|
||||||
|
p->yp = dest;
|
||||||
|
p->stride = (p->width*2 + 1)&(~0x3);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_hline_RGB565 (paintinfo * p, int x, int y, int w)
|
||||||
|
{
|
||||||
|
int offset = y * p->stride;
|
||||||
|
unsigned int a,b;
|
||||||
|
|
||||||
|
a = (p->color->R&0xf8) | (p->color->G>>5);
|
||||||
|
b = ((p->color->G<<3)&0xe0) | (p->color->B>>3);
|
||||||
|
|
||||||
|
memset_str2 (p->yp + offset + x * 2 + 0, a, w);
|
||||||
|
memset_str2 (p->yp + offset + x * 2 + 1, b, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_setup_xRGB1555 (paintinfo * p, char *dest)
|
||||||
|
{
|
||||||
|
p->yp = dest;
|
||||||
|
p->stride = (p->width*2 + 1)&(~0x3);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_hline_xRGB1555 (paintinfo * p, int x, int y, int w)
|
||||||
|
{
|
||||||
|
int offset = y * p->stride;
|
||||||
|
unsigned int a,b;
|
||||||
|
|
||||||
|
a = ((p->color->R>>1)&0x7c) | (p->color->G>>6);
|
||||||
|
b = ((p->color->G<<2)&0xe0) | (p->color->B>>3);
|
||||||
|
|
||||||
|
memset_str2 (p->yp + offset + x * 2 + 0, a, w);
|
||||||
|
memset_str2 (p->yp + offset + x * 2 + 1, b, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
65
gst/videotestsrc/videotestsrc.h
Normal file
65
gst/videotestsrc/videotestsrc.h
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) <2003> David A. Schleef <ds@schleef.org>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __VIDEOTESTSRC_H__
|
||||||
|
#define __VIDEOTESTSRC_H__
|
||||||
|
|
||||||
|
struct vts_color_struct{
|
||||||
|
int Y,U,V;
|
||||||
|
int R,G,B;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct paintinfo_struct paintinfo;
|
||||||
|
struct paintinfo_struct
|
||||||
|
{
|
||||||
|
unsigned char *dest;
|
||||||
|
unsigned char *yp, *up, *vp;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
char *fourcc;
|
||||||
|
char *name;
|
||||||
|
int bitspp;
|
||||||
|
void (*paint_setup) (paintinfo * p, char *dest);
|
||||||
|
void (*paint_hline) (paintinfo * p, int x, int y, int w);
|
||||||
|
int ext_caps;
|
||||||
|
int depth;
|
||||||
|
unsigned int red_mask;
|
||||||
|
unsigned int green_mask;
|
||||||
|
unsigned int blue_mask;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct fourcc_list_struct * paintrect_find_fourcc (int find_fourcc);
|
||||||
|
struct fourcc_list_struct * paintrect_find_name (char *name);
|
||||||
|
struct fourcc_list_struct *paintinfo_find_by_caps(GstCaps *caps);
|
||||||
|
GstCaps *paint_get_caps(struct fourcc_list_struct *format);
|
||||||
|
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);
|
||||||
|
|
||||||
|
extern struct fourcc_list_struct fourcc_list[];
|
||||||
|
extern int n_fourccs;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue