Page 1 of 1

libvlc_media_new_path() possible bug in version 2.1.3

Posted: 24 Jul 2014 08:02
by AndresH
I've been using this:

Code: Select all

libvlc_media_new_path(libvlc, url);
with url assigned to

Code: Select all

"rtsp:\\169.254.102.233\h264"
without problems with versions up to 2.0.1

Now with version 2.1.3 it assumes that the url is a file.

Because It logs the following:

libdvdnav: Using dvdnav version 5.0.0
libdvdread: Could not open C:\prj\MyProject\rtsp:\\169.254.102.233\h264 with libdvdcss.
libdvdread: Can't open C:\prj\MyProject\rtsp:\\169.254.102.233\h264 for reading
libdvdnav: vm: failed to open/read the DVD
[06666f34] filesystem access error: cannot open file C:\prj\MyProject\rtsp:\\169.254.102.233\h264 (Invalid argument)
[06666f34] main access error: File reading failed



So, it is using the current working directory and then concatenating url contents. Prior versions were using just url contents.

So my question to the board is if you people think that this is an error to be reported or if you think that I am making a bad use of the function.

Thanks.

Re: libvlc_media_new_path() possible bug in version 2.1.3

Posted: 24 Jul 2014 09:04
by sherington
You're supposed to use libvlc_media_new_location for things that aren't actual file paths.

Re: libvlc_media_new_path() possible bug in version 2.1.3

Posted: 26 Jul 2014 07:12
by AndresH
Thank you very much for your reply. After posting my previous I've found that in the documentation.

So, previous version was accepting rtsp streams and files.

Now it seems to be neccesary to distinguish that before calling lib_vlc_media_new_path() or libvlc_media_new_location(), depending on the case.

If it is that way, it seems that the new is worse than the previous. So, is there a way of checking if a string is a file or a stream, in order to call the right function ?

If not, programs will need to ask the user: "is this a network camera or a file ?" or things like that.

Re: libvlc_media_new_path() possible bug in version 2.1.3

Posted: 26 Jul 2014 20:43
by sherington
You don't need to ask the user, some simple pattern matching should be enough.

i.e. local files don't look like URLs like "protocol://...", so match that.

I do this, it works just fine for everything I play.

Re: libvlc_media_new_path() possible bug in version 2.1.3

Posted: 26 Jul 2014 22:20
by RĂ©mi Denis-Courmont
Now it seems to be neccesary to distinguish that before calling lib_vlc_media_new_path() or libvlc_media_new_location(), depending on the case.
The two separate functions are not new. The documentation always made the distinction already in previous releases.
So, is there a way of checking if a string is a file or a stream, in order to call the right function ?
Not generally since some strings are both syntactically valid file paths and URLs. That is why LibVLC cannot figure it out for you.