Libav
|
Miscellaneous utility functions related to both encoding and decoding (or neither). More...
Modules | |
Pixel formats | |
Functions for working with pixel formats. | |
FFT functions | |
Data Structures | |
struct | AVBitStreamFilterContext |
struct | AVBSFContext |
The bitstream filter state. More... | |
struct | AVBitStreamFilter |
Enumerations | |
enum | AVLockOp { AV_LOCK_CREATE, AV_LOCK_OBTAIN, AV_LOCK_RELEASE, AV_LOCK_DESTROY } |
Lock operation used by lockmgr. More... | |
Functions | |
attribute_deprecated void | avcodec_set_dimensions (AVCodecContext *s, int width, int height) |
size_t | av_get_codec_tag_string (char *buf, size_t buf_size, unsigned int codec_tag) |
Put a string representing the codec tag codec_tag in buf. More... | |
void | avcodec_string (char *buf, int buf_size, AVCodecContext *enc, int encode) |
const char * | av_get_profile_name (const AVCodec *codec, int profile) |
Return a name for the specified profile, if available. More... | |
const char * | avcodec_profile_name (enum AVCodecID codec_id, int profile) |
Return a name for the specified profile, if available. More... | |
int | avcodec_default_execute (AVCodecContext *c, int(*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size) |
int | avcodec_default_execute2 (AVCodecContext *c, int(*func)(AVCodecContext *c2, void *arg2, int, int), void *arg, int *ret, int count) |
int | avcodec_fill_audio_frame (AVFrame *frame, int nb_channels, enum AVSampleFormat sample_fmt, const uint8_t *buf, int buf_size, int align) |
Fill audio frame data and linesize. More... | |
void | avcodec_flush_buffers (AVCodecContext *avctx) |
Reset the internal decoder state / flush internal buffers. More... | |
int | av_get_bits_per_sample (enum AVCodecID codec_id) |
Return codec bits per sample. More... | |
int | av_get_exact_bits_per_sample (enum AVCodecID codec_id) |
Return codec bits per sample. More... | |
int | av_get_audio_frame_duration (AVCodecContext *avctx, int frame_bytes) |
Return audio frame duration. More... | |
int | av_get_audio_frame_duration2 (AVCodecParameters *par, int frame_bytes) |
This function is the same as av_get_audio_frame_duration(), except it works with AVCodecParameters instead of an AVCodecContext. More... | |
attribute_deprecated void | av_register_bitstream_filter (AVBitStreamFilter *bsf) |
attribute_deprecated AVBitStreamFilterContext * | av_bitstream_filter_init (const char *name) |
attribute_deprecated int | av_bitstream_filter_filter (AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe) |
attribute_deprecated void | av_bitstream_filter_close (AVBitStreamFilterContext *bsf) |
attribute_deprecated AVBitStreamFilter * | av_bitstream_filter_next (const AVBitStreamFilter *f) |
const AVBitStreamFilter * | av_bsf_get_by_name (const char *name) |
const AVBitStreamFilter * | av_bsf_next (void **opaque) |
Iterate over all registered bitstream filters. More... | |
int | av_bsf_alloc (const AVBitStreamFilter *filter, AVBSFContext **ctx) |
Allocate a context for a given bitstream filter. More... | |
int | av_bsf_init (AVBSFContext *ctx) |
Prepare the filter for use, after all the parameters and options have been set. More... | |
int | av_bsf_send_packet (AVBSFContext *ctx, AVPacket *pkt) |
Submit a packet for filtering. More... | |
int | av_bsf_receive_packet (AVBSFContext *ctx, AVPacket *pkt) |
Retrieve a filtered packet. More... | |
void | av_bsf_free (AVBSFContext **ctx) |
Free a bitstream filter context and everything associated with it; write NULL into the supplied pointer. More... | |
const AVClass * | av_bsf_get_class (void) |
Get the AVClass for AVBSFContext. More... | |
void | av_fast_padded_malloc (void *ptr, unsigned int *size, size_t min_size) |
Allocate a buffer with padding, reusing the given one if large enough. More... | |
unsigned int | av_xiphlacing (unsigned char *s, unsigned int v) |
Encode extradata length to a buffer. More... | |
attribute_deprecated void | av_log_missing_feature (void *avc, const char *feature, int want_sample) |
Log a generic warning message about a missing feature. More... | |
attribute_deprecated void | av_log_ask_for_sample (void *avc, const char *msg,...) av_printf_format(2 |
Log a generic warning message asking for a sample. More... | |
attribute_deprecated void void | av_register_hwaccel (AVHWAccel *hwaccel) |
Register the hardware accelerator hwaccel. More... | |
AVHWAccel * | av_hwaccel_next (const AVHWAccel *hwaccel) |
If hwaccel is NULL, returns the first registered hardware accelerator, if hwaccel is non-NULL, returns the next registered hardware accelerator after hwaccel, or NULL if hwaccel is the last one. More... | |
int | av_lockmgr_register (int(*cb)(void **mutex, enum AVLockOp op)) |
Register a user provided lock manager supporting the operations specified by AVLockOp. More... | |
enum AVMediaType | avcodec_get_type (enum AVCodecID codec_id) |
Get the type of the given codec. More... | |
int | avcodec_is_open (AVCodecContext *s) |
int | av_codec_is_encoder (const AVCodec *codec) |
int | av_codec_is_decoder (const AVCodec *codec) |
const AVCodecDescriptor * | avcodec_descriptor_get (enum AVCodecID id) |
const AVCodecDescriptor * | avcodec_descriptor_next (const AVCodecDescriptor *prev) |
Iterate over all codec descriptors known to libavcodec. More... | |
const AVCodecDescriptor * | avcodec_descriptor_get_by_name (const char *name) |
AVCPBProperties * | av_cpb_properties_alloc (size_t *size) |
Allocate a CPB properties structure and initialize its fields to default values. More... | |
Miscellaneous utility functions related to both encoding and decoding (or neither).
enum AVLockOp |
attribute_deprecated void avcodec_set_dimensions | ( | AVCodecContext * | s, |
int | width, | ||
int | height | ||
) |
size_t av_get_codec_tag_string | ( | char * | buf, |
size_t | buf_size, | ||
unsigned int | codec_tag | ||
) |
Put a string representing the codec tag codec_tag in buf.
buf | buffer to place codec tag in |
buf_size | size in bytes of buf |
codec_tag | codec tag to assign |
Definition at line 2071 of file utils.c.
Referenced by avcodec_string(), avi_read_header(), control_port_cb(), ffmmal_init_decoder(), ffmmal_read_frame(), init_muxer(), matroska_parse_tracks(), mov_write_hdlr_tag(), parse_pixel_format(), and show_stream().
void avcodec_string | ( | char * | buf, |
int | buf_size, | ||
AVCodecContext * | enc, | ||
int | encode | ||
) |
Definition at line 2091 of file utils.c.
Referenced by avformat_find_stream_info(), and dump_stream_format().
const char* av_get_profile_name | ( | const AVCodec * | codec, |
int | profile | ||
) |
const char* avcodec_profile_name | ( | enum AVCodecID | codec_id, |
int | profile | ||
) |
Return a name for the specified profile, if available.
codec_id | the ID of the codec to which the requested profile belongs |
profile | the profile value for which a name is requested |
Definition at line 2254 of file utils.c.
Referenced by avcodec_string(), and show_stream().
int avcodec_default_execute | ( | AVCodecContext * | c, |
int(*)(AVCodecContext *c2, void *arg2) | func, | ||
void * | arg, | ||
int * | ret, | ||
int | count, | ||
int | size | ||
) |
Definition at line 703 of file utils.c.
Referenced by init_context_defaults(), and thread_execute().
int avcodec_default_execute2 | ( | AVCodecContext * | c, |
int(*)(AVCodecContext *c2, void *arg2, int, int) | func, | ||
void * | arg, | ||
int * | ret, | ||
int | count | ||
) |
Referenced by init_context_defaults().
int avcodec_fill_audio_frame | ( | AVFrame * | frame, |
int | nb_channels, | ||
enum AVSampleFormat | sample_fmt, | ||
const uint8_t * | buf, | ||
int | buf_size, | ||
int | align | ||
) |
Fill audio frame data and linesize.
AVFrame extended_data channel pointers are allocated if necessary for planar audio.
frame | the AVFrame frame->nb_samples must be set prior to calling the function. This function fills in frame->data, frame->extended_data, frame->linesize[0]. |
nb_channels | channel count |
sample_fmt | sample format |
buf | buffer to use for frame data |
buf_size | size of buffer |
align | plane size sample alignment (0 = default) |
Definition at line 300 of file utils.c.
Referenced by audio_encode_example().
void avcodec_flush_buffers | ( | AVCodecContext * | avctx | ) |
Reset the internal decoder state / flush internal buffers.
Should be called e.g. when seeking or when switching to a different stream.
Definition at line 2285 of file utils.c.
Referenced by audio_decode_frame(), get_video_frame(), seek_to_start(), and subtitle_thread().
int av_get_bits_per_sample | ( | enum AVCodecID | codec_id | ) |
Return codec bits per sample.
[in] | codec_id | the codec |
Definition at line 2348 of file utils.c.
Referenced by adpcm_encode_init(), aiff_write_header(), avformat_find_stream_info(), ff_alsa_open(), ff_audio_interleave_init(), ff_pcm_read_seek(), ff_put_wav_header(), ff_voc_get_packet(), g722_read_header(), get_aiff_header(), get_bit_rate(), gxf_packet(), init_muxer(), mkv_write_track(), mov_get_codec_tag(), mov_parse_stsd_audio(), mov_write_audio_tag(), mov_write_header(), mxf_set_audio_pts(), mxf_write_generic_sound_common(), oma_read_header(), pcm_decode_frame(), pcm_decode_init(), pcm_encode_frame(), pcm_encode_init(), pcm_read_header(), pcm_read_packet(), pulse_read_header(), rso_read_header(), rso_read_packet(), show_stream(), and smjpeg_write_header().
int av_get_exact_bits_per_sample | ( | enum AVCodecID | codec_id | ) |
Return codec bits per sample.
Only return non-zero if the bits per sample is exactly correct, not an approximation.
[in] | codec_id | the codec |
Definition at line 2302 of file utils.c.
Referenced by av_get_bits_per_sample(), and get_audio_frame_duration().
int av_get_audio_frame_duration | ( | AVCodecContext * | avctx, |
int | frame_bytes | ||
) |
int av_get_audio_frame_duration2 | ( | AVCodecParameters * | par, |
int | frame_bytes | ||
) |
This function is the same as av_get_audio_frame_duration(), except it works with AVCodecParameters instead of an AVCodecContext.
Definition at line 2515 of file utils.c.
Referenced by build_frame_code(), ff_compute_frame_duration(), ff_parse_specific_params(), ff_put_wav_header(), get_aiff_header(), mpegts_write_header(), rm_write_header(), rtp_send_ilbc(), rv10_write_header(), and swf_write_audio().
attribute_deprecated void av_register_bitstream_filter | ( | AVBitStreamFilter * | bsf | ) |
Use the new bitstream filtering API (using AVBSFContext).
Definition at line 42 of file bitstream_filter.c.
attribute_deprecated AVBitStreamFilterContext* av_bitstream_filter_init | ( | const char * | name | ) |
Definition at line 50 of file bitstream_filter.c.
attribute_deprecated int av_bitstream_filter_filter | ( | AVBitStreamFilterContext * | bsfc, |
AVCodecContext * | avctx, | ||
const char * | args, | ||
uint8_t ** | poutbuf, | ||
int * | poutbuf_size, | ||
const uint8_t * | buf, | ||
int | buf_size, | ||
int | keyframe | ||
) |
Definition at line 91 of file bitstream_filter.c.
attribute_deprecated void av_bitstream_filter_close | ( | AVBitStreamFilterContext * | bsf | ) |
Definition at line 82 of file bitstream_filter.c.
attribute_deprecated AVBitStreamFilter* av_bitstream_filter_next | ( | const AVBitStreamFilter * | f | ) |
Definition at line 31 of file bitstream_filter.c.
const AVBitStreamFilter* av_bsf_get_by_name | ( | const char * | name | ) |
Definition at line 53 of file bitstream_filters.c.
Referenced by av_bitstream_filter_init(), init_bsf(), new_output_stream(), and qsv_init_bsf().
const AVBitStreamFilter* av_bsf_next | ( | void ** | opaque | ) |
Iterate over all registered bitstream filters.
opaque | a pointer where libavcodec will store the iteration state. Must point to NULL to start the iteration. |
Definition at line 42 of file bitstream_filters.c.
Referenced by av_bitstream_filter_next(), and show_bsfs().
int av_bsf_alloc | ( | const AVBitStreamFilter * | filter, |
AVBSFContext ** | ctx | ||
) |
Allocate a context for a given bitstream filter.
The caller must fill in the context parameters as described in the documentation and then call av_bsf_init() before sending any data to the filter.
filter | the filter for which to allocate an instance. |
ctx | a pointer into which the pointer to the newly-allocated context will be written. It must be freed with av_bsf_free() after the filtering is done. |
Definition at line 79 of file bsf.c.
Referenced by av_bitstream_filter_filter(), init_bsf(), init_output_bsfs(), and qsv_init_bsf().
int av_bsf_init | ( | AVBSFContext * | ctx | ) |
Prepare the filter for use, after all the parameters and options have been set.
Definition at line 132 of file bsf.c.
Referenced by av_bitstream_filter_filter(), init_bsf(), init_output_bsfs(), and qsv_init_bsf().
int av_bsf_send_packet | ( | AVBSFContext * | ctx, |
AVPacket * | pkt | ||
) |
Submit a packet for filtering.
After sending each packet, the filter must be completely drained by calling av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or AVERROR_EOF.
pkt | the packet to filter. The bitstream filter will take ownership of the packet and reset the contents of pkt. pkt is not touched if an error occurs. This parameter may be NULL, which signals the end of the stream (i.e. no more packets will be sent). That will cause the filter to output any packets it may have buffered internally. |
Definition at line 173 of file bsf.c.
Referenced by av_bitstream_filter_filter(), output_packet(), qsv_decode_frame(), and svc_decode_frame().
int av_bsf_receive_packet | ( | AVBSFContext * | ctx, |
AVPacket * | pkt | ||
) |
Retrieve a filtered packet.
[out] | pkt | this struct will be filled with the contents of the filtered packet. It is owned by the caller and must be freed using av_packet_unref() when it is no longer needed. This parameter should be "clean" (i.e. freshly allocated with av_packet_alloc() or unreffed with av_packet_unref()) when this function is called. If this function returns successfully, the contents of pkt will be completely overwritten by the returned data. On failure, pkt is not touched. |
Definition at line 194 of file bsf.c.
Referenced by av_bitstream_filter_filter(), output_packet(), qsv_decode_frame(), and svc_decode_frame().
void av_bsf_free | ( | AVBSFContext ** | ctx | ) |
Free a bitstream filter context and everything associated with it; write NULL into the supplied pointer.
Definition at line 33 of file bsf.c.
Referenced by av_bitstream_filter_close(), av_bitstream_filter_init(), av_bsf_alloc(), avconv_cleanup(), qsv_clear_buffers(), and svc_decode_close().
Get the AVClass for AVBSFContext.
It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options.
Allocate a buffer with padding, reusing the given one if large enough.
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_PADDING_SIZE at the end which will always memset to 0.
Definition at line 60 of file utils.c.
Referenced by cdxl_decode_frame(), cllc_decode_frame(), decode_block(), decode_frame(), ff_mjpeg_find_marker(), init_buffers(), mimic_decode_frame(), mpc7_decode_frame(), svq1_decode_frame(), and tqi_decode_frame().
unsigned int av_xiphlacing | ( | unsigned char * | s, |
unsigned int | v | ||
) |
Encode extradata length to a buffer.
Used by xiph codecs.
s | buffer to write to; must be at least (v/255+1) bytes long |
v | size of extradata in bytes |
Definition at line 2531 of file utils.c.
Referenced by fixup_vorbis_headers(), libvorbis_encode_init(), parse_packed_headers(), and put_main_header().
attribute_deprecated void av_log_missing_feature | ( | void * | avc, |
const char * | feature, | ||
int | want_sample | ||
) |
Log a generic warning message about a missing feature.
This function is intended to be used internally by Libav (libavcodec, libavformat, etc.) only, and would normally not be used by applications.
[in] | avc | a pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct |
[in] | feature | string containing the name of the missing feature |
[in] | want_sample | indicates if samples are wanted which exhibit this feature. If want_sample is non-zero, additional verbiage will be added to the log message which tells the user how to report samples to the development mailing list. |
attribute_deprecated void av_log_ask_for_sample | ( | void * | avc, |
const char * | msg, | ||
... | |||
) |
Log a generic warning message asking for a sample.
This function is intended to be used internally by Libav (libavcodec, libavformat, etc.) only, and would normally not be used by applications.
[in] | avc | a pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct |
[in] | msg | string containing an optional message, or NULL if no message |
attribute_deprecated void void av_register_hwaccel | ( | AVHWAccel * | hwaccel | ) |
If hwaccel is NULL, returns the first registered hardware accelerator, if hwaccel is non-NULL, returns the next registered hardware accelerator after hwaccel, or NULL if hwaccel is the last one.
Definition at line 2592 of file utils.c.
Referenced by find_hwaccel().
Register a user provided lock manager supporting the operations specified by AVLockOp.
The "mutex" argument to the function points to a (void *) where the lockmgr should store/get a pointer to a user allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the value left by the last call for all other ops. If the lock manager is unable to perform the op then it should leave the mutex in the same state as when it was called and return a non-zero value. However, when called with AV_LOCK_DESTROY the mutex will always be assumed to have been successfully destroyed. If av_lockmgr_register succeeds it will return a non-negative value, if it fails it will return a negative value and destroy all mutex and unregister all callbacks. av_lockmgr_register is not thread-safe, it must be called from a single thread before any calls which make use of locking are used.
cb | User defined callback. av_lockmgr_register invokes calls to this callback and the previously registered callback. The callback will be used to create more than one mutex each of which must be backed by its own underlying locking mechanism (i.e. do not use a single static object to implement your lock manager). If cb is set to NULL the lockmgr will be unregistered. |
enum AVMediaType avcodec_get_type | ( | enum AVCodecID | codec_id | ) |
Get the type of the given codec.
Definition at line 2491 of file codec_desc.c.
Referenced by m4sl_cb(), and mkv_query_codec().
int avcodec_is_open | ( | AVCodecContext * | s | ) |
Definition at line 2702 of file utils.c.
Referenced by avcodec_close(), avcodec_copy_context(), avcodec_open2(), avcodec_receive_frame(), avcodec_receive_packet(), avcodec_send_frame(), avcodec_send_packet(), and try_decode_frame().
int av_codec_is_encoder | ( | const AVCodec * | codec | ) |
Definition at line 96 of file utils.c.
Referenced by alloc_frame_buffer(), avcodec_close(), avcodec_find_encoder_by_name(), avcodec_open2(), avcodec_receive_packet(), avcodec_send_frame(), find_encdec(), init_band_stepsize(), next_codec_for_id(), and print_codec().
int av_codec_is_decoder | ( | const AVCodec * | codec | ) |
Definition at line 101 of file utils.c.
Referenced by avcodec_find_decoder_by_name(), avcodec_open2(), avcodec_receive_frame(), avcodec_send_packet(), find_encdec(), and next_codec_for_id().
const AVCodecDescriptor* avcodec_descriptor_get | ( | enum AVCodecID | id | ) |
Definition at line 2462 of file codec_desc.c.
Referenced by asf_write_header1(), av_bsf_init(), avcodec_get_type(), avcodec_profile_name(), avcodec_string(), build_frame_code(), get_sockaddr(), init_muxer(), is_intra_only(), list_formats(), show_help_muxer(), show_stream(), transcode_init(), unsupported_codec(), vaapi_build_decoder_config(), wav_write_header(), and write_streamheader().
const AVCodecDescriptor* avcodec_descriptor_next | ( | const AVCodecDescriptor * | prev | ) |
Iterate over all codec descriptors known to libavcodec.
prev | previous descriptor. NULL to get the first descriptor. |
Definition at line 2472 of file codec_desc.c.
Referenced by avcodec_descriptor_get_by_name(), print_codecs(), and show_codecs().
const AVCodecDescriptor* avcodec_descriptor_get_by_name | ( | const char * | name | ) |
Definition at line 2481 of file codec_desc.c.
Referenced by find_codec_or_die(), and show_help_codec().
AVCPBProperties* av_cpb_properties_alloc | ( | size_t * | size | ) |
Allocate a CPB properties structure and initialize its fields to default values.
size | if non-NULL, the size of the allocated struct will be written here. This is useful for embedding it in side data. |
Definition at line 2740 of file utils.c.
Referenced by ff_add_cpb_side_data(), and ff_mpv_encode_picture().