FFmpeg
|
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 | 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. | |
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. | |
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 AVFrame audio data and linesize pointers. | |
void | avcodec_flush_buffers (AVCodecContext *avctx) |
Reset the internal decoder state / flush internal buffers. | |
int | av_get_bits_per_sample (enum AVCodecID codec_id) |
Return codec bits per sample. | |
enum AVCodecID | av_get_pcm_codec (enum AVSampleFormat fmt, int be) |
Return the PCM codec associated with a sample format. | |
int | av_get_exact_bits_per_sample (enum AVCodecID codec_id) |
Return codec bits per sample. | |
int | av_get_audio_frame_duration (AVCodecContext *avctx, int frame_bytes) |
Return audio frame duration. | |
void | av_register_bitstream_filter (AVBitStreamFilter *bsf) |
Register a bitstream filter. | |
AVBitStreamFilterContext * | av_bitstream_filter_init (const char *name) |
Create and initialize a bitstream filter context given a bitstream filter name. | |
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) |
Filter bitstream. | |
void | av_bitstream_filter_close (AVBitStreamFilterContext *bsf) |
Release bitstream filter context. | |
AVBitStreamFilter * | av_bitstream_filter_next (AVBitStreamFilter *f) |
If f is NULL, return the first registered bitstream filter, if f is non-NULL, return the next registered bitstream filter after f, or NULL if f is the last one. | |
void | av_fast_padded_malloc (void *ptr, unsigned int *size, size_t min_size) |
Same behaviour av_fast_malloc but the buffer has additional FF_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0. | |
void | av_fast_padded_mallocz (void *ptr, unsigned int *size, size_t min_size) |
Same behaviour av_fast_padded_malloc except that buffer will always be 0-initialized after call. | |
unsigned int | av_xiphlacing (unsigned char *s, unsigned int v) |
Encode extradata length to a buffer. | |
attribute_deprecated void | av_log_missing_feature (void *avc, const char *feature, int want_sample) |
Log a generic warning message about a missing feature. | |
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. | |
attribute_deprecated void void | av_register_hwaccel (AVHWAccel *hwaccel) |
Register the hardware accelerator hwaccel. | |
AVHWAccel * | av_hwaccel_next (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. | |
int | av_lockmgr_register (int(*cb)(void **mutex, enum AVLockOp op)) |
Register a user provided lock manager supporting the operations specified by AVLockOp. | |
enum AVMediaType | avcodec_get_type (enum AVCodecID codec_id) |
Get the type of the given codec. | |
const char * | avcodec_get_name (enum AVCodecID id) |
Get the name of a codec. | |
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. | |
const AVCodecDescriptor * | avcodec_descriptor_get_by_name (const char *name) |
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 | ||
) |
Definition at line 234 of file utils.c.
Referenced by ff_vc1_decode_entry_point(), ff_vc1_decode_sequence_header(), and smvjpeg_decode_frame().
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 2737 of file utils.c.
Referenced by avcodec_string(), init_muxer(), main(), mjpeg_decode_app(), mov_write_hdlr_tag(), print_pix_fmt_fourccs(), rsd_read_header(), and show_stream().
void avcodec_string | ( | char * | buf, |
int | buf_size, | ||
AVCodecContext * | enc, | ||
int | encode | ||
) |
Definition at line 2757 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 | ||
) |
Return a name for the specified profile, if available.
codec | the codec that is searched for the given profile |
profile | the profile value for which a name is requested |
Definition at line 2893 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 1051 of file utils.c.
Referenced by avcodec_get_context_defaults3(), 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 avcodec_get_context_defaults3().
int avcodec_fill_audio_frame | ( | AVFrame * | frame, |
int | nb_channels, | ||
enum AVSampleFormat | sample_fmt, | ||
const uint8_t * | buf, | ||
int | buf_size, | ||
int | align | ||
) |
Fill AVFrame audio data and linesize pointers.
The buffer buf must be a preallocated buffer with a size big enough to contain the specified samples amount. The filled AVFrame data pointers will point to this buffer.
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 462 of file utils.c.
Referenced by audio_encode_example(), avcodec_encode_audio(), and write_audio_frame().
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 2934 of file utils.c.
Referenced by get_video_frame(), rewind_file(), 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 3019 of file utils.c.
Referenced by adpcm_encode_init(), aiff_write_header(), avcodec_encode_audio(), avformat_find_stream_info(), caf_write_header(), epaf_read_header(), 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(), iff_read_header(), init_muxer(), ircam_read_header(), mkv_write_tracks(), 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(), pulse_read_header(), read_header(), rso_read_header(), and show_stream().
enum AVCodecID av_get_pcm_codec | ( | enum AVSampleFormat | fmt, |
int | be | ||
) |
Return the PCM codec associated with a sample format.
be | endianness, 0 for little, 1 for big, -1 (or anything else) for native |
Definition at line 2998 of file utils.c.
Referenced by lavfi_read_header(), and main().
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 2948 of file utils.c.
Referenced by av_get_audio_frame_duration(), av_get_bits_per_sample(), and new_output_stream().
int av_get_audio_frame_duration | ( | AVCodecContext * | avctx, |
int | frame_bytes | ||
) |
Return audio frame duration.
avctx | codec context |
frame_bytes | size of the frame, or 0 if unknown |
Definition at line 3037 of file utils.c.
Referenced by adp_read_header(), build_frame_code(), do_streamcopy(), ff_get_audio_frame_size(), ff_parse_specific_params(), ff_put_wav_header(), get_aiff_header(), rsd_read_header(), rtp_send_ilbc(), and rtp_write_header().
void av_register_bitstream_filter | ( | AVBitStreamFilter * | bsf | ) |
Register a bitstream filter.
The filter will be accessible to the application code through av_bitstream_filter_next() or can be directly initialized with av_bitstream_filter_init().
Definition at line 37 of file bitstream_filter.c.
AVBitStreamFilterContext* av_bitstream_filter_init | ( | const char * | name | ) |
Create and initialize a bitstream filter context given a bitstream filter name.
The returned context must be freed with av_bitstream_filter_close().
name | the name of the bitstream filter |
Definition at line 44 of file bitstream_filter.c.
Referenced by init(), new_output_stream(), parse_bsfs(), and Stagefright_init().
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 | ||
) |
Filter bitstream.
This function filters the buffer buf with size buf_size, and places the filtered buffer in the buffer pointed to by poutbuf.
The output buffer must be freed by the caller.
bsfc | bitstream filter context created by av_bitstream_filter_init() |
avctx | AVCodecContext accessed by the filter, may be NULL. If specified, this must point to the encoder context of the output stream the packet is sent to. |
args | arguments which specify the filter configuration, may be NULL |
poutbuf | pointer which is updated to point to the filtered buffer |
poutbuf_size | pointer which is updated to the filtered buffer size in bytes |
buf | buffer containing the data to filter |
buf_size | size in bytes of buf |
keyframe | set to non-zero if the buffer to filter corresponds to a key-frame packet data |
If the return value is positive, an output buffer is allocated and is availble in *poutbuf, and is distinct from the input buffer.
If the return value is 0, the output buffer is not allocated and should be considered identical to the input buffer, or in case *poutbuf was set it points to the input buffer (not necessarily to its starting address).
Definition at line 73 of file bitstream_filter.c.
Referenced by decode(), filter_packet(), init(), Stagefright_decode_frame(), and write_frame().
void av_bitstream_filter_close | ( | AVBitStreamFilterContext * | bsf | ) |
Release bitstream filter context.
bsf | the bitstream filter context created with av_bitstream_filter_init(), can be NULL |
Definition at line 62 of file bitstream_filter.c.
Referenced by close_slaves(), ffmpeg_cleanup(), Stagefright_close(), Stagefright_init(), and uninit().
AVBitStreamFilter* av_bitstream_filter_next | ( | AVBitStreamFilter * | f | ) |
If f is NULL, return the first registered bitstream filter, if f is non-NULL, return the next registered bitstream filter after f, or NULL if f is the last one.
This function can be used to iterate over all registered bitstream filters.
Definition at line 29 of file bitstream_filter.c.
Referenced by show_bsfs().
Same behaviour av_fast_malloc but the buffer has additional FF_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0.
In addition the whole buffer will initially and after resizes be 0-initialized so that no uninitialized data will ever appear.
Definition at line 153 of file utils.c.
Referenced by allocate_buffers(), allocate_buffers2(), ape_decode_frame(), cdxl_decode_frame(), cllc_decode_frame(), decode_block(), decode_frame(), decode_i_frame(), decode_p_frame(), deinvert_buffer(), ebml_read_binary(), encode_frame(), ff_alloc_packet2(), ff_h264_decode_nal(), ff_mjpeg_find_marker(), ff_mpeg4_frame_end(), init_buffers(), mimic_decode_frame(), mp_decode_frame(), mpc7_decode_frame(), parse_picture_segment(), svq3_decode_frame(), tqi_decode_frame(), utvideo_encode_frame(), wavpack_encode_block(), wavpack_encode_frame(), and wv_stereo().
Same behaviour av_fast_padded_malloc except that buffer will always be 0-initialized after call.
Definition at line 165 of file utils.c.
Referenced by decode_frame(), and encode_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 3210 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 FFmpeg (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 verbage 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 FFmpeg (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 |
Referenced by av_log_missing_feature().
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 3272 of file utils.c.
Referenced by ff_find_hwaccel().
Register a user provided lock manager supporting the operations specified by AVLockOp.
mutex points to a (void *) where the lockmgr should store/get a pointer to a user allocated mutex. It's NULL upon AV_LOCK_CREATE and != NULL for all other ops.
cb | User defined callback. Note: FFmpeg may invoke calls to this callback during the call to av_lockmgr_register(). Thus, the application must be prepared to handle that. If cb is set to NULL the lockmgr will be unregistered. Also note that during unregistration the previously registered lockmgr callback may also be invoked. |
enum AVMediaType avcodec_get_type | ( | enum AVCodecID | codec_id | ) |
Get the type of the given codec.
Definition at line 3442 of file utils.c.
Referenced by mkv_query_codec().
const char* avcodec_get_name | ( | enum AVCodecID | id | ) |
Get the name of a codec.
Definition at line 2717 of file utils.c.
Referenced by add_stream(), avcodec_string(), avformat_find_stream_info(), device_try_init(), filter_packet(), flv_write_header(), flv_write_packet(), get_audio_flags(), init_input_stream(), log_slave(), mkv_write_codecprivate(), mkv_write_header(), mov_write_header(), mpeg_mux_init(), mxf_parse_structural_metadata(), read_frame_internal(), rtp_write_header(), srt_write_header(), and transcode_init().
int avcodec_is_open | ( | AVCodecContext * | s | ) |
Definition at line 3462 of file utils.c.
Referenced by avcodec_close(), avcodec_copy_context(), avcodec_open2(), ff_mp4_read_dec_config_descr(), mpegts_find_stream_type(), mpegts_set_stream_info(), and try_decode_frame().
int av_codec_is_encoder | ( | const AVCodec * | codec | ) |
Definition at line 201 of file utils.c.
Referenced by alloc_frame_buffer(), avcodec_close(), avcodec_find_encoder_by_name(), avcodec_open2(), ff_jpeg2000_init_component(), find_encdec(), next_codec_for_id(), and print_codec().
int av_codec_is_decoder | ( | const AVCodec * | codec | ) |
Definition at line 206 of file utils.c.
Referenced by avcodec_find_decoder_by_name(), avcodec_open2(), find_encdec(), and next_codec_for_id().
const AVCodecDescriptor* avcodec_descriptor_get | ( | enum AVCodecID | id | ) |
Definition at line 2641 of file codec_desc.c.
Referenced by avcodec_get_name(), avcodec_open2(), is_intra_only(), and show_help_muxer().
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 2651 of file codec_desc.c.
Referenced by avcodec_descriptor_get_by_name(), and get_codecs_sorted().
const AVCodecDescriptor* avcodec_descriptor_get_by_name | ( | const char * | name | ) |
Definition at line 2660 of file codec_desc.c.
Referenced by find_codec_or_die(), and show_help_codec().