Go to the documentation of this file.
19 #ifndef AVCODEC_CODEC_INTERNAL_H
20 #define AVCODEC_CODEC_INTERNAL_H
34 #define FF_CODEC_CAP_NOT_INIT_THREADSAFE (1 << 0)
42 #define FF_CODEC_CAP_INIT_CLEANUP (1 << 1)
49 #define FF_CODEC_CAP_SETS_PKT_DTS (1 << 2)
54 #define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM (1 << 3)
60 #define FF_CODEC_CAP_EXPORTS_CROPPING (1 << 4)
64 #define FF_CODEC_CAP_SLICE_THREAD_HAS_MF (1 << 5)
69 #define FF_CODEC_CAP_ALLOCATE_PROGRESS (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
194 int *got_frame_ptr,
struct AVPacket *avpkt);
202 int *got_frame_ptr,
const struct AVPacket *avpkt);
270 #define CODEC_LONG_NAME(str) .p.long_name = NULL
272 #define CODEC_LONG_NAME(str) .p.long_name = str
276 #define UPDATE_THREAD_CONTEXT(func) \
277 .update_thread_context = (func)
278 #define UPDATE_THREAD_CONTEXT_FOR_USER(func) \
279 .update_thread_context_for_user = (func)
281 #define UPDATE_THREAD_CONTEXT(func) \
282 .update_thread_context = NULL
283 #define UPDATE_THREAD_CONTEXT_FOR_USER(func) \
284 .update_thread_context_for_user = NULL
287 #if FF_API_OLD_CHANNEL_LAYOUT
288 #define CODEC_OLD_CHANNEL_LAYOUTS(...) CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(((const uint64_t[]) { __VA_ARGS__, 0 }))
289 #if defined(__clang__)
290 #define CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(array) \
291 FF_DISABLE_DEPRECATION_WARNINGS \
292 .p.channel_layouts = (array), \
293 FF_ENABLE_DEPRECATION_WARNINGS
295 #define CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(array) .p.channel_layouts = (array),
302 #define CODEC_OLD_CHANNEL_LAYOUTS(...)
303 #define CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(array)
306 #define FF_CODEC_DECODE_CB(func) \
307 .cb_type = FF_CODEC_CB_TYPE_DECODE, \
309 #define FF_CODEC_DECODE_SUB_CB(func) \
310 .cb_type = FF_CODEC_CB_TYPE_DECODE_SUB, \
311 .cb.decode_sub = (func)
312 #define FF_CODEC_RECEIVE_FRAME_CB(func) \
313 .cb_type = FF_CODEC_CB_TYPE_RECEIVE_FRAME, \
314 .cb.receive_frame = (func)
315 #define FF_CODEC_ENCODE_CB(func) \
316 .cb_type = FF_CODEC_CB_TYPE_ENCODE, \
318 #define FF_CODEC_ENCODE_SUB_CB(func) \
319 .cb_type = FF_CODEC_CB_TYPE_ENCODE_SUB, \
320 .cb.encode_sub = (func)
321 #define FF_CODEC_RECEIVE_PACKET_CB(func) \
322 .cb_type = FF_CODEC_CB_TYPE_RECEIVE_PACKET, \
323 .cb.receive_packet = (func)
int(* update_thread_context)(struct AVCodecContext *dst, const struct AVCodecContext *src)
Copy necessary context variables from a previous thread context to the current one.
int(* receive_frame)(struct AVCodecContext *avctx, struct AVFrame *frame)
Decode API with decoupled packet/frame dataflow.
const FFCodecDefault * defaults
Private codec-specific defaults.
@ FF_CODEC_CB_TYPE_RECEIVE_PACKET
static float sub(float src0, float src1)
This structure describes decoded (raw) audio or video data.
int(* encode)(struct AVCodecContext *avctx, struct AVPacket *avpkt, const struct AVFrame *frame, int *got_packet_ptr)
Encode data to an AVPacket.
@ FF_CODEC_CB_TYPE_ENCODE_SUB
AVCodec p
The public AVCodec.
@ FF_CODEC_CB_TYPE_DECODE
int(* update_thread_context_for_user)(struct AVCodecContext *dst, const struct AVCodecContext *src)
Copy variables back to the user-facing context.
@ FF_CODEC_CB_TYPE_ENCODE
void(* flush)(struct AVCodecContext *)
Flush buffers.
int(* encode_sub)(struct AVCodecContext *avctx, uint8_t *buf, int buf_size, const struct AVSubtitle *sub)
Encode subtitles to a raw buffer.
int(* decode)(struct AVCodecContext *avctx, struct AVFrame *frame, int *got_frame_ptr, struct AVPacket *avpkt)
Decode to an AVFrame.
int(* init)(struct AVCodecContext *)
@ FF_CODEC_CB_TYPE_DECODE_SUB
int(* receive_packet)(struct AVCodecContext *avctx, struct AVPacket *avpkt)
Encode API with decoupled frame/packet dataflow.
static const av_always_inline FFCodec * ffcodec(const AVCodec *codec)
const struct AVCodecHWConfigInternal *const * hw_configs
Array of pointers to hardware configurations supported by the codec, or NULL if no hardware supported...
unsigned caps_internal
Internal codec capabilities FF_CODEC_CAP_*.
int(* decode_sub)(struct AVCodecContext *avctx, struct AVSubtitle *sub, int *got_frame_ptr, const struct AVPacket *avpkt)
Decode subtitle data to an AVSubtitle.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
main external API structure.
const uint32_t * codec_tags
List of supported codec_tags, terminated by FF_CODEC_TAGS_END.
@ FF_CODEC_CB_TYPE_RECEIVE_FRAME
unsigned cb_type
This field determines the type of the codec (decoder/encoder) and also the exact callback cb implemen...
int(* close)(struct AVCodecContext *)
const char * bsfs
Decoding only, a comma-separated list of bitstream filters to apply to packets before decoding.
This structure stores compressed data.
void(* init_static_data)(struct FFCodec *codec)
Initialize codec static data, called from av_codec_iterate().