v = GST_VIDEOTESTSRC (element);
+#if GST_VERSION_MINOR > 6
gst_object_replace ((GstObject **)&v->clock, (GstObject *)clock);
+#else
+ gst_object_swap ((GstObject **)&v->clock, (GstObject *)clock);
+#endif
}
static GstPadLinkReturn
return GST_PAD_LINK_DELAYED;
}
- printf ("videotestsrc: using fourcc element %p %s\n",
+ GST_DEBUG (0,"videotestsrc: using fourcc element %p %s\n",
videotestsrc->fourcc, videotestsrc->fourcc->name);
gst_caps_get_int (caps, "width", &videotestsrc->width);
if (videotestsrc->pool) {
buf = gst_buffer_new_from_pool (videotestsrc->pool, 0, 0);
/* if the buffer we get is too small, make our own */
- if (GST_BUFFER_SIZE (buf) < newsize)
- {
+ if (buf && GST_BUFFER_SIZE (buf) < newsize){
gst_buffer_unref (buf);
buf = NULL;
}
{
src->type = pattern_type;
- g_print("setting pattern to %d\n",pattern_type);
+ GST_DEBUG (0,"setting pattern to %d\n",pattern_type);
switch(pattern_type){
case GST_VIDEOTESTSRC_SMPTE:
src->make_image = gst_videotestsrc_smpte;
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));
src->height = g_value_get_int (value);
break;
case ARG_FOURCC:
- src->forced_format = g_strdup(g_value_get_string (value));
- printf ("forcing FOURCC to \"%s\"\n", src->forced_format);
+ format = g_value_get_string (value);
+ if(paintrect_find_name (format) != NULL){
+ src->forced_format = g_strdup(format);
+ GST_DEBUG (0,"forcing format to \"%s\"\n", format);
+ }else{
+ GST_DEBUG (0,"unknown format \"%s\"\n", format);
+ }
break;
case ARG_RATE:
src->rate = g_value_get_int (value);
g_value_set_int (value, src->height);
break;
case ARG_FOURCC:
- /* FIXME */
- /* g_value_set_int (value, src->forced_format); */
+ g_value_set_string (value, src->forced_format);
break;
case ARG_RATE:
g_value_set_int (value, src->rate);
#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);
-
-
+#if 0
static void
gst_videotestsrc_setup (GstVideotestsrc * v)
{
}
+#endif
static unsigned char
random_char (void)
return (state >> 16);
}
+#if 0
static void
random_chars (unsigned char *dest, int nbytes)
{
dest[i] = (state >> 16);
}
}
+#endif
static void
memset_str2 (unsigned char *dest, unsigned char val, int n)
}
}
+#if 0
static void
paint_rect_random (unsigned char *dest, int stride, int x, int y, int w, int h)
{
d += stride;
}
}
+#endif
#if 0
static void
}
#endif
+#if 0
static void
paint_rect_s2 (unsigned char *dest, int stride, int x, int y, int w, int h, unsigned char col)
{
d += stride;
}
}
+#endif
+#if 0
static void
paint_rect2 (unsigned char *dest, int stride, int x, int y, int w, int h, unsigned char *col)
{
d += stride;
}
}
+#endif
+
+#if 0
static void
paint_rect3 (unsigned char *dest, int stride, int x, int y, int w, int h, unsigned char *col)
{
d += stride;
}
}
+#endif
+
+#if 0
static void
paint_rect4 (unsigned char *dest, int stride, int x, int y, int w, int h, unsigned char *col)
{
d += stride;
}
}
+#endif
+#if 0
static void
paint_rect_s4 (unsigned char *dest, int stride, int x, int y, int w, int h, unsigned char col)
{
d += stride;
}
}
+#endif
enum {
COLOR_WHITE = 0,
return NULL;
}
-struct fourcc_list_struct * paintrect_find_name (char *name)
+struct fourcc_list_struct * paintrect_find_name (const char *name)
{
int i;
fourcc = GST_MAKE_FOURCC (format->fourcc[0], format->fourcc[1], format->fourcc[2], format->fourcc[3]);
if(format->ext_caps){
+#if GST_VERSION_MINOR > 6
caps = GST_CAPS_NEW ("videotestsrc_filter",
"video/raw",
"format", GST_PROPS_FOURCC (fourcc),
"bpp", GST_PROPS_INT(format->bitspp),
+ "endianness", GST_PROPS_INT(G_BIG_ENDIAN),
"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
+ guint32 red_mask;
+ guint32 green_mask;
+ guint32 blue_mask;
+ guint32 endianness;
+
+ if(format->bitspp==16){
+ endianness = G_BYTE_ORDER;
+ red_mask = format->red_mask;
+ green_mask = format->green_mask;
+ blue_mask = format->blue_mask;
+ }else if(format->bitspp==24){
+ endianness = G_BYTE_ORDER;
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+ red_mask = GUINT32_SWAP_LE_BE(format->red_mask)>>8;
+ green_mask = GUINT32_SWAP_LE_BE(format->green_mask)>>8;
+ blue_mask = GUINT32_SWAP_LE_BE(format->blue_mask)>>8;
+#else
+ red_mask = format->red_mask;
+ green_mask = format->green_mask;
+ blue_mask = format->blue_mask;
+#endif
+ }else{
+ endianness = G_BYTE_ORDER;
+ red_mask = GUINT32_FROM_BE(format->red_mask);
+ green_mask = GUINT32_FROM_BE(format->green_mask);
+ blue_mask = GUINT32_FROM_BE(format->blue_mask);
+ }
+
+ caps = GST_CAPS_NEW ("videotestsrc_filter",
+ "video/raw",
+ "format", GST_PROPS_FOURCC (fourcc),
+ "bpp", GST_PROPS_INT(format->bitspp),
+ "endianness", GST_PROPS_INT(endianness),
+ "depth", GST_PROPS_INT(format->depth),
+ "red_mask", GST_PROPS_INT(red_mask),
+ "green_mask", GST_PROPS_INT(green_mask),
+ "blue_mask", GST_PROPS_INT(blue_mask));
+#endif
}else{
caps = GST_CAPS_NEW ("videotestsrc_filter",
"video/raw",
a = (p->color->R&0xf8) | (p->color->G>>5);
b = ((p->color->G<<3)&0xe0) | (p->color->B>>3);
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+ memset_str2 (p->yp + offset + x * 2 + 0, b, w);
+ memset_str2 (p->yp + offset + x * 2 + 1, a, w);
+#else
memset_str2 (p->yp + offset + x * 2 + 0, a, w);
memset_str2 (p->yp + offset + x * 2 + 1, b, w);
+#endif
}
static void
a = ((p->color->R>>1)&0x7c) | (p->color->G>>6);
b = ((p->color->G<<2)&0xe0) | (p->color->B>>3);
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+ memset_str2 (p->yp + offset + x * 2 + 0, b, w);
+ memset_str2 (p->yp + offset + x * 2 + 1, a, w);
+#else
memset_str2 (p->yp + offset + x * 2 + 0, a, w);
memset_str2 (p->yp + offset + x * 2 + 1, b, w);
+#endif
}
#if 0