Go to the documentation of this file.
27 return ret ?
ret :
"unknown";
30 #define AV_LOG(...) av_log(NULL, AV_LOG_FATAL, __VA_ARGS__)
31 #define ERR_INTERNAL(msg, ...) \
33 AV_LOG(msg, codec->name __VA_ARGS__); \
36 #define ERR(msg) ERR_INTERNAL(msg, )
37 #define ERR_EXT(msg, ...) ERR_INTERNAL(msg, , __VA_ARGS__)
50 AV_LOG(
"Option %s offset %d nonsensical\n",
51 opt->name, opt->offset);
66 int is_decoder = 0, is_encoder = 0;
69 AV_LOG(
"Codec for format %s has no name\n",
77 ERR_EXT(
"Codec %s has unsupported type %s\n",
82 ERR(
"Non-audio codec %s has audio-only fields set\n");
86 ERR(
"Non-audio codec %s has audio-only capabilities set\n");
90 ERR(
"Non-video codec %s has video-only fields set\n");
92 ERR(
"Non-video codec %s exports cropping\n");
96 ERR(
"Codec %s wants mainfunction despite not being "
97 "slice-threading capable");
102 ERR(
"Codec %s has private-only threading support\n");
116 ERR(
"Codec %s has unknown cb_type\n");
121 ERR(
"Codec %s cb_type and av_codec_is_(de|en)coder inconsistent.\n");
124 #define CHECK(TYPE, type) (codec2->cb_type == FF_CODEC_CB_TYPE_ ## TYPE && !codec2->cb.type)
126 CHECK(RECEIVE_PACKET, receive_packet) ||
129 ERR_EXT(
"Codec %s does not implement its %s callback.\n",
130 is_decoder ?
"decoding" :
"encoding");
135 ERR(
"Encoder %s is both subtitle encoder and not subtitle encoder.");
137 ERR(
"Encoder %s has decoder-only thread functions or bsf.\n");
152 ERR(
"Encoder %s has decoder-only capabilities set\n");
155 ERR(
"Frame-threaded encoder %s claims to support flushing\n");
158 ERR(
"Frame-threaded encoder %s claims to have delay\n");
162 ERR(
"EOF_FLUSH encoder %s is not marked as having delay\n");
165 ERR(
"Subtitle decoder %s does not implement decode_sub callback\n");
167 ERR(
"Automatic bitstream filtering unsupported for subtitles; "
168 "yet decoder %s has it set\n");
173 ERR(
"Decoder %s has encoder-only capabilities\n");
176 ERR(
"Decoder %s is marked as setting pkt_dts when it doesn't have"
180 ERR_EXT(
"Private context of codec %s is impossibly-sized (size %d).",
183 ERR(
"Codec %s lacks a corresponding descriptor\n");
184 }
else if (
desc->type != codec->
type)
185 ERR_EXT(
"The type of AVCodec %s and its AVCodecDescriptor differ: "
int(* update_thread_context)(struct AVCodecContext *dst, const struct AVCodecContext *src)
Copy necessary context variables from a previous thread context to the current one.
#define FF_CODEC_CAP_SLICE_THREAD_HAS_MF
Codec initializes slice-based threading with a main function.
#define ENCODE(type, endian, src, dst, n, shift, offset)
Write PCM samples macro.
@ FF_CODEC_CB_TYPE_RECEIVE_PACKET
const AVClass * priv_class
AVClass for the private context.
#define FF_CODEC_CAP_EOF_FLUSH
The encoder has AV_CODEC_CAP_DELAY set, but does not actually have delay - it only wants to be flushe...
int capabilities
Codec capabilities.
@ FF_CODEC_CB_TYPE_ENCODE_SUB
const attribute_deprecated AVRational * supported_framerates
Deprecated codec capabilities.
AVCodec p
The public AVCodec.
const attribute_deprecated int * supported_samplerates
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
#define AV_CODEC_CAP_ENCODER_FLUSH
This encoder can be flushed using avcodec_flush_buffers().
@ FF_CODEC_CB_TYPE_DECODE
#define FF_CODEC_CAP_USES_PROGRESSFRAMES
The decoder might make use of the ProgressFrame API.
int(* update_thread_context_for_user)(struct AVCodecContext *dst, const struct AVCodecContext *src)
Copy variables back to the user-facing context.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
This struct describes the properties of a single codec described by an AVCodecID.
static int priv_data_size_wrong(const FFCodec *codec)
#define AV_CODEC_CAP_OTHER_THREADS
Codec supports multithreading through a method other than slice- or frame-level multithreading.
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
@ FF_CODEC_CB_TYPE_ENCODE
static int receive_frame(AVFilterLink *inlink, AVFrame *out)
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Describe the class of an AVClass context structure.
static const char * get_type_string(enum AVMediaType type)
@ FF_CODEC_CB_TYPE_DECODE_SUB
#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE
Audio encoder supports receiving a different number of samples in each call.
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
int av_codec_is_decoder(const AVCodec *codec)
const attribute_deprecated AVChannelLayout * ch_layouts
Array of supported channel layouts, terminated with a zeroed layout.
attribute_deprecated enum AVPixelFormat * pix_fmts
#define FF_CODEC_CAP_SETS_FRAME_PROPS
Codec handles output frame properties internally instead of letting the internal logic derive them fr...
#define FF_CODEC_CAP_EXPORTS_CROPPING
The decoder sets the cropping fields in the output frames manually.
#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
The decoder extracts and fills its parameters even if the frame is skipped due to the skip_frame sett...
static const av_always_inline FFCodec * ffcodec(const AVCodec *codec)
#define DECODE(size, endian, src, dst, n, shift, offset)
Read PCM samples macro.
static void encode(AVCodecContext *ctx, AVFrame *frame, AVPacket *pkt, FILE *output)
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
int av_codec_is_encoder(const AVCodec *codec)
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
unsigned caps_internal
Internal codec capabilities FF_CODEC_CAP_*.
const char * name
Name of the codec implementation.
#define FF_CODEC_CAP_SETS_PKT_DTS
Decoders marked with FF_CODEC_CAP_SETS_PKT_DTS want to set AVFrame.pkt_dts manually.
attribute_deprecated enum AVSampleFormat * sample_fmts
const AVCodec * av_codec_iterate(void **opaque)
Iterate over all registered codecs.
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
const struct AVOption * option
An array of options for the structure or NULL.
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
@ 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...
const char * bsfs
Decoding only, a comma-separated list of bitstream filters to apply to packets before decoding.
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
#define CHECK(TYPE, type)
#define AV_CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
#define AV_CODEC_CAP_AVOID_PROBING
Decoder is not a preferred choice for probing.
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
#define AV_CODEC_CAP_SMALL_LAST_FRAME
Codec can be fed a final frame with a smaller size.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.