[FFmpeg-devel] [PATCH] libavcodec/qsv.c: Re-design session control and internal allocation

Hendrik Leppkes h.leppkes at gmail.com
Wed Oct 7 16:58:25 CEST 2015

On Wed, Oct 7, 2015 at 4:41 PM, Ivan Uskov <ivan.uskov at nablet.com> wrote:
> Hello All,
> The attached patch represents new design for qsv session control and internal
> allocation.  All qsv modules now uses instance of AVQSVContext so now session
> allocates by external application and session allocates internally by ffmpeg
> itself handles by unified way.
> For  the  case  of  internal  session  allocation  now one global instance of
> AVQSVContext   creates,   I.e. one common session uses for all qsv components
> in  processing  chain   (decoder,   vpp,  encoder).   This   opens  a  way to
> implement a complex video processing into the GPU without system memory using.
> index 4c8e6b0..6ced294 100644
>--- a/libavcodec/qsv.c
>+++ b/libavcodec/qsv.c
>@@ -30,6 +30,8 @@
> #include "avcodec.h"
> #include "qsv_internal.h"
>+static AVQSVContext* g_av_qsv = NULL;
> int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
> {

Global static variables are not acceptable, sorry.
You'll have to find another way to solve your problem, but global
state is not the way to go.

- Hendrik

More information about the ffmpeg-devel mailing list