FFmpeg
1.2.12
|
Modules | |
Utility functions | |
Miscellaneous utility functions related to both muxing and demuxing (or neither). | |
Demuxing | |
Demuxers read a media file and split it into chunks of data (packets). |
Data Structures | |
struct | AVOutputFormat |
Typedefs | |
typedef struct AVOutputFormat | AVOutputFormat |
typedef struct AVOutputFormat | AVOutputFormat |
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_write_trailer (AVFormatContext *s) |
Write the stream trailer to an output media file and free the file private data. | |
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. | |
enum AVCodecID | 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. | |
int | av_get_output_timestamp (struct AVFormatContext *s, int stream, int64_t *dts, int64_t *wall) |
Get timing information for the data currently output. |
Allocate and read the payload of a packet and initialize its fields with default values.
pkt | packet |
size | desired payload size |
Read data and append it to the current content of the AVPacket. If pkt->size is 0 this is identical to av_get_packet. Note that this uses av_grow_packet and thus involves a realloc which is inefficient. Thus this function should only be used when there is no reasonable way to know (an upper bound of) the final size.
pkt | packet |
size | amount of data to read |
The exact value of the fractional number is: 'val + num / den'. num is assumed to be 0 <= num < den.
This structure contains the data a format has to probe a file.
< Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
< Size of buf except extra allocated bytes
Demuxer will use avio_open, no opened file should be provided by the caller.
< Format does not require strictly increasing timestamps, but they must still be monotonic
Add a new stream to a media file.
Can only be called in the read_header() function. If the flag AVFMTCTX_NOHEADER is in the format context, then new streams can be added in read_packet too.
s | media file handle |
id | file-format-dependent stream ID |
typedef struct AVOutputFormat AVOutputFormat |
typedef struct AVOutputFormat AVOutputFormat |
typedef struct AVOutputFormat AVOutputFormat |
int av_get_output_timestamp | ( | struct AVFormatContext * | s, |
int | stream, | ||
int64_t * | dts, | ||
int64_t * | wall | ||
) |
Get timing information for the data currently output.
The exact meaning of "currently output" depends on the format. It is mostly relevant for devices that have an internal buffer and/or work in real time.
s | media file handle | |
stream | stream in the media file | |
[out] | dts | DTS of the last packet output for the stream, in stream time_base units |
[out] | wall | absolute time when that packet whas output, in microsecond |
enum AVCodecID 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 217 of file utils.c.
Referenced by choose_encoder().
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.
short_name | if non-NULL checks if short_name matches with the names of the registered formats |
filename | if non-NULL checks if filename terminates with the extensions of the registered formats |
mime_type | if non-NULL checks if mime_type matches with the MIME type of the registered formats |
Definition at line 182 of file utils.c.
Referenced by av_guess_format(), avformat_alloc_output_context2(), ff_rtp_chain_mux_open(), ffserver_guess_format(), hls_write_header(), ism_write_header(), mpegts_write_header(), parse_ffconfig(), prepare_sdp_description(), rtp_new_av_stream(), seg_write_header(), and show_help_muxer().
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.
s | media file handle |
pkt | The 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. This can be NULL (at any time, not just at the end), to flush the interleaving queues. 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. |
Definition at line 734 of file mux.c.
Referenced by tee_write_packet(), 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.
s | media file handle |
pkt | The packet, which contains the stream_index, buf/buf_size, dts/pts, ... This can be NULL (at any time, not just at the end), in order to immediately flush data buffered within the muxer, for muxers that buffer up data internally before writing it to the output. |
Definition at line 508 of file mux.c.
Referenced by ff_write_chained(), hls_write_packet(), http_prepare_data(), ism_flush(), mpegts_write_packet_internal(), and segment_end().
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 avformat_write_header.
s | media file handle |
Definition at line 777 of file mux.c.
Referenced by close_connection(), ff_mov_close_hinting(), ff_rtsp_undo_setup(), hls_write_trailer(), http_prepare_data(), ism_free(), main(), sap_write_close(), seg_write_trailer(), segment_end(), tee_write_trailer(), 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.
s | Media 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. |
options | An 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. |
Definition at line 383 of file mux.c.
Referenced by build_feed_streams(), ff_rtp_chain_mux_open(), hls_write_header(), http_prepare_data(), ism_write_header(), main(), mpegts_write_header(), open_slave(), rtp_new_av_stream(), seg_write_header(), segment_start(), and transcode_init().