FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
vda.h
Go to the documentation of this file.
1 /*
2  * VDA HW acceleration
3  *
4  * copyright (c) 2011 Sebastien Zwickert
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #ifndef AVCODEC_VDA_H
24 #define AVCODEC_VDA_H
25 
26 /**
27  * @file
28  * @ingroup lavc_codec_hwaccel_vda
29  * Public libavcodec VDA header.
30  */
31 
32 #include <stdint.h>
33 
34 // emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes
35 // http://openradar.appspot.com/8026390
36 #undef __GNUC_STDC_INLINE__
37 
38 #define Picture QuickdrawPicture
39 #include <VideoDecodeAcceleration/VDADecoder.h>
40 #undef Picture
41 
42 #include "libavcodec/version.h"
43 
44 // extra flags not defined in VDADecoder.h
45 enum {
48 };
49 
50 /**
51  * @defgroup lavc_codec_hwaccel_vda VDA
52  * @ingroup lavc_codec_hwaccel
53  *
54  * @{
55  */
56 
57 /**
58  * This structure is used to provide the necessary configurations and data
59  * to the VDA FFmpeg HWAccel implementation.
60  *
61  * The application must make it available as AVCodecContext.hwaccel_context.
62  */
63 struct vda_context {
64  /**
65  * VDA decoder object.
66  *
67  * - encoding: unused
68  * - decoding: Set/Unset by libavcodec.
69  */
70  VDADecoder decoder;
71 
72  /**
73  * The Core Video pixel buffer that contains the current image data.
74  *
75  * encoding: unused
76  * decoding: Set by libavcodec. Unset by user.
77  */
78  CVPixelBufferRef cv_buffer;
79 
80  /**
81  * Use the hardware decoder in synchronous mode.
82  *
83  * encoding: unused
84  * decoding: Set by user.
85  */
87 
88  /**
89  * The frame width.
90  *
91  * - encoding: unused
92  * - decoding: Set/Unset by user.
93  */
94  int width;
95 
96  /**
97  * The frame height.
98  *
99  * - encoding: unused
100  * - decoding: Set/Unset by user.
101  */
102  int height;
103 
104  /**
105  * The frame format.
106  *
107  * - encoding: unused
108  * - decoding: Set/Unset by user.
109  */
110  int format;
111 
112  /**
113  * The pixel format for output image buffers.
114  *
115  * - encoding: unused
116  * - decoding: Set/Unset by user.
117  */
119 
120  /**
121  * The current bitstream buffer.
122  *
123  * - encoding: unused
124  * - decoding: Set/Unset by libavcodec.
125  */
127 
128  /**
129  * The current size of the bitstream.
130  *
131  * - encoding: unused
132  * - decoding: Set/Unset by libavcodec.
133  */
135 
136  /**
137  * The reference size used for fast reallocation.
138  *
139  * - encoding: unused
140  * - decoding: Set/Unset by libavcodec.
141  */
143 
144  /**
145  * Use av_buffer to manage buffer.
146  * When the flag is set, the CVPixelBuffers returned by the decoder will
147  * be released automatically, so you have to retain them if necessary.
148  * Not setting this flag may cause memory leak.
149  *
150  * encoding: unused
151  * decoding: Set by user.
152  */
154 };
155 
156 /** Create the video decoder. */
157 int ff_vda_create_decoder(struct vda_context *vda_ctx,
158  uint8_t *extradata,
159  int extradata_size);
160 
161 /** Destroy the video decoder. */
162 int ff_vda_destroy_decoder(struct vda_context *vda_ctx);
163 
164 /**
165  * @}
166  */
167 
168 #endif /* AVCODEC_VDA_H */