83 .log_level_offset_offset = offsetof(
AVCodecContext, log_level_offset),
187 "Tried to copy AVCodecContext %p into already-initialized %p\n",
199 memcpy(dest, src,
sizeof(*dest));
203 dest->
codec = orig_codec;
223 #define alloc_and_copy_or_fail(obj, size, pad) \
224 if (src->obj && size > 0) { \
225 dest->obj = av_malloc(size + pad); \
228 memcpy(dest->obj, src->obj, size); \
230 memset(((uint8_t *) dest->obj) + size, 0, pad); \
240 #undef alloc_and_copy_or_fail
261 #define FOFFSET(x) offsetof(AVFrame,x)
288 #define SROFFSET(x) offsetof(AVSubtitleRect,x)
336 typedef struct Dummy12Context {
342 typedef struct Dummy3Context {
348 #define OFFSET(x) offsetof(Dummy12Context, x)
349 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
350 static const AVOption dummy_options[] = {
356 static const AVClass dummy_v1_class = {
359 .option = dummy_options,
363 static const AVClass dummy_v2_class = {
366 .option = dummy_options,
372 .
name =
"dummy_v1_codec",
375 .encode2 = dummy_encode,
377 .close = dummy_close,
378 .priv_class = &dummy_v1_class,
379 .priv_data_size =
sizeof(Dummy12Context),
384 .
name =
"dummy_v2_codec",
387 .encode2 = dummy_encode,
389 .close = dummy_close,
390 .priv_class = &dummy_v2_class,
391 .priv_data_size =
sizeof(Dummy12Context),
396 .
name =
"dummy_v3_codec",
399 .encode2 = dummy_encode,
401 .close = dummy_close,
402 .priv_data_size =
sizeof(Dummy3Context),
407 .
name =
"dummy_v4_codec",
410 .encode2 = dummy_encode,
412 .close = dummy_close,
417 printf(
"%-14s: %dx%d prv: %s",
426 printf(
" opts: %"PRId64
" %s", i64, str);
435 printf(
"%s -> %s\nclosed:\n", c1 ? c1->
name :
"NULL", c2 ? c2->
name :
"NULL");
444 test_copy_print_codec(ctx1);
445 test_copy_print_codec(ctx2);
454 test_copy_print_codec(ctx1);
455 test_copy_print_codec(ctx2);
473 for (i = 0; dummy_codec[i]; i++)
476 printf(
"testing avcodec_copy_context()\n");
479 test_copy(dummy_codec[i], dummy_codec[j]);