Media path is getting the application path inserted in front
Posted: 30 Sep 2013 09:51
I'm experimenting with LibVLC 2.1.0. I want to play a video that's in "dvd:///F:" It's failing with the error being that the path to the media I want to play is getting the current directory inserted in front of it. I've created a test app that shows just the failure point.
The output from that program is "media resource locator: file:///C:/tmp/dvd%3A%2F%2F%2FF%3A"
"file:///C:/tmp/" is the current directory. If I 'cd' somewhere else then the "file:///C:/tmp/" part changes to whatever directory I'm in. Why is the current directory getting inserted like this?
On the theory I was dealing with compiler weirdness I made the media name configurable and have that in the code above. If I run "test-vlclib test" then the output is: "media resource locator: file:///C:/tmp/test"
I have VLC 2.1.0 installed and am I'm compiling with Visual Studio 2010 Express. It's running on Windows Vista.
Marc
Code: Select all
int main(int argc, char **argv)
{
char * szMedia;
libvlc_instance_t * vlcInstance;
libvlc_media_t * vlcMedia;
const char * cszMrl;
szMedia = "dvd:///F:";
argv++;
if (*argv)
szMedia = *argv;
vlcInstance = libvlc_new(0, NULL);
if (vlcInstance != NULL)
{
vlcMedia = libvlc_media_new_path (vlcInstance, szMedia);
if (vlcMedia != NULL)
{
cszMrl = libvlc_media_get_mrl (vlcMedia);
if (cszMrl != NULL)
printf ("media resource locator: %s\n", cszMrl);
else
fprintf(stderr, "Error, libvlc_media_get_mrl() returns NULL: %s\n", libvlc_errmsg ());
libvlc_media_release (vlcMedia);
}
else
{
fprintf(stderr, "Error, libvlc_media_new_path() failed: %s\n", libvlc_errmsg ());
}
libvlc_release (vlcInstance);
vlcInstance = NULL;
}
else
{
fprintf(stderr, "Error, libvlc_new() failed: %s\n", libvlc_errmsg ());
}
return 0;
}
"file:///C:/tmp/" is the current directory. If I 'cd' somewhere else then the "file:///C:/tmp/" part changes to whatever directory I'm in. Why is the current directory getting inserted like this?
On the theory I was dealing with compiler weirdness I made the media name configurable and have that in the code above. If I run "test-vlclib test" then the output is: "media resource locator: file:///C:/tmp/test"
I have VLC 2.1.0 installed and am I'm compiling with Visual Studio 2010 Express. It's running on Windows Vista.
Marc