Use of libmpv and GetProcAddress

I am looking at a way to integrate libcinder with libmpv (cross-platform media player library) - the biggest problem i face is to get an fbo from mpv and use it in as an opengl context in libcinder.

I need to retrieve OpenGL function pointers like SDL_GL_GetProcAddress, glXGetProcAddressARB or wglGetProcAddress but cannot find a way to get to these functions in libcinder.

*if you want to try libmpv, it is best to compile libmpv as a shared library with *
git clone
cd mpv-build
echo “–enable-libmpv-shared” >> mpv_options
*./rebuild *
sudo ./install

You’ll find an example using sdl here

Finally found a solution to embed libmpv in cinder !

The main problem i got, was solved with the use of

#include “glfw/glfw3.h”

in setup

static void *get_proc_address_mpv(void *fn_ctx, const char *name) {
	return reinterpret_cast<void *>(glfwGetProcAddress(name));

static void on_mpv_redraw(void *ctx) {

	mpv_opengl_init_params gl_init_params{get_proc_address_mpv, nullptr, nullptr};
	mpv_render_param params[]{
													 {MPV_RENDER_PARAM_API_TYPE, const_cast<char *>(MPV_RENDER_API_TYPE_OPENGL)},
														 {MPV_RENDER_PARAM_OPENGL_INIT_PARAMS, &gl_init_params},
															 {MPV_RENDER_PARAM_INVALID, nullptr}
	mpv_render_context_create(&mpv_gl, mpv, params);
	mpv_render_context_set_update_callback(mpv_gl, on_mpv_redraw, nullptr);
1 Like