I wrote a piece of code to learn playing video with libvlc, the code works well on windows, but doesn't work on my mac book pro(the macos version is 13.2), and I use qt 6.4. I found that libvlc_new returns null on macos. My code is like:
Code: Select all
libvlc_instance_t *_vlcInst = NULL;
libvlc_media_t *_vlcMedia = NULL;
libvlc_media_player_t *_vlcPlayer = NULL;
libvlc_event_manager_t *_eventManager = NULL;
const char *tempArg = "";
const char *vlc_args[10] = {"-I", "dummy", "--no-osd", "--no-stats", "--ignore-config", "--verbose=2",
"--no-video-on-top", "--no-video-title-show", "--no-snapshot-preview",
tempArg};
int argc = sizeof(vlc_args) / sizeof(vlc_args[0]);
qDebug() << "argc: " << argc;
_vlcInst = libvlc_new(argc, vlc_args);
if(!_vlcInst)
{
qDebug() << "create vlc instance failed: " << libvlc_errmsg();
return;
}
qDebug() << "create instance ok";
_vlcPlayer = libvlc_media_player_new(_vlcInst);
if(!_vlcPlayer)
{
qDebug() << "create player failed.";
return;
}
qDebug() << "create player ok";