Newbie's questions

This forum is about all development around libVLC.
Dadam
New Cone
New Cone
Posts: 3
Joined: 06 Sep 2009 17:07

Newbie's questions

Postby Dadam » 06 Sep 2009 17:27

Hi, I'd like to make a small media player based on libvlc (part of a bigger project), but I'm in some troubles:
1) How to make a playlist? I tried libvlc_media_list_t conversion to libvlc_media_t using libvlc_media_list_media(), but it didn't work, then playing libvlc_media_list_t in libvlc_media_list_player_t with the same result.
2) How to play an audio CD? I follow these instructions: http://wiki.videolan.org/LibVLC_SampleCode_Qt, playing "cdda:///dev/sr0" (same device as in vlc) - doesn't work for me.
2) The position slider from the example above restarts playback when moved.
I'm using Ubuntu 9.04, vlc 1.0.1. Thanks for any help

MCyr
Blank Cone
Blank Cone
Posts: 21
Joined: 07 Aug 2009 16:07
VLC version: 1.1.0-git
Operating System: Linux

Re: Newbie's questions

Postby MCyr » 09 Sep 2009 19:54

1) Would something like libvlc_media_list_add_media, libvlc_media_list_count, libvlc_media_list_item_at_index and libvlc_media_list_index_of_item be what you're after?
2) I tried this and it seemed to work. The only warning I had was this which is alright since there is no audio CD in the drive (I don't have an audio CD handy, so I can't really test it right).
[0x7fecb8001490] cdda access warning: could not open /dev/sr0

Here's my snippet

Code: Select all

#define _GNU_SOURCE #include <stdio.h> #include <string.h> #include <stdlib.h> #include <vlc/vlc.h> int main() { libvlc_exception_t ex; libvlc_instance_t *vlc; libvlc_media_t *media; libvlc_media_player_t *player; const char* argv[] = {"--ignore-config", "-vvv"}; int argc; argc = sizeof(argv) / sizeof(*argv); libvlc_exception_init (&ex); vlc = libvlc_new (argc, argv, &ex); libvlc_add_intf (vlc, "dummy", &ex); media = libvlc_media_new (vlc, "cdda:///dev/sr0", &ex); player = libvlc_media_player_new_from_media (media, &ex); libvlc_media_player_set_media (player, media, &ex); libvlc_media_player_play (player, &ex); libvlc_wait (vlc); libvlc_media_release (media); libvlc_release(vlc); return (EXIT_SUCCESS); }
3) Can't help you there, I don't know the first thing about QT. Sorry

Hopes this helps a bit.

Dadam
New Cone
New Cone
Posts: 3
Joined: 06 Sep 2009 17:07

Re: Newbie's questions

Postby Dadam » 11 Sep 2009 17:44

1) I know about these functions, but I create media list and don't know what to do with it. Here is the code:

Code: Select all

#define _GNU_SOURCE #include <stdio.h> #include <string.h> #include <stdlib.h> #include <vlc/vlc.h> int main() { libvlc_exception_t ex; libvlc_instance_t *vlc; libvlc_media_t *media; libvlc_media_player_t *player; libvlc_media_list_t *media_list; libvlc_media_list_player_t *list_player; const char* argv[] = {"--ignore-config", "-vvv"}; int argc; argc = sizeof(argv) / sizeof(*argv); libvlc_exception_init (&ex); vlc = libvlc_new (argc, argv, &ex); libvlc_add_intf (vlc, "dummy", &ex); list_player = libvlc_media_list_player_new(vlc, &ex); media_list = libvlc_media_list_new(vlc, &ex); media = libvlc_media_new (vlc, "music/media1.mp4", &ex); libvlc_media_list_add_media(media_list, media, &ex); media = libvlc_media_new (vlc, "music/media2.mp4", &ex); libvlc_media_list_add_media(media_list, media, &ex); player = libvlc_media_player_new_from_media (media, &ex); libvlc_media_list_player_set_media_player(list_player, player, &ex); libvlc_media_list_player_play (list_player, &ex); libvlc_wait (vlc); libvlc_media_release (media); libvlc_release(vlc); return (EXIT_SUCCESS); }
It doesn't work, doesn't even write out any error.

2) I get these errors:

Code: Select all

(...) [0x103c478] main stream debug: pre buffering [0x103c478] main stream error: cannot pre fill buffer [0x103aa38] main input warning: cannot create a stream_t from access [0x1040858] main access debug: removing module "cdda" (...)
3) Problem solved, I found a bug in sample code, changePosition function:

Code: Select all

float pos=(newPosition)/POSITION_RESOLUTION;
is allways 0 due to integer division, this is the right way:

Code: Select all

float pos=(float)newPosition/POSITION_RESOLUTION;

Dadam
New Cone
New Cone
Posts: 3
Joined: 06 Sep 2009 17:07

Re: Newbie's questions

Postby Dadam » 13 Sep 2009 11:24

Does vlc have D-Bus API? I found this: http://wiki.videolan.org/DBus-spec


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 51 guests