test: port some more tests

This commit is contained in:
Wim Taymans 2011-06-16 13:41:25 +02:00
parent d06f599193
commit 3802d2365c
14 changed files with 132 additions and 178 deletions

View file

@ -1,6 +1,6 @@
/* GStreamer
*
* unit test for ffmpegcolorspace
* unit test for videoconvert
*
* Copyright (C) <2006> Tim-Philipp Müller <tim centricular net>
*
@ -32,77 +32,47 @@
#include <gst/check/gstcheck.h>
typedef struct _RGBFormat
{
const gchar *nick;
guint bpp, depth;
guint32 red_mask, green_mask, blue_mask, alpha_mask;
guint endianness;
} RGBFormat;
typedef struct _RGBConversion
{
RGBFormat from_fmt;
RGBFormat to_fmt;
const gchar *from_fmt;
const gchar *to_fmt;
GstCaps *from_caps;
GstCaps *to_caps;
} RGBConversion;
static GstCaps *
rgb_format_to_caps (RGBFormat * fmt)
rgb_format_to_caps (const gchar * fmt)
{
GstCaps *caps;
g_assert (fmt != NULL);
g_assert (fmt->endianness != 0);
caps = gst_caps_new_simple ("video/x-raw-rgb",
"bpp", G_TYPE_INT, fmt->bpp,
"depth", G_TYPE_INT, fmt->depth,
"red_mask", G_TYPE_INT, fmt->red_mask,
"green_mask", G_TYPE_INT, fmt->green_mask,
"blue_mask", G_TYPE_INT, fmt->blue_mask,
caps = gst_caps_new_simple ("video/x-raw",
"format", G_TYPE_STRING, fmt,
"width", G_TYPE_INT, 16, "height", G_TYPE_INT, 16,
"endianness", G_TYPE_INT, fmt->endianness,
"framerate", GST_TYPE_FRACTION, 1, 1, NULL);
fail_unless (fmt->alpha_mask == 0 || fmt->bpp == 32);
if (fmt->alpha_mask != 0) {
gst_structure_set (gst_caps_get_structure (caps, 0),
"alpha_mask", G_TYPE_INT, fmt->alpha_mask, NULL);
}
return caps;
}
static GList *
create_rgb_conversions (void)
{
const RGBFormat rgb_formats[] = {
{
"RGBA", 32, 32, 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff, 0}, {
"ARGB", 32, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000, 0}, {
"BGRA", 32, 32, 0x0000ff00, 0x00ff0000, 0xff000000, 0x000000ff, 0}, {
"ABGR", 32, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000, 0}, {
"RGBx", 32, 24, 0xff000000, 0x00ff0000, 0x0000ff00, 0x00000000, 0}, {
"xRGB", 32, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000, 0}, {
"BGRx", 32, 24, 0x0000ff00, 0x00ff0000, 0xff000000, 0x00000000, 0}, {
"xBGR", 32, 24, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000, 0}, {
"RGB ", 24, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000, 0}, {
"BGR ", 24, 24, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000, 0}, {
"RGB565", 16, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000, 0}, {
"xRGB1555", 16, 15, 0x00007c00, 0x000003e0, 0x0000001f, 0x0000000, 0}
};
const struct
{
guint from_endianness, to_endianness;
} end_arr[4] = {
{
G_LITTLE_ENDIAN, G_LITTLE_ENDIAN}, {
G_BIG_ENDIAN, G_LITTLE_ENDIAN}, {
G_LITTLE_ENDIAN, G_BIG_ENDIAN}, {
G_BIG_ENDIAN, G_BIG_ENDIAN}
const gchar *rgb_formats[] = {
"RGBA",
"ARGB",
"BGRA",
"ABGR",
"RGBx",
"xRGB",
"BGRx",
"xBGR",
"RGB",
"BGR",
"RGB15",
"BGR15",
"RGB16",
"BGR16"
};
GList *conversions = NULL;
guint from_fmt, to_fmt;
@ -117,10 +87,8 @@ create_rgb_conversions (void)
conversion = g_new0 (RGBConversion, 1);
conversion->from_fmt = rgb_formats[from_fmt];
conversion->to_fmt = rgb_formats[to_fmt];
conversion->from_fmt.endianness = end_arr[i].from_endianness;
conversion->to_fmt.endianness = end_arr[i].to_endianness;
conversion->from_caps = rgb_format_to_caps (&conversion->from_fmt);
conversion->to_caps = rgb_format_to_caps (&conversion->to_fmt);
conversion->from_caps = rgb_format_to_caps (conversion->from_fmt);
conversion->to_caps = rgb_format_to_caps (conversion->to_fmt);
conversions = g_list_prepend (conversions, conversion);
}
}
@ -153,6 +121,7 @@ right_shift_colour (guint32 mask, guint32 pixel)
return pixel;
}
#if 0
static guint8
fix_expected_colour (guint32 col_mask, guint8 col_expected)
{
@ -237,6 +206,7 @@ check_rgb_buf (const guint8 * pixels, guint32 r_mask, guint32 g_mask,
// FIXME: fix alpha check
// fail_unless (a_mask == 0 || alpha != 0); /* better than nothing */
}
#endif
static void
got_buf_cb (GstElement * sink, GstBuffer * new_buf, GstPad * pad,
@ -266,7 +236,7 @@ GST_START_TEST (test_rgb_to_rgb)
GstElement *pipeline, *src, *filter1, *csp, *filter2, *sink;
GstCaps *template_caps;
GstBuffer *buf = NULL;
GstPad *srcpad;
GstPad *srcpad, *csppad;
GList *conversions, *l;
gint p;
@ -276,7 +246,7 @@ GST_START_TEST (test_rgb_to_rgb)
pipeline = gst_pipeline_new ("pipeline");
src = gst_check_setup_element ("videotestsrc");
filter1 = gst_check_setup_element ("capsfilter");
csp = gst_check_setup_element ("ffmpegcolorspace");
csp = gst_check_setup_element ("videoconvert");
filter2 = gst_element_factory_make ("capsfilter", "to_filter");
sink = gst_check_setup_element ("fakesink");
@ -291,6 +261,8 @@ GST_START_TEST (test_rgb_to_rgb)
template_caps = gst_pad_get_pad_template_caps (srcpad);
gst_object_unref (srcpad);
csppad = gst_element_get_static_pad (csp, "src");
g_object_set (sink, "signal-handoffs", TRUE, NULL);
g_signal_connect (sink, "preroll-handoff", G_CALLBACK (got_buf_cb), &buf);
@ -311,10 +283,12 @@ GST_START_TEST (test_rgb_to_rgb)
/* caps are supported, let's run some tests then ... */
for (p = 0; p < G_N_ELEMENTS (test_patterns); ++p) {
GstStateChangeReturn state_ret;
RGBFormat *from = &conv->from_fmt;
RGBFormat *to = &conv->to_fmt;
const gchar *from = conv->from_fmt;
const gchar *to = conv->to_fmt;
#if 0
guint8 *data;
gsize size;
#endif
/* trick compiler into thinking from is used, might throw warning
* otherwise if the debugging system is disabled */
@ -324,18 +298,13 @@ GST_START_TEST (test_rgb_to_rgb)
g_object_set (src, "pattern", test_patterns[p].pattern_enum, NULL);
GST_INFO ("%5s %u/%u %08x %08x %08x %08x %u => "
"%5s %u/%u %08x %08x %08x %08x %u, pattern=%s",
from->nick, from->bpp, from->depth, from->red_mask,
from->green_mask, from->blue_mask, from->alpha_mask,
from->endianness, to->nick, to->bpp, to->depth, to->red_mask,
to->green_mask, to->blue_mask, to->alpha_mask, to->endianness,
test_patterns[p].pattern_name);
GST_INFO ("%5s => %5s, pattern=%s",
from, to, test_patterns[p].pattern_name);
/* now get videotestsrc to produce a buffer with the given caps */
g_object_set (filter1, "caps", conv->from_caps, NULL);
/* ... and force ffmpegcolorspace to convert to our target caps */
/* ... and force videoconvert to convert to our target caps */
g_object_set (filter2, "caps", conv->to_caps, NULL);
state_ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
@ -350,7 +319,7 @@ GST_START_TEST (test_rgb_to_rgb)
fail_unless (err != NULL);
if (msg->src == GST_OBJECT_CAST (src) &&
err->code == GST_STREAM_ERROR_FORMAT) {
GST_DEBUG ("ffmpegcolorspace does not support this conversion");
GST_DEBUG ("videoconvert does not support this conversion");
gst_message_unref (msg);
g_error_free (err);
continue;
@ -370,30 +339,20 @@ GST_START_TEST (test_rgb_to_rgb)
/* check buffer caps */
{
GstCaps *caps;
GstStructure *s;
gint v;
const gchar *fmt;
fail_unless (GST_BUFFER_CAPS (buf) != NULL);
s = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0);
fail_unless (gst_structure_get_int (s, "bpp", &v));
fail_unless_equals_int (v, to->bpp);
fail_unless (gst_structure_get_int (s, "depth", &v));
fail_unless_equals_int (v, to->depth);
fail_unless (gst_structure_get_int (s, "red_mask", &v));
fail_unless_equals_int (v, to->red_mask);
fail_unless (gst_structure_get_int (s, "green_mask", &v));
fail_unless_equals_int (v, to->green_mask);
fail_unless (gst_structure_get_int (s, "blue_mask", &v));
fail_unless_equals_int (v, to->blue_mask);
/* there mustn't be an alpha_mask if there's no alpha component */
if (to->depth == 32) {
fail_unless (gst_structure_get_int (s, "alpha_mask", &v));
fail_unless_equals_int (v, to->alpha_mask);
} else {
fail_unless (gst_structure_get_value (s, "alpha_mask") == NULL);
}
g_object_get (csppad, "caps", &caps, NULL);
fail_unless (caps != NULL);
s = gst_caps_get_structure (caps, 0);
fmt = gst_structure_get_string (s, "format");
fail_unless (fmt != NULL);
fail_unless (!strcmp (fmt, to));
}
#if 0
/* now check the top-left pixel */
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
check_rgb_buf (data, to->red_mask,
@ -401,6 +360,7 @@ GST_START_TEST (test_rgb_to_rgb)
test_patterns[p].r_expected, test_patterns[p].g_expected,
test_patterns[p].b_expected, to->endianness, to->bpp, to->depth);
gst_buffer_unmap (buf, data, size);
#endif
gst_buffer_unref (buf);
buf = NULL;
@ -419,9 +379,9 @@ GST_START_TEST (test_rgb_to_rgb)
GST_END_TEST;
static Suite *
ffmpegcolorspace_suite (void)
videoconvert_suite (void)
{
Suite *s = suite_create ("ffmpegcolorspace");
Suite *s = suite_create ("videoconvert");
TCase *tc_chain = tcase_create ("general");
suite_add_tcase (s, tc_chain);
@ -442,4 +402,4 @@ ffmpegcolorspace_suite (void)
return s;
}
GST_CHECK_MAIN (ffmpegcolorspace);
GST_CHECK_MAIN (videoconvert);

View file

@ -43,7 +43,7 @@ test_shutdown_for_factory (const gchar * factory_name)
vis = gst_check_setup_element (factory_name);
cf = gst_check_setup_element ("capsfilter");
caps = gst_caps_new_simple ("video/x-raw-rgb", "width", G_TYPE_INT, 320,
caps = gst_caps_new_simple ("video/x-raw", "width", G_TYPE_INT, 320,
"height", G_TYPE_INT, 240, "framerate", GST_TYPE_FRACTION, 15, 1, NULL);
g_object_set (cf, "caps", caps, NULL);
gst_caps_unref (caps);

View file

@ -380,7 +380,7 @@ gst_video_codec_sink_base_init (gpointer klass)
{
static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-raw-yuv; video/x-compressed")
GST_STATIC_CAPS ("video/x-raw; video/x-compressed")
);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@ -398,12 +398,12 @@ gst_video_codec_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
s = gst_caps_get_structure (caps, 0);
if (gst_structure_has_name (s, "video/x-raw-yuv")) {
if (gst_structure_has_name (s, "video/x-raw")) {
sink->raw = TRUE;
} else if (gst_structure_has_name (s, "video/x-compressed")) {
sink->raw = FALSE;
} else {
fail_unless (gst_structure_has_name (s, "video/x-raw-yuv")
fail_unless (gst_structure_has_name (s, "video/x-raw")
|| gst_structure_has_name (s, "video/x-compressed"));
return FALSE;
}
@ -464,7 +464,7 @@ gst_codec_demuxer_base_init (gpointer klass)
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src_%d",
GST_PAD_SRC, GST_PAD_SOMETIMES,
GST_STATIC_CAPS ("audio/x-raw-int; audio/x-compressed; "
"video/x-raw-yuv; video/x-compressed")
"video/x-raw; video/x-compressed")
);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@ -577,7 +577,7 @@ gst_codec_demuxer_setup_pad (GstCodecDemuxer * demux, GstPad ** pad,
}
if (g_str_equal (streaminfo, "raw-video")) {
caps = gst_caps_new_simple ("video/x-raw-yuv",
caps = gst_caps_new_simple ("video/x-raw",
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
"width", G_TYPE_INT, 320,
"height", G_TYPE_INT, 240,
@ -692,8 +692,8 @@ GST_START_TEST (test_raw_single_video_stream_manual_sink)
playbin =
create_playbin
("caps:video/x-raw-yuv, "
"format=(fourcc)I420, "
("caps:video/x-raw, "
"format=(string)I420, "
"width=(int)320, "
"height=(int)240, "
"framerate=(fraction)0/1, " "pixel-aspect-ratio=(fraction)1/1", TRUE);

View file

@ -586,7 +586,7 @@ static GstCaps *
gst_red_video_src_get_caps (GstBaseSrc * src, GstCaps * filter)
{
guint w = 64, h = 64;
return gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC,
return gst_caps_new_simple ("video/x-raw", "format", GST_TYPE_FOURCC,
GST_MAKE_FOURCC ('I', '4', '2', '0'), "width", G_TYPE_INT, w, "height",
G_TYPE_INT, h, "framerate", GST_TYPE_FRACTION, 1, 1, NULL);
}
@ -598,7 +598,7 @@ gst_red_video_src_class_init (GstRedVideoSrcClass * klass)
GstBaseSrcClass *basesrc_class = GST_BASE_SRC_CLASS (klass);
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-raw-yuv, format=(fourcc)I420")
GST_STATIC_CAPS ("video/x-raw, format=(string)I420")
);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);

View file

@ -41,15 +41,15 @@
static GstPad *myvideosrcpad, *mytextsrcpad, *mysinkpad;
#define VIDEO_CAPS_STRING \
"video/x-raw-yuv, " \
"format = (fourcc) I420, " \
"video/x-raw, " \
"format = (string) I420, " \
"framerate = (fraction) 1/1, " \
"width = (int) 240, " \
"height = (int) 120"
#define VIDEO_CAPS_TEMPLATE_STRING \
"video/x-raw-yuv, " \
"format = (fourcc) I420"
"video/x-raw, " \
"format = (string) I420"
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,

View file

@ -31,34 +31,34 @@ static GstPad *mysrcpad, *mysinkpad;
#define VIDEO_CAPS_TEMPLATE_STRING \
"video/x-raw-yuv"
"video/x-raw"
#define VIDEO_CAPS_STRING \
"video/x-raw-yuv, " \
"video/x-raw, " \
"width = (int) 320, " \
"height = (int) 240, " \
"framerate = (fraction) 25/1 , " \
"format = (fourcc) I420"
"format = (string) I420"
#define VIDEO_CAPS_NO_FRAMERATE_STRING \
"video/x-raw-yuv, " \
"video/x-raw, " \
"width = (int) 320, " \
"height = (int) 240, " \
"format = (fourcc) I420"
"format = (string) I420"
#define VIDEO_CAPS_NEWSIZE_STRING \
"video/x-raw-yuv, " \
"video/x-raw, " \
"width = (int) 240, " \
"height = (int) 120, " \
"framerate = (fraction) 25/1 , " \
"format = (fourcc) I420"
"format = (string) I420"
#define VIDEO_CAPS_UNUSUAL_FRAMERATE \
"video/x-raw-yuv, " \
"video/x-raw, " \
"width = (int) 240, " \
"height = (int) 120, " \
"framerate = (fraction) 999/7 , " \
"format = (fourcc) I420, " \
"format = (string) I420, " \
"color-matrix=(string)sdtv"
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",

View file

@ -498,44 +498,42 @@ _test_negotiation (const gchar * src_templ, const gchar * sink_templ,
GST_START_TEST (test_negotiation)
{
_test_negotiation
("video/x-raw-yuv,format=(fourcc)AYUV,width=720,height=576,pixel-aspect-ratio=16/15",
"video/x-raw-yuv,format=(fourcc)AYUV,width=768,height=576",
768, 576, 1, 1);
("video/x-raw,format=(string)AYUV,width=720,height=576,pixel-aspect-ratio=16/15",
"video/x-raw,format=(string)AYUV,width=768,height=576", 768, 576, 1, 1);
_test_negotiation
("video/x-raw-yuv,format=(fourcc)AYUV,width=320,height=240",
"video/x-raw-yuv,format=(fourcc)AYUV,width=640,height=320",
("video/x-raw,format=(string)AYUV,width=320,height=240",
"video/x-raw,format=(string)AYUV,width=640,height=320", 640, 320, 2, 3);
_test_negotiation
("video/x-raw,format=(string)AYUV,width=320,height=240",
"video/x-raw,format=(string)AYUV,width=640,height=320,pixel-aspect-ratio=[0/1, 1/1]",
640, 320, 2, 3);
_test_negotiation
("video/x-raw-yuv,format=(fourcc)AYUV,width=320,height=240",
"video/x-raw-yuv,format=(fourcc)AYUV,width=640,height=320,pixel-aspect-ratio=[0/1, 1/1]",
640, 320, 2, 3);
_test_negotiation
("video/x-raw-yuv,format=(fourcc)AYUV,width=1920,height=2560,pixel-aspect-ratio=1/1",
"video/x-raw-yuv,format=(fourcc)AYUV,width=[1, 2048],height=[1, 2048],pixel-aspect-ratio=1/1",
("video/x-raw,format=(string)AYUV,width=1920,height=2560,pixel-aspect-ratio=1/1",
"video/x-raw,format=(string)AYUV,width=[1, 2048],height=[1, 2048],pixel-aspect-ratio=1/1",
1536, 2048, 1, 1);
_test_negotiation
("video/x-raw-yuv,format=(fourcc)AYUV,width=1920,height=2560,pixel-aspect-ratio=1/1",
"video/x-raw-yuv,format=(fourcc)AYUV,width=[1, 2048],height=[1, 2048]",
("video/x-raw,format=(string)AYUV,width=1920,height=2560,pixel-aspect-ratio=1/1",
"video/x-raw,format=(string)AYUV,width=[1, 2048],height=[1, 2048]",
1920, 2048, 4, 5);
_test_negotiation
("video/x-raw-yuv,format=(fourcc)AYUV,width=1920,height=2560",
"video/x-raw-yuv,format=(fourcc)AYUV,width=[1, 2048],height=[1, 2048]",
("video/x-raw,format=(string)AYUV,width=1920,height=2560",
"video/x-raw,format=(string)AYUV,width=[1, 2048],height=[1, 2048]",
1920, 2048, 4, 5);
_test_negotiation
("video/x-raw-yuv,format=(fourcc)AYUV,width=1920,height=2560",
"video/x-raw-yuv,format=(fourcc)AYUV,width=1200,height=[1, 2048],pixel-aspect-ratio=1/1",
("video/x-raw,format=(string)AYUV,width=1920,height=2560",
"video/x-raw,format=(string)AYUV,width=1200,height=[1, 2048],pixel-aspect-ratio=1/1",
1200, 1600, 1, 1);
/* Doesn't keep DAR but must be possible! */
_test_negotiation
("video/x-raw-yuv,format=(fourcc)AYUV,width=320,height=240,pixel-aspect-ratio=1/1",
"video/x-raw-yuv,format=(fourcc)AYUV,width=200,height=200,pixel-aspect-ratio=1/2",
("video/x-raw,format=(string)AYUV,width=320,height=240,pixel-aspect-ratio=1/1",
"video/x-raw,format=(string)AYUV,width=200,height=200,pixel-aspect-ratio=1/2",
200, 200, 1, 2);
}
@ -782,7 +780,7 @@ GST_START_TEST (test_basetransform_negotiation)
g_object_set (src, "num-buffers", 3, NULL);
caps = gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC,
caps = gst_caps_new_simple ("video/x-raw", "format", GST_TYPE_FOURCC,
GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), "width", G_TYPE_INT, 352,
"height", G_TYPE_INT, 288, "framerate", GST_TYPE_FRACTION, 30, 1,
"pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1, NULL);
@ -790,7 +788,7 @@ GST_START_TEST (test_basetransform_negotiation)
gst_caps_unref (caps);
/* same caps, just different pixel-aspect-ratio */
caps = gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC,
caps = gst_caps_new_simple ("video/x-raw", "format", GST_TYPE_FOURCC,
GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), "width", G_TYPE_INT, 352,
"height", G_TYPE_INT, 288, "framerate", GST_TYPE_FRACTION, 30, 1,
"pixel-aspect-ratio", GST_TYPE_FRACTION, 12, 11, NULL);

View file

@ -41,7 +41,7 @@ static GstPad *mysinkpad;
#define CAPS_TEMPLATE_STRING \
"video/x-raw-yuv, " \
"format = (fourcc) UYVY, " \
"format = (string) UYVY, " \
"width = (int) [ 1, MAX ], " \
"height = (int) [ 1, MAX ], " \
"framerate = (fraction) [ 0/1, MAX ]"

View file

@ -271,7 +271,7 @@ static const gchar *caps_strings[] = {
"video/x-h261", "video/x-huffyuv", "video/x-intel-h263", "video/x-jpeg",
"video/x-mjpeg", "video/x-mjpeg-b", "video/mpegts", "video/x-mng",
"video/x-mszh", "video/x-msvideocodec", "video/x-mve", "video/x-nut",
"video/x-nuv", "video/x-qdrw", "video/x-raw-gray", "video/x-smc",
"video/x-nuv", "video/x-qdrw", "video/x-raw", "video/x-smc",
"video/x-smoke", "video/x-tarkin", "video/x-theora", "video/x-rle",
"video/x-ultimotion", "video/x-vcd", "video/x-vmnc", "video/x-vp3",
"video/x-vp5", "video/x-vp6", "video/x-vp6-flash", "video/x-vp7",
@ -383,8 +383,8 @@ static const gchar *caps_strings[] = {
"audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)44100, channels=(int)2",
"audio/x-raw-float, rate=(int)22050, channels=(int)2, endianness=(int)1234, width=(int)32",
/* raw video */
"video/x-raw-rgb, bpp=(int)16, endianness=(int)1234, depth=(int)16, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)320, height=(int)240, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1",
"video/x-raw-yuv, format=(fourcc)YUY2, width=(int)320, height=(int)240, framerate=(fraction)30/1",
"video/x-raw, format=(string)RGB16, width=(int)320, height=(int)240, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1",
"video/x-raw, format=(string)YUY2, width=(int)320, height=(int)240, framerate=(fraction)30/1",
/* and a made-up format */
"video/x-tpm"
};

View file

@ -239,8 +239,7 @@ create_saveload_target (const gchar * targetname)
caps = gst_caps_from_string ("video/x-glitter,sparkling=True");
caps2 =
gst_caps_from_string
("video/x-raw-yuv,width=640,height=480,framerate=15/1");
gst_caps_from_string ("video/x-raw,width=640,height=480,framerate=15/1");
sprof = (GstEncodingProfile *)
gst_encoding_video_profile_new (caps, "seriously glittery", caps2, 0);
gst_encoding_video_profile_set_variableframerate ((GstEncodingVideoProfile *)
@ -376,8 +375,7 @@ test_individual_target (GstEncodingTarget * target)
GST_DEBUG ("Checking the container profile has the video//x-glitter stream");
tmpcaps = gst_caps_from_string ("video/x-glitter,sparkling=True");
tmpcaps2 =
gst_caps_from_string
("video/x-raw-yuv,width=640,height=480,framerate=15/1");
gst_caps_from_string ("video/x-raw,width=640,height=480,framerate=15/1");
sprof2 = (GstEncodingProfile *)
gst_encoding_video_profile_new (tmpcaps, "seriously glittery", tmpcaps2,
0);
@ -536,7 +534,7 @@ parent=pony\n\
type=video\n\
preset=seriously glittery\n\
format=video/x-glitter,sparkling=True\n\
restriction=video/x-raw-yuv,width=640,height=480,framerate=15/1\n\
restriction=video/x-raw,width=640,height=480,framerate=15/1\n\
presence=0\n\
variableframerate=true\n\
";

View file

@ -755,9 +755,9 @@ GST_END_TEST;
GST_START_TEST (test_video_size_from_caps)
{
gint size;
guint32 fourcc = GST_MAKE_FOURCC ('Y', 'V', '1', '2');
GstCaps *caps = gst_caps_new_simple ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, fourcc,
GstCaps *caps = gst_caps_new_simple ("video/x-raw",
"format", G_TYPE_STRING, "YV12",
"width", G_TYPE_INT, 640,
"height", G_TYPE_INT, 480,
"framerate", GST_TYPE_FRACTION, 25, 1,

View file

@ -23,12 +23,12 @@
#include <gst/check/gstcheck.h>
#define FIRST_CAPS "video/x-raw-yuv,width=(int)480,height=(int)320"
#define SECOND_CAPS "video/x-raw-yuv,width=(int)120,height=(int)100"
#define THIRD_CAPS "video/x-raw-yuv,width=(int)[10,50],height=(int)[100,200]"
#define FOURTH_CAPS "video/x-raw-rgb,width=(int)300,height=(int)[25,75];" \
"video/x-raw-yuv,width=(int)[30,40]," \
"height=(int)[100,200],format=(fourcc)YUY2"
#define FIRST_CAPS "video/x-raw,width=(int)480,height=(int)320"
#define SECOND_CAPS "video/x-raw,width=(int)120,height=(int)100"
#define THIRD_CAPS "video/x-raw,width=(int)[10,50],height=(int)[100,200]"
#define FOURTH_CAPS "video/x-raw,width=(int)300,height=(int)[25,75];" \
"video/x-raw,width=(int)[30,40]," \
"height=(int)[100,200],format=(string)YUY2"
int buffer_count = 0;
GstCaps *current_caps = NULL;
@ -147,8 +147,8 @@ GST_START_TEST (test_capsfilter_renegotiation)
run_capsfilter_renegotiation ("videotestsrc num-buffers=200 peer-alloc=false"
" ! capsfilter caps=\"" FIRST_CAPS "\" name=cf ! fakesink name=sink");
run_capsfilter_renegotiation ("videotestsrc num-buffers=200 peer-alloc=false"
" ! capsfilter caps=\"video/x-raw-yuv, format=(fourcc)I420, width=(int)100, height=(int)100\" "
" ! ffmpegcolorspace ! videoscale ! capsfilter caps=\"" FIRST_CAPS
" ! capsfilter caps=\"video/x-raw, format=(string)I420, width=(int)100, height=(int)100\" "
" ! videoconvert ! videoscale ! capsfilter caps=\"" FIRST_CAPS
"\" name=cf " " ! fakesink name=sink");
}

View file

@ -122,7 +122,7 @@ GST_START_TEST (test_element_negotiation)
#ifdef HAVE_LIBVISUAL
s = "audiotestsrc num-buffers=30 ! tee name=t ! alsasink t. ! audioconvert ! "
"libvisual_lv_scope ! ffmpegcolorspace ! xvimagesink";
"libvisual_lv_scope ! videoconvert ! xvimagesink";
run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN);
@ -140,17 +140,17 @@ GST_START_TEST (test_basetransform_based)
/* Check that videoscale can pick a height given only a width */
s = "videotestsrc num-buffers=2 ! "
"video/x-raw-yuv,format=(fourcc)I420,width=320,height=240 ! "
"videoscale ! video/x-raw-yuv,width=640 ! fakesink";
"video/x-raw,format=(string)I420,width=320,height=240 ! "
"videoscale ! video/x-raw,width=640 ! fakesink";
run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN);
/* Test that ffmpegcolorspace can pick an output format that isn't
/* Test that videoconvert can pick an output format that isn't
* passthrough without completely specified output caps */
s = "videotestsrc num-buffers=2 ! "
"video/x-raw-yuv,format=(fourcc)I420,width=320,height=240 ! "
"ffmpegcolorspace ! video/x-raw-rgb ! fakesink";
"video/x-raw,format=(string)I420,width=320,height=240 ! "
"videoconvert ! video/x-raw,format=(string)RGB ! fakesink";
run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN);
@ -172,30 +172,28 @@ GST_START_TEST (test_basetransform_based)
GST_MESSAGE_UNKNOWN);
/* Check that videoscale doesn't claim to be able to transform input in
* formats it can't handle for a given scaling method; ffmpegcolorspace
* formats it can't handle for a given scaling method; videoconvert
* should then make sure a format that can be handled is chosen (4-tap
* scaling is not implemented for RGB and packed yuv currently) */
s = "videotestsrc num-buffers=2 ! video/x-raw-rgb,width=64,height=64 ! "
"ffmpegcolorspace ! videoscale method=4-tap ! ffmpegcolorspace ! "
"video/x-raw-rgb,width=32,height=32,framerate=(fraction)30/1,"
"pixel-aspect-ratio=(fraction)1/1,bpp=(int)24,depth=(int)24,"
"red_mask=(int)16711680,green_mask=(int)65280,blue_mask=(int)255,"
"endianness=(int)4321 ! fakesink";
s = "videotestsrc num-buffers=2 ! video/x-raw,format=(string)ARGB64 ! "
"videoconvert ! videoscale method=4-tap ! videoconvert ! "
"video/x-raw,format=(string)RGB, width=32,height=32,framerate=(fraction)30/1,"
"pixel-aspect-ratio=(fraction)1/1 ! fakesink";
run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN);
s = "videotestsrc num-buffers=2 ! video/x-raw-yuv,format=(fourcc)AYUV,"
"width=64,height=64 ! ffmpegcolorspace ! videoscale method=4-tap ! "
"ffmpegcolorspace ! video/x-raw-yuv,format=(fourcc)AYUV,width=32,"
s = "videotestsrc num-buffers=2 ! video/x-raw,format=(string)AYUV,"
"width=64,height=64 ! videoconvert ! videoscale method=4-tap ! "
"videoconvert ! video/x-raw,format=(string)AYUV,width=32,"
"height=32 ! fakesink";
run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
GST_MESSAGE_UNKNOWN);
/* make sure nothing funny happens in passthrough mode (we don't check that
* passthrough mode is chosen though) */
s = "videotestsrc num-buffers=2 ! video/x-raw-yuv,format=(fourcc)I420,"
"width=64,height=64 ! ffmpegcolorspace ! videoscale method=4-tap ! "
"ffmpegcolorspace ! video/x-raw-yuv,format=(fourcc)I420,width=32,"
s = "videotestsrc num-buffers=2 ! video/x-raw,format=(string)I420,"
"width=64,height=64 ! videoconvert ! videoscale method=4-tap ! "
"videoconvert ! video/x-raw,format=(string)I420,width=32,"
"height=32 ! fakesink";
run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),

View file

@ -135,7 +135,7 @@ GST_START_TEST (test_granulepos_offset)
GError *error = NULL;
pipe_str = g_strdup_printf ("videotestsrc timestamp-offset=%" G_GUINT64_FORMAT
" num-buffers=10 ! video/x-raw-yuv,format=(fourcc)I420,framerate=10/1"
" num-buffers=10 ! video/x-raw,format=(string)I420,framerate=10/1"
" ! theoraenc ! fakesink name=fs0", TIMESTAMP_OFFSET);
bin = gst_parse_launch (pipe_str, &error);
@ -228,7 +228,7 @@ GST_START_TEST (test_continuity)
GError *error = NULL;
pipe_str = g_strdup_printf ("videotestsrc num-buffers=10"
" ! video/x-raw-yuv,format=(fourcc)I420,framerate=10/1"
" ! video/x-raw,format=(string)I420,framerate=10/1"
" ! theoraenc ! fakesink name=fs0");
bin = gst_parse_launch (pipe_str, &error);
@ -324,7 +324,7 @@ GST_START_TEST (test_discontinuity)
guint drop_id;
pipe_str = g_strdup_printf ("videotestsrc num-buffers=10"
" ! video/x-raw-yuv,format=(fourcc)I420,framerate=10/1"
" ! video/x-raw,format=(string)I420,framerate=10/1"
" ! theoraenc ! fakesink name=fs0");
bin = gst_parse_launch (pipe_str, &error);