Miscellaneous utility functions related to both encoding and decoding (or neither).
More...
|
void | avcodec_string (char *buf, int buf_size, AVCodecContext *enc, int encode) |
|
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) |
| Reset the internal codec state / flush internal buffers. More...
|
|
int | av_get_audio_frame_duration (AVCodecContext *avctx, int frame_bytes) |
| Return audio frame duration. 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 AV_INPUT_BUFFER_PADDING_SIZE at the end which 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...
|
|
int | avcodec_is_open (AVCodecContext *s) |
|
Miscellaneous utility functions related to both encoding and decoding (or neither).
◆ avcodec_string()
void avcodec_string |
( |
char * |
buf, |
|
|
int |
buf_size, |
|
|
AVCodecContext * |
enc, |
|
|
int |
encode |
|
) |
| |
◆ avcodec_default_execute()
◆ avcodec_default_execute2()
int avcodec_default_execute2 |
( |
AVCodecContext * |
c, |
|
|
int(*)(AVCodecContext *c2, void *arg2, int, int) |
func, |
|
|
void * |
arg, |
|
|
int * |
ret, |
|
|
int |
count |
|
) |
| |
◆ avcodec_fill_audio_frame()
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
◆ avcodec_flush_buffers()
Reset the internal codec state / flush internal buffers.
Should be called e.g. when seeking or when switching to a different stream.
- Note
- for decoders, this function just releases any references the decoder might keep internally, but the caller's references remain valid.
-
for encoders, this function will only do something if the encoder declares support for AV_CODEC_CAP_ENCODER_FLUSH. When called, the encoder will drain any remaining packets, and can then be re-used for a different stream (as opposed to sending a null frame which will leave the encoder in a permanent EOF state after draining). This can be desirable if the cost of tearing down and replacing the encoder instance is high.
◆ av_get_audio_frame_duration()
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.
◆ av_fast_padded_malloc()
void av_fast_padded_malloc |
( |
void * |
ptr, |
|
|
unsigned int * |
size, |
|
|
size_t |
min_size |
|
) |
| |
Same behaviour av_fast_malloc but the buffer has additional AV_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.
◆ av_fast_padded_mallocz()
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.
◆ avcodec_is_open()