1 /*
2 * Copyright (c) 2001 Fabrice Bellard
3 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /**
23 * @file
24 * Options definition for AVCodecContext.
25 */
26
32 #include <float.h> /* FLT_MIN, FLT_MAX */
33 #include <string.h>
34
36
39
42 else
43 return "NULL";
44 }
45
47 {
51 return NULL;
52 }
53
55 {
57
58 /* find the codec that corresponds to prev */
61 break;
62
63 /* find next codec with priv options */
67 return NULL;
68 }
69
71 {
75 }
76
82 .log_level_offset_offset = offsetof(
AVCodecContext, log_level_offset),
87 };
88
89 #if FF_API_ALLOC_CONTEXT
94 }
95 #endif
96
98 {
101
103
105 if (codec)
107
115
125
132 }
133 }
137 }
138 }
145 d++;
146 }
147 }
148 return 0;
149 }
150
152 {
154
155 if(avctx==NULL) return NULL;
156
159 return NULL;
160 }
161
162 return avctx;
163 }
164
165 #if FF_API_ALLOC_CONTEXT
168
169 if(avctx==NULL) return NULL;
170
171 avcodec_get_context_defaults2(avctx, codec_type);
172
173 return avctx;
174 }
175
178 }
179
182 }
183 #endif
184
186 {
187 if (
avcodec_is_open(dest)) {
// check that the dest context is uninitialized
189 "Tried to copy AVCodecContext %p into already-initialized %p\n",
190 src, dest);
192 }
193 memcpy(dest, src, sizeof(*dest));
194
195 /* set values specific to opened codecs back to their default state */
202
203 /* reallocate values that should be allocated separately */
213 }
214
215 #define alloc_and_copy_or_fail(obj, size, pad) \
216 if (src->obj && size > 0) { \
217 dest->obj = av_malloc(size + pad); \
218 if (!dest->obj) \
219 goto fail; \
220 memcpy(dest->obj, src->obj, size); \
221 if (pad) \
222 memset(((uint8_t *) dest->obj) + size, 0, pad); \
223 }
230 #undef alloc_and_copy_or_fail
231
232 return 0;
233
234 fail:
241 }
242
244 {
246 }
247
248 #define FOFFSET(x) offsetof(AVFrame,x)
249
260 {NULL},
261 };
262
265 .item_name = NULL,
268 };
269
271 {
273 }
274
275 #define SROFFSET(x) offsetof(AVSubtitleRect,x)
276
285 {NULL},
286 };
287
290 .item_name = NULL,
293 };
294
296 {
298 }