FFmpeg
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
libavcodec
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 "
libavcodec/avcodec.h
"
33
34
#include <stdint.h>
35
36
// emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes
37
// http://openradar.appspot.com/8026390
38
#undef __GNUC_STDC_INLINE__
39
40
#define Picture QuickdrawPicture
41
#include <VideoDecodeAcceleration/VDADecoder.h>
42
#undef Picture
43
44
#include "
libavcodec/version.h
"
45
46
// extra flags not defined in VDADecoder.h
47
enum
{
48
kVDADecodeInfo_Asynchronous
= 1UL << 0,
49
kVDADecodeInfo_FrameDropped
= 1UL << 1
50
};
51
52
/**
53
* @defgroup lavc_codec_hwaccel_vda VDA
54
* @ingroup lavc_codec_hwaccel
55
*
56
* @{
57
*/
58
59
/**
60
* This structure is used to provide the necessary configurations and data
61
* to the VDA FFmpeg HWAccel implementation.
62
*
63
* The application must make it available as AVCodecContext.hwaccel_context.
64
*/
65
struct
vda_context
{
66
/**
67
* VDA decoder object.
68
*
69
* - encoding: unused
70
* - decoding: Set/Unset by libavcodec.
71
*/
72
VDADecoder
decoder
;
73
74
/**
75
* The Core Video pixel buffer that contains the current image data.
76
*
77
* encoding: unused
78
* decoding: Set by libavcodec. Unset by user.
79
*/
80
CVPixelBufferRef
cv_buffer
;
81
82
/**
83
* Use the hardware decoder in synchronous mode.
84
*
85
* encoding: unused
86
* decoding: Set by user.
87
*/
88
int
use_sync_decoding
;
89
90
/**
91
* The frame width.
92
*
93
* - encoding: unused
94
* - decoding: Set/Unset by user.
95
*/
96
int
width
;
97
98
/**
99
* The frame height.
100
*
101
* - encoding: unused
102
* - decoding: Set/Unset by user.
103
*/
104
int
height
;
105
106
/**
107
* The frame format.
108
*
109
* - encoding: unused
110
* - decoding: Set/Unset by user.
111
*/
112
int
format
;
113
114
/**
115
* The pixel format for output image buffers.
116
*
117
* - encoding: unused
118
* - decoding: Set/Unset by user.
119
*/
120
OSType
cv_pix_fmt_type
;
121
122
/**
123
* unused
124
*/
125
uint8_t
*
priv_bitstream
;
126
127
/**
128
* unused
129
*/
130
int
priv_bitstream_size
;
131
132
/**
133
* unused
134
*/
135
int
priv_allocated_size
;
136
137
/**
138
* Use av_buffer to manage buffer.
139
* When the flag is set, the CVPixelBuffers returned by the decoder will
140
* be released automatically, so you have to retain them if necessary.
141
* Not setting this flag may cause memory leak.
142
*
143
* encoding: unused
144
* decoding: Set by user.
145
*/
146
int
use_ref_buffer
;
147
};
148
149
/** Create the video decoder. */
150
int
ff_vda_create_decoder
(
struct
vda_context
*vda_ctx,
151
uint8_t
*extradata,
152
int
extradata_size);
153
154
/** Destroy the video decoder. */
155
int
ff_vda_destroy_decoder
(
struct
vda_context
*vda_ctx);
156
157
/**
158
* This struct holds all the information that needs to be passed
159
* between the caller and libavcodec for initializing VDA decoding.
160
* Its size is not a part of the public ABI, it must be allocated with
161
* av_vda_alloc_context() and freed with av_free().
162
*/
163
typedef
struct
AVVDAContext
{
164
/**
165
* VDA decoder object. Created and freed by the caller.
166
*/
167
VDADecoder
decoder
;
168
169
/**
170
* The output callback that must be passed to VDADecoderCreate.
171
* Set by av_vda_alloc_context().
172
*/
173
VDADecoderOutputCallback
output_callback
;
174
}
AVVDAContext
;
175
176
/**
177
* Allocate and initialize a VDA context.
178
*
179
* This function should be called from the get_format() callback when the caller
180
* selects the AV_PIX_FMT_VDA format. The caller must then create the decoder
181
* object (using the output callback provided by libavcodec) that will be used
182
* for VDA-accelerated decoding.
183
*
184
* When decoding with VDA is finished, the caller must destroy the decoder
185
* object and free the VDA context using av_free().
186
*
187
* @return the newly allocated context or NULL on failure
188
*/
189
AVVDAContext
*
av_vda_alloc_context
(
void
);
190
191
/**
192
* This is a convenience function that creates and sets up the VDA context using
193
* an internal implementation.
194
*
195
* @param avctx the corresponding codec context
196
*
197
* @return >= 0 on success, a negative AVERROR code on failure
198
*/
199
int
av_vda_default_init
(
AVCodecContext
*avctx);
200
201
/**
202
* This function must be called to free the VDA context initialized with
203
* av_vda_default_init().
204
*
205
* @param avctx the corresponding codec context
206
*/
207
void
av_vda_default_free
(
AVCodecContext
*avctx);
208
209
/**
210
* @}
211
*/
212
213
#endif
/* AVCODEC_VDA_H */
Generated on Sun Jul 20 2014 23:05:56 for FFmpeg by
1.8.2