Page 1 of 1

libvlc_media_new_fd problem

Posted: 29 Aug 2011 11:51
by FreshIce
Hi everyone, I have some trouble with the libvlc_media_new_fd function on Windows. I read in the doc that this function should work fine for libVLC 1.1.5 and later. However
i cannot play any video. Each time i used this function, i get the log "Invalid parameter passed to C runtime function.". I use VLC with Qt 4.7.2 and vmem to render the video (because my
application has transparent background VLC cannot normally render in a QWidget).

Here is the code

Code: Select all

char const* vlc_argv[] = { "--no-xlib", "-I", "dummy", /* Don't use any interface */ "--ignore-config", "--no-video-title-show", }; int vlc_argc = sizeof(vlc_argv) / sizeof(*vlc_argv); vlc = libvlc_new( vlc_argc, vlc_argv); QFile* file = new QFile(path); if (!file->open(QIODevice::ReadOnly)) return false; qDebug() << "FILE OPENED " << file->handle(); mediaplayer = libvlc_media_player_new(vlc); media = libvlc_media_new_fd(vlc, file->handle()); libvlc_media_player_set_media(mediaplayer, media); libvlc_media_player_play();
Can someone help me out ?

Re: libvlc_media_new_fd problem

Posted: 29 Aug 2011 13:55
by RĂ©mi Denis-Courmont
Hmm, are you sure the function gets a file descriptor, not a Win32 file handle?

Re: libvlc_media_new_fd problem

Posted: 29 Aug 2011 14:04
by FreshIce
Indeed, its a Win32 file handle. How can i get a File Descriptor on Win32 platform (I thought that handle were windows FD) ?

Thank you for your answer :)

Edit: I gave up the FD. I use imem instead.

Re: libvlc_media_new_fd problem

Posted: 02 Sep 2011 03:51
by Arkaid
You can open a file descriptor for a windows file handle using _open_osfhandle, declared in io.h. However, I must be doing something wrong because nothing happens.

How did you solve it with imem? Can you give me some tips? I need to do something similar.