FFmpeg
|
muxing functions for use within libavformat More...
#include "avformat.h"
#include "avio_internal.h"
#include "internal.h"
#include "libavcodec/internal.h"
#include "libavcodec/bytestream.h"
#include "libavutil/opt.h"
#include "libavutil/dict.h"
#include "libavutil/pixdesc.h"
#include "libavutil/timestamp.h"
#include "metadata.h"
#include "id3v2.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/mathematics.h"
#include "libavutil/parseutils.h"
#include "libavutil/time.h"
#include "riff.h"
#include "audiointerleave.h"
#include "url.h"
#include <stdarg.h>
#include <assert.h>
Go to the source code of this file.
Macros | |
#define | CHUNK_START 0x1000 |
Functions | |
static void | frac_init (AVFrac *f, int64_t val, int64_t num, int64_t den) |
f = val + (num / den) + 0.5. More... | |
static void | frac_add (AVFrac *f, int64_t incr) |
Fractional addition to f: f = f + (incr / f->den). More... | |
AVRational | ff_choose_timebase (AVFormatContext *s, AVStream *st, int min_precission) |
Chooses a timebase for muxing the specified stream. More... | |
int | avformat_alloc_output_context2 (AVFormatContext **avctx, 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) |
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 int | compute_pkt_fields2 (AVFormatContext *s, AVStream *st, AVPacket *pkt) |
static int | split_write_packet (AVFormatContext *s, AVPacket *pkt) |
Move side data from payload to internal struct, call muxer, and restore original packet. More... | |
int | av_write_frame (AVFormatContext *s, AVPacket *pkt) |
Write a packet to an output media file. More... | |
int | ff_interleave_add_packet (AVFormatContext *s, AVPacket *pkt, int(*compare)(AVFormatContext *, AVPacket *, AVPacket *)) |
Add packet to AVFormatContext->packet_buffer list, determining its interleaved position using compare() function argument. More... | |
static int | ff_interleave_compare_dts (AVFormatContext *s, AVPacket *next, AVPacket *pkt) |
int | ff_interleave_packet_per_dts (AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush) |
Interleave a packet per dts in an output media file. More... | |
static int | interleave_packet (AVFormatContext *s, AVPacket *out, AVPacket *in, int flush) |
Interleave an AVPacket correctly so it can be muxed. 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... | |
Detailed Description
muxing functions for use within libavformat
Definition in file mux.c.
Macro Definition Documentation
#define CHUNK_START 0x1000 |
Definition at line 534 of file mux.c.
Referenced by ff_interleave_add_packet().
Function Documentation
int avformat_alloc_output_context2 | ( | AVFormatContext ** | ctx, |
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.
- Parameters
-
*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
- Returns
- >= 0 in case of success, a negative AVERROR code in case of failure
Definition at line 125 of file mux.c.
Referenced by main(), open_output_file(), and open_slave().
|
static |
Definition at line 405 of file mux.c.
Referenced by av_interleaved_write_frame(), and av_write_frame().
AVRational ff_choose_timebase | ( | AVFormatContext * | s, |
AVStream * | st, | ||
int | min_precission | ||
) |
Chooses a timebase for muxing the specified stream.
The choosen timebase allows sample accurate timestamps based on the framerate or sample rate for audio streams. It also is at least as precisse as 1/min_precission would be.
Definition at line 106 of file mux.c.
Referenced by nut_write_header().
int ff_interleave_add_packet | ( | AVFormatContext * | s, |
AVPacket * | pkt, | ||
int(*)(AVFormatContext *, AVPacket *, AVPacket *) | compare | ||
) |
Add packet to AVFormatContext->packet_buffer list, determining its interleaved position using compare() function argument.
- Returns
- 0, or < 0 on error
Definition at line 536 of file mux.c.
Referenced by ff_audio_rechunk_interleave(), and ff_interleave_packet_per_dts().
|
static |
Definition at line 603 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 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
-
s media file handle out the interleaved packet will be output here pkt the input packet flush 1 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 625 of file mux.c.
Referenced by gxf_interleave_packet(), and interleave_packet().
Fractional addition to f: f = f + (incr / f->den).
- Parameters
-
f fractional number incr increment, can be positive or negative
Definition at line 86 of file mux.c.
Referenced by compute_pkt_fields2().
f = val + (num / den) + 0.5.
'num' is normalized so that it is such as 0 <= num < den.
- Parameters
-
f fractional number val integer value num must be >= 0 den must be >= 1
Definition at line 68 of file mux.c.
Referenced by init_pts().
|
static |
Definition at line 222 of file mux.c.
Referenced by avformat_write_header().
|
static |
Definition at line 352 of file mux.c.
Referenced by avformat_write_header().
|
static |
Interleave an AVPacket correctly so it can be muxed.
- Parameters
-
out the interleaved packet will be output here in the input packet flush 1 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 715 of file mux.c.
Referenced by av_interleaved_write_frame(), and av_write_trailer().
|
inlinestatic |
Move side data from payload to internal struct, call muxer, and restore original packet.
Definition at line 491 of file mux.c.
Referenced by av_interleaved_write_frame(), av_write_frame(), and av_write_trailer().
|
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 188 of file mux.c.
Referenced by init_muxer().
Generated on Fri Dec 20 2024 06:56:14 for FFmpeg by 1.8.11