Go to the documentation of this file.
28 return ret ?
ret :
"unknown";
31 #define AV_LOG(...) av_log(NULL, AV_LOG_FATAL, __VA_ARGS__)
32 #define ERR_INTERNAL(msg, ...) \
34 AV_LOG(msg, codec->name __VA_ARGS__); \
37 #define ERR(msg) ERR_INTERNAL(msg, )
38 #define ERR_EXT(msg, ...) ERR_INTERNAL(msg, , __VA_ARGS__)
51 AV_LOG(
"Option %s offset %d nonsensical\n",
52 opt->name, opt->offset);
67 int is_decoder = 0, is_encoder = 0;
70 AV_LOG(
"Codec for format %s has no name\n",
78 ERR_EXT(
"Codec %s has unsupported type %s\n",
83 ERR(
"Non-audio codec %s has audio-only fields set\n");
87 ERR(
"Non-audio codec %s has audio-only capabilities set\n");
91 ERR(
"Non-video codec %s has video-only fields set\n");
93 ERR(
"Non-video codec %s exports cropping\n");
97 ERR(
"Codec %s wants mainfunction despite not being "
98 "slice-threading capable");
103 ERR(
"Codec %s has private-only threading support\n");
117 ERR(
"Codec %s has unknown cb_type\n");
122 ERR(
"Codec %s cb_type and av_codec_is_(de|en)coder inconsistent.\n");
125 #define CHECK(TYPE, type) (codec2->cb_type == FF_CODEC_CB_TYPE_ ## TYPE && !codec2->cb.type)
127 CHECK(RECEIVE_PACKET, receive_packet) ||
130 ERR_EXT(
"Codec %s does not implement its %s callback.\n",
131 is_decoder ?
"decoding" :
"encoding");
136 ERR(
"Encoder %s is both subtitle encoder and not subtitle encoder.");
138 ERR(
"Encoder %s has decoder-only thread functions or bsf.\n");
154 ERR(
"Encoder %s has decoder-only capabilities set\n");
157 ERR(
"Frame-threaded encoder %s claims to support flushing\n");
160 ERR(
"Subtitle decoder %s does not implement decode_sub callback\n");
162 ERR(
"Automatic bitstream filtering unsupported for subtitles; "
163 "yet decoder %s has it set\n");
168 ERR(
"Decoder %s has encoder-only capabilities\n");
171 ERR(
"Decoder %s wants allocated progress without supporting"
175 ERR_EXT(
"Private context of codec %s is impossibly-sized (size %d).",
178 ERR(
"Codec %s lacks a corresponding descriptor\n");
179 }
else if (
desc->type != codec->
type)
180 ERR_EXT(
"The type of AVCodec %s and its AVCodecDescriptor differ: "
const AVChannelLayout * ch_layouts
Array of supported channel layouts, terminated with a zeroed layout.
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.
enum AVPixelFormat * pix_fmts
array of supported pixel formats, or NULL if unknown, array is terminated by -1
int capabilities
Codec capabilities.
@ FF_CODEC_CB_TYPE_ENCODE_SUB
AVCodec p
The public AVCodec.
enum AVSampleFormat * sample_fmts
array of supported sample formats, or NULL if unknown, array is terminated by -1
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
const int * supported_samplerates
array of supported audio samplerates, or NULL if unknown, array is terminated by 0
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)
const AVRational * supported_framerates
array of supported framerates, or NULL if any, array is terminated by {0,0}
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 codec takes the reordered_opaque field from input AVFrames and returns it in the corresponding f...
@ FF_CODEC_CB_TYPE_ENCODE
#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)
static CopyRet receive_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame)
@ 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)
#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_ALLOCATE_PROGRESS
#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.
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
a pointer to the first option specified in the class if any or NULL
@ 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 AV_CODEC_CAP_SUBFRAMES
Codec can output multiple frames per AVPacket Normally demuxers return one frame at a time,...
#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.