1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #ifndef AVCODEC_AMFENC_H
20 #define AVCODEC_AMFENC_H
21
22 #include <AMF/core/Factory.h>
23
24 #include <AMF/components/ColorSpace.h>
25 #include <AMF/components/VideoEncoderVCE.h>
26 #include <AMF/components/VideoEncoderHEVC.h>
27 #include <AMF/components/VideoEncoderAV1.h>
28
30
33
34 #define MAX_LOOKAHEAD_DEPTH 41
35
36 /**
37 * AMF trace writer callback class
38 * Used to capture all AMF logging
39 */
40
45
46 /**
47 * AMF encoder context
48 */
49
52 // access to AMF runtime
53 amf_handle
library;
///< handle to DLL library
54 AMFFactory *
factory;
///< pointer to AMF factory
55 AMFDebug *
debug;
///< pointer to AMF debug interface
56 AMFTrace *
trace;
///< pointer to AMF trace interface
57
58 amf_uint64
version;
///< version of AMF runtime
61 //encoder
62 AMFComponent *
encoder;
///< AMF encoder object
63 amf_bool
eof;
///< flag indicating EOF happened
64 AMF_SURFACE_FORMAT
format;
///< AMF surface format
65
68
71
72 // helpers to handle async calls
76
77 // shift dts back by max_b_frames in timing
80
81 // common encoder option options
82
84
85 // Static options, have to be set before Init() call
94
95 // Dynamic options, can be set after Init() call
96
117
118 // HEVC - specific options
119
127
128 // AV1 - specific options
129
130 enum AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_ENUM
align;
131 enum AMF_VIDEO_ENCODER_AV1_AQ_MODE_ENUM
aq_mode;
132
133 // Preanalysis - specific options
134
151
152
154
156
157 /**
158 * Common encoder initization function
159 */
161 /**
162 * Common encoder termination function
163 */
165
166 /**
167 * Ecoding one frame - common function for all AMF encoders
168 */
170
171 /**
172 * Supported formats
173 */
175
177
178 /**
179 * Error handling helper
180 */
181 #define AMF_RETURN_IF_FALSE(avctx, exp, ret_value, /*message,*/ ...) \
182 if (!(exp)) { \
183 av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \
184 return ret_value; \
185 }
186
187 #endif //AVCODEC_AMFENC_H