Code: Select all
unsigned int texture_width = 256;
unsigned int texture height = 256;
unsigned int texture_depth = 4;
libvlc_video_set_callbacks(media_player, lock, unlock, display, &context);
libvlc_video_set_format(media_player, "RV32", texture_width, texture_height, texture_width * texture_depth);
libvlc_media_player_play(media_player);
I realize you don't know the size of the video until after it starts playing so currently, I set an arbitrary size for the video at initialization and defer creation of the buffer until my "lock" method is called. I get the video size and set the format like this:
Code: Select all
static void* lock(void* data, void** p_pixels)
{
...
...
libvlc_video_get_size(context->mp, 0, &video_width, &video_height);
libvlc_video_set_format(context->mp, "RV32", video_width, video_height, video_width * 4);
...
...
Is this the right approach and if so, anyone know what I am doing wrong?
If there is a better way to do this, can you please share details.