Data Structures

struct  AVOutputFormat

Typedefs

typedef struct AVOutputFormat AVOutputFormat

Functions

int avformat_write_header (AVFormatContext *s, AVDictionary **options)
 Allocate the stream private data and write the stream header to an output media file.
int av_write_frame (AVFormatContext *s, AVPacket *pkt)
 Write a packet to an output media file.
int av_interleaved_write_frame (AVFormatContext *s, AVPacket *pkt)
 Write a packet to an output media file ensuring correct interleaving.
int av_interleave_packet_per_dts (AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush)
 Interleave a packet per dts in an output media file.
int av_write_trailer (AVFormatContext *s)
 Write the stream trailer to an output media file and free the file private data.
AVOutputFormatav_guess_format (const char *short_name, const char *filename, const char *mime_type)
 Return the output format in the list of registered output formats which best matches the provided parameters, or return NULL if there is no match.
enum CodecID av_guess_codec (AVOutputFormat *fmt, const char *short_name, const char *filename, const char *mime_type, enum AVMediaType type)
 Guess the codec ID based upon muxer and filename.

Detailed Description

Typedef Documentation

Function Documentation

enum CodecID av_guess_codec ( AVOutputFormat fmt,
const char *  short_name,
const char *  filename,
const char *  mime_type,
enum AVMediaType  type 
)

Guess the codec ID based upon muxer and filename.

Definition at line 237 of file utils.c.

Referenced by choose_encoder(), new_audio_stream(), new_subtitle_stream(), and new_video_stream().

AVOutputFormat* av_guess_format ( const char *  short_name,
const char *  filename,
const char *  mime_type 
)

Return the output format in the list of registered output formats which best matches the provided parameters, or return NULL if there is no match.

Parameters
short_nameif non-NULL checks if short_name matches with the names of the registered formats
filenameif non-NULL checks if filename terminates with the extensions of the registered formats
mime_typeif non-NULL checks if mime_type matches with the MIME type of the registered formats
Examples:
libavformat/output-example.c.

Definition at line 202 of file utils.c.

Referenced by av_guess_format(), avserver_guess_format(), ff_rtp_chain_mux_open(), main(), opt_output_file(), parse_ffconfig(), rtp_new_av_stream(), and seg_write_header().

int av_interleave_packet_per_dts ( AVFormatContext s,
AVPacket out,
AVPacket pkt,
int  flush 
)

Interleave a packet per dts in an output media file.

Packets with pkt->destruct == av_destruct_packet will be freed inside this function, so they cannot be used after it. Note that calling av_free_packet() on them is still safe.

Parameters
smedia file handle
outthe interleaved packet will be output here
pktthe input packet
flush1 if no further packets are available as input and all remaining packets should be output
Returns
1 if a packet was output, 0 if no packet could be output, < 0 if an error occurred

Definition at line 3213 of file utils.c.

Referenced by gxf_interleave_packet(), and interleave_packet().

int av_interleaved_write_frame ( AVFormatContext s,
AVPacket pkt 
)

Write a packet to an output media file ensuring correct interleaving.

The packet must contain one audio or video frame. If the packets are already correctly interleaved, the application should call av_write_frame() instead as it is slightly faster. It is also important to keep in mind that completely non-interleaved input will need huge amounts of memory to interleave with this, so it is preferable to interleave at the demuxer level.

Parameters
smedia file handle
pktThe packet containing the data to be written. Libavformat takes ownership of the data and will free it when it sees fit using the packet's destruct field. The caller must not access the data after this function returns, as it may already be freed. Packet's stream_index field must be set to the index of the corresponding stream in s.streams. It is very strongly recommended that timing information (pts, dts duration) is set to correct values.
Returns
0 on success, a negative AVERROR on error.
Examples:
libavformat/output-example.c.

Definition at line 3262 of file utils.c.

Referenced by write_audio_frame(), write_frame(), and write_video_frame().

int av_write_frame ( AVFormatContext s,
AVPacket pkt 
)

Write a packet to an output media file.

The packet shall contain one audio or video frame. The packet must be correctly interleaved according to the container specification, if not then av_interleaved_write_frame must be used.

Parameters
smedia file handle
pktThe packet, which contains the stream_index, buf/buf_size, dts/pts, ...
Returns
< 0 on error, = 0 if OK, 1 if end of stream wanted

Definition at line 3151 of file utils.c.

Referenced by ff_write_chained(), and http_prepare_data().

int av_write_trailer ( AVFormatContext s)

Write the stream trailer to an output media file and free the file private data.

May only be called after a successful call to av_write_header.

Parameters
smedia file handle
Returns
0 if OK, AVERROR_xxx on error
Examples:
libavformat/output-example.c.

Definition at line 3296 of file utils.c.

Referenced by close_connection(), ff_mov_close_hinting(), ff_rtsp_undo_setup(), http_prepare_data(), main(), sap_write_close(), and transcode().

int avformat_write_header ( AVFormatContext s,
AVDictionary **  options 
)

Allocate the stream private data and write the stream header to an output media file.

Parameters
sMedia file handle, must be allocated with avformat_alloc_context(). Its oformat field must be set to the desired output format; Its pb field must be set to an already openened AVIOContext.
optionsAn AVDictionary filled with AVFormatContext and muxer-private options. On return this parameter will be destroyed and replaced with a dict containing options that were not found. May be NULL.
Returns
0 on success, negative AVERROR on failure.
See Also
av_opt_find, av_dict_set, avio_open, av_oformat_next.

Definition at line 2941 of file utils.c.

Referenced by build_feed_streams(), ff_rtp_chain_mux_open(), http_prepare_data(), rtp_new_av_stream(), seg_write_header(), transcode(), and transcode_init().