After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 469402 - File uri handling on windows broken
File uri handling on windows broken
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.10.13
Other Windows
: Normal normal
: 0.10.15
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-08-22 21:50 UTC by Samuel Vinson
Modified: 2007-09-12 12:44 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Samuel Vinson 2007-08-22 21:50:17 UTC
When you use gst-app (from cvs repository) or when you use gst-launch like this :
   gst-launch playbin uri=file:///c:/film.avi

you obtained this messages (on msdos and msys):
FAILED to play file:///g:/film.avi: Could not open file "/g:/film.avi" for reading.
E:\devel-release\src_releases\gstreamer\plugins\elements\gstfilesrc.c(981): (function) (): /playbin/source:
system error: Invalid argument

Effectively, /c:/path doesn't exist on windows.
To correct this bug, I propose following patch in gst/gsturi.c.
Function uses g_filename_from_uri from glib and the result will be fine on all platforms.
Perhaps, else case does not necessary.

Samuel

gchar *
gst_uri_get_location (const gchar * uri)
{
  gchar *colon;
  gchar *location, *unescaped;
  GError *err = NULL;

  g_return_val_if_fail (uri != NULL, NULL);
  g_return_val_if_fail (gst_uri_is_valid (uri), NULL);

  if (gst_uri_has_protocol(uri, "file") == TRUE)
  {
     unescaped = g_filename_from_uri(uri, NULL, &err);
     if (err != NULL)
     {
       GST_WARNING ("Failed to convert URI to a local filename: %s", err->message);
       g_error_free(err);
     }
  }
  else
  {
    colon = strstr (uri, "://");

    location = g_strdup (colon + 3);

    unescaped = unescape_string (location, "/");
    g_free (location);
  }

  return unescaped;
}
Comment 1 Sebastian Dröge (slomo) 2007-09-12 10:30:35 UTC
Shouldn't this be
gst-launch playbin uri=file://c:/film.avi

i.e. with only two / before c:/?
Comment 2 Tim-Philipp Müller 2007-09-12 12:44:16 UTC
Should be fixed now:

 2007-09-12  Tim-Philipp Müller  <tim at centricular dot net>

        * gst/gsturi.c: (gst_uri_get_location):
          If there's no hostname, we want to return 'c:/foo/bar.txt'
          and not '/c:/foo/bar.txt' on Windows. Fixes #469402.

        * tests/check/gst/gsturi.c:
          Unit test for the above and a few more things.

g_filename_from_uri() is not really an option because it only handles the 'file://' protocol, and other protocols may include file paths too.  Besides, it's a bit awkward since you'd also need to prepend the hostname to the return value of _from_uri().


(In reply to comment #1)
> Shouldn't this be
> gst-launch playbin uri=file://c:/film.avi
> 
> i.e. with only two / before c:/?

Don't think so.  Do you have links that suggest otherwise?