FFmpeg
|
#include "avformat.h"
#include "internal.h"
#include "libavcodec/internal.h"
#include "libavcodec/packet_internal.h"
#include "libavutil/opt.h"
#include "libavutil/dict.h"
#include "libavutil/pixdesc.h"
#include "libavutil/timestamp.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
Go to the source code of this file.
Macros | |
#define | AV_PKT_FLAG_UNCODED_FRAME 0x2000 |
#define | CHUNK_START 0x1000 |
Functions | |
static void | frac_init (FFFrac *f, int64_t val, int64_t num, int64_t den) |
f = val + (num / den) + 0.5. More... | |
static void | frac_add (FFFrac *f, int64_t incr) |
Fractional addition to f: f = f + (incr / f->den). More... | |
AVRational | ff_choose_timebase (AVFormatContext *s, AVStream *st, int min_precision) |
Chooses a timebase for muxing the specified stream. More... | |
enum AVChromaLocation | ff_choose_chroma_location (AVFormatContext *s, AVStream *st) |
Chooses a timebase for muxing the specified stream. More... | |
int | avformat_alloc_output_context2 (AVFormatContext **avctx, ff_const59 AVOutputFormat *oformat, const char *format, const char *filename) |
Allocate an AVFormatContext for an output format. More... | |
static int | validate_codec_tag (AVFormatContext *s, AVStream *st) |
static int | init_muxer (AVFormatContext *s, AVDictionary **options) |
static int | init_pts (AVFormatContext *s) |
static void | flush_if_needed (AVFormatContext *s) |
static void | deinit_muxer (AVFormatContext *s) |
int | avformat_init_output (AVFormatContext *s, AVDictionary **options) |
Allocate the stream private data and initialize the codec, but do not write the header. More... | |
int | avformat_write_header (AVFormatContext *s, AVDictionary **options) |
Allocate the stream private data and write the stream header to an output media file. More... | |
static void | guess_pkt_duration (AVFormatContext *s, AVStream *st, AVPacket *pkt) |
static int | write_packet (AVFormatContext *s, AVPacket *pkt) |
Shift timestamps and call muxer; the original pts/dts are not kept. More... | |
static int | check_packet (AVFormatContext *s, AVPacket *pkt) |
static int | prepare_input_packet (AVFormatContext *s, AVStream *st, AVPacket *pkt) |
int | ff_interleave_add_packet (AVFormatContext *s, AVPacket *pkt, int(*compare)(AVFormatContext *, const AVPacket *, const AVPacket *)) |
Add packet to an AVFormatContext's packet_buffer list, determining its interleaved position using compare() function argument. More... | |
static int | interleave_compare_dts (AVFormatContext *s, const AVPacket *next, const AVPacket *pkt) |
int | ff_interleave_packet_per_dts (AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush) |
Interleave an AVPacket per dts so it can be muxed. More... | |
int | ff_get_muxer_ts_offset (AVFormatContext *s, int stream_index, int64_t *offset) |
const AVPacket * | ff_interleaved_peek (AVFormatContext *s, int stream) |
Find the next packet in the interleaving queue for the given stream. More... | |
static int | interleave_packet (AVFormatContext *s, AVPacket *out, AVPacket *in, int flush) |
Interleave an AVPacket correctly so it can be muxed. More... | |
static int | check_bitstream (AVFormatContext *s, AVStream *st, AVPacket *pkt) |
static int | interleaved_write_packet (AVFormatContext *s, AVPacket *pkt, int flush) |
static int | write_packet_common (AVFormatContext *s, AVStream *st, AVPacket *pkt, int interleaved) |
static int | write_packets_from_bsfs (AVFormatContext *s, AVStream *st, AVPacket *pkt, int interleaved) |
static int | write_packets_common (AVFormatContext *s, AVPacket *pkt, int interleaved) |
int | av_write_frame (AVFormatContext *s, AVPacket *in) |
Write a packet to an output media file. More... | |
int | av_interleaved_write_frame (AVFormatContext *s, AVPacket *pkt) |
Write a packet to an output media file ensuring correct interleaving. More... | |
int | av_write_trailer (AVFormatContext *s) |
Write the stream trailer to an output media file and free the file private data. More... | |
int | av_get_output_timestamp (struct AVFormatContext *s, int stream, int64_t *dts, int64_t *wall) |
Get timing information for the data currently output. More... | |
int | ff_write_chained (AVFormatContext *dst, int dst_stream, AVPacket *pkt, AVFormatContext *src, int interleave) |
Write a packet to another muxer than the one the user originally intended. More... | |
static void | uncoded_frame_free (void *unused, uint8_t *data) |
static int | write_uncoded_frame_internal (AVFormatContext *s, int stream_index, AVFrame *frame, int interleaved) |
int | av_write_uncoded_frame (AVFormatContext *s, int stream_index, AVFrame *frame) |
Write an uncoded frame to an output media file. More... | |
int | av_interleaved_write_uncoded_frame (AVFormatContext *s, int stream_index, AVFrame *frame) |
Write an uncoded frame to an output media file. More... | |
int | av_write_uncoded_frame_query (AVFormatContext *s, int stream_index) |
Test whether a muxer supports uncoded frame. More... | |
muxing functions for use within libavformat
Definition in file mux.c.
|
static |
f = val + (num / den) + 0.5.
'num' is normalized so that it is such as 0 <= num < den.
f | fractional number |
val | integer value |
num | must be >= 0 |
den | must be >= 1 |
Definition at line 52 of file mux.c.
Referenced by init_pts().
|
static |
AVRational ff_choose_timebase | ( | AVFormatContext * | s, |
AVStream * | st, | ||
int | min_precision | ||
) |
Chooses a timebase for muxing the specified stream.
The chosen timebase allows sample accurate timestamps based on the framerate or sample rate for audio streams. It also is at least as precise as 1/min_precision would be.
Definition at line 90 of file mux.c.
Referenced by nut_write_header().
enum AVChromaLocation ff_choose_chroma_location | ( | AVFormatContext * | s, |
AVStream * | st | ||
) |
Chooses a timebase for muxing the specified stream.
Definition at line 106 of file mux.c.
Referenced by mxf_write_header().
int avformat_alloc_output_context2 | ( | AVFormatContext ** | ctx, |
ff_const59 AVOutputFormat * | oformat, | ||
const char * | format_name, | ||
const char * | filename | ||
) |
Allocate an AVFormatContext for an output format.
avformat_free_context() can be used to free the context and everything allocated by the framework within it.
*ctx | is set to the created format context, or to NULL in case of failure |
oformat | format to use for allocating the context, if NULL format_name and filename are used instead |
format_name | the name of output format to use for allocating the context, if NULL filename is used instead |
filename | the name of the filename to use for allocating the context, may be NULL |
Definition at line 136 of file mux.c.
Referenced by avdevice_list_output_sinks(), fifo_mux_init(), hls_mux_init(), initialize_fifo_tst_muxer_chain(), main(), open_output_file(), open_slave(), segment_mux_init(), webm_chunk_init(), and write_muxed_file().
|
static |
Check that tag + id is in the table If neither is in the table -> OK If tag is in the table with another id -> FAIL If id is in the table with another tag -> FAIL unless strict < normal
Definition at line 197 of file mux.c.
Referenced by init_muxer().
|
static |
Definition at line 231 of file mux.c.
Referenced by avformat_init_output().
|
static |
Definition at line 423 of file mux.c.
Referenced by avformat_init_output(), and avformat_write_header().
|
static |
Definition at line 468 of file mux.c.
Referenced by av_write_frame(), avformat_write_header(), and write_packet().
|
static |
Definition at line 478 of file mux.c.
Referenced by av_write_trailer(), and avformat_write_header().
|
static |
Definition at line 642 of file mux.c.
Referenced by write_packet_common().
|
static |
Shift timestamps and call muxer; the original pts/dts are not kept.
FIXME: this function should NEVER get undefined pts/dts beside when the AVFMT_NOTIMESTAMPS is set. Those additional safety checks should be dropped once the correct checks are set in the callers.
Definition at line 681 of file mux.c.
Referenced by interleaved_write_packet(), and write_packet_common().
|
static |
Definition at line 764 of file mux.c.
Referenced by write_packets_common().
|
static |
Definition at line 780 of file mux.c.
Referenced by write_packets_common().
int ff_interleave_add_packet | ( | AVFormatContext * | s, |
AVPacket * | pkt, | ||
int(*)(AVFormatContext *, const AVPacket *, const AVPacket *) | compare | ||
) |
Add packet to an AVFormatContext's packet_buffer list, determining its interleaved position using compare() function argument.
Definition at line 830 of file mux.c.
Referenced by ff_interleave_packet_per_dts(), gxf_interleave_packet(), and mxf_interleave().
|
static |
Definition at line 902 of file mux.c.
Referenced by ff_interleave_packet_per_dts().
int ff_interleave_packet_per_dts | ( | AVFormatContext * | s, |
AVPacket * | out, | ||
AVPacket * | pkt, | ||
int | flush | ||
) |
Interleave an AVPacket per dts so it can be muxed.
s | an AVFormatContext for output. pkt resp. out will be added to resp. taken from its packet buffer. |
out | the interleaved packet will be output here |
pkt | the input packet; will be blank on return if not NULL |
flush | 1 if no further packets are available as input and all remaining packets should be output |
Definition at line 932 of file mux.c.
Referenced by gxf_interleave_packet(), and interleave_packet().
int ff_get_muxer_ts_offset | ( | AVFormatContext * | s, |
int | stream_index, | ||
int64_t * | offset | ||
) |
Definition at line 1050 of file mux.c.
Referenced by mov_flush_fragment().
const AVPacket* ff_interleaved_peek | ( | AVFormatContext * | s, |
int | stream | ||
) |
Find the next packet in the interleaving queue for the given stream.
Definition at line 1066 of file mux.c.
Referenced by mov_flush_fragment().
|
static |
Interleave an AVPacket correctly so it can be muxed.
out | the interleaved packet will be output here |
in | the input packet; will always be blank on return if not NULL |
flush | 1 if no further packets are available as input and all remaining packets should be output |
Definition at line 1087 of file mux.c.
Referenced by interleaved_write_packet().
|
static |
Definition at line 1095 of file mux.c.
Referenced by write_packets_common().
|
static |
Definition at line 1114 of file mux.c.
Referenced by av_interleaved_write_frame(), av_write_trailer(), and write_packet_common().
|
static |
Definition at line 1133 of file mux.c.
Referenced by write_packets_common(), and write_packets_from_bsfs().
|
static |
Definition at line 1157 of file mux.c.
Referenced by av_write_trailer(), and write_packets_common().
|
static |
Definition at line 1189 of file mux.c.
Referenced by av_interleaved_write_frame(), and av_write_frame().
int ff_write_chained | ( | AVFormatContext * | dst, |
int | dst_stream, | ||
AVPacket * | pkt, | ||
AVFormatContext * | src, | ||
int | interleave | ||
) |
Write a packet to another muxer than the one the user originally intended.
Useful when chaining muxers, where one muxer internally writes a received packet to another muxer.
dst | the muxer to write the packet to |
dst_stream | the stream index within dst to write the packet to |
pkt | the packet to be written |
src | the muxer the packet originally was intended for |
interleave | 0->use av_write_frame, 1->av_interleaved_write_frame |
Definition at line 1328 of file mux.c.
Referenced by dash_write_packet(), ff_mov_add_hinted_packet(), hds_write_packet(), hls_write_packet(), ism_write_packet(), rtsp_write_packet(), sap_write_packet(), and seg_write_packet().
|
static |
Definition at line 1349 of file mux.c.
Referenced by write_uncoded_frame_internal().
|
static |
Definition at line 1355 of file mux.c.
Referenced by av_interleaved_write_uncoded_frame(), and av_write_uncoded_frame().