mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
value: remove our FOURCC GType
Remove our custom fourcc GValue.
This commit is contained in:
parent
b1573e9865
commit
405a5d2a92
11 changed files with 155 additions and 559 deletions
|
@ -43,8 +43,8 @@
|
|||
* <title>Creating caps</title>
|
||||
* <programlisting>
|
||||
* GstCaps *caps;
|
||||
* caps = gst_caps_new_simple ("video/x-raw-yuv",
|
||||
* "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
|
||||
* caps = gst_caps_new_simple ("video/x-raw",
|
||||
* "format", G_TYPE_STRING, "I420"),
|
||||
* "framerate", GST_TYPE_FRACTION, 25, 1,
|
||||
* "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
|
||||
* "width", G_TYPE_INT, 320,
|
||||
|
|
|
@ -1363,42 +1363,6 @@ gst_structure_get_uint (const GstStructure * structure,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_structure_get_fourcc:
|
||||
* @structure: a #GstStructure
|
||||
* @fieldname: the name of a field
|
||||
* @value: (out): a pointer to a 32bit unsigned int to set
|
||||
*
|
||||
* Sets the Fourcc pointed to by @value corresponding to the value of the
|
||||
* given field. Caller is responsible for making sure the field exists
|
||||
* and has the correct type.
|
||||
*
|
||||
* Returns: TRUE if the value could be set correctly. If there was no field
|
||||
* with @fieldname or the existing field did not contain a fourcc, this function
|
||||
* returns FALSE.
|
||||
*/
|
||||
gboolean
|
||||
gst_structure_get_fourcc (const GstStructure * structure,
|
||||
const gchar * fieldname, guint32 * value)
|
||||
{
|
||||
GstStructureField *field;
|
||||
|
||||
g_return_val_if_fail (structure != NULL, FALSE);
|
||||
g_return_val_if_fail (fieldname != NULL, FALSE);
|
||||
g_return_val_if_fail (value != NULL, FALSE);
|
||||
|
||||
field = gst_structure_get_field (structure, fieldname);
|
||||
|
||||
if (field == NULL)
|
||||
return FALSE;
|
||||
if (!GST_VALUE_HOLDS_FOURCC (&field->value))
|
||||
return FALSE;
|
||||
|
||||
*value = gst_value_get_fourcc (&field->value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_structure_get_date:
|
||||
* @structure: a #GstStructure
|
||||
|
@ -1705,10 +1669,6 @@ gst_structure_get_abbrs (gint * n_abbrs)
|
|||
,
|
||||
{"buffer", GST_TYPE_BUFFER}
|
||||
,
|
||||
{"fourcc", GST_TYPE_FOURCC}
|
||||
,
|
||||
{"4", GST_TYPE_FOURCC}
|
||||
,
|
||||
{"fraction", GST_TYPE_FRACTION}
|
||||
,
|
||||
{"boolean", G_TYPE_BOOLEAN}
|
||||
|
|
|
@ -195,9 +195,6 @@ gboolean gst_structure_get_int (const GstStructure
|
|||
gboolean gst_structure_get_uint (const GstStructure *structure,
|
||||
const gchar *fieldname,
|
||||
guint *value);
|
||||
gboolean gst_structure_get_fourcc (const GstStructure *structure,
|
||||
const gchar *fieldname,
|
||||
guint32 *value);
|
||||
gboolean gst_structure_get_double (const GstStructure *structure,
|
||||
const gchar *fieldname,
|
||||
gdouble *value);
|
||||
|
|
181
gst/gstvalue.c
181
gst/gstvalue.c
|
@ -714,160 +714,6 @@ gst_value_deserialize_array (GValue * dest, const gchar * s)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/**********
|
||||
* fourcc *
|
||||
**********/
|
||||
|
||||
static void
|
||||
gst_value_init_fourcc (GValue * value)
|
||||
{
|
||||
value->data[0].v_int = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_value_copy_fourcc (const GValue * src_value, GValue * dest_value)
|
||||
{
|
||||
dest_value->data[0].v_int = src_value->data[0].v_int;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gst_value_collect_fourcc (GValue * value, guint n_collect_values,
|
||||
GTypeCValue * collect_values, guint collect_flags)
|
||||
{
|
||||
value->data[0].v_int = collect_values[0].v_int;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gst_value_lcopy_fourcc (const GValue * value, guint n_collect_values,
|
||||
GTypeCValue * collect_values, guint collect_flags)
|
||||
{
|
||||
guint32 *fourcc_p = collect_values[0].v_pointer;
|
||||
|
||||
if (!fourcc_p)
|
||||
return g_strdup_printf ("value location for `%s' passed as NULL",
|
||||
G_VALUE_TYPE_NAME (value));
|
||||
|
||||
*fourcc_p = value->data[0].v_int;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_value_set_fourcc:
|
||||
* @value: a GValue initialized to #GST_TYPE_FOURCC
|
||||
* @fourcc: the #guint32 fourcc to set
|
||||
*
|
||||
* Sets @value to @fourcc.
|
||||
*/
|
||||
void
|
||||
gst_value_set_fourcc (GValue * value, guint32 fourcc)
|
||||
{
|
||||
g_return_if_fail (GST_VALUE_HOLDS_FOURCC (value));
|
||||
|
||||
value->data[0].v_int = fourcc;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_value_get_fourcc:
|
||||
* @value: a GValue initialized to #GST_TYPE_FOURCC
|
||||
*
|
||||
* Gets the #guint32 fourcc contained in @value.
|
||||
*
|
||||
* Returns: the #guint32 fourcc contained in @value.
|
||||
*/
|
||||
guint32
|
||||
gst_value_get_fourcc (const GValue * value)
|
||||
{
|
||||
g_return_val_if_fail (GST_VALUE_HOLDS_FOURCC (value), 0);
|
||||
|
||||
return value->data[0].v_int;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_value_transform_fourcc_string (const GValue * src_value,
|
||||
GValue * dest_value)
|
||||
{
|
||||
guint32 fourcc = src_value->data[0].v_int;
|
||||
gchar fourcc_char[4];
|
||||
|
||||
fourcc_char[0] = (fourcc >> 0) & 0xff;
|
||||
fourcc_char[1] = (fourcc >> 8) & 0xff;
|
||||
fourcc_char[2] = (fourcc >> 16) & 0xff;
|
||||
fourcc_char[3] = (fourcc >> 24) & 0xff;
|
||||
|
||||
if ((g_ascii_isalnum (fourcc_char[0]) || fourcc_char[0] == ' ') &&
|
||||
(g_ascii_isalnum (fourcc_char[1]) || fourcc_char[1] == ' ') &&
|
||||
(g_ascii_isalnum (fourcc_char[2]) || fourcc_char[2] == ' ') &&
|
||||
(g_ascii_isalnum (fourcc_char[3]) || fourcc_char[3] == ' ')) {
|
||||
dest_value->data[0].v_pointer =
|
||||
g_strdup_printf ("%" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
|
||||
} else {
|
||||
dest_value->data[0].v_pointer = g_strdup_printf ("0x%08x", fourcc);
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
gst_value_compare_fourcc (const GValue * value1, const GValue * value2)
|
||||
{
|
||||
if (value2->data[0].v_int == value1->data[0].v_int)
|
||||
return GST_VALUE_EQUAL;
|
||||
return GST_VALUE_UNORDERED;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gst_value_serialize_fourcc (const GValue * value)
|
||||
{
|
||||
guint32 fourcc = value->data[0].v_int;
|
||||
gchar fourcc_char[4];
|
||||
|
||||
fourcc_char[0] = (fourcc >> 0) & 0xff;
|
||||
fourcc_char[1] = (fourcc >> 8) & 0xff;
|
||||
fourcc_char[2] = (fourcc >> 16) & 0xff;
|
||||
fourcc_char[3] = (fourcc >> 24) & 0xff;
|
||||
|
||||
if ((g_ascii_isalnum (fourcc_char[0]) || fourcc_char[0] == ' ') &&
|
||||
(g_ascii_isalnum (fourcc_char[1]) || fourcc_char[1] == ' ') &&
|
||||
(g_ascii_isalnum (fourcc_char[2]) || fourcc_char[2] == ' ') &&
|
||||
(g_ascii_isalnum (fourcc_char[3]) || fourcc_char[3] == ' ')) {
|
||||
return g_strdup_printf ("%" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
|
||||
} else {
|
||||
return g_strdup_printf ("0x%08x", fourcc);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_value_deserialize_fourcc (GValue * dest, const gchar * s)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
guint32 fourcc = 0;
|
||||
gchar *end;
|
||||
gint l = strlen (s);
|
||||
|
||||
if (l == 4) {
|
||||
fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]);
|
||||
ret = TRUE;
|
||||
} else if (l == 3) {
|
||||
fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], ' ');
|
||||
ret = TRUE;
|
||||
} else if (l == 2) {
|
||||
fourcc = GST_MAKE_FOURCC (s[0], s[1], ' ', ' ');
|
||||
ret = TRUE;
|
||||
} else if (l == 1) {
|
||||
fourcc = GST_MAKE_FOURCC (s[0], ' ', ' ', ' ');
|
||||
ret = TRUE;
|
||||
} else if (g_ascii_isdigit (*s)) {
|
||||
fourcc = strtoul (s, &end, 0);
|
||||
if (*end == 0) {
|
||||
ret = TRUE;
|
||||
}
|
||||
}
|
||||
gst_value_set_fourcc (dest, fourcc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*************
|
||||
* int range *
|
||||
*************/
|
||||
|
@ -4717,19 +4563,6 @@ GType gst_ ## type ## _get_type (void) \
|
|||
return gst_ ## type ## _type; \
|
||||
}
|
||||
|
||||
static const GTypeValueTable _gst_fourcc_value_table = {
|
||||
gst_value_init_fourcc,
|
||||
NULL,
|
||||
gst_value_copy_fourcc,
|
||||
NULL,
|
||||
(char *) "i",
|
||||
gst_value_collect_fourcc,
|
||||
(char *) "p",
|
||||
gst_value_lcopy_fourcc
|
||||
};
|
||||
|
||||
FUNC_VALUE_GET_TYPE (fourcc, "GstFourcc");
|
||||
|
||||
static const GTypeValueTable _gst_int_range_value_table = {
|
||||
gst_value_init_int_range,
|
||||
NULL,
|
||||
|
@ -4867,18 +4700,6 @@ _gst_value_initialize (void)
|
|||
gst_value_subtract_funcs = g_array_new (FALSE, FALSE,
|
||||
sizeof (GstValueSubtractInfo));
|
||||
|
||||
{
|
||||
static GstValueTable gst_value = {
|
||||
0,
|
||||
gst_value_compare_fourcc,
|
||||
gst_value_serialize_fourcc,
|
||||
gst_value_deserialize_fourcc,
|
||||
};
|
||||
|
||||
gst_value.type = gst_fourcc_get_type ();
|
||||
gst_value_register (&gst_value);
|
||||
}
|
||||
|
||||
{
|
||||
static GstValueTable gst_value = {
|
||||
0,
|
||||
|
@ -5050,8 +4871,6 @@ _gst_value_initialize (void)
|
|||
|
||||
REGISTER_SERIALIZATION (G_TYPE_UCHAR, uchar);
|
||||
|
||||
g_value_register_transform_func (GST_TYPE_FOURCC, G_TYPE_STRING,
|
||||
gst_value_transform_fourcc_string);
|
||||
g_value_register_transform_func (GST_TYPE_INT_RANGE, G_TYPE_STRING,
|
||||
gst_value_transform_int_range_string);
|
||||
g_value_register_transform_func (GST_TYPE_INT64_RANGE, G_TYPE_STRING,
|
||||
|
|
|
@ -85,14 +85,6 @@ G_BEGIN_DECLS
|
|||
((gchar) (((fourcc)>>16)&0xff)), \
|
||||
((gchar) (((fourcc)>>24)&0xff))
|
||||
|
||||
/**
|
||||
* GST_VALUE_HOLDS_FOURCC:
|
||||
* @x: the #GValue to check
|
||||
*
|
||||
* Checks if the given #GValue contains a #GST_TYPE_FOURCC value.
|
||||
*/
|
||||
#define GST_VALUE_HOLDS_FOURCC(x) (G_VALUE_HOLDS((x), gst_fourcc_get_type ()))
|
||||
|
||||
/**
|
||||
* GST_VALUE_HOLDS_INT_RANGE:
|
||||
* @x: the #GValue to check
|
||||
|
@ -195,15 +187,6 @@ G_BEGIN_DECLS
|
|||
*/
|
||||
#define GST_VALUE_HOLDS_DATE_TIME(x) (G_VALUE_HOLDS((x), gst_date_time_get_type ()))
|
||||
|
||||
/**
|
||||
* GST_TYPE_FOURCC:
|
||||
*
|
||||
* a #GValue type that represents 4 byte identifier (e.g. used for codecs)
|
||||
*
|
||||
* Returns: the #GType of GstFourcc
|
||||
*/
|
||||
#define GST_TYPE_FOURCC gst_fourcc_get_type ()
|
||||
|
||||
/**
|
||||
* GST_TYPE_INT_RANGE:
|
||||
*
|
||||
|
@ -442,7 +425,6 @@ GType gst_int_range_get_type (void);
|
|||
GType gst_int64_range_get_type (void);
|
||||
GType gst_double_range_get_type (void);
|
||||
GType gst_fraction_range_get_type (void);
|
||||
GType gst_fourcc_get_type (void);
|
||||
GType gst_fraction_get_type (void);
|
||||
GType gst_value_list_get_type (void);
|
||||
GType gst_value_array_get_type (void);
|
||||
|
@ -482,11 +464,6 @@ guint gst_value_array_get_size (const GValue *value);
|
|||
const GValue * gst_value_array_get_value (const GValue *value,
|
||||
guint index);
|
||||
|
||||
/* fourcc */
|
||||
void gst_value_set_fourcc (GValue *value,
|
||||
guint32 fourcc);
|
||||
guint32 gst_value_get_fourcc (const GValue *value);
|
||||
|
||||
/* int range */
|
||||
void gst_value_set_int_range (GValue *value,
|
||||
gint start,
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
|
||||
static const gchar *caps_list[] = {
|
||||
"audio/x-adpcm, layout=(string)quicktime; audio/x-adpcm, layout=(string)quicktime; audio/x-adpcm, layout=(string)wav; audio/x-adpcm, layout=(string)wav; audio/x-adpcm, layout=(string)dk3; audio/x-adpcm, layout=(string)dk3; audio/x-adpcm, layout=(string)dk4; audio/x-adpcm, layout=(string)dk4; audio/x-adpcm, layout=(string)westwood; audio/x-adpcm, layout=(string)westwood; audio/x-adpcm, layout=(string)smjpeg; audio/x-adpcm, layout=(string)smjpeg; audio/x-adpcm, layout=(string)microsoft; audio/x-adpcm, layout=(string)microsoft; audio/x-adpcm, layout=(string)4xm; audio/x-adpcm, layout=(string)4xm; audio/x-adpcm, layout=(string)xa; audio/x-adpcm, layout=(string)xa; audio/x-adpcm, layout=(string)adx; audio/x-adpcm, layout=(string)adx; audio/x-adpcm, layout=(string)ea; audio/x-adpcm, layout=(string)ea; audio/x-adpcm, layout=(string)g726; audio/x-adpcm, layout=(string)g726",
|
||||
"video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)I420; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)YUY2; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, endianness=(int)4321; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, endianness=(int)4321; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)Y42B; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)32, depth=(int)24, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, endianness=(int)4321; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)YUV9; video/x-raw-yuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(fourcc)Y41B; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)16, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, endianness=(int)1234; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)15, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, endianness=(int)1234",
|
||||
"video/x-raw-yuv, format=(fourcc){ YUY2, I420 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-jpeg, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-divx, divxversion=(int)[ 3, 5 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-xvid, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-3ivx, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-msmpeg, msmpegversion=(int)[ 41, 43 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-h263, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-dv, systemstream=(boolean)false, width=(int)720, height=(int){ 576, 480 }; video/x-huffyuv, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]",
|
||||
"video/x-raw-yuv, format=(fourcc){ YUY2, I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; image/jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-divx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], divxversion=(int)[ 3, 5 ]; video/x-xvid, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-3ivx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-msmpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], msmpegversion=(int)[ 41, 43 ]; video/mpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], mpegversion=(int)1, systemstream=(boolean)false; video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-dv, width=(int)720, height=(int){ 576, 480 }, systemstream=(boolean)false; video/x-huffyuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]",
|
||||
"video/x-raw, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(string)I420; video/x-raw, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(string)YUY2; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, endianness=(int)4321; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)24, depth=(int)24, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, endianness=(int)4321; video/x-raw, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(string)Y42B; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)32, depth=(int)24, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, endianness=(int)4321; video/x-raw, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(string)YUV9; video/x-raw, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], format=(string)Y41B; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)16, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, endianness=(int)1234; video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ], bpp=(int)16, depth=(int)15, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, endianness=(int)1234",
|
||||
"video/x-raw, format=(string){ YUY2, I420 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-jpeg, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-divx, divxversion=(int)[ 3, 5 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-xvid, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-3ivx, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-msmpeg, msmpegversion=(int)[ 41, 43 ], width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-h263, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]; video/x-dv, systemstream=(boolean)false, width=(int)720, height=(int){ 576, 480 }; video/x-huffyuv, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ]",
|
||||
"video/x-raw, format=(string){ YUY2, I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; image/jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-divx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], divxversion=(int)[ 3, 5 ]; video/x-xvid, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-3ivx, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-msmpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], msmpegversion=(int)[ 41, 43 ]; video/mpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], mpegversion=(int)1, systemstream=(boolean)false; video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-dv, width=(int)720, height=(int){ 576, 480 }, systemstream=(boolean)false; video/x-huffyuv, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]",
|
||||
"video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]",
|
||||
"video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]",
|
||||
"video/x-raw-yuv, format=(fourcc){ I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]",
|
||||
"video/x-raw, format=(string){ I420 }, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(double)[ 0, 1.7976931348623157e+308 ]",
|
||||
"video/x-raw-rgb, bpp = (int) 32, depth = (int) 24, endianness = (int) BIG_ENDIAN, red_mask = (int) 0x000000FF, framerate = (double) [ 0, max ]",
|
||||
"video/x-raw-rgb, bpp = (int) 32, depth = (int) 24, endianness = (int) BIG_ENDIAN, red_mask = (int) 0xFF000000, framerate = (double) [ 0, max ]",
|
||||
"video/x-raw-rgb,\\ bpp=(int)32",
|
||||
|
@ -28,7 +28,7 @@ static const gchar *caps_list[] = {
|
|||
"test/gst-fraction-range, fraction = (fraction) { [ 1/4, 1/3 ], [ 1/8, 2/8 ] }",
|
||||
|
||||
/* Some random checks */
|
||||
"video/x-raw-yuv, format = (fourcc) { I420, Y42B, Y444 }, framerate = (fraction) [1/MAX, MAX], width = (int) [ 1, MAX ], height = (int) [ 1, MAX ]",
|
||||
"video/x-raw, format = (string) { I420, Y42B, Y444 }, framerate = (fraction) [1/MAX, MAX], width = (int) [ 1, MAX ], height = (int) [ 1, MAX ]",
|
||||
|
||||
"ANY",
|
||||
"EMPTY"
|
||||
|
|
|
@ -59,7 +59,7 @@ GST_START_TEST (test_double_append)
|
|||
GstCaps *c1;
|
||||
|
||||
c1 = gst_caps_new_any ();
|
||||
s1 = gst_structure_from_string ("audio/x-raw-int,rate=44100", NULL);
|
||||
s1 = gst_structure_from_string ("audio/x-raw,rate=44100", NULL);
|
||||
gst_caps_append_structure (c1, s1);
|
||||
ASSERT_CRITICAL (gst_caps_append_structure (c1, s1));
|
||||
|
||||
|
@ -75,7 +75,7 @@ GST_START_TEST (test_mutability)
|
|||
gint ret;
|
||||
|
||||
c1 = gst_caps_new_any ();
|
||||
s1 = gst_structure_from_string ("audio/x-raw-int,rate=44100", NULL);
|
||||
s1 = gst_structure_from_string ("audio/x-raw,rate=44100", NULL);
|
||||
gst_structure_set (s1, "rate", G_TYPE_INT, 48000, NULL);
|
||||
gst_caps_append_structure (c1, s1);
|
||||
gst_structure_set (s1, "rate", G_TYPE_INT, 22500, NULL);
|
||||
|
@ -100,7 +100,7 @@ GST_END_TEST;
|
|||
|
||||
GST_START_TEST (test_static_caps)
|
||||
{
|
||||
static GstStaticCaps scaps = GST_STATIC_CAPS ("audio/x-raw-int,rate=44100");
|
||||
static GstStaticCaps scaps = GST_STATIC_CAPS ("audio/x-raw,rate=44100");
|
||||
GstCaps *caps1;
|
||||
GstCaps *caps2;
|
||||
|
||||
|
@ -125,57 +125,71 @@ GST_START_TEST (test_static_caps)
|
|||
GST_END_TEST;
|
||||
|
||||
static const gchar non_simple_caps_string[] =
|
||||
"video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)[ 1/100, 100 ], "
|
||||
"width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-raw-yuv, "
|
||||
"format=(fourcc)YUY2, framerate=(fraction)[ 1/100, 100 ], width=(int)[ 16, 4096 ], "
|
||||
"height=(int)[ 16, 4096 ]; video/x-raw-rgb, bpp=(int)8, depth=(int)8, "
|
||||
"endianness=(int)1234, framerate=(fraction)[ 1/100, 100 ], width=(int)[ 16, 4096 ], "
|
||||
"height=(int)[ 16, 4096 ]; video/x-raw-yuv, "
|
||||
"format=(fourcc){ I420, YUY2, YV12 }, width=(int)[ 16, 4096 ], "
|
||||
"video/x-raw, format=(string)I420, framerate=(fraction)[ 1/100, 100 ], "
|
||||
"width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-raw, "
|
||||
"format=(string)YUY2, framerate=(fraction)[ 1/100, 100 ], width=(int)[ 16, 4096 ], "
|
||||
"height=(int)[ 16, 4096 ]; video/x-raw, format=(string)RGB8_PALETTED, "
|
||||
"framerate=(fraction)[ 1/100, 100 ], width=(int)[ 16, 4096 ], "
|
||||
"height=(int)[ 16, 4096 ]; video/x-raw, "
|
||||
"format=(string){ I420, YUY2, YV12 }, width=(int)[ 16, 4096 ], "
|
||||
"height=(int)[ 16, 4096 ], framerate=(fraction)[ 1/100, 100 ]";
|
||||
|
||||
static gboolean
|
||||
check_fourcc_list (const GValue * format_value)
|
||||
check_string_list (const GValue * format_value)
|
||||
{
|
||||
const GValue *fourcc_value;
|
||||
const GValue *string_value;
|
||||
gboolean got_rgb8 = FALSE;
|
||||
gboolean got_yv12 = FALSE;
|
||||
gboolean got_i420 = FALSE;
|
||||
gboolean got_yuy2 = FALSE;
|
||||
guint32 fourcc;
|
||||
const gchar *string;
|
||||
|
||||
fourcc_value = gst_value_list_get_value (format_value, 0);
|
||||
fail_unless (fourcc_value != NULL);
|
||||
fail_unless (GST_VALUE_HOLDS_FOURCC (fourcc_value));
|
||||
fourcc = gst_value_get_fourcc (fourcc_value);
|
||||
fail_unless (fourcc != 0);
|
||||
got_i420 = got_i420 || (fourcc == GST_STR_FOURCC ("I420"));
|
||||
got_yuy2 = got_yuy2 || (fourcc == GST_STR_FOURCC ("YUY2"));
|
||||
got_yv12 = got_yv12 || (fourcc == GST_STR_FOURCC ("YV12"));
|
||||
string_value = gst_value_list_get_value (format_value, 0);
|
||||
fail_unless (string_value != NULL);
|
||||
fail_unless (G_VALUE_HOLDS_STRING (string_value));
|
||||
string = g_value_get_string (string_value);
|
||||
fail_unless (string != NULL);
|
||||
got_rgb8 = got_rgb8 || (g_str_equal (string, "RGB8_PALETTED"));
|
||||
got_i420 = got_i420 || (g_str_equal (string, "I420"));
|
||||
got_yuy2 = got_yuy2 || (g_str_equal (string, "YUY2"));
|
||||
got_yv12 = got_yv12 || (g_str_equal (string, "YV12"));
|
||||
|
||||
fourcc_value = gst_value_list_get_value (format_value, 1);
|
||||
fail_unless (fourcc_value != NULL);
|
||||
fail_unless (GST_VALUE_HOLDS_FOURCC (fourcc_value));
|
||||
fourcc = gst_value_get_fourcc (fourcc_value);
|
||||
fail_unless (fourcc != 0);
|
||||
got_i420 = got_i420 || (fourcc == GST_STR_FOURCC ("I420"));
|
||||
got_yuy2 = got_yuy2 || (fourcc == GST_STR_FOURCC ("YUY2"));
|
||||
got_yv12 = got_yv12 || (fourcc == GST_STR_FOURCC ("YV12"));
|
||||
string_value = gst_value_list_get_value (format_value, 1);
|
||||
fail_unless (string_value != NULL);
|
||||
fail_unless (G_VALUE_HOLDS_STRING (string_value));
|
||||
string = g_value_get_string (string_value);
|
||||
fail_unless (string != NULL);
|
||||
got_rgb8 = got_rgb8 || (g_str_equal (string, "RGB8_PALETTED"));
|
||||
got_i420 = got_i420 || (g_str_equal (string, "I420"));
|
||||
got_yuy2 = got_yuy2 || (g_str_equal (string, "YUY2"));
|
||||
got_yv12 = got_yv12 || (g_str_equal (string, "YV12"));
|
||||
|
||||
fourcc_value = gst_value_list_get_value (format_value, 2);
|
||||
fail_unless (fourcc_value != NULL);
|
||||
fail_unless (GST_VALUE_HOLDS_FOURCC (fourcc_value));
|
||||
fourcc = gst_value_get_fourcc (fourcc_value);
|
||||
fail_unless (fourcc != 0);
|
||||
got_i420 = got_i420 || (fourcc == GST_STR_FOURCC ("I420"));
|
||||
got_yuy2 = got_yuy2 || (fourcc == GST_STR_FOURCC ("YUY2"));
|
||||
got_yv12 = got_yv12 || (fourcc == GST_STR_FOURCC ("YV12"));
|
||||
string_value = gst_value_list_get_value (format_value, 2);
|
||||
fail_unless (string_value != NULL);
|
||||
fail_unless (G_VALUE_HOLDS_STRING (string_value));
|
||||
string = g_value_get_string (string_value);
|
||||
fail_unless (string != NULL);
|
||||
got_rgb8 = got_rgb8 || (g_str_equal (string, "RGB8_PALETTED"));
|
||||
got_i420 = got_i420 || (g_str_equal (string, "I420"));
|
||||
got_yuy2 = got_yuy2 || (g_str_equal (string, "YUY2"));
|
||||
got_yv12 = got_yv12 || (g_str_equal (string, "YV12"));
|
||||
|
||||
return (got_i420 && got_yuy2 && got_yv12);
|
||||
string_value = gst_value_list_get_value (format_value, 3);
|
||||
fail_unless (string_value != NULL);
|
||||
fail_unless (G_VALUE_HOLDS_STRING (string_value));
|
||||
string = g_value_get_string (string_value);
|
||||
fail_unless (string != NULL);
|
||||
got_rgb8 = got_rgb8 || (g_str_equal (string, "RGB8_PALETTED"));
|
||||
got_i420 = got_i420 || (g_str_equal (string, "I420"));
|
||||
got_yuy2 = got_yuy2 || (g_str_equal (string, "YUY2"));
|
||||
got_yv12 = got_yv12 || (g_str_equal (string, "YV12"));
|
||||
|
||||
return (got_rgb8 && got_i420 && got_yuy2 && got_yv12);
|
||||
}
|
||||
|
||||
GST_START_TEST (test_simplify)
|
||||
{
|
||||
GstStructure *s1, *s2;
|
||||
GstStructure *s1;
|
||||
gboolean did_simplify;
|
||||
GstCaps *caps;
|
||||
|
||||
|
@ -189,46 +203,31 @@ GST_START_TEST (test_simplify)
|
|||
|
||||
/* check simplified caps, should be:
|
||||
*
|
||||
* video/x-raw-rgb, bpp=(int)8, depth=(int)8, endianness=(int)1234,
|
||||
* framerate=(fraction)[ 1/100, 100 ], width=(int)[ 16, 4096 ],
|
||||
* height=(int)[ 16, 4096 ];
|
||||
* video/x-raw-yuv, format=(fourcc){ YV12, YUY2, I420 },
|
||||
* video/x-raw, format=(string){ RGB8_PALETTED, YV12, YUY2, I420 },
|
||||
* width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ],
|
||||
* framerate=(fraction)[ 1/100, 100 ]
|
||||
*/
|
||||
fail_unless (gst_caps_get_size (caps) == 2);
|
||||
GST_DEBUG ("simplyfied %" GST_PTR_FORMAT, caps);
|
||||
fail_unless (gst_caps_get_size (caps) == 1);
|
||||
s1 = gst_caps_get_structure (caps, 0);
|
||||
s2 = gst_caps_get_structure (caps, 1);
|
||||
fail_unless (s1 != NULL);
|
||||
fail_unless (s2 != NULL);
|
||||
|
||||
if (!gst_structure_has_name (s1, "video/x-raw-rgb")) {
|
||||
GstStructure *tmp;
|
||||
|
||||
tmp = s1;
|
||||
s1 = s2;
|
||||
s2 = tmp;
|
||||
}
|
||||
|
||||
fail_unless (gst_structure_has_name (s1, "video/x-raw-rgb"));
|
||||
fail_unless (gst_structure_has_name (s1, "video/x-raw"));
|
||||
{
|
||||
const GValue *framerate_value;
|
||||
const GValue *format_value;
|
||||
const GValue *width_value;
|
||||
const GValue *height_value;
|
||||
const GValue *val_fps;
|
||||
GValue test_fps = { 0, };
|
||||
gint bpp, depth, endianness;
|
||||
gint min_width, max_width;
|
||||
gint min_height, max_height;
|
||||
|
||||
fail_unless (gst_structure_get_int (s1, "bpp", &bpp));
|
||||
fail_unless (bpp == 8);
|
||||
|
||||
fail_unless (gst_structure_get_int (s1, "depth", &depth));
|
||||
fail_unless (depth == 8);
|
||||
|
||||
fail_unless (gst_structure_get_int (s1, "endianness", &endianness));
|
||||
fail_unless (endianness == G_LITTLE_ENDIAN);
|
||||
format_value = gst_structure_get_value (s1, "format");
|
||||
fail_unless (format_value != NULL);
|
||||
fail_unless (GST_VALUE_HOLDS_LIST (format_value));
|
||||
fail_unless (gst_value_list_get_size (format_value) == 4);
|
||||
fail_unless (check_string_list (format_value) == TRUE);
|
||||
|
||||
g_value_init (&test_fps, GST_TYPE_FRACTION);
|
||||
framerate_value = gst_structure_get_value (s1, "framerate");
|
||||
|
@ -260,53 +259,6 @@ GST_START_TEST (test_simplify)
|
|||
fail_unless (min_height == 16 && max_height == 4096);
|
||||
}
|
||||
|
||||
fail_unless (gst_structure_has_name (s2, "video/x-raw-yuv"));
|
||||
{
|
||||
const GValue *framerate_value;
|
||||
const GValue *format_value;
|
||||
const GValue *width_value;
|
||||
const GValue *height_value;
|
||||
const GValue *val_fps;
|
||||
GValue test_fps = { 0, };
|
||||
gint min_width, max_width;
|
||||
gint min_height, max_height;
|
||||
|
||||
format_value = gst_structure_get_value (s2, "format");
|
||||
fail_unless (format_value != NULL);
|
||||
fail_unless (GST_VALUE_HOLDS_LIST (format_value));
|
||||
fail_unless (gst_value_list_get_size (format_value) == 3);
|
||||
fail_unless (check_fourcc_list (format_value) == TRUE);
|
||||
|
||||
g_value_init (&test_fps, GST_TYPE_FRACTION);
|
||||
framerate_value = gst_structure_get_value (s2, "framerate");
|
||||
fail_unless (framerate_value != NULL);
|
||||
fail_unless (GST_VALUE_HOLDS_FRACTION_RANGE (framerate_value));
|
||||
|
||||
val_fps = gst_value_get_fraction_range_min (framerate_value);
|
||||
gst_value_set_fraction (&test_fps, 1, 100);
|
||||
fail_unless (gst_value_compare (&test_fps, val_fps) == GST_VALUE_EQUAL);
|
||||
|
||||
val_fps = gst_value_get_fraction_range_max (framerate_value);
|
||||
gst_value_set_fraction (&test_fps, 100, 1);
|
||||
fail_unless (gst_value_compare (&test_fps, val_fps) == GST_VALUE_EQUAL);
|
||||
|
||||
g_value_unset (&test_fps);
|
||||
|
||||
width_value = gst_structure_get_value (s2, "width");
|
||||
fail_unless (width_value != NULL);
|
||||
fail_unless (GST_VALUE_HOLDS_INT_RANGE (width_value));
|
||||
min_width = gst_value_get_int_range_min (width_value);
|
||||
max_width = gst_value_get_int_range_max (width_value);
|
||||
fail_unless (min_width == 16 && max_width == 4096);
|
||||
|
||||
height_value = gst_structure_get_value (s2, "height");
|
||||
fail_unless (height_value != NULL);
|
||||
fail_unless (GST_VALUE_HOLDS_INT_RANGE (height_value));
|
||||
min_height = gst_value_get_int_range_min (height_value);
|
||||
max_height = gst_value_get_int_range_max (height_value);
|
||||
fail_unless (min_height == 16 && max_height == 4096);
|
||||
}
|
||||
|
||||
gst_caps_unref (caps);
|
||||
}
|
||||
|
||||
|
@ -331,24 +283,23 @@ GST_START_TEST (test_subset)
|
|||
{
|
||||
GstCaps *c1, *c2;
|
||||
|
||||
c1 = gst_caps_from_string ("video/x-raw-yuv; video/x-raw-rgb");
|
||||
c2 = gst_caps_from_string ("video/x-raw-yuv, format=(fourcc)YUY2");
|
||||
c1 = gst_caps_from_string ("video/x-raw; video/x-raw");
|
||||
c2 = gst_caps_from_string ("video/x-raw, format=(string)YUY2");
|
||||
fail_unless (gst_caps_is_subset (c2, c1));
|
||||
fail_if (gst_caps_is_subset (c1, c2));
|
||||
gst_caps_unref (c1);
|
||||
gst_caps_unref (c2);
|
||||
|
||||
c1 = gst_caps_from_string
|
||||
("audio/x-raw-int, channels=(int)[ 1, 2 ], rate=(int)44100");
|
||||
c2 = gst_caps_from_string
|
||||
("audio/x-raw-int, channels=(int)1, rate=(int)44100");
|
||||
("audio/x-raw, channels=(int)[ 1, 2 ], rate=(int)44100");
|
||||
c2 = gst_caps_from_string ("audio/x-raw, channels=(int)1, rate=(int)44100");
|
||||
fail_unless (gst_caps_is_subset (c2, c1));
|
||||
fail_if (gst_caps_is_subset (c1, c2));
|
||||
gst_caps_unref (c1);
|
||||
gst_caps_unref (c2);
|
||||
|
||||
c1 = gst_caps_from_string ("audio/x-raw-int, channels=(int) {1}");
|
||||
c2 = gst_caps_from_string ("audio/x-raw-int, channels=(int)1");
|
||||
c1 = gst_caps_from_string ("audio/x-raw, channels=(int) {1}");
|
||||
c2 = gst_caps_from_string ("audio/x-raw, channels=(int)1");
|
||||
fail_unless (gst_caps_is_subset (c2, c1));
|
||||
fail_unless (gst_caps_is_subset (c1, c2));
|
||||
fail_unless (gst_caps_is_equal (c1, c2));
|
||||
|
@ -356,9 +307,9 @@ GST_START_TEST (test_subset)
|
|||
gst_caps_unref (c2);
|
||||
|
||||
c1 = gst_caps_from_string
|
||||
("audio/x-raw-int, rate=(int)44100, channels=(int)3, endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean)false");
|
||||
("audio/x-raw, rate=(int)44100, channels=(int)3, format=(string)U16_LE");
|
||||
c2 = gst_caps_from_string
|
||||
("audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int){ 1234, 4321 }, width=(int)16, depth=(int)[ 1, 16 ], signed=(boolean){ true, false }");
|
||||
("audio/x-raw, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], format=(string){ S16_LE, U16_LE }");
|
||||
fail_unless (gst_caps_is_subset (c1, c2));
|
||||
fail_if (gst_caps_is_subset (c2, c1));
|
||||
gst_caps_unref (c1);
|
||||
|
@ -372,7 +323,7 @@ GST_START_TEST (test_merge_fundamental)
|
|||
GstCaps *c1, *c2;
|
||||
|
||||
/* ANY + specific = ANY */
|
||||
c1 = gst_caps_from_string ("audio/x-raw-int,rate=44100");
|
||||
c1 = gst_caps_from_string ("audio/x-raw,rate=44100");
|
||||
c2 = gst_caps_new_any ();
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
|
@ -381,7 +332,7 @@ GST_START_TEST (test_merge_fundamental)
|
|||
gst_caps_unref (c2);
|
||||
|
||||
/* specific + ANY = ANY */
|
||||
c2 = gst_caps_from_string ("audio/x-raw-int,rate=44100");
|
||||
c2 = gst_caps_from_string ("audio/x-raw,rate=44100");
|
||||
c1 = gst_caps_new_any ();
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
|
@ -390,7 +341,7 @@ GST_START_TEST (test_merge_fundamental)
|
|||
gst_caps_unref (c2);
|
||||
|
||||
/* EMPTY + specific = specific */
|
||||
c1 = gst_caps_from_string ("audio/x-raw-int,rate=44100");
|
||||
c1 = gst_caps_from_string ("audio/x-raw,rate=44100");
|
||||
c2 = gst_caps_new_empty ();
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
|
@ -399,7 +350,7 @@ GST_START_TEST (test_merge_fundamental)
|
|||
gst_caps_unref (c2);
|
||||
|
||||
/* specific + EMPTY = specific */
|
||||
c2 = gst_caps_from_string ("audio/x-raw-int,rate=44100");
|
||||
c2 = gst_caps_from_string ("audio/x-raw,rate=44100");
|
||||
c1 = gst_caps_new_empty ();
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
|
@ -415,19 +366,19 @@ GST_START_TEST (test_merge_same)
|
|||
GstCaps *c1, *c2, *test;
|
||||
|
||||
/* this is the same */
|
||||
c1 = gst_caps_from_string ("audio/x-raw-int,rate=44100,channels=1");
|
||||
c2 = gst_caps_from_string ("audio/x-raw-int,rate=44100,channels=1");
|
||||
c1 = gst_caps_from_string ("audio/x-raw,rate=44100,channels=1");
|
||||
c2 = gst_caps_from_string ("audio/x-raw,rate=44100,channels=1");
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
||||
test = gst_caps_from_string ("audio/x-raw-int,rate=44100,channels=1");
|
||||
test = gst_caps_from_string ("audio/x-raw,rate=44100,channels=1");
|
||||
fail_unless (gst_caps_is_equal (c2, test));
|
||||
gst_caps_unref (test);
|
||||
gst_caps_unref (c2);
|
||||
|
||||
/* and so is this */
|
||||
c1 = gst_caps_from_string ("audio/x-raw-int,rate=44100,channels=1");
|
||||
c2 = gst_caps_from_string ("audio/x-raw-int,channels=1,rate=44100");
|
||||
c1 = gst_caps_from_string ("audio/x-raw,rate=44100,channels=1");
|
||||
c2 = gst_caps_from_string ("audio/x-raw,channels=1,rate=44100");
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
||||
|
@ -469,123 +420,121 @@ GST_START_TEST (test_merge_subset)
|
|||
GstCaps *c1, *c2, *test;
|
||||
|
||||
/* the 2nd is already covered */
|
||||
c2 = gst_caps_from_string ("audio/x-raw-int,channels=[1,2]");
|
||||
c1 = gst_caps_from_string ("audio/x-raw-int,channels=1");
|
||||
c2 = gst_caps_from_string ("audio/x-raw,channels=[1,2]");
|
||||
c1 = gst_caps_from_string ("audio/x-raw,channels=1");
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
||||
test = gst_caps_from_string ("audio/x-raw-int,channels=[1,2]");
|
||||
test = gst_caps_from_string ("audio/x-raw,channels=[1,2]");
|
||||
fail_unless (gst_caps_is_equal (c2, test));
|
||||
gst_caps_unref (c2);
|
||||
gst_caps_unref (test);
|
||||
|
||||
/* here it is not */
|
||||
c2 = gst_caps_from_string ("audio/x-raw-int,channels=1,rate=44100");
|
||||
c1 = gst_caps_from_string ("audio/x-raw-int,channels=[1,2],rate=44100");
|
||||
c2 = gst_caps_from_string ("audio/x-raw,channels=1,rate=44100");
|
||||
c1 = gst_caps_from_string ("audio/x-raw,channels=[1,2],rate=44100");
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
fail_unless (gst_caps_get_size (c2) == 2, NULL);
|
||||
test = gst_caps_from_string ("audio/x-raw-int,channels=[1,2],rate=44100");
|
||||
test = gst_caps_from_string ("audio/x-raw,channels=[1,2],rate=44100");
|
||||
fail_unless (gst_caps_is_equal (c2, test));
|
||||
gst_caps_unref (c2);
|
||||
gst_caps_unref (test);
|
||||
|
||||
/* second one was already contained in the first one */
|
||||
c2 = gst_caps_from_string ("audio/x-raw-int,channels=[1,3]");
|
||||
c1 = gst_caps_from_string ("audio/x-raw-int,channels=[1,2]");
|
||||
c2 = gst_caps_from_string ("audio/x-raw,channels=[1,3]");
|
||||
c1 = gst_caps_from_string ("audio/x-raw,channels=[1,2]");
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
||||
test = gst_caps_from_string ("audio/x-raw-int,channels=[1,3]");
|
||||
test = gst_caps_from_string ("audio/x-raw,channels=[1,3]");
|
||||
fail_unless (gst_caps_is_equal (c2, test));
|
||||
gst_caps_unref (c2);
|
||||
gst_caps_unref (test);
|
||||
|
||||
/* second one was already contained in the first one */
|
||||
c2 = gst_caps_from_string ("audio/x-raw-int,channels=[1,4]");
|
||||
c1 = gst_caps_from_string ("audio/x-raw-int,channels=[1,2]");
|
||||
c2 = gst_caps_from_string ("audio/x-raw,channels=[1,4]");
|
||||
c1 = gst_caps_from_string ("audio/x-raw,channels=[1,2]");
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
||||
test = gst_caps_from_string ("audio/x-raw-int,channels=[1,4]");
|
||||
test = gst_caps_from_string ("audio/x-raw,channels=[1,4]");
|
||||
fail_unless (gst_caps_is_equal (c2, test));
|
||||
gst_caps_unref (c2);
|
||||
gst_caps_unref (test);
|
||||
|
||||
/* second one was already contained in the first one */
|
||||
c2 = gst_caps_from_string ("audio/x-raw-int,channels=[1,4]");
|
||||
c1 = gst_caps_from_string ("audio/x-raw-int,channels=[2,4]");
|
||||
c2 = gst_caps_from_string ("audio/x-raw,channels=[1,4]");
|
||||
c1 = gst_caps_from_string ("audio/x-raw,channels=[2,4]");
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
||||
test = gst_caps_from_string ("audio/x-raw-int,channels=[1,4]");
|
||||
test = gst_caps_from_string ("audio/x-raw,channels=[1,4]");
|
||||
fail_unless (gst_caps_is_equal (c2, test));
|
||||
gst_caps_unref (c2);
|
||||
gst_caps_unref (test);
|
||||
|
||||
/* second one was already contained in the first one */
|
||||
c2 = gst_caps_from_string ("audio/x-raw-int,channels=[1,4]");
|
||||
c1 = gst_caps_from_string ("audio/x-raw-int,channels=[2,3]");
|
||||
c2 = gst_caps_from_string ("audio/x-raw,channels=[1,4]");
|
||||
c1 = gst_caps_from_string ("audio/x-raw,channels=[2,3]");
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
||||
test = gst_caps_from_string ("audio/x-raw-int,channels=[1,4]");
|
||||
test = gst_caps_from_string ("audio/x-raw,channels=[1,4]");
|
||||
fail_unless (gst_caps_is_equal (c2, test));
|
||||
gst_caps_unref (c2);
|
||||
gst_caps_unref (test);
|
||||
|
||||
/* these caps cannot be merged */
|
||||
c2 = gst_caps_from_string ("audio/x-raw-int,channels=[2,3]");
|
||||
c1 = gst_caps_from_string ("audio/x-raw-int,channels=[1,4]");
|
||||
c2 = gst_caps_from_string ("audio/x-raw,channels=[2,3]");
|
||||
c1 = gst_caps_from_string ("audio/x-raw,channels=[1,4]");
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
fail_unless (gst_caps_get_size (c2) == 2, NULL);
|
||||
test =
|
||||
gst_caps_from_string
|
||||
("audio/x-raw-int,channels=[2,3];audio/x-raw-int,channels=[1,4]");
|
||||
("audio/x-raw,channels=[2,3];audio/x-raw,channels=[1,4]");
|
||||
fail_unless (gst_caps_is_equal (c2, test));
|
||||
gst_caps_unref (c2);
|
||||
gst_caps_unref (test);
|
||||
|
||||
/* these caps cannot be merged */
|
||||
c2 = gst_caps_from_string ("audio/x-raw-int,channels=[1,2]");
|
||||
c1 = gst_caps_from_string ("audio/x-raw-int,channels=[1,3]");
|
||||
c2 = gst_caps_from_string ("audio/x-raw,channels=[1,2]");
|
||||
c1 = gst_caps_from_string ("audio/x-raw,channels=[1,3]");
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
fail_unless (gst_caps_get_size (c2) == 2, NULL);
|
||||
test =
|
||||
gst_caps_from_string
|
||||
("audio/x-raw-int,channels=[1,2];audio/x-raw-int,channels=[1,3]");
|
||||
("audio/x-raw,channels=[1,2];audio/x-raw,channels=[1,3]");
|
||||
fail_unless (gst_caps_is_equal (c2, test));
|
||||
gst_caps_unref (c2);
|
||||
gst_caps_unref (test);
|
||||
|
||||
c2 = gst_caps_from_string ("audio/x-raw-int,channels={1,2}");
|
||||
c1 = gst_caps_from_string ("audio/x-raw-int,channels={1,2,3,4}");
|
||||
c2 = gst_caps_from_string ("audio/x-raw,channels={1,2}");
|
||||
c1 = gst_caps_from_string ("audio/x-raw,channels={1,2,3,4}");
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
fail_unless (gst_caps_get_size (c2) == 2, NULL);
|
||||
test = gst_caps_from_string ("audio/x-raw-int,channels={1,2};"
|
||||
"audio/x-raw-int,channels={1,2,3,4}");
|
||||
test = gst_caps_from_string ("audio/x-raw,channels={1,2};"
|
||||
"audio/x-raw,channels={1,2,3,4}");
|
||||
fail_unless (gst_caps_is_equal (c2, test));
|
||||
gst_caps_unref (c2);
|
||||
gst_caps_unref (test);
|
||||
|
||||
c2 = gst_caps_from_string ("audio/x-raw-int,channels={1,2}");
|
||||
c1 = gst_caps_from_string ("audio/x-raw-int,channels={1,3}");
|
||||
c2 = gst_caps_from_string ("audio/x-raw,channels={1,2}");
|
||||
c1 = gst_caps_from_string ("audio/x-raw,channels={1,3}");
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
fail_unless (gst_caps_get_size (c2) == 2, NULL);
|
||||
test = gst_caps_from_string ("audio/x-raw-int,channels={1,2};"
|
||||
"audio/x-raw-int,channels={1,3}");
|
||||
test = gst_caps_from_string ("audio/x-raw,channels={1,2};"
|
||||
"audio/x-raw,channels={1,3}");
|
||||
fail_unless (gst_caps_is_equal (c2, test));
|
||||
gst_caps_unref (c2);
|
||||
gst_caps_unref (test);
|
||||
|
||||
c2 = gst_caps_from_string
|
||||
("video/x-raw-yuv, framerate=(fraction){ 15/2, 5/1 }");
|
||||
c1 = gst_caps_from_string
|
||||
("video/x-raw-yuv, framerate=(fraction){ 15/1, 5/1 }");
|
||||
c2 = gst_caps_from_string ("video/x-raw, framerate=(fraction){ 15/2, 5/1 }");
|
||||
c1 = gst_caps_from_string ("video/x-raw, framerate=(fraction){ 15/1, 5/1 }");
|
||||
test = gst_caps_copy (c1);
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
|
@ -593,22 +542,22 @@ GST_START_TEST (test_merge_subset)
|
|||
gst_caps_unref (test);
|
||||
gst_caps_unref (c2);
|
||||
|
||||
c2 = gst_caps_from_string ("audio/x-raw-int");
|
||||
c1 = gst_caps_from_string ("audio/x-raw-int,channels=1");
|
||||
c2 = gst_caps_from_string ("audio/x-raw");
|
||||
c1 = gst_caps_from_string ("audio/x-raw,channels=1");
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
fail_unless (gst_caps_get_size (c2) == 1, NULL);
|
||||
test = gst_caps_from_string ("audio/x-raw-int");
|
||||
test = gst_caps_from_string ("audio/x-raw");
|
||||
fail_unless (gst_caps_is_equal (c2, test));
|
||||
gst_caps_unref (c2);
|
||||
gst_caps_unref (test);
|
||||
|
||||
c2 = gst_caps_from_string ("audio/x-raw-int,channels=1");
|
||||
c1 = gst_caps_from_string ("audio/x-raw-int");
|
||||
c2 = gst_caps_from_string ("audio/x-raw,channels=1");
|
||||
c1 = gst_caps_from_string ("audio/x-raw");
|
||||
gst_caps_merge (c2, c1);
|
||||
GST_DEBUG ("merged: (%d) %" GST_PTR_FORMAT, gst_caps_get_size (c2), c2);
|
||||
fail_unless (gst_caps_get_size (c2) == 2, NULL);
|
||||
test = gst_caps_from_string ("audio/x-raw-int,channels=1; audio/x-raw-int");
|
||||
test = gst_caps_from_string ("audio/x-raw,channels=1; audio/x-raw");
|
||||
fail_unless (gst_caps_is_equal (c2, test));
|
||||
gst_caps_unref (c2);
|
||||
gst_caps_unref (test);
|
||||
|
@ -623,14 +572,14 @@ GST_START_TEST (test_intersect)
|
|||
|
||||
/* field not specified = any value possible, so the intersection
|
||||
* should keep fields which are only part of one set of caps */
|
||||
c2 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,width=20");
|
||||
c1 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420");
|
||||
c2 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20");
|
||||
c1 = gst_caps_from_string ("video/x-raw,format=(string)I420");
|
||||
|
||||
ci1 = gst_caps_intersect (c2, c1);
|
||||
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1);
|
||||
fail_unless (gst_caps_get_size (ci1) == 1, NULL);
|
||||
s = gst_caps_get_structure (ci1, 0);
|
||||
fail_unless (gst_structure_has_name (s, "video/x-raw-yuv"));
|
||||
fail_unless (gst_structure_has_name (s, "video/x-raw"));
|
||||
fail_unless (gst_structure_get_value (s, "format") != NULL);
|
||||
fail_unless (gst_structure_get_value (s, "width") != NULL);
|
||||
|
||||
|
@ -639,7 +588,7 @@ GST_START_TEST (test_intersect)
|
|||
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2);
|
||||
fail_unless (gst_caps_get_size (ci2) == 1, NULL);
|
||||
s = gst_caps_get_structure (ci2, 0);
|
||||
fail_unless (gst_structure_has_name (s, "video/x-raw-yuv"));
|
||||
fail_unless (gst_structure_has_name (s, "video/x-raw"));
|
||||
fail_unless (gst_structure_get_value (s, "format") != NULL);
|
||||
fail_unless (gst_structure_get_value (s, "width") != NULL);
|
||||
|
||||
|
@ -653,8 +602,8 @@ GST_START_TEST (test_intersect)
|
|||
|
||||
/* ========== */
|
||||
|
||||
c2 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,width=20");
|
||||
c1 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,width=30");
|
||||
c2 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20");
|
||||
c1 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=30");
|
||||
|
||||
ci1 = gst_caps_intersect (c2, c1);
|
||||
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1);
|
||||
|
@ -675,8 +624,8 @@ GST_START_TEST (test_intersect)
|
|||
|
||||
/* ========== */
|
||||
|
||||
c2 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,width=20");
|
||||
c1 = gst_caps_from_string ("video/x-raw-rgb,format=(fourcc)I420,width=20");
|
||||
c2 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20");
|
||||
c1 = gst_caps_from_string ("video/x-raw2,format=(string)I420,width=20");
|
||||
|
||||
ci1 = gst_caps_intersect (c2, c1);
|
||||
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1);
|
||||
|
@ -697,14 +646,14 @@ GST_START_TEST (test_intersect)
|
|||
|
||||
/* ========== */
|
||||
|
||||
c2 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,width=20");
|
||||
c1 = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420,height=30");
|
||||
c2 = gst_caps_from_string ("video/x-raw,format=(string)I420,width=20");
|
||||
c1 = gst_caps_from_string ("video/x-raw,format=(string)I420,height=30");
|
||||
|
||||
ci1 = gst_caps_intersect (c2, c1);
|
||||
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci1);
|
||||
fail_unless (gst_caps_get_size (ci1) == 1, NULL);
|
||||
s = gst_caps_get_structure (ci1, 0);
|
||||
fail_unless (gst_structure_has_name (s, "video/x-raw-yuv"));
|
||||
fail_unless (gst_structure_has_name (s, "video/x-raw"));
|
||||
fail_unless (gst_structure_get_value (s, "format") != NULL);
|
||||
fail_unless (gst_structure_get_value (s, "width") != NULL);
|
||||
fail_unless (gst_structure_get_value (s, "height") != NULL);
|
||||
|
@ -714,7 +663,7 @@ GST_START_TEST (test_intersect)
|
|||
GST_DEBUG ("intersected: %" GST_PTR_FORMAT, ci2);
|
||||
fail_unless (gst_caps_get_size (ci2) == 1, NULL);
|
||||
s = gst_caps_get_structure (ci2, 0);
|
||||
fail_unless (gst_structure_has_name (s, "video/x-raw-yuv"));
|
||||
fail_unless (gst_structure_has_name (s, "video/x-raw"));
|
||||
fail_unless (gst_structure_get_value (s, "format") != NULL);
|
||||
fail_unless (gst_structure_get_value (s, "height") != NULL);
|
||||
fail_unless (gst_structure_get_value (s, "width") != NULL);
|
||||
|
@ -735,14 +684,14 @@ GST_START_TEST (test_intersect2)
|
|||
GstCaps *caps1, *caps2, *icaps;
|
||||
|
||||
/* tests array subtraction */
|
||||
caps1 = gst_caps_from_string ("audio/x-raw-float, "
|
||||
caps1 = gst_caps_from_string ("audio/x-raw, "
|
||||
"channel-positions=(int)< "
|
||||
"{ 1, 2, 3, 4, 5, 6 }, "
|
||||
"{ 1, 2, 3, 4, 5, 6 }, "
|
||||
"{ 1, 2, 3, 4, 5, 6 }, "
|
||||
"{ 1, 2, 3, 4, 5, 6 }, "
|
||||
"{ 1, 2, 3, 4, 5, 6 }, " "{ 1, 2, 3, 4, 5, 6 }>");
|
||||
caps2 = gst_caps_from_string ("audio/x-raw-float, "
|
||||
caps2 = gst_caps_from_string ("audio/x-raw, "
|
||||
"channel-positions=(int)< 1, 2, 3, 4, 5, 6 >");
|
||||
icaps = gst_caps_intersect (caps1, caps2);
|
||||
GST_LOG ("intersected caps: %" GST_PTR_FORMAT, icaps);
|
||||
|
@ -855,9 +804,9 @@ GST_START_TEST (test_intersect_duplication)
|
|||
GstCaps *c1, *c2, *test;
|
||||
|
||||
c1 = gst_caps_from_string
|
||||
("audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]");
|
||||
("audio/x-raw, format=(string)S16_LE, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]");
|
||||
c2 = gst_caps_from_string
|
||||
("audio/x-raw-int, width=(int)16, depth=(int)16, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ], endianness=(int){ 1234, 4321 }, signed=(boolean){ true, false }; audio/x-raw-int, width=(int)16, depth=(int)16, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 11 ], endianness=(int){ 1234, 4321 }, signed=(boolean){ true, false }; audio/x-raw-int, width=(int)16, depth=(int)[ 1, 16 ], rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 11 ], endianness=(int){ 1234, 4321 }, signed=(boolean){ true, false }");
|
||||
("audio/x-raw, format=(string) { S16_LE, S16_BE, U16_LE, U16_BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ]; audio/x-raw, format=(string) { S16_LE, S16_BE, U16_LE, U16_BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 11 ]; audio/x-raw, format=(string) { S16_LE, S16_BE, U16_LE, U16_BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 11 ]");
|
||||
|
||||
test = gst_caps_intersect_full (c1, c2, GST_CAPS_INTERSECT_FIRST);
|
||||
fail_unless_equals_int (gst_caps_get_size (test), 1);
|
||||
|
|
|
@ -284,26 +284,24 @@ GST_START_TEST (test_structure_new)
|
|||
gboolean bool;
|
||||
gint num, den;
|
||||
GstClockTime clocktime;
|
||||
guint32 fourcc;
|
||||
|
||||
s = gst_structure_new ("name",
|
||||
"key", G_TYPE_STRING, "value",
|
||||
"bool", G_TYPE_BOOLEAN, TRUE,
|
||||
"fraction", GST_TYPE_FRACTION, 1, 5,
|
||||
"clocktime", GST_TYPE_CLOCK_TIME, GST_CLOCK_TIME_NONE,
|
||||
"fourcc", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('f', 'o', 'u', 'r'), NULL);
|
||||
"clocktime", GST_TYPE_CLOCK_TIME, GST_CLOCK_TIME_NONE, NULL);
|
||||
|
||||
fail_unless (gst_structure_get_field_type (s, "unknown") == G_TYPE_INVALID);
|
||||
/* test setting a different name */
|
||||
gst_structure_set_name (s, "newname");
|
||||
fail_unless (strcmp (gst_structure_get_string (s, "key"), "value") == 0);
|
||||
fail_unless (gst_structure_has_field (s, "key"));
|
||||
fail_unless_equals_int (gst_structure_n_fields (s), 5);
|
||||
fail_unless_equals_int (gst_structure_n_fields (s), 4);
|
||||
/* test removing a field */
|
||||
gst_structure_remove_field (s, "key");
|
||||
fail_if (gst_structure_get_string (s, "key"));
|
||||
fail_if (gst_structure_has_field (s, "key"));
|
||||
fail_unless_equals_int (gst_structure_n_fields (s), 4);
|
||||
fail_unless_equals_int (gst_structure_n_fields (s), 3);
|
||||
|
||||
fail_unless (gst_structure_get_boolean (s, "bool", &bool));
|
||||
fail_unless (bool);
|
||||
|
@ -315,8 +313,6 @@ GST_START_TEST (test_structure_new)
|
|||
fail_unless (gst_structure_get_clock_time (s, "clocktime", &clocktime));
|
||||
fail_unless_equals_uint64 (clocktime, GST_CLOCK_TIME_NONE);
|
||||
|
||||
fail_unless (gst_structure_get_fourcc (s, "fourcc", &fourcc));
|
||||
|
||||
gst_structure_free (s);
|
||||
|
||||
domain = g_quark_from_static_string ("test");
|
||||
|
|
|
@ -24,92 +24,6 @@
|
|||
#include <gst/check/gstcheck.h>
|
||||
|
||||
|
||||
GST_START_TEST (test_serialize_fourcc)
|
||||
{
|
||||
int i;
|
||||
|
||||
guint32 fourccs[] = {
|
||||
GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
|
||||
GST_MAKE_FOURCC ('Y', '8', '0', '0'),
|
||||
GST_MAKE_FOURCC ('Y', '8', ' ', ' '),
|
||||
GST_MAKE_FOURCC ('Y', '1', '6', ' '),
|
||||
GST_MAKE_FOURCC ('Y', 'U', 'Y', '_'),
|
||||
GST_MAKE_FOURCC ('Y', 'U', 'Y', '#'),
|
||||
};
|
||||
gint fourccs_size = sizeof (fourccs) / sizeof (fourccs[0]);
|
||||
const gchar *fourcc_strings[] = {
|
||||
"YUY2",
|
||||
"Y800",
|
||||
"Y8 ",
|
||||
"Y16 ",
|
||||
"0x5f595559", /* Ascii values of YUY_ */
|
||||
"0x23595559", /* Ascii values of YUY# */
|
||||
};
|
||||
gint fourcc_strings_size =
|
||||
sizeof (fourcc_strings) / sizeof (fourcc_strings[0]);
|
||||
|
||||
fail_unless (fourccs_size == fourcc_strings_size);
|
||||
|
||||
for (i = 0; i < fourccs_size; ++i) {
|
||||
gchar *str;
|
||||
GValue value = { 0 };
|
||||
g_value_init (&value, GST_TYPE_FOURCC);
|
||||
|
||||
gst_value_set_fourcc (&value, fourccs[i]);
|
||||
str = gst_value_serialize (&value);
|
||||
|
||||
fail_unless (strcmp (str, fourcc_strings[i]) == 0);
|
||||
|
||||
g_free (str);
|
||||
}
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_deserialize_fourcc)
|
||||
{
|
||||
int i;
|
||||
|
||||
guint32 fourccs[] = {
|
||||
GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
|
||||
GST_MAKE_FOURCC ('Y', '8', '0', '0'),
|
||||
GST_MAKE_FOURCC ('Y', '8', ' ', ' '),
|
||||
GST_MAKE_FOURCC ('Y', '8', ' ', ' '),
|
||||
GST_MAKE_FOURCC ('Y', '8', ' ', ' '),
|
||||
GST_MAKE_FOURCC ('Y', '1', '6', ' '),
|
||||
GST_MAKE_FOURCC ('Y', 'U', 'Y', '_'),
|
||||
GST_MAKE_FOURCC ('Y', 'U', 'Y', '#'),
|
||||
};
|
||||
gint fourccs_size = sizeof (fourccs) / sizeof (fourccs[0]);
|
||||
const gchar *fourcc_strings[] = {
|
||||
"YUY2",
|
||||
"Y800",
|
||||
"Y8 ",
|
||||
"Y8 ",
|
||||
"Y8",
|
||||
"Y16 ",
|
||||
"0x5f595559", /* Ascii values of YUY_ */
|
||||
"0x23595559", /* Ascii values of YUY# */
|
||||
};
|
||||
gint fourcc_strings_size =
|
||||
sizeof (fourcc_strings) / sizeof (fourcc_strings[0]);
|
||||
|
||||
fail_unless (fourccs_size == fourcc_strings_size);
|
||||
|
||||
for (i = 0; i < fourccs_size; ++i) {
|
||||
GValue value = { 0 };
|
||||
|
||||
g_value_init (&value, GST_TYPE_FOURCC);
|
||||
|
||||
fail_unless (gst_value_deserialize (&value, fourcc_strings[i]));
|
||||
fail_unless_equals_int (gst_value_get_fourcc (&value), fourccs[i]);
|
||||
|
||||
g_value_unset (&value);
|
||||
}
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_deserialize_buffer)
|
||||
{
|
||||
GValue value = { 0 };
|
||||
|
@ -683,15 +597,6 @@ GST_START_TEST (test_value_compare)
|
|||
g_value_unset (&value1);
|
||||
g_value_unset (&value2);
|
||||
|
||||
g_value_init (&value1, GST_TYPE_FOURCC);
|
||||
gst_value_set_fourcc (&value1, GST_MAKE_FOURCC ('a', 'b', 'c', 'd'));
|
||||
g_value_init (&value2, GST_TYPE_FOURCC);
|
||||
gst_value_set_fourcc (&value2, GST_MAKE_FOURCC ('1', '2', '3', '4'));
|
||||
fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_UNORDERED);
|
||||
fail_unless (gst_value_compare (&value1, &value1) == GST_VALUE_EQUAL);
|
||||
g_value_unset (&value1);
|
||||
g_value_unset (&value2);
|
||||
|
||||
/* comparing 2/3 with 3/4 */
|
||||
g_value_init (&value1, GST_TYPE_FRACTION);
|
||||
gst_value_set_fraction (&value1, 2, 3);
|
||||
|
@ -853,21 +758,20 @@ GST_START_TEST (test_value_intersect)
|
|||
g_value_unset (&src1);
|
||||
g_value_unset (&src2);
|
||||
|
||||
g_value_init (&src1, GST_TYPE_FOURCC);
|
||||
gst_value_set_fourcc (&src1, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'));
|
||||
g_value_init (&src1, G_TYPE_STRING);
|
||||
g_value_set_string (&src1, "YUY2");
|
||||
g_value_init (&src2, GST_TYPE_LIST);
|
||||
g_value_init (&item, GST_TYPE_FOURCC);
|
||||
gst_value_set_fourcc (&item, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'));
|
||||
g_value_init (&item, G_TYPE_STRING);
|
||||
g_value_set_string (&item, "YUY2");
|
||||
gst_value_list_append_value (&src2, &item);
|
||||
gst_value_set_fourcc (&item, GST_MAKE_FOURCC ('I', '4', '2', '0'));
|
||||
g_value_set_string (&item, "I420");
|
||||
gst_value_list_append_value (&src2, &item);
|
||||
gst_value_set_fourcc (&item, GST_MAKE_FOURCC ('A', 'B', 'C', 'D'));
|
||||
g_value_set_string (&item, "ABCD");
|
||||
gst_value_list_append_value (&src2, &item);
|
||||
|
||||
fail_unless (gst_value_intersect (&dest, &src1, &src2));
|
||||
fail_unless (GST_VALUE_HOLDS_FOURCC (&dest));
|
||||
fail_unless (gst_value_get_fourcc (&dest) ==
|
||||
GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'));
|
||||
fail_unless (G_VALUE_HOLDS_STRING (&dest));
|
||||
fail_unless (g_str_equal (g_value_get_string (&dest), "YUY2"));
|
||||
|
||||
g_value_unset (&src1);
|
||||
g_value_unset (&src2);
|
||||
|
@ -2603,8 +2507,6 @@ gst_value_suite (void)
|
|||
TCase *tc_chain = tcase_create ("general");
|
||||
|
||||
suite_add_tcase (s, tc_chain);
|
||||
tcase_add_test (tc_chain, test_serialize_fourcc);
|
||||
tcase_add_test (tc_chain, test_deserialize_fourcc);
|
||||
tcase_add_test (tc_chain, test_deserialize_buffer);
|
||||
tcase_add_test (tc_chain, test_serialize_buffer);
|
||||
tcase_add_test (tc_chain, test_deserialize_gint);
|
||||
|
|
|
@ -96,7 +96,7 @@ static const gchar *test_lines[] = {
|
|||
"filesrc location=http://domain.com/music.mp3 ! identity silent=true ! fakesink silent=true",
|
||||
"filesrc location=movie.avi ! tee name=demuxer ! ( queue ! identity silent=true ! fakesink silent=true ) ( demuxer. ! queue ! identity silent=true ! fakesink silent=true )",
|
||||
"fakesrc ! video/x-raw-yuv ! fakesink silent=true",
|
||||
"fakesrc ! video/raw, format=(fourcc)YUY2; video/raw, format=(fourcc)YV12 ! fakesink silent=true",
|
||||
"fakesrc ! video/raw, format=(string)YUY2; video/raw, format=(string)YV12 ! fakesink silent=true",
|
||||
"fakesrc ! audio/x-raw-int, width=[16, 32], depth={16, 24, 32}, signed=TRUE ! fakesink silent=true",
|
||||
"fakesrc ! identity silent=true ! identity silent=true ! identity silent=true ! fakesink silent=true",
|
||||
"fakesrc name=100 fakesink name=101 silent=true 100. ! 101.",
|
||||
|
|
|
@ -442,7 +442,6 @@ EXPORTS
|
|||
gst_format_register
|
||||
gst_format_to_quark
|
||||
gst_formats_contains
|
||||
gst_fourcc_get_type
|
||||
gst_fraction_get_type
|
||||
gst_fraction_range_get_type
|
||||
gst_g_error_get_type
|
||||
|
@ -987,7 +986,6 @@ EXPORTS
|
|||
gst_structure_get_double
|
||||
gst_structure_get_enum
|
||||
gst_structure_get_field_type
|
||||
gst_structure_get_fourcc
|
||||
gst_structure_get_fraction
|
||||
gst_structure_get_int
|
||||
gst_structure_get_name
|
||||
|
@ -1199,7 +1197,6 @@ EXPORTS
|
|||
gst_value_get_date
|
||||
gst_value_get_double_range_max
|
||||
gst_value_get_double_range_min
|
||||
gst_value_get_fourcc
|
||||
gst_value_get_fraction_denominator
|
||||
gst_value_get_fraction_numerator
|
||||
gst_value_get_fraction_range_max
|
||||
|
@ -1227,7 +1224,6 @@ EXPORTS
|
|||
gst_value_set_caps
|
||||
gst_value_set_date
|
||||
gst_value_set_double_range
|
||||
gst_value_set_fourcc
|
||||
gst_value_set_fraction
|
||||
gst_value_set_fraction_range
|
||||
gst_value_set_fraction_range_full
|
||||
|
|
Loading…
Reference in a new issue