gst/gststructure.c: Forward-port a 0.8 patch to handle escaped spaces in structure string, so that gst_parse...

Original commit message from CVS:

patch by: Tim-Philipp Müller <tim at centricular dot net>

* gst/gststructure.c: (gst_structure_parse_field),
(gst_structure_from_string):
Forward-port a 0.8 patch to handle escaped spaces in structure string,          so that gst_parse_launch() can deal with spaces in filtered link
caps (fixes #164479)
* check/gst/capslist.h:
* check/gst/gststructure.c: (GST_START_TEST):
add unit tests for this change
This commit is contained in:
Tim-Philipp Müller 2005-11-10 12:32:57 +00:00 committed by Thomas Vander Stichele
parent a56bdf2768
commit a144ca207c
6 changed files with 30 additions and 5 deletions

View file

@ -1,3 +1,16 @@
2005-11-10 Thomas Vander Stichele <thomas at apestaart dot org>
patch by: Tim-Philipp Müller <tim at centricular dot net>
* gst/gststructure.c: (gst_structure_parse_field),
(gst_structure_from_string):
Forward-port a 0.8 patch to handle escaped spaces in structure string,
so that gst_parse_launch() can deal with spaces in filtered link
caps (fixes #164479)
* check/gst/capslist.h:
* check/gst/gststructure.c: (GST_START_TEST):
add unit tests for this change
2005-11-10 Wim Taymans <wim@fluendo.com>
* docs/gst/gstreamer-sections.txt:

View file

@ -14,6 +14,7 @@ static const gchar *caps_list[] = {
"video/x-raw-yuv, format=(fourcc){ 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",
"ANY",
"EMPTY"
};

View file

@ -33,6 +33,9 @@ GST_START_TEST (test_from_string_int)
"video/x-raw-rgb, red_mask = (int) 0x7FFFFFFF",
"video/x-raw-rgb, red_mask = (int) 0x80000000",
"video/x-raw-rgb, red_mask = (int) 0xFF000000",
/* result from
* gst-launch ... ! "video/x-raw-rgb, red_mask=(int)0xFF000000" ! ... */
"video/x-raw-rgb,\\ red_mask=(int)0xFF000000",
};
gint results[] = {
123456,
@ -42,6 +45,7 @@ GST_START_TEST (test_from_string_int)
0x7FFFFFFF,
0x80000000,
0xFF000000,
0xFF000000,
};
GstStructure *structure;
int i;

View file

@ -1542,14 +1542,14 @@ gst_structure_parse_field (gchar * str,
s = str;
while (g_ascii_isspace (*s))
while (g_ascii_isspace (*s) || (s[0] == '\\' && g_ascii_isspace (s[1])))
s++;
name = s;
if (!gst_structure_parse_simple_string (s, &name_end))
return FALSE;
s = name_end;
while (g_ascii_isspace (*s))
while (g_ascii_isspace (*s) || (s[0] == '\\' && g_ascii_isspace (s[1])))
s++;
if (*s != '=')
@ -1685,7 +1685,7 @@ gst_structure_from_string (const gchar * string, gchar ** end)
if (!gst_structure_parse_string (r, &w, &r))
goto error;
while (g_ascii_isspace (*r))
while (g_ascii_isspace (*r) || (r[0] == '\\' && g_ascii_isspace (r[1])))
r++;
if (*r != 0 && *r != ';' && *r != ',')
goto error;
@ -1699,14 +1699,16 @@ gst_structure_from_string (const gchar * string, gchar ** end)
if (*r != ',')
goto error;
r++;
while (*r && g_ascii_isspace (*r))
while (*r && (g_ascii_isspace (*r) || (r[0] == '\\'
&& g_ascii_isspace (r[1]))))
r++;
memset (&field, 0, sizeof (field));
if (!gst_structure_parse_field (r, &r, &field))
goto error;
gst_structure_set_field (structure, &field);
while (*r && g_ascii_isspace (*r))
while (*r && (g_ascii_isspace (*r) || (r[0] == '\\'
&& g_ascii_isspace (r[1]))))
r++;
}

View file

@ -14,6 +14,7 @@ static const gchar *caps_list[] = {
"video/x-raw-yuv, format=(fourcc){ 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",
"ANY",
"EMPTY"
};

View file

@ -33,6 +33,9 @@ GST_START_TEST (test_from_string_int)
"video/x-raw-rgb, red_mask = (int) 0x7FFFFFFF",
"video/x-raw-rgb, red_mask = (int) 0x80000000",
"video/x-raw-rgb, red_mask = (int) 0xFF000000",
/* result from
* gst-launch ... ! "video/x-raw-rgb, red_mask=(int)0xFF000000" ! ... */
"video/x-raw-rgb,\\ red_mask=(int)0xFF000000",
};
gint results[] = {
123456,
@ -42,6 +45,7 @@ GST_START_TEST (test_from_string_int)
0x7FFFFFFF,
0x80000000,
0xFF000000,
0xFF000000,
};
GstStructure *structure;
int i;