GNOME Bugzilla – Bug 164479
[cli-tools] gst_parse_launch can't handle spaces
Last modified: 2005-03-21 16:23:21 UTC
This should work: gst-launch-0.8 -v v4lsrc ! 'video/x-raw-yuv, format=(fourcc)I420, width=(int)320, height=(int)240, framerate=(double)28.125' ! xvimagesink The caps string comes from what gst-launch -v prints out. This works, however: gst-launch-0.8 -v v4lsrc ! 'video/x-raw-yuv,format=(fourcc)I420,width=(int)320,height=(int)240,framerate=(double)28.125' ! xvimagesink
Created attachment 37335 [details] [review] hackish fix The problem seems to be that in the string passed to gst_structure_from_string() the whitespaces are escaped with a leading backslash (not any other special shell characters like round brackets though). The parsing code doesn't expect those escape slashes. Not sure who does the escaping. One could fix this like in the attached patch, but it seems a bit hackish to me somehow. Cheers -Tim
Shouldn't you unescape such strings then? I'm not opposed to this patch, but it seems a bit wrong, since you'll skip other escaped sequences as well.
A better method is to use g_ascii_isspace(*s) || (s[0] == '\\' && g_ascii_isspace(s[1])). Feel free to commit the patch with that fixed.
The thing is that only spaces seem to be escaped, not brackets etc. The cleaner fix would undoubtedly have been to unescape the string once before parsing and then parse it in the usual way, but that would have been much less straight-forward and more error-prone IMHO, because of the gchar **end out parameter in gst_structure_new_from_string() and related functions (you can't just add the number of escaped spaces to the end-pointer-in-the-unescaped-string because it's not easy to know how many of the escaped spaces are in the parsed part of the string and how many are in the part of the string after *end etc.). Anyway, committed and changed as suggested. Cheers -Tim