19#ifndef AVCODEC_CODEC_INTERNAL_H
20#define AVCODEC_CODEC_INTERNAL_H
35#define FF_CODEC_CAP_NOT_INIT_THREADSAFE (1 << 0)
43#define FF_CODEC_CAP_INIT_CLEANUP (1 << 1)
50#define FF_CODEC_CAP_SETS_PKT_DTS (1 << 2)
55#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM (1 << 3)
61#define FF_CODEC_CAP_EXPORTS_CROPPING (1 << 4)
65#define FF_CODEC_CAP_SLICE_THREAD_HAS_MF (1 << 5)
69#define FF_CODEC_CAP_USES_PROGRESSFRAMES (1 << 6)
73#define FF_CODEC_CAP_AUTO_THREADS (1 << 7)
78#define FF_CODEC_CAP_SETS_FRAME_PROPS (1 << 8)
82#define FF_CODEC_CAP_ICC_PROFILES (1 << 9)
90#define FF_CODEC_CAP_EOF_FLUSH (1 << 10)
95#define FF_CODEC_TAGS_END -1
205 int *got_frame_ptr,
struct AVPacket *avpkt);
213 int *got_frame_ptr,
const struct AVPacket *avpkt);
296 const void **out_configs,
297 int *out_num_configs);
298#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
353 const void **out_configs,
354 int *out_num_configs);
357#define CODEC_LONG_NAME(str) .p.long_name = NULL
359#define CODEC_LONG_NAME(str) .p.long_name = str
363#define UPDATE_THREAD_CONTEXT(func) \
364 .update_thread_context = (func)
365#define UPDATE_THREAD_CONTEXT_FOR_USER(func) \
366 .update_thread_context_for_user = (func)
368#define UPDATE_THREAD_CONTEXT(func) \
369 .update_thread_context = NULL
370#define UPDATE_THREAD_CONTEXT_FOR_USER(func) \
371 .update_thread_context_for_user = NULL
374#define FF_CODEC_DECODE_CB(func) \
376 .cb_type = FF_CODEC_CB_TYPE_DECODE, \
378#define FF_CODEC_DECODE_SUB_CB(func) \
380 .cb_type = FF_CODEC_CB_TYPE_DECODE_SUB, \
381 .cb.decode_sub = (func)
382#define FF_CODEC_RECEIVE_FRAME_CB(func) \
384 .cb_type = FF_CODEC_CB_TYPE_RECEIVE_FRAME, \
385 .cb.receive_frame = (func)
386#define FF_CODEC_ENCODE_CB(func) \
388 .cb_type = FF_CODEC_CB_TYPE_ENCODE, \
390#define FF_CODEC_ENCODE_SUB_CB(func) \
392 .cb_type = FF_CODEC_CB_TYPE_ENCODE_SUB, \
393 .cb.encode_sub = (func)
394#define FF_CODEC_RECEIVE_PACKET_CB(func) \
396 .cb_type = FF_CODEC_CB_TYPE_RECEIVE_PACKET, \
397 .cb.receive_packet = (func)
399#define CODEC_CH_LAYOUTS(...) CODEC_CH_LAYOUTS_ARRAY(((const AVChannelLayout[]) { __VA_ARGS__, { 0 } }))
400#define CODEC_CH_LAYOUTS_ARRAY(array) CODEC_ARRAY(ch_layouts, (array))
402#define CODEC_SAMPLERATES(...) CODEC_SAMPLERATES_ARRAY(((const int[]) { __VA_ARGS__, 0 }))
403#define CODEC_SAMPLERATES_ARRAY(array) CODEC_ARRAY(supported_samplerates, (array))
405#define CODEC_SAMPLEFMTS(...) CODEC_SAMPLEFMTS_ARRAY(((const enum AVSampleFormat[]) { __VA_ARGS__, AV_SAMPLE_FMT_NONE }))
406#define CODEC_SAMPLEFMTS_ARRAY(array) CODEC_ARRAY(sample_fmts, (array))
408#define CODEC_FRAMERATES(...) CODEC_FRAMERATES_ARRAY(((const AVRational[]) { __VA_ARGS__, { 0, 0 } }))
409#define CODEC_FRAMERATES_ARRAY(array) CODEC_ARRAY(supported_framerates, (array))
411#define CODEC_PIXFMTS(...) CODEC_PIXFMTS_ARRAY(((const enum AVPixelFormat[]) { __VA_ARGS__, AV_PIX_FMT_NONE }))
412#define CODEC_PIXFMTS_ARRAY(array) CODEC_ARRAY(pix_fmts, (array))
414#define CODEC_ARRAY(field, array) \
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Libavcodec external API header.
#define flags(name, subs,...)
int ff_default_get_supported_config(const struct AVCodecContext *avctx, const AVCodec *codec, enum AVCodecConfig config, unsigned flags, const void **out_configs, int *out_num_configs)
Default implementation for avcodec_get_supported_config().
@ FF_CODEC_CB_TYPE_ENCODE
@ FF_CODEC_CB_TYPE_RECEIVE_PACKET
@ FF_CODEC_CB_TYPE_DECODE_SUB
@ FF_CODEC_CB_TYPE_RECEIVE_FRAME
@ FF_CODEC_CB_TYPE_ENCODE_SUB
@ FF_CODEC_CB_TYPE_DECODE
static av_always_inline const FFCodec * ffcodec(const AVCodec *codec)
static int ff_codec_is_decoder(const AVCodec *avcodec)
Internal version of av_codec_is_decoder().
static int ff_codec_is_encoder(const AVCodec *avcodec)
Internal version of av_codec_is_encoder().
AVSampleFormat
Audio sample formats.
Macro definitions for various function/variable attributes.
AVPixelFormat
Pixel format.
An AVChannelLayout holds information about the channel layout of audio data.
main external API structure.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
Rational number (pair of numerator and denominator).
int(* update_thread_context)(struct AVCodecContext *dst, const struct AVCodecContext *src)
Copy necessary context variables from a previous thread context to the current one.
AVCodec p
The public AVCodec.
enum AVSampleFormat * sample_fmts
const AVChannelLayout * ch_layouts
int(* init)(struct AVCodecContext *)
int(* receive_frame)(struct AVCodecContext *avctx, struct AVFrame *frame)
Decode API with decoupled packet/frame dataflow.
const struct AVCodecHWConfigInternal *const * hw_configs
Array of pointers to hardware configurations supported by the codec, or NULL if no hardware supported...
int(* update_thread_context_for_user)(struct AVCodecContext *dst, const struct AVCodecContext *src)
Copy variables back to the user-facing context.
unsigned cb_type
This field determines the type of the codec (decoder/encoder) and also the exact callback cb implemen...
const int * supported_samplerates
const char * bsfs
Decoding only, a comma-separated list of bitstream filters to apply to packets before decoding.
void(* flush)(struct AVCodecContext *)
Flush buffers.
int(* decode_sub)(struct AVCodecContext *avctx, struct AVSubtitle *sub, int *got_frame_ptr, const struct AVPacket *avpkt)
Decode subtitle data to an AVSubtitle.
unsigned alpha_modes
This field determines the alpha modes supported by an encoder.
const FFCodecDefault * defaults
Private codec-specific defaults.
int(* decode)(struct AVCodecContext *avctx, struct AVFrame *frame, int *got_frame_ptr, struct AVPacket *avpkt)
Decode to an AVFrame.
const uint32_t * codec_tags
List of supported codec_tags, terminated by FF_CODEC_TAGS_END.
int(* receive_packet)(struct AVCodecContext *avctx, struct AVPacket *avpkt)
Encode API with decoupled frame/packet dataflow.
int(* reconf)(struct AVCodecContext *avctx, struct AVDictionary **dict)
Encoding only.
int(* encode_sub)(struct AVCodecContext *avctx, uint8_t *buf, int buf_size, const struct AVSubtitle *sub)
Encode subtitles to a raw buffer.
const AVRational * supported_framerates
unsigned is_decoder
Is this a decoder?
int(* encode)(struct AVCodecContext *avctx, struct AVPacket *avpkt, const struct AVFrame *frame, int *got_packet_ptr)
Encode data to an AVPacket.
enum AVPixelFormat * pix_fmts
unsigned caps_internal
Internal codec capabilities FF_CODEC_CAP_*.
int(* close)(struct AVCodecContext *)
int(* get_supported_config)(const struct AVCodecContext *avctx, const AVCodec *codec, enum AVCodecConfig config, unsigned flags, const void **out_configs, int *out_num_configs)
Custom callback for avcodec_get_supported_config().
unsigned color_ranges
This field determines the video color ranges supported by an encoder.
static double cb(void *priv, double x, double y)