2 * Intel MediaSDK QSV public API
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #include <mfx/mfxvideo.h>
26 #include "libavutil/buffer.h"
29 * This struct is used for communicating QSV parameters between libavcodec and
30 * the caller. It is managed by the caller and must be assigned to
31 * AVCodecContext.hwaccel_context.
32 * - decoding: hwaccel_context must be set on return from the get_format()
34 * - encoding: hwaccel_context must be set before avcodec_open2()
36 typedef struct AVQSVContext {
38 * If non-NULL, the session to use for encoding or decoding.
39 * Otherwise, libavcodec will try to create an internal session.
44 * The IO pattern to use.
49 * Extra buffers to pass to encoder or decoder initialization.
51 mfxExtBuffer **ext_buffers;
55 * Encoding only. If this field is set to non-zero by the caller, libavcodec
56 * will create an mfxExtOpaqueSurfaceAlloc extended buffer and pass it to
57 * the encoder initialization. This only makes sense if iopattern is also
58 * set to MFX_IOPATTERN_IN_OPAQUE_MEMORY.
60 * The number of allocated opaque surfaces will be the sum of the number
61 * required by the encoder and the user-provided value nb_opaque_surfaces.
62 * The array of the opaque surfaces will be exported to the caller through
63 * the opaque_surfaces field.
68 * Encoding only, and only if opaque_alloc is set to non-zero. Before
69 * calling avcodec_open2(), the caller should set this field to the number
70 * of extra opaque surfaces to allocate beyond what is required by the
73 * On return from avcodec_open2(), this field will be set by libavcodec to
74 * the total number of allocated opaque surfaces.
76 int nb_opaque_surfaces;
79 * Encoding only, and only if opaque_alloc is set to non-zero. On return
80 * from avcodec_open2(), this field will be used by libavcodec to export the
81 * array of the allocated opaque surfaces to the caller, so they can be
82 * passed to other parts of the pipeline.
84 * The buffer reference exported here is owned and managed by libavcodec,
85 * the callers should make their own reference with av_buffer_ref() and free
86 * it with av_buffer_unref() when it is no longer needed.
88 * The buffer data is an nb_opaque_surfaces-sized array of mfxFrameSurface1.
90 AVBufferRef *opaque_surfaces;
93 * Encoding only, and only if opaque_alloc is set to non-zero. On return
94 * from avcodec_open2(), this field will be set to the surface type used in
95 * the opaque allocation request.
97 int opaque_alloc_type;
101 * Allocate a new context.
103 * It must be freed by the caller with av_free().
105 AVQSVContext *av_qsv_alloc_context(void);
107 #endif /* AVCODEC_QSV_H */