Page 1 of 1

media_player.c

Posted: 29 Jun 2010 17:03
by kj90
I'm just learning libVLC and tried running media_player.c
It runs without any errors but it doesn't do anything and I'm not sure what I'm supposed to expect?

I'm guessing that this program is supposed to open up an instance of vlc and play the file specified in test_default_sample[] but if vout and aout is set to dummy, doesn't that disable the video and audio?

Any thoughts and advise is welcome. Thanks in advance.

Re: media_player.c

Posted: 29 Jun 2010 17:15
by laszloj
Hi,

I am new, too, but surely dummy outputs wont produce anything. You should have written vlc version number and OS type what you use, but anyways, this tutorial will help:

http://wiki.videolan.org/LibVLC_Tutorial_0.9

jozsef

Re: media_player.c

Posted: 29 Jun 2010 17:33
by kj90
Thanks, I'm using vlc 1.1.0 on Windows XP.

I've actually looked at that tutorial and passed in a local video file to play but I'm having the same issue... I commented out the "dummy" flag in the arguments but I still don't get anything. How do I get it to play a video file? Is there an option that I'm missing?

Re: media_player.c

Posted: 29 Jun 2010 19:29
by kj90
I realized that I needed to add libvlc_add_intf() to have to open up vlc so now vlc opens but for some reason, it doesn't play the file. Any ideas of why this could be?

This is the test code that I'm working with:

Code: Select all

int main(int argc, char* argv[]) { const char * const vlc_args[] = { "--ignore-config" }; libvlc_instance_t * inst; libvlc_media_player_t *mp; libvlc_media_t *m; inst = libvlc_new (sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args); libvlc_add_intf(inst, NULL); m = libvlc_media_new_path (inst, "output2.mpg"); mp = libvlc_media_player_new_from_media (m); libvlc_media_player_set_media(mp, m); libvlc_media_release (m); libvlc_media_player_play (mp); Sleep(100); libvlc_media_player_stop (mp); libvlc_media_player_release (mp); libvlc_release (inst); return 0; }

Re: media_player.c

Posted: 29 Jun 2010 20:17
by laszloj
1. Seems you miss plugin-path, its something like c:\program files\videolan\vlc\plugins, check it out
const char * const vlc_args[] = {
"-I", "dummy", /* Don't use any interface */
"--ignore-config", /* Don't use VLC's config */
"--plugin-path=/set/your/path/to/libvlc/module/if/you/are/on/windows/or/macosx" };

2. Set a window to output the rendered frames

libvlc_drawable_t drawable = hwnd;
libvlc_media_player_set_drawable (mp, drawable, &ex);

jozsef

Re: media_player.c

Posted: 30 Jun 2010 16:33
by kj90
Thanks! I realized that I wasn't setting the hwnd properly. The sample code works now :)

Re: media_player.c

Posted: 30 Jun 2010 22:17
by kj90
Just one more question... if I wanted to stream a file over udp or rtp, where would I start? Are there options for that that I can add to vlc_args or is there a separate set of functions to stream video files?

Re: media_player.c

Posted: 05 Jul 2010 08:46
by laszloj
You should look at the vlc command line parameters and examples first.
http://wiki.videolan.org/Documentation:Streaming_HowTo

jozsef