g_filename_from_uri # error

Tim Müller tim at centricular.com
Tue Sep 2 01:31:08 PDT 2014


On Mon, 2014-09-01 at 19:14 -0700, meeshel wrote:

Hi,

> I'm using gstreamer v1.2 and meet some issue.
> If '#' character is including in file name, g_filename_from_uri return NULL.
> g_filename_from_uri is calling in gst_file_src_uri_set_uri() .
> 
> I did googling and find g_filename_from_uri() cannot treat '#'.
>
> So, I changed like below.
>  (snip)
> But, when I try the file 'pa#pa.mp3', I got a result 'pa'.
> 
> Q1. g_file_get_path() function also cannot handle '#' character?
> 
> Q2. Or, is there something that I missed?
 
The '#' in the URI needs to be escaped properly if it's part of the
location part of an URI.

Try this:

{
  gchar *uri, *fn;

  uri = gst_filename_to_uri ("/path/Track #1.mp3", NULL);
  g_print (" uri: %s\n", uri);
  fn = g_filename_from_uri (uri, NULL, NULL);
  g_print ("file: %s\n", fn);
  g_free (fn);
  g_free (uri);
}

'#' has a special meaning in URIs so must be escaped.

 Cheers
  -Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com



More information about the gstreamer-devel mailing list