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 |
Typedefs | |
typedef struct AVBitStreamFilterContext | AVBitStreamFilterContext |
typedef struct AVBitStreamFilter | AVBitStreamFilter |
Enumerations | |
enum | AVLockOp { AV_LOCK_CREATE, AV_LOCK_OBTAIN, AV_LOCK_RELEASE, AV_LOCK_DESTROY } |
Lock operation used by lockmgr. More... | |
Functions | |
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... | |
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. More... | |
void | avcodec_flush_buffers (AVCodecContext *avctx) |
Flush buffers, should be called when seeking or when switching to a different stream. More... | |
int | av_get_bits_per_sample (enum AVCodecID codec_id) |
Return codec bits per sample. More... | |
enum AVCodecID | av_get_pcm_codec (enum AVSampleFormat fmt, int be) |
Return the PCM codec associated with a sample format. 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... | |
void | av_register_bitstream_filter (AVBitStreamFilter *bsf) |
AVBitStreamFilterContext * | av_bitstream_filter_init (const char *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) |
void | av_bitstream_filter_close (AVBitStreamFilterContext *bsf) |
AVBitStreamFilter * | av_bitstream_filter_next (AVBitStreamFilter *f) |
void * | av_fast_realloc (void *ptr, unsigned int *size, size_t min_size) |
Reallocate the given block if it is not large enough, otherwise do nothing. More... | |
void | av_fast_malloc (void *ptr, unsigned int *size, size_t min_size) |
Allocate a buffer, reusing the given one if large enough. More... | |
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 will always be 0. More... | |
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. More... | |
unsigned int | av_xiphlacing (unsigned char *s, unsigned int v) |
Encode extradata length to a buffer. More... | |
void | av_register_hwaccel (AVHWAccel *hwaccel) |
Register the hardware accelerator hwaccel. More... | |
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. 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... | |
const char * | avcodec_get_name (enum AVCodecID id) |
Get the name of a 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) |
Detailed Description
Miscellaneous utility functions related to both encoding and decoding (or neither).
Typedef Documentation
typedef struct AVBitStreamFilter AVBitStreamFilter |
typedef struct AVBitStreamFilterContext AVBitStreamFilterContext |
Enumeration Type Documentation
enum AVLockOp |
Lock operation used by lockmgr.
Enumerator | |
---|---|
AV_LOCK_CREATE |
Create a mutex. |
AV_LOCK_OBTAIN |
Lock the mutex. |
AV_LOCK_RELEASE |
Unlock the mutex. |
AV_LOCK_DESTROY |
Free mutex resources. |
Definition at line 4649 of file libavcodec/avcodec.h.
Function Documentation
void av_bitstream_filter_close | ( | AVBitStreamFilterContext * | bsf | ) |
Definition at line 53 of file bitstream_filter.c.
Referenced by exit_program(), Stagefright_close(), Stagefright_init(), and uninit().
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 61 of file bitstream_filter.c.
Referenced by decode(), init(), Stagefright_decode_frame(), and write_frame().
AVBitStreamFilterContext* av_bitstream_filter_init | ( | const char * | name | ) |
Definition at line 38 of file bitstream_filter.c.
Referenced by init(), new_output_stream(), and Stagefright_init().
AVBitStreamFilter* av_bitstream_filter_next | ( | AVBitStreamFilter * | f | ) |
Definition at line 28 of file bitstream_filter.c.
Referenced by show_bsfs().
int av_codec_is_decoder | ( | const AVCodec * | codec | ) |
- Returns
- a non-zero number if codec is a decoder, zero otherwise
Definition at line 153 of file libavcodec/utils.c.
Referenced by avcodec_find_decoder_by_name(), avcodec_open2(), find_encdec(), and next_codec_for_id().
int av_codec_is_encoder | ( | const AVCodec * | codec | ) |
- Returns
- a non-zero number if codec is an encoder, zero otherwise
Definition at line 148 of file libavcodec/utils.c.
Referenced by avcodec_close(), avcodec_find_encoder_by_name(), avcodec_open2(), find_encdec(), next_codec_for_id(), and print_codec().
Allocate a buffer, reusing the given one if large enough.
Contrary to av_fast_realloc the current buffer contents might not be preserved and on error the old buffer is freed, thus no special handling to avoid memleaks is necessary.
- Parameters
-
ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer size size of the buffer *ptr points to min_size minimum size of *ptr buffer after returning, *ptr will be NULL and *size 0 if an error occurred.
Definition at line 96 of file libavcodec/utils.c.
Referenced by allocate_buffers(), ape_decode_frame(), audio_decode_frame(), codec_reinit(), dca_decode_frame(), decode_8(), decode_frame(), decode_i_frame(), decode_p_frame(), ff_h263_decode_frame(), ff_id3v2_parse(), ff_mpeg_update_thread_context(), gif_decode_frame(), gif_read_image(), ljpeg_decode_rgb_scan(), mp_decode_frame(), parse_picture_segment(), pmp_packet(), reconfigure_at_keyframe(), spdif_header_dts4(), spdif_write_packet(), submit_packet(), svq3_decode_frame(), tak_decode_frame(), truemotion1_decode_header(), truemotion1_decode_init(), update_md5_sum(), and utvideo_encode_frame().
Same behaviour av_fast_malloc but the buffer has additional FF_INPUT_BUFFER_PADDING_SIZE at the end which will 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 101 of file libavcodec/utils.c.
Referenced by cdxl_decode_frame(), cllc_decode_frame(), decode_block(), decode_frame(), ebml_read_binary(), encode_frame(), ff_alloc_packet2(), ff_h264_decode_nal(), ff_mjpeg_find_marker(), init_buffers(), mimic_decode_frame(), mpc7_decode_frame(), tiff_unpack_strip(), and tqi_decode_frame().
Same behaviour av_fast_padded_malloc except that buffer will always be 0-initialized after call.
Definition at line 113 of file libavcodec/utils.c.
Referenced by encode_frame().
Reallocate the given block if it is not large enough, otherwise do nothing.
- See also
- av_realloc
Definition at line 63 of file libavcodec/utils.c.
Referenced by caf_write_packet(), decode_frame(), dirac_combine_frame(), ff_add_index_entry(), ff_af_queue_add(), ff_combine_frame(), ff_mms_asf_header_parser(), ff_subtitles_queue_insert(), ff_thread_release_buffer(), ff_vaapi_alloc_slice(), ff_vaapi_commit_slices(), ff_vdpau_add_buffer(), ff_vdpau_add_data_chunk(), flac_fifo_read_wrap(), get_stats(), mxg_update_cache(), read_frame(), shorten_decode_frame(), spdif_header_eac3(), and vda_h264_decode_slice().
int av_get_audio_frame_duration | ( | AVCodecContext * | avctx, |
int | frame_bytes | ||
) |
Return audio frame duration.
- Parameters
-
avctx codec context frame_bytes size of the frame, or 0 if unknown
- Returns
- frame duration, in samples, if known. 0 if not able to determine.
Definition at line 2708 of file libavcodec/utils.c.
Referenced by build_frame_code(), do_streamcopy(), ff_get_audio_frame_size(), get_aiff_header(), rtp_send_ilbc(), and rtp_write_header().
int av_get_bits_per_sample | ( | enum AVCodecID | codec_id | ) |
Return codec bits per sample.
- Parameters
-
[in] codec_id the codec
- Returns
- Number of bits per sample or zero if unknown for the given codec.
Definition at line 2690 of file libavcodec/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_mov_read_stsd_entries(), ff_pcm_read_seek(), 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_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().
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.
- Parameters
-
buf_size size in bytes of buf
- Returns
- the length of the string that would have been generated if enough space had been available, excluding the trailing null
Definition at line 2436 of file libavcodec/utils.c.
Referenced by avcodec_string(), init_muxer(), main(), print_pix_fmt_fourccs(), and show_stream().
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.
- Parameters
-
[in] codec_id the codec
- Returns
- Number of bits per sample or zero if unknown for the given codec.
Definition at line 2619 of file libavcodec/utils.c.
Referenced by av_get_audio_frame_duration(), av_get_bits_per_sample(), and new_output_stream().
enum AVCodecID av_get_pcm_codec | ( | enum AVSampleFormat | fmt, |
int | be | ||
) |
Return the PCM codec associated with a sample format.
- Parameters
-
be endianness, 0 for little, 1 for big, -1 (or anything else) for native
- Returns
- AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE
Definition at line 2669 of file libavcodec/utils.c.
Referenced by lavfi_read_header().
const char* av_get_profile_name | ( | const AVCodec * | codec, |
int | profile | ||
) |
Return a name for the specified profile, if available.
- Parameters
-
codec the codec that is searched for the given profile profile the profile value for which a name is requested
- Returns
- A name for the profile if found, NULL otherwise.
Definition at line 2567 of file libavcodec/utils.c.
Referenced by avcodec_string(), and show_stream().
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 2934 of file libavcodec/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.
- Parameters
-
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.
Definition at line 2950 of file libavcodec/utils.c.
void av_register_bitstream_filter | ( | AVBitStreamFilter * | bsf | ) |
Definition at line 33 of file bitstream_filter.c.
Register the hardware accelerator hwaccel.
Definition at line 2925 of file libavcodec/utils.c.
unsigned int av_xiphlacing | ( | unsigned char * | s, |
unsigned int | v | ||
) |
Encode extradata length to a buffer.
Used by xiph codecs.
- Parameters
-
s buffer to write to; must be at least (v/255+1) bytes long v size of extradata in bytes
- Returns
- number of bytes written to the buffer.
Definition at line 2875 of file libavcodec/utils.c.
Referenced by fixup_vorbis_headers(), oggvorbis_encode_init(), parse_packed_headers(), and put_main_header().
int avcodec_default_execute | ( | AVCodecContext * | c, |
int(*)(AVCodecContext *c2, void *arg2) | func, | ||
void * | arg, | ||
int * | ret, | ||
int | count, | ||
int | size | ||
) |
Definition at line 890 of file libavcodec/utils.c.
Referenced by avcodec_get_context_defaults3(), and avcodec_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().
const AVCodecDescriptor* avcodec_descriptor_get | ( | enum AVCodecID | id | ) |
- Returns
- descriptor for given codec ID or NULL if no descriptor exists.
Definition at line 2566 of file codec_desc.c.
Referenced by avcodec_get_name(), avcodec_open2(), is_intra_only(), and show_help_muxer().
const AVCodecDescriptor* avcodec_descriptor_get_by_name | ( | const char * | name | ) |
- Returns
- codec descriptor with the given name or NULL if no such descriptor exists.
Definition at line 2585 of file codec_desc.c.
Referenced by find_codec_or_die(), and show_help_codec().
const AVCodecDescriptor* avcodec_descriptor_next | ( | const AVCodecDescriptor * | prev | ) |
Iterate over all codec descriptors known to libavcodec.
- Parameters
-
prev previous descriptor. NULL to get the first descriptor.
- Returns
- next descriptor or NULL after the last descriptor
Definition at line 2576 of file codec_desc.c.
Referenced by avcodec_descriptor_get_by_name(), and get_codecs_sorted().
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.
- Parameters
-
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)
- Returns
- >=0 on success, negative error code on failure
- Todo:
- return the size in bytes required to store the samples in case of success, at the next libavutil bump
Definition at line 326 of file libavcodec/utils.c.
Referenced by audio_encode_example(), avcodec_encode_audio(), ff_default_get_audio_buffer(), pad_last_frame(), and write_audio_frame().
void avcodec_flush_buffers | ( | AVCodecContext * | avctx | ) |
Flush buffers, should be called when seeking or when switching to a different stream.
Definition at line 2608 of file libavcodec/utils.c.
Referenced by audio_decode_frame(), get_video_frame(), rewind_file(), subtitle_thread(), and video_thread().
const char* avcodec_get_name | ( | enum AVCodecID | id | ) |
Get the name of a codec.
- Returns
- a static string identifying the codec; never NULL
Definition at line 2416 of file libavcodec/utils.c.
Referenced by add_stream(), avcodec_string(), avformat_find_stream_info(), device_try_init(), flv_write_header(), flv_write_packet(), get_audio_flags(), init_input_stream(), mkv_write_codecprivate(), mkv_write_header(), mxf_parse_structural_metadata(), read_frame_internal(), rtp_write_header(), srt_write_header(), and transcode_init().
enum AVMediaType avcodec_get_type | ( | enum AVCodecID | codec_id | ) |
Get the type of the given codec.
Definition at line 3082 of file libavcodec/utils.c.
Referenced by mkv_query_codec().
int avcodec_is_open | ( | AVCodecContext * | s | ) |
- Returns
- a positive value if s is open (i.e. avcodec_open2() was called on it with no corresponding avcodec_close()), 0 otherwise.
Definition at line 3102 of file libavcodec/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().
void avcodec_set_dimensions | ( | AVCodecContext * | s, |
int | width, | ||
int | height | ||
) |
Definition at line 177 of file libavcodec/utils.c.
Referenced by apply_param_change(), av_mpeg4_decode_header(), avcodec_open2(), avpriv_dirac_parse_sequence_header(), avs_decode_init(), brpix_decode_frame(), cdxl_decode_frame(), cmv_process_header(), decode_frame(), decode_frame_headers(), decode_init(), dnxhd_decode_frame(), dvdsub_parse_extradata(), dvvideo_decode_frame(), execute_code(), ff_h263_decode_frame(), ff_ivi_decode_frame(), ff_mjpeg_decode_sof(), ff_rv34_decode_frame(), ff_vc1_decode_entry_point(), ff_vc1_decode_sequence_header(), flashsv_decode_frame(), gif_decode_frame(), h261_decode_frame(), init_image(), libopenjpeg_decode_frame(), mpeg_decode_postinit(), mpegvideo_extract_headers(), mvc_decode_init(), parse_presentation_segment(), pcx_decode_frame(), process_frame_obj(), ptx_decode_frame(), rv20_decode_picture_header(), sunrast_decode_frame(), svq1_decode_frame(), tgq_decode_frame(), tgv_decode_frame(), theora_header(), tqi_decode_frame(), truemotion1_decode_header(), txd_decode_frame(), update_dimensions(), vp3_init_thread_copy(), vp56_size_changed(), vp5_parse_header(), vp6_parse_header(), and vp8_decode().
void avcodec_string | ( | char * | buf, |
int | buf_size, | ||
AVCodecContext * | enc, | ||
int | encode | ||
) |
Definition at line 2456 of file libavcodec/utils.c.
Referenced by avformat_find_stream_info(), and dump_stream_format().
Generated on Mon Nov 18 2024 06:52:10 for FFmpeg by 1.8.11