OSDN Git Service

avcodec/vorbisenc: Include bufqueue and afqueue
[android-x86/external-ffmpeg.git] / libavcodec / qsv.h
1 /*
2  * Intel MediaSDK QSV public API
3  *
4  * This file is part of FFmpeg.
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #ifndef AVCODEC_QSV_H
22 #define AVCODEC_QSV_H
23
24 #include <mfx/mfxvideo.h>
25
26 #include "libavutil/buffer.h"
27
28 /**
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()
33  *             callback
34  * - encoding: hwaccel_context must be set before avcodec_open2()
35  */
36 typedef struct AVQSVContext {
37     /**
38      * If non-NULL, the session to use for encoding or decoding.
39      * Otherwise, libavcodec will try to create an internal session.
40      */
41     mfxSession session;
42
43     /**
44      * The IO pattern to use.
45      */
46     int iopattern;
47
48     /**
49      * Extra buffers to pass to encoder or decoder initialization.
50      */
51     mfxExtBuffer **ext_buffers;
52     int         nb_ext_buffers;
53
54     /**
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.
59      *
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.
64      */
65     int opaque_alloc;
66
67     /**
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
71      * encoder.
72      *
73      * On return from avcodec_open2(), this field will be set by libavcodec to
74      * the total number of allocated opaque surfaces.
75      */
76     int nb_opaque_surfaces;
77
78     /**
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.
83      *
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.
87      *
88      * The buffer data is an nb_opaque_surfaces-sized array of mfxFrameSurface1.
89      */
90     AVBufferRef *opaque_surfaces;
91
92     /**
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.
96      */
97     int opaque_alloc_type;
98 } AVQSVContext;
99
100 /**
101  * Allocate a new context.
102  *
103  * It must be freed by the caller with av_free().
104  */
105 AVQSVContext *av_qsv_alloc_context(void);
106
107 #endif /* AVCODEC_QSV_H */