Postby neosettler » 11 Nov 2017 21:59
Hello Jean-Baptiste, thank you for your support!
I'm not certain what video output you are referring to but I basically render a texture on an OpenGL plane. Here is a simplified code snippet. Hope it make sense.
PS: Code formatting doesn't seem to work for this message.
[code]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()
{
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);
}[/code]