FFmpeg 5.1.4
Functions
Core functions

Functions for querying libavformat capabilities, allocating core structures, etc. More...

Functions

unsigned avformat_version (void)
 Return the LIBAVFORMAT_VERSION_INT constant. More...
 
const char * avformat_configuration (void)
 Return the libavformat build-time configuration. More...
 
const char * avformat_license (void)
 Return the libavformat license. More...
 
int avformat_network_init (void)
 Do global initialization of network libraries. More...
 
int avformat_network_deinit (void)
 Undo the initialization done by avformat_network_init. More...
 
const AVOutputFormatav_muxer_iterate (void **opaque)
 Iterate over all registered muxers. More...
 
const AVInputFormatav_demuxer_iterate (void **opaque)
 Iterate over all registered demuxers. More...
 
AVFormatContextavformat_alloc_context (void)
 Allocate an AVFormatContext. More...
 
void avformat_free_context (AVFormatContext *s)
 Free an AVFormatContext and all its streams. More...
 
const AVClassavformat_get_class (void)
 Get the AVClass for AVFormatContext. More...
 
const AVClassav_stream_get_class (void)
 Get the AVClass for AVStream. More...
 
AVStreamavformat_new_stream (AVFormatContext *s, const AVCodec *c)
 Add a new stream to a media file. More...
 
int av_stream_add_side_data (AVStream *st, enum AVPacketSideDataType type, uint8_t *data, size_t size)
 Wrap an existing array as stream side data. More...
 
uint8_t * av_stream_new_side_data (AVStream *stream, enum AVPacketSideDataType type, size_t size)
 Allocate new information from stream. More...
 
uint8_t * av_stream_get_side_data (const AVStream *stream, enum AVPacketSideDataType type, size_t *size)
 Get side information from stream. More...
 
AVProgramav_new_program (AVFormatContext *s, int id)
 

Detailed Description

Functions for querying libavformat capabilities, allocating core structures, etc.

Function Documentation

◆ avformat_version()

unsigned avformat_version ( void  )

Return the LIBAVFORMAT_VERSION_INT constant.

◆ avformat_configuration()

const char * avformat_configuration ( void  )

Return the libavformat build-time configuration.

◆ avformat_license()

const char * avformat_license ( void  )

Return the libavformat license.

◆ avformat_network_init()

int avformat_network_init ( void  )

Do global initialization of network libraries.

This is optional, and not recommended anymore.

This functions only exists to work around thread-safety issues with older GnuTLS or OpenSSL libraries. If libavformat is linked to newer versions of those libraries, or if you do not use them, calling this function is unnecessary. Otherwise, you need to call this function before any other threads using them are started.

This function will be deprecated once support for older GnuTLS and OpenSSL libraries is removed, and this function has no purpose anymore.

Examples
http_multiclient.c.

Referenced by main().

◆ avformat_network_deinit()

int avformat_network_deinit ( void  )

Undo the initialization done by avformat_network_init.

Call it only once for each time you called avformat_network_init.

Referenced by main().

◆ av_muxer_iterate()

const AVOutputFormat * av_muxer_iterate ( void **  opaque)

Iterate over all registered muxers.

Parameters
opaquea pointer where libavformat will store the iteration state. Must point to NULL to start the iteration.
Returns
the next registered muxer or NULL when the iteration is finished

◆ av_demuxer_iterate()

const AVInputFormat * av_demuxer_iterate ( void **  opaque)

Iterate over all registered demuxers.

Parameters
opaquea pointer where libavformat will store the iteration state. Must point to NULL to start the iteration.
Returns
the next registered demuxer or NULL when the iteration is finished

◆ avformat_alloc_context()

AVFormatContext * avformat_alloc_context ( void  )

Allocate an AVFormatContext.

avformat_free_context() can be used to free the context and everything allocated by the framework within it.

Examples
avio_reading.c, and transcode_aac.c.

Referenced by main(), and open_output_file().

◆ avformat_free_context()

void avformat_free_context ( AVFormatContext s)

Free an AVFormatContext and all its streams.

Parameters
scontext to free
Examples
muxing.c, remuxing.c, transcode_aac.c, and transcoding.c.

Referenced by main(), and open_output_file().

◆ avformat_get_class()

const AVClass * avformat_get_class ( void  )

Get the AVClass for AVFormatContext.

It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options.

See also
av_opt_find().

◆ av_stream_get_class()

const AVClass * av_stream_get_class ( void  )

Get the AVClass for AVStream.

It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options.

See also
av_opt_find().

◆ avformat_new_stream()

AVStream * avformat_new_stream ( AVFormatContext s,
const AVCodec c 
)

Add a new stream to a media file.

When demuxing, it is called by the demuxer in read_header(). If the flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also be called in read_packet().

When muxing, should be called by the user before avformat_write_header().

User is required to call avformat_free_context() to clean up the allocation by avformat_new_stream().

Parameters
smedia file handle
cunused, does nothing
Returns
newly created stream or NULL on error.
Examples
muxing.c, remuxing.c, transcode_aac.c, transcoding.c, and vaapi_transcode.c.

Referenced by add_stream(), dec_enc(), main(), and open_output_file().

◆ av_stream_add_side_data()

int av_stream_add_side_data ( AVStream st,
enum AVPacketSideDataType  type,
uint8_t *  data,
size_t  size 
)

Wrap an existing array as stream side data.

Parameters
ststream
typeside information type
datathe side data array. It must be allocated with the av_malloc() family of functions. The ownership of the data is transferred to st.
sizeside information size
Returns
zero on success, a negative AVERROR code on failure. On failure, the stream is unchanged and the data remains owned by the caller.

◆ av_stream_new_side_data()

uint8_t * av_stream_new_side_data ( AVStream stream,
enum AVPacketSideDataType  type,
size_t  size 
)

Allocate new information from stream.

Parameters
streamstream
typedesired side information type
sizeside information size
Returns
pointer to fresh allocated data or NULL otherwise

◆ av_stream_get_side_data()

uint8_t * av_stream_get_side_data ( const AVStream stream,
enum AVPacketSideDataType  type,
size_t *  size 
)

Get side information from stream.

Parameters
streamstream
typedesired side information type
sizeIf supplied, *size will be set to the size of the side data or to zero if the desired side data is not present.
Returns
pointer to data if present or NULL otherwise

◆ av_new_program()

AVProgram * av_new_program ( AVFormatContext s,
int  id 
)