Hello mfkl, thank you for your support. Yes, the video is playing on win32 and I did try disabling the hardware acceleration. (GeForce GTC 980 Ti) I found out that it might be related to the fact that I'm rendering the video off-screen with libvlc_video_set_callbacks because I do not have this issue while playing inside a window.
void VideoLandMovie::CallbackDisplay(void *in_data, void *in_picture)
{
VideoLandMovie *l_movie = reinterpret_cast<VideoLandMovie*>(in_data);
l_movie->SetUpdated(true);
}
void *VideoLandMovie::CallbackLock(void *in_data, void **in_pixels)
{
VideoLandMovie *l_movie = reinterpret_cast<ZVideoLandMovie*>(in_data);
l_movie->Lock();
*in_pixels = l_movie->GetPixels();
return NULL;
}
void VideoLandMovie::CallbackUnLock(void *in_data, void *in_id, void * const *in_pixels)
{
VideoLandMovie *l_movie = reinterpret_cast<VideoLandMovie*>(in_data);
l_movie->Unlock();
}
unsigned VideoLandMovie::CallbackSetup(void **in_data, char *in_chroma, unsigned *in_width, unsigned *in_height, unsigned *in_pitches, unsigned *in_lines)
{
VideoLandMovie *l_movie = reinterpret_cast<VideoLandMovie*>(*in_data);
unsigned l_w = (*in_width);
unsigned l_h = (*in_height);
(*in_pitches) = l_w * l_movie->GetChannelCount();
(*in_lines) = l_h;
if (l_movie->GetChannelCount() == 3)
{
memcpy(in_chroma, "RGB8", 4); /// No BGR8?
}
else if (l_movie->GetChannelCount() == 4)
{
memcpy(in_chroma, "BGRA", 4);
}
l_movie->CreatePixels(l_w, l_h);
return 1;
}
void VideoLandMovie::Open()
{
if (m_VLC_Media != NULL)
{
libvlc_media_release(m_VLC_Media);
m_VLC_Media = NULL;
}
if (m_VLC_Player != NULL)
{
/// VLC will continue to use old callbacks until playback will be stopped.
libvlc_media_player_stop(m_VLC_Player);
libvlc_media_player_release(m_VLC_Player);
m_VLC_Player = NULL;
}
SetEventHandler(&VideoLandMovie::CallbackEvent, this);
libvlc_media_parse(m_VLC_Media);
libvlc_media_player_set_media(m_VLC_Player, m_VLC_Media);
libvlc_video_set_format_callbacks(m_VLC_Player, VideoLandMovie::CallbackSetup, NULL);
libvlc_video_set_callbacks(m_VLC_Player,
VideoLandMovie::CallbackLock,
VideoLandMovie::CallbackUnLock,
VideoLandMovie::CallbackDisplay, this);
}
Is there any cleaning up that I might be missing? Perhaps OpenGL texture doesn't have time to flush itself before opening the next video or something along those lines?
PS: The code tag doesn't work for me.
Side question: What is the equivalent of addOption for LibVCL in C?
CurrentMedia.addOption(!Locator.SettingsVM.HardwareAccelerationEnabled ? ":avcodec-hw=none" : ":avcodec-hw=d3d11va");