[FFmpeg-devel] [PATCH 3/3] lavd: add opengl device

Lukasz M lukasz.m.luki at gmail.com
Mon Jan 13 01:57:02 CET 2014


On 13 January 2014 01:41, Lukasz Marek <lukasz.m.luki at gmail.com> wrote:

> It can render to OpenGL context provided by application or into SDL window
>
> Signed-off-by: Lukasz Marek <lukasz.m.luki at gmail.com>
> ---
>  Changelog                        |    1 +
>  configure                        |    9 +
>  doc/outdevs.texi                 |   31 ++
>  libavdevice/Makefile             |    1 +
>  libavdevice/alldevices.c         |    1 +
>  libavdevice/opengl_enc.c         | 1060
> ++++++++++++++++++++++++++++++++++++++
>  libavdevice/opengl_enc_shaders.h |  158 ++++++
>  libavdevice/version.h            |    4 +-
>  8 files changed, 1263 insertions(+), 2 deletions(-)
>  create mode 100644 libavdevice/opengl_enc.c
>  create mode 100644 libavdevice/opengl_enc_shaders.h
>

Few comments:
OpenGL context cannot be used across threads.
SDL 1.2 doesn't allow to recreate context on other thread so default window
cannot be improved (perfectly event queue should be moved to other thread).
As far I remember  SDL_SetVideoMode and SDL_PeepEvents should be on the
same thread.

More important use case for me is to allow to render to context provided by
application. In this case there is also a thread problem. It is very
unlikely device is working on main thread so context have to be moved.
In my own code I rebind it on avdevice_external_window_size as it is called
in front of opengl code in both write_header and write_frame. Personally I
think one more callback should be added like "prepare_window" or something.
I just wonder how to make it generec, because other devices may have other
issues that potentially should be cared by this callback too.

In case someone want to test rendering to external context I may provide
code of qt client, but I don't want to post in on ML.

Regards
Lukasz Marek


More information about the ffmpeg-devel mailing list