Page 1 of 1

Are there any complete samples about using libvlc for audio CDs?

Posted: 26 Jan 2021 14:04
by zedrummer
Hello
Looking around I tried different solution proposed to read an audio CD (Windows 10, original audio CD inside):

Code: Select all

bool avlc_playCD_VLC(char driveletter) { libvlc_instance_t *avlc_inst; libvlc_media_player_t *avlc_mp; libvlc_media_t *m; // create a new item char tbuf[MAX_PATH]; sprintf_s(tbuf, MAX_PATH, "cdda:///%c:/",driveletter); libvlc_media_t *vlcMedia = libvlc_media_new_location(avlc_inst, tbuf); if (!vlcMedia) return false; /* Create a new libvlc player */ libvlc_media_parse(vlcMedia); libvlc_media_player_t* vlcPlayer = libvlc_media_player_new_from_media(vlcMedia); if (!vlcPlayer) return false; /* Release the media */ libvlc_media_player_play(vlcPlayer); Sleep(100); libvlc_media_list_t* pMediaList = libvlc_media_subitems(vlcMedia); if (pMediaList != NULL) { libvlc_media_list_lock(pMediaList); int listcount = libvlc_media_list_count(pMediaList); for (int ti = 0; ti < listcount; ti++) { libvlc_media_t* subItemInstance = libvlc_media_list_item_at_index(pMediaList, ti); } libvlc_media_list_unlock(pMediaList); libvlc_media_list_release(pMediaList); } return true; }
(I know the "Sleep(100)" method is not the right one, I do that for testing)
Everything is going OK, it returns "true", in the debug log, I have:

Code: Select all

main libvlc debug: VLC media player - 3.0.11 Vetinari main libvlc debug: Copyright © 1996-2020 the VideoLAN team main libvlc debug: revision 3.0.11-0-gdc0c5ced72 main libvlc debug: configured with ../extras/package/win32/../../../configure '--enable-update-check' '--enable-lua' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-avcodec' '--enable-merge-ffmpeg' '--enable-dca' '--enable-mpc' '--enable-libass' '--enable-schroedinger' '--enable-realrtsp' '--enable-live555' '--enable-dvdread' '--enable-shout' '--enable-goom' '--enable-caca' '--enable-qt' '--enable-skins2' '--enable-sse' '--enable-mmx' '--enable-libcddb' '--enable-zvbi' '--disable-telx' '--enable-nls' '--host=x86_64-w64-mingw32' '--with-breakpad=https://win.crashes.videolan.org' 'host_alias=x86_64-w64-mingw32' 'PKG_CONFIG_LIBDIR=/home/jenkins/workspace/vlc-release/windows/vlc-release-win32-x64/contrib/x86_64-w64-mingw32/lib/pkgconfig' main libvlc debug: using multimedia timers as clock source main libvlc debug: min period: 1 ms, max period: 1000000 ms main libvlc debug: searching plug-in modules main libvlc debug: loading plugins cache file D:\Mes documents\C++\Jukesoft\Jukesoft\plugins\plugins.dat main libvlc debug: recursively browsing `D:\Mes documents\C++\Jukesoft\Jukesoft\plugins' main libvlc debug: plug-ins loaded: 494 modules main logger debug: looking for logger module matching "any": 2 candidates main logger debug: using logger module "console" main libvlc debug: translation test: code is "C" main keystore debug: looking for keystore module matching "memory": 3 candidates main keystore debug: using keystore module "memory" main libvlc debug: CPU has capabilities MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 FPU main generic debug: creating audio output main audio output debug: looking for audio output module matching "any": 6 candidates mmdevice audio output debug: display name changed: VLC media player (LibVLC 3.0.11) mmdevice audio output debug: version 2 session control unavailable mmdevice audio output debug: volume from -64.000000 dB to +0.000000 dB with 0.031250 dB increments main audio output debug: using audio output module "mmdevice" main generic debug: keeping audio output main input debug: Creating an input for 'cdda:///G:/' main input debug: using timeshift granularity of 50 MiB main input debug: using timeshift path: C:\Users\Zorro\AppData\Local\Temp main input debug: `cdda:///G:/' gives access `cdda' demux `any' path `/G:/' main input source debug: creating demux: access='cdda' demux='any' location='/G:/' file='G:\' main demux debug: looking for access_demux module matching "cdda": 15 candidates cdda demux debug: using winNT/2K/XP ioctl layer main demux debug: no access_demux modules matched main stream debug: creating access: cdda:///G:/ main stream debug: (path: G:\) main stream debug: looking for access module matching "cdda": 26 candidates cdda stream debug: using winNT/2K/XP ioctl layer cdda stream debug: p_sectors: 0, 0 cdda stream debug: p_sectors: 1, 21775 cdda stream debug: p_sectors: 2, 33757 cdda stream debug: p_sectors: 3, 51225 cdda stream debug: p_sectors: 4, 69857 cdda stream debug: p_sectors: 5, 77037 cdda stream debug: p_sectors: 6, 91850 cdda stream debug: p_sectors: 7, 105482 cdda stream debug: p_sectors: 8, 116272 cdda stream debug: p_sectors: 9, 132850 cdda stream debug: p_sectors: 10, 145920 cdda stream debug: p_sectors: 11, 163995 cdda stream debug: p_sectors: 12, 177915 cdda stream debug: retrieving metadata with CDDB cdda stream debug: album art policy set to manual: not fetching cdda stream debug: CDDB failure
1/ But it never plays a sound.
If I debug, listcount (= libvlc_media_list_count(pMediaList)) is always 0.

2/ Why is the CDDB failing? Is there anything to do to make the CDDB works?
Is the VLC CDDB server reliable or can we switch to gnudb.gnudb.org/80 ?

Thanks
David

Re: Are there any complete samples about using libvlc for audio CDs?

Posted: 26 Jan 2021 16:08
by mangokm40
Which "Sleep()" function is that?
This one: https://docs.microsoft.com/en-us/window ... hapi-sleep uses milliseconds.

Re: Are there any complete samples about using libvlc for audio CDs?

Posted: 26 Jan 2021 17:02
by zedrummer
Yeas it's this one, it stops for 0.1s, you believe that it's not enough?
I just tried 1s "Sleep(1000);" and it doesn't change

Re: Are there any complete samples about using libvlc for audio CDs?

Posted: 27 Jan 2021 08:12
by Lotesdelere
About the CDDB issue:
https://forum.videolan.org/viewtopic.php?f=18&t=152035

Looks like nothing has been done in time.
And I still can't get gnudb.org to work with VLC as of today.

Re: Are there any complete samples about using libvlc for audio CDs?

Posted: 27 Jan 2021 19:33
by zedrummer
Thanks Lotesdelere, I don't even know how to play the audio CD for the moment, so...