85 .log_level_offset_offset = offsetof(
AVCodecContext, log_level_offset),
189 "Tried to copy AVCodecContext %p into already-initialized %p\n",
201 memcpy(dest, src,
sizeof(*dest));
205 dest->
codec = orig_codec;
216 #if FF_API_CODED_FRAME
229 #define alloc_and_copy_or_fail(obj, size, pad) \
230 if (src->obj && size > 0) { \
231 dest->obj = av_malloc(size + pad); \
234 memcpy(dest->obj, src->obj, size); \
236 memset(((uint8_t *) dest->obj) + size, 0, pad); \
246 #undef alloc_and_copy_or_fail
267 #define FOFFSET(x) offsetof(AVFrame,x)
294 #define SROFFSET(x) offsetof(AVSubtitleRect,x)
340 typedef struct Dummy12Context {
346 typedef struct Dummy3Context {
352 #define OFFSET(x) offsetof(Dummy12Context, x)
353 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
354 static const AVOption dummy_options[] = {
360 static const AVClass dummy_v1_class = {
363 .option = dummy_options,
367 static const AVClass dummy_v2_class = {
370 .option = dummy_options,
375 static AVCodec dummy_v1_encoder = {
376 .
name =
"dummy_v1_codec",
379 .encode2 = dummy_encode,
381 .close = dummy_close,
382 .priv_class = &dummy_v1_class,
383 .priv_data_size =
sizeof(Dummy12Context),
387 static AVCodec dummy_v2_encoder = {
388 .
name =
"dummy_v2_codec",
391 .encode2 = dummy_encode,
393 .close = dummy_close,
394 .priv_class = &dummy_v2_class,
395 .priv_data_size =
sizeof(Dummy12Context),
399 static AVCodec dummy_v3_encoder = {
400 .
name =
"dummy_v3_codec",
403 .encode2 = dummy_encode,
405 .close = dummy_close,
406 .priv_data_size =
sizeof(Dummy3Context),
410 static AVCodec dummy_v4_encoder = {
411 .
name =
"dummy_v4_codec",
414 .encode2 = dummy_encode,
416 .close = dummy_close,
421 printf(
"%-14s: %dx%d prv: %s",
430 printf(
" opts: %"PRId64
" %s", i64, str);
439 printf(
"%s -> %s\nclosed:\n", c1 ? c1->
name :
"NULL", c2 ? c2->
name :
"NULL");
448 test_copy_print_codec(ctx1);
449 test_copy_print_codec(ctx2);
458 test_copy_print_codec(ctx1);
459 test_copy_print_codec(ctx2);
477 for (i = 0; dummy_codec[i]; i++)
480 printf(
"testing avcodec_copy_context()\n");
483 test_copy(dummy_codec[i], dummy_codec[j]);
const struct AVCodec * codec
This structure describes decoded (raw) audio or video data.
int avcodec_default_execute2(AVCodecContext *c, int(*func)(AVCodecContext *c2, void *arg2, int, int), void *arg, int *ret, int count)
#define AV_OPT_FLAG_SUBTITLE_PARAM
#define LIBAVUTIL_VERSION_INT
memory handling functions
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
#define AV_OPT_FLAG_AUDIO_PARAM
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
static const AVOption avcodec_options[]
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int(* decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt)
int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
Copy the settings of the source AVCodecContext into the destination AVCodecContext.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
static const AVClass av_codec_context_class
struct AVHWAccel * hwaccel
Hardware accelerator in use.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat *fmt)
enum AVSampleFormat sample_fmt
audio sample format
static const AVOption subtitle_rect_options[]
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
const AVClass * av_class
information on struct for av_log
static const AVClass av_subtitle_rect_class
const AVClass * avcodec_get_frame_class(void)
Get the AVClass for AVFrame.
int avcodec_close(AVCodecContext *avctx)
Close a given AVCodecContext and free all the data associated with it (but not the AVCodecContext its...
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
const AVCodecDefault * defaults
Private codec-specific defaults.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVCodec * av_codec_next(const AVCodec *c)
If c is NULL, returns the first registered codec, if c is non-NULL, returns the next registered codec...
int avcodec_is_open(AVCodecContext *s)
static void * codec_child_next(void *obj, void *prev)
simple assert() macros that are a bit more flexible than ISO C assert().
const char * name
Name of the codec implementation.
AVClassCategory category
Category used for visualization (like color) This is only set if the category is equal for all object...
common internal API header
int rc_override_count
ratecontrol override, see RcOverride
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
int width
picture width / height.
static const AVClass * codec_child_class_next(const AVClass *prev)
const AVClass * avcodec_get_subtitle_rect_class(void)
Get the AVClass for AVSubtitleRect.
void av_opt_set_defaults2(void *s, int mask, int flags)
Set the values of all AVOption fields to their default values.
int64_t reordered_opaque
opaque 64bit number (generally a PTS) that will be reordered and output in AVFrame.reordered_opaque
Usually treated as AVMEDIA_TYPE_DATA.
#define FF_ARRAY_ELEMS(a)
int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val)
int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags)
The default callback for AVCodecContext.get_buffer2().
Libavcodec external API header.
enum AVMediaType codec_type
void avcodec_free_context(AVCodecContext **pavctx)
Free the codec context and everything associated with it and write NULL to the provided pointer...
#define AV_OPT_FLAG_VIDEO_PARAM
main external API structure.
static const char * format
static const AVClass av_class
uint16_t * intra_matrix
custom intra quantization matrix
BYTE int const BYTE int int int height
Describe the class of an AVClass context structure.
enum AVPixelFormat(* get_format)(struct AVCodecContext *s, const enum AVPixelFormat *fmt)
callback to negotiate the pixelFormat
rational number numerator/denominator
int(* get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags)
This callback is called at the beginning of each frame to get data buffer(s) for it.
int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
uint16_t * inter_matrix
custom inter quantization matrix
const AVClass * priv_class
AVClass for the private context.
void av_opt_free(void *obj)
Free all allocated objects in obj.
static const AVOption frame_options[]
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header.
int av_opt_copy(void *dst, const void *src)
Copy options from src object into dest object.
static AVClassCategory get_category(void *ptr)
attribute_deprecated AVFrame * coded_frame
the picture in the bitstream
static const AVClass av_frame_class
int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
Set the fields of the given AVCodecContext to default values corresponding to the given codec (defaul...
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
int(* execute)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size)
The codec may call this to execute several independent things.
#define FF_ENABLE_DEPRECATION_WARNINGS
#define alloc_and_copy_or_fail(obj, size, pad)
int(* execute2)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count)
The codec may call this to execute several independent things.
struct AVCodecInternal * internal
Private context used for internal data.
FF_DISABLE_DEPRECATION_WARNINGS static FF_ENABLE_DEPRECATION_WARNINGS const char * context_to_name(void *ptr)
void avcodec_register(AVCodec *codec)
Register the codec codec and initialize libavcodec.
int * slice_offset
slice offsets in the frame in bytes
int main(int argc, char **argv)
This structure stores compressed data.
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
#define AV_NOPTS_VALUE
Undefined timestamp value.
int avcodec_default_execute(AVCodecContext *c, int(*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size)
uint8_t * subtitle_header
Header containing style information for text subtitles.