FFmpeg
Data Structures | Enumerations | Functions
mux.h File Reference
#include <stdint.h>
#include "libavcodec/packet.h"
#include "avformat.h"

Go to the source code of this file.

Data Structures

struct  FFOutputFormat
 

Enumerations

enum  AVWriteUncodedFrameFlags { AV_WRITE_UNCODED_FRAME_QUERY = 0x0001 }
 Flags for AVFormatContext.write_uncoded_frame() More...
 

Functions

static const FFOutputFormatffofmt (const AVOutputFormat *fmt)
 
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...
 
int ff_interleave_packet_per_dts (AVFormatContext *s, AVPacket *pkt, int flush, int has_packet)
 Interleave an AVPacket per dts so it can be muxed. More...
 
int ff_interleave_packet_passthrough (AVFormatContext *s, AVPacket *pkt, int flush, int has_packet)
 Interleave packets directly in the order in which they arrive without any sort of buffering. More...
 
const AVPacketff_interleaved_peek (AVFormatContext *s, int stream)
 Find the next packet in the interleaving queue for the given stream. More...
 
int ff_get_muxer_ts_offset (AVFormatContext *s, int stream_index, int64_t *offset)
 
int ff_stream_add_bitstream_filter (AVStream *st, const char *name, const char *args)
 Add a bitstream filter to a stream. 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...
 
int ff_format_shift_data (AVFormatContext *s, int64_t read_start, int shift_size)
 Make shift_size amount of space at read_start by shifting data in the output at read_start until the current IO position. More...
 
int ff_format_output_open (AVFormatContext *s, const char *url, AVDictionary **options)
 Utility function to open IO stream of output format. More...
 
int ff_parse_creation_time_metadata (AVFormatContext *s, int64_t *timestamp, int return_seconds)
 Parse creation_time in AVFormatContext metadata if exists and warn if the parsing fails. More...
 
int ff_standardize_creation_time (AVFormatContext *s)
 Standardize creation_time metadata in AVFormatContext to an ISO-8601 timestamp string. More...
 

Enumeration Type Documentation

◆ AVWriteUncodedFrameFlags

Flags for AVFormatContext.write_uncoded_frame()

Enumerator
AV_WRITE_UNCODED_FRAME_QUERY 

Query whether the feature is possible on this stream.

The frame argument is ignored.

Definition at line 202 of file mux.h.

Function Documentation

◆ ffofmt()

static const FFOutputFormat* ffofmt ( const AVOutputFormat fmt)
inlinestatic

◆ ff_interleave_add_packet()

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.

Returns
0 on success, < 0 on error. pkt will always be blank on return.

Definition at line 819 of file mux.c.

Referenced by ff_interleave_packet_per_dts(), gxf_interleave_packet(), and mxf_interleave().

◆ ff_interleave_packet_per_dts()

int ff_interleave_packet_per_dts ( AVFormatContext s,
AVPacket pkt,
int  flush,
int  has_packet 
)

Interleave an AVPacket per dts so it can be muxed.

See the documentation of AVOutputFormat.interleave_packet for details.

Definition at line 923 of file mux.c.

Referenced by gxf_interleave_packet(), and init_muxer().

◆ ff_interleave_packet_passthrough()

int ff_interleave_packet_passthrough ( AVFormatContext s,
AVPacket pkt,
int  flush,
int  has_packet 
)

Interleave packets directly in the order in which they arrive without any sort of buffering.

Definition at line 1040 of file mux.c.

Referenced by init_muxer().

◆ ff_interleaved_peek()

const AVPacket* ff_interleaved_peek ( AVFormatContext s,
int  stream 
)

Find the next packet in the interleaving queue for the given stream.

Returns
a pointer to a packet if one was found, NULL otherwise.

Definition at line 1062 of file mux.c.

Referenced by mov_flush_fragment().

◆ ff_get_muxer_ts_offset()

int ff_get_muxer_ts_offset ( AVFormatContext s,
int  stream_index,
int64_t *  offset 
)

Definition at line 1046 of file mux.c.

Referenced by mov_flush_fragment().

◆ ff_stream_add_bitstream_filter()

int ff_stream_add_bitstream_filter ( AVStream st,
const char *  name,
const char *  args 
)

Add a bitstream filter to a stream.

Parameters
stoutput stream to add a filter to
namethe name of the filter to add
argsfilter-specific argument string
Returns
>0 on success; AVERROR code on failure

Definition at line 1312 of file mux.c.

Referenced by flv_check_bitstream(), gxf_write_header(), ivf_init(), latm_check_bitstream(), mkv_check_bitstream(), mov_check_bitstream(), mpegts_check_bitstream(), and mxf_init().

◆ ff_write_chained()

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.

Parameters
dstthe muxer to write the packet to
dst_streamthe stream index within dst to write the packet to
pktthe packet to be written. It will be returned blank when av_interleaved_write_frame() is used, unchanged otherwise.
srcthe muxer the packet originally was intended for
interleave0->use av_write_frame, 1->av_interleaved_write_frame
Returns
the value av_write_frame returned

Definition at line 1355 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().

◆ ff_format_shift_data()

int ff_format_shift_data ( AVFormatContext s,
int64_t  read_start,
int  shift_size 
)

Make shift_size amount of space at read_start by shifting data in the output at read_start until the current IO position.

The underlying IO context must be seekable.

Definition at line 60 of file mux_utils.c.

Referenced by mkv_write_trailer(), shift_data(), and write_header().

◆ ff_format_output_open()

int ff_format_output_open ( AVFormatContext s,
const char *  url,
AVDictionary **  options 
)

Utility function to open IO stream of output format.

Parameters
sAVFormatContext
urlURL or file name to open for writing @options optional options which will be passed to io_open callback
Returns
>=0 on success, negative AVERROR in case of failure

Definition at line 116 of file mux_utils.c.

Referenced by fifo_thread_write_header(), and open_slave().

◆ ff_parse_creation_time_metadata()

int ff_parse_creation_time_metadata ( AVFormatContext s,
int64_t *  timestamp,
int  return_seconds 
)

Parse creation_time in AVFormatContext metadata if exists and warn if the parsing fails.

Parameters
sAVFormatContext
timestampparsed timestamp in microseconds, only set on successful parsing
return_secondsset this to get the number of seconds in timestamp instead of microseconds
Returns
1 if OK, 0 if the metadata was not present, AVERROR(EINVAL) on parse error

Definition at line 126 of file mux_utils.c.

Referenced by asf_write_header1(), dv_init_mux(), ff_standardize_creation_time(), gxf_write_umf_material_description(), mkv_write_info(), mov_write_header(), and mxf_init().

◆ ff_standardize_creation_time()

int ff_standardize_creation_time ( AVFormatContext s)

Standardize creation_time metadata in AVFormatContext to an ISO-8601 timestamp string.

Parameters
sAVFormatContext
Returns
<0 on error

Definition at line 143 of file mux_utils.c.

Referenced by caf_write_header(), ff_ape_write_tag(), ff_id3v2_write_metadata(), lrc_write_header(), smjpeg_write_header(), write_globalinfo(), write_metadata(), and write_table_entries_attrib().