FFmpeg
Loading...
Searching...
No Matches
FFCodec Struct Reference

#include <codec_internal.h>

Data Fields

AVCodec p
 The public AVCodec.
 
unsigned caps_internal:24
 Internal codec capabilities FF_CODEC_CAP_*.
 
unsigned is_decoder:1
 Is this a decoder?
 
unsigned color_ranges:2
 This field determines the video color ranges supported by an encoder.
 
unsigned alpha_modes:2
 This field determines the alpha modes supported by an encoder.
 
unsigned cb_type:3
 This field determines the type of the codec (decoder/encoder) and also the exact callback cb implemented by the codec.
 
int priv_data_size
 
const FFCodecDefaultdefaults
 Private codec-specific defaults.
 
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.
 
union { 
 
   int(*   reconf )(struct AVCodecContext *avctx,
       struct AVDictionary **dict) 
 Encoding only. 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.
 
const uint32_t * codec_tags
 List of supported codec_tags, terminated by FF_CODEC_TAGS_END.
 
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().
 
union { 
 
   struct { 
 
      const AVRational *   supported_framerates 
 
      enum AVPixelFormat *   pix_fmts 
 
   }  
 Video-only fields.
 
   struct { 
 
      const AVChannelLayout *   ch_layouts 
 
      const int *   supported_samplerates 
 
      enum AVSampleFormat *   sample_fmts 
 
   }  
 Audio-only fields.
 
};  
 
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.
 
int(* update_thread_context_for_user )(struct AVCodecContext *dst, const struct AVCodecContext *src)
 Copy variables back to the user-facing context.
 

Detailed Description

Definition at line 129 of file codec_internal.h.

Field Documentation

◆ p

AVCodec FFCodec::p

The public AVCodec.

See codec.h for it.

Definition at line 133 of file codec_internal.h.

Referenced by ff_frame_thread_free(), ff_frame_thread_init(), init_thread(), and priv_data_size_wrong().

◆ caps_internal

◆ is_decoder

unsigned FFCodec::is_decoder

Is this a decoder?

Definition at line 143 of file codec_internal.h.

Referenced by av_codec_is_decoder(), av_codec_is_encoder(), ff_codec_is_decoder(), and ff_codec_is_encoder().

◆ color_ranges

unsigned FFCodec::color_ranges

This field determines the video color ranges supported by an encoder.

Should be set to a bitmask of AVCOL_RANGE_MPEG and AVCOL_RANGE_JPEG.

Definition at line 149 of file codec_internal.h.

Referenced by ff_default_get_supported_config(), and main().

◆ alpha_modes

unsigned FFCodec::alpha_modes

This field determines the alpha modes supported by an encoder.

Should be set to a bitmask of AVALPHA_MODE_PREMULTIPLIED and AVALPHA_MODE_STRAIGHT.

Definition at line 155 of file codec_internal.h.

Referenced by ff_default_get_supported_config(), and main().

◆ 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 162 of file codec_internal.h.

Referenced by avcodec_decode_subtitle2(), encode_receive_packet_internal(), encode_simple_internal(), ff_decode_receive_frame_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 176 of file codec_internal.h.

Referenced by frame_worker_thread(), main(), and update_context_from_thread().

◆ 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 181 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 187 of file codec_internal.h.

Referenced by ff_encode_reconf_parse_dict(), and init_context_defaults().

◆ init

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

Definition at line 189 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 204 of file codec_internal.h.

Referenced by decode_simple_internal().

◆ 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 212 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 221 of file codec_internal.h.

Referenced by ff_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 233 of file codec_internal.h.

Referenced by ff_encode_encode_cb().

◆ 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 239 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 248 of file codec_internal.h.

Referenced by encode_receive_packet_internal().

◆ [union]

◆ close

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

Definition at line 251 of file codec_internal.h.

Referenced by ff_codec_close(), and ff_frame_thread_free().

◆ flush

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

Flush buffers.

Will be called when seeking

Definition at line 257 of file codec_internal.h.

Referenced by avcodec_flush_buffers().

◆ reconf

int(* FFCodec::reconf) (struct AVCodecContext *avctx, struct AVDictionary **dict)

Encoding only.

Reconfigure the encoder Called by avcodec_encode_reconfigure()

Definition at line 264 of file codec_internal.h.

Referenced by avcodec_encode_reconfigure(), and main().

◆ bsfs

const char* FFCodec::bsfs

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

Definition at line 270 of file codec_internal.h.

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

◆ [union]

union { ... } FFCodec

◆ 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 280 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 285 of file codec_internal.h.

◆ get_supported_config

int(* FFCodec::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().

If absent, ff_default_get_supported_config() will be used. out_num_configs will always be set to a valid pointer.

Definition at line 292 of file codec_internal.h.

Referenced by avcodec_get_supported_config().

◆ supported_framerates

const AVRational* FFCodec::supported_framerates

Definition at line 305 of file codec_internal.h.

Referenced by main().

◆ pix_fmts

enum AVPixelFormat* FFCodec::pix_fmts

Definition at line 306 of file codec_internal.h.

Referenced by main().

◆ ch_layouts

const AVChannelLayout* FFCodec::ch_layouts

Definition at line 310 of file codec_internal.h.

Referenced by main().

◆ supported_samplerates

const int* FFCodec::supported_samplerates

Definition at line 311 of file codec_internal.h.

Referenced by main().

◆ sample_fmts

enum AVSampleFormat* FFCodec::sample_fmts

Definition at line 312 of file codec_internal.h.

Referenced by main().

◆ [union]

union { ... } FFCodec

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