FFmpeg
Data Fields
FFCodec Struct Reference

#include <codec_internal.h>

Data Fields

AVCodec p
 The public AVCodec. More...
 
unsigned caps_internal:29
 Internal codec capabilities FF_CODEC_CAP_*. More...
 
unsigned cb_type:3
 This field determines the type of the codec (decoder/encoder) and also the exact callback cb implemented by the codec. More...
 
int priv_data_size
 
const FFCodecDefaultdefaults
 Private codec-specific defaults. More...
 
void(* init_static_data )(struct FFCodec *codec)
 Initialize codec static data, called from av_codec_iterate(). More...
 
int(* init )(struct AVCodecContext *)
 
union {
   int(*   decode )(struct AVCodecContext *avctx,
      struct AVFrame *frame, int
      *got_frame_ptr, struct
      AVPacket *avpkt)
 Decode to an AVFrame. More...
 
   int(*   decode_sub )(struct AVCodecContext *avctx,
      struct AVSubtitle *sub, int
      *got_frame_ptr, const struct
      AVPacket *avpkt)
 Decode subtitle data to an AVSubtitle. More...
 
   int(*   receive_frame )(struct AVCodecContext *avctx,
      struct AVFrame *frame)
 Decode API with decoupled packet/frame dataflow. More...
 
   int(*   encode )(struct AVCodecContext *avctx,
      struct AVPacket *avpkt, const
      struct AVFrame *frame, int
      *got_packet_ptr)
 Encode data to an AVPacket. More...
 
   int(*   encode_sub )(struct AVCodecContext *avctx,
      uint8_t *buf, int buf_size,
      const struct AVSubtitle *sub)
 Encode subtitles to a raw buffer. More...
 
   int(*   receive_packet )(struct AVCodecContext *avctx,
      struct AVPacket *avpkt)
 Encode API with decoupled frame/packet dataflow. More...
 
cb
 
int(* close )(struct AVCodecContext *)
 
void(* flush )(struct AVCodecContext *)
 Flush buffers. More...
 
const char * bsfs
 Decoding only, a comma-separated list of bitstream filters to apply to packets before decoding. More...
 
const struct AVCodecHWConfigInternal *const * hw_configs
 Array of pointers to hardware configurations supported by the codec, or NULL if no hardware supported. More...
 
const uint32_t * codec_tags
 List of supported codec_tags, terminated by FF_CODEC_TAGS_END. More...
 
Frame-level threading support functions
int(* update_thread_context )(struct AVCodecContext *dst, const struct AVCodecContext *src)
 Copy necessary context variables from a previous thread context to the current one. More...
 
int(* update_thread_context_for_user )(struct AVCodecContext *dst, const struct AVCodecContext *src)
 Copy variables back to the user-facing context. More...
 

Detailed Description

Definition at line 112 of file codec_internal.h.

Field Documentation

◆ p

AVCodec FFCodec::p

◆ caps_internal

unsigned FFCodec::caps_internal

◆ cb_type

unsigned FFCodec::cb_type

This field determines the type of the codec (decoder/encoder) and also the exact callback cb implemented by the codec.

cb_type uses enum FFCodecType values.

Definition at line 128 of file codec_internal.h.

Referenced by av_codec_is_decoder(), av_codec_is_encoder(), decode_receive_frame_internal(), encode_receive_packet_internal(), encode_simple_internal(), ff_encode_preinit(), and main().

◆ priv_data_size

int FFCodec::priv_data_size

◆ update_thread_context

int(* FFCodec::update_thread_context) (struct AVCodecContext *dst, const struct AVCodecContext *src)

Copy necessary context variables from a previous thread context to the current one.

If not defined, the next thread will start automatically; otherwise, the codec must call ff_thread_finish_setup().

dst and src will (rarely) point to the same context, in which case memcpy should be skipped.

Definition at line 142 of file codec_internal.h.

Referenced by ff_thread_can_start_frame(), frame_worker_thread(), main(), thread_get_buffer_internal(), update_context_from_thread(), and vp78_decode_frame().

◆ update_thread_context_for_user

int(* FFCodec::update_thread_context_for_user) (struct AVCodecContext *dst, const struct AVCodecContext *src)

Copy variables back to the user-facing context.

Definition at line 147 of file codec_internal.h.

Referenced by main(), and update_context_from_thread().

◆ defaults

const FFCodecDefault* FFCodec::defaults

Private codec-specific defaults.

Definition at line 153 of file codec_internal.h.

Referenced by init_context_defaults().

◆ init_static_data

void(* FFCodec::init_static_data) (struct FFCodec *codec)

Initialize codec static data, called from av_codec_iterate().

This is not intended for time consuming operations as it is run for every codec regardless of that codec being used.

Definition at line 161 of file codec_internal.h.

Referenced by av_codec_init_static().

◆ init

int(* FFCodec::init) (struct AVCodecContext *)

Definition at line 163 of file codec_internal.h.

Referenced by avcodec_open2(), init_thread(), lock_avcodec(), and unlock_avcodec().

◆ decode

int(* FFCodec::decode) (struct AVCodecContext *avctx, struct AVFrame *frame, int *got_frame_ptr, struct AVPacket *avpkt)

Decode to an AVFrame.

cb is in this state if cb_type is FF_CODEC_CB_TYPE_DECODE.

Parameters
avctxcodec context
[out]frameAVFrame for output
[out]got_frame_ptrdecoder sets to 0 or 1 to indicate that a non-empty frame was returned in frame.
[in]avpktAVPacket containing the data to be decoded
Returns
amount of bytes read from the packet on success, negative error code on failure

Definition at line 178 of file codec_internal.h.

Referenced by decode_simple_internal(), and frame_worker_thread().

◆ decode_sub

int(* FFCodec::decode_sub) (struct AVCodecContext *avctx, struct AVSubtitle *sub, int *got_frame_ptr, const struct AVPacket *avpkt)

Decode subtitle data to an AVSubtitle.

cb is in this state if cb_type is FF_CODEC_CB_TYPE_DECODE_SUB.

Apart from that this is like the decode callback.

Definition at line 186 of file codec_internal.h.

Referenced by avcodec_decode_subtitle2().

◆ receive_frame

int(* FFCodec::receive_frame) (struct AVCodecContext *avctx, struct AVFrame *frame)

Decode API with decoupled packet/frame dataflow.

cb is in this state if cb_type is FF_CODEC_CB_TYPE_RECEIVE_FRAME.

This function is called to get one output frame. It should call ff_decode_get_packet() to obtain input data.

Definition at line 195 of file codec_internal.h.

Referenced by decode_receive_frame_internal().

◆ encode

int(* FFCodec::encode) (struct AVCodecContext *avctx, struct AVPacket *avpkt, const struct AVFrame *frame, int *got_packet_ptr)

Encode data to an AVPacket.

cb is in this state if cb_type is FF_CODEC_CB_TYPE_ENCODE

Parameters
avctxcodec context
[out]avpktoutput AVPacket
[in]frameAVFrame containing the input to be encoded
[out]got_packet_ptrencoder sets to 0 or 1 to indicate that a non-empty packet was returned in avpkt.
Returns
0 on success, negative error code on failure

Definition at line 207 of file codec_internal.h.

Referenced by encode_simple_internal(), and worker().

◆ encode_sub

int(* FFCodec::encode_sub) (struct AVCodecContext *avctx, uint8_t *buf, int buf_size, const struct AVSubtitle *sub)

Encode subtitles to a raw buffer.

cb is in this state if cb_type is FF_CODEC_CB_TYPE_ENCODE_SUB.

Definition at line 213 of file codec_internal.h.

Referenced by avcodec_encode_subtitle().

◆ receive_packet

int(* FFCodec::receive_packet) (struct AVCodecContext *avctx, struct AVPacket *avpkt)

Encode API with decoupled frame/packet dataflow.

cb is in this state if cb_type is FF_CODEC_CB_TYPE_RECEIVE_PACKET.

This function is called to get one output packet. It should call ff_encode_get_frame() to obtain input data.

Definition at line 222 of file codec_internal.h.

Referenced by encode_receive_packet_internal().

◆ cb

union { ... } FFCodec::cb

◆ close

int(* FFCodec::close) (struct AVCodecContext *)

Definition at line 225 of file codec_internal.h.

Referenced by avcodec_close(), and ff_frame_thread_free().

◆ flush

void(* FFCodec::flush) (struct AVCodecContext *)

Flush buffers.

Will be called when seeking

Definition at line 231 of file codec_internal.h.

Referenced by avcodec_flush_buffers(), and ff_thread_flush().

◆ bsfs

const char* FFCodec::bsfs

Decoding only, a comma-separated list of bitstream filters to apply to packets before decoding.

Definition at line 237 of file codec_internal.h.

Referenced by cuvid_decode_init(), decode_bsfs_init(), and main().

◆ hw_configs

const struct AVCodecHWConfigInternal* const * FFCodec::hw_configs

Array of pointers to hardware configurations supported by the codec, or NULL if no hardware supported.

The array is terminated by a NULL pointer.

The user can only access this field via avcodec_get_hw_config().

Definition at line 246 of file codec_internal.h.

Referenced by avcodec_default_get_format(), avcodec_get_hw_config(), avcodec_get_hw_frames_parameters(), and ff_get_format().

◆ codec_tags

const uint32_t* FFCodec::codec_tags

List of supported codec_tags, terminated by FF_CODEC_TAGS_END.

Definition at line 251 of file codec_internal.h.

Referenced by LLVMFuzzerTestOneInput().


The documentation for this struct was generated from the following file: