Windows 10 C short code to play a CD track

This forum is about all development around libVLC.
cathyvlc
New Cone
New Cone
Posts: 1
Joined: 18 Feb 2021 15:41

Windows 10 C short code to play a CD track

Postby cathyvlc » 18 Feb 2021 15:51

Hello

Sorry I am new here and starting to code libvlc in C for Windows 10.

I succeeded playing a MP3/M4a using

Code: Select all

bool avlc_startPlayVLC(char* soundpath) { libvlc_media_t *m; // create a new item m = libvlc_media_new_path(avlc_inst, soundpath); if (m == NULL) return false; libvlc_media_parse(m); // create a media play playing environment avlc_mp = libvlc_media_player_new_from_media(m); if (avlc_mp == NULL) return false; // no need to keep the media now libvlc_media_release(m); // play the media_player libvlc_media_player_play(avlc_mp); return true; }
I succeeded streaming a radio sending the stream address to

Code: Select all

bool avlc_startStreamVLC(char* server) { libvlc_media_t *m; // create a new item m = libvlc_media_new_location(avlc_inst, server); if (m == NULL) return false; // create a media play playing environment avlc_mp = libvlc_media_player_new_from_media(m); if (avlc_mp == NULL) return false; // no need to keep the media now libvlc_media_release(m); // play the media_player libvlc_media_player_play(avlc_mp); return true; }
But I can't make a simple audio CD to play. I thought the code was the same as the MP3 file sending "cdda:///G:/" or "cdda:///G:" or for a track "cdda:///G:/Track01.cda" to libvlc_media_new_path, but even if I don't see any error in the log, the CD doesn't play at all.

Could someone give me a simple piece of code to play the nth track of an audio CD via libvlc, please?

Thanks a lot
Cathy from France

Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 38 guests