FFmpeg
mux.h
Go to the documentation of this file.
1 /*
2  * copyright (c) 2001 Fabrice Bellard
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef AVFORMAT_MUX_H
22 #define AVFORMAT_MUX_H
23 
24 #include <stdint.h>
25 #include "libavcodec/packet.h"
26 #include "avformat.h"
27 
28 /**
29  * Add packet to an AVFormatContext's packet_buffer list, determining its
30  * interleaved position using compare() function argument.
31  * @return 0 on success, < 0 on error. pkt will always be blank on return.
32  */
34  int (*compare)(AVFormatContext *, const AVPacket *, const AVPacket *));
35 
36 /**
37  * Interleave an AVPacket per dts so it can be muxed.
38  * See the documentation of AVOutputFormat.interleave_packet for details.
39  */
41  int flush, int has_packet);
42 
43 /**
44  * Interleave packets directly in the order in which they arrive
45  * without any sort of buffering.
46  */
48  int flush, int has_packet);
49 
50 /**
51  * Find the next packet in the interleaving queue for the given stream.
52  *
53  * @return a pointer to a packet if one was found, NULL otherwise.
54  */
55 const AVPacket *ff_interleaved_peek(AVFormatContext *s, int stream);
56 
57 int ff_get_muxer_ts_offset(AVFormatContext *s, int stream_index, int64_t *offset);
58 
59 /**
60  * Add a bitstream filter to a stream.
61  *
62  * @param st output stream to add a filter to
63  * @param name the name of the filter to add
64  * @param args filter-specific argument string
65  * @return >0 on success;
66  * AVERROR code on failure
67  */
68 int ff_stream_add_bitstream_filter(AVStream *st, const char *name, const char *args);
69 
70 /**
71  * Write a packet to another muxer than the one the user originally
72  * intended. Useful when chaining muxers, where one muxer internally
73  * writes a received packet to another muxer.
74  *
75  * @param dst the muxer to write the packet to
76  * @param dst_stream the stream index within dst to write the packet to
77  * @param pkt the packet to be written. It will be returned blank when
78  * av_interleaved_write_frame() is used, unchanged otherwise.
79  * @param src the muxer the packet originally was intended for
80  * @param interleave 0->use av_write_frame, 1->av_interleaved_write_frame
81  * @return the value av_write_frame returned
82  */
83 int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt,
85 
86 /**
87  * Flags for AVFormatContext.write_uncoded_frame()
88  */
90 
91  /**
92  * Query whether the feature is possible on this stream.
93  * The frame argument is ignored.
94  */
96 
97 };
98 
99 /**
100  * Make shift_size amount of space at read_start by shifting data in the output
101  * at read_start until the current IO position. The underlying IO context must
102  * be seekable.
103  */
104 int ff_format_shift_data(AVFormatContext *s, int64_t read_start, int shift_size);
105 
106 /**
107  * Utility function to open IO stream of output format.
108  *
109  * @param s AVFormatContext
110  * @param url URL or file name to open for writing
111  * @options optional options which will be passed to io_open callback
112  * @return >=0 on success, negative AVERROR in case of failure
113  */
115 
116 /**
117  * Parse creation_time in AVFormatContext metadata if exists and warn if the
118  * parsing fails.
119  *
120  * @param s AVFormatContext
121  * @param timestamp parsed timestamp in microseconds, only set on successful parsing
122  * @param return_seconds set this to get the number of seconds in timestamp instead of microseconds
123  * @return 1 if OK, 0 if the metadata was not present, AVERROR(EINVAL) on parse error
124  */
125 int ff_parse_creation_time_metadata(AVFormatContext *s, int64_t *timestamp, int return_seconds);
126 
127 /**
128  * Standardize creation_time metadata in AVFormatContext to an ISO-8601
129  * timestamp string.
130  *
131  * @param s AVFormatContext
132  * @return <0 on error
133  */
135 
136 #endif /* AVFORMAT_MUX_H */
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
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: mux.c:1037
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.
Definition: mux.c:1353
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.
Definition: mux_utils.c:127
AVDictionary
Definition: dict.c:31
ff_interleave_add_packet
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 com...
Definition: mux.c:817
ff_interleaved_peek
const AVPacket * ff_interleaved_peek(AVFormatContext *s, int stream)
Find the next packet in the interleaving queue for the given stream.
Definition: mux.c:1059
pkt
AVPacket * pkt
Definition: movenc.c:59
s
#define s(width, name)
Definition: cbs_vp9.c:256
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 ...
Definition: mux_utils.c:61
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.
Definition: mux.c:921
AVFormatContext
Format I/O context.
Definition: avformat.h:1216
flush
static void flush(AVCodecContext *avctx)
Definition: aacdec_template.c:607
interleave
static void interleave(uint8_t *dst, uint8_t *src, int w, int h, int dst_linesize, int src_linesize, enum FilterMode mode, int swap)
Definition: vf_il.c:108
options
const OptionDef options[]
ff_standardize_creation_time
int ff_standardize_creation_time(AVFormatContext *s)
Standardize creation_time metadata in AVFormatContext to an ISO-8601 timestamp string.
Definition: mux_utils.c:144
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
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.
Definition: mux.c:1310
packet.h
ff_get_muxer_ts_offset
int ff_get_muxer_ts_offset(AVFormatContext *s, int stream_index, int64_t *offset)
Definition: mux.c:1043
AVStream
Stream structure.
Definition: avformat.h:948
avformat.h
compare
static float compare(const AVFrame *haystack, const AVFrame *obj, int offx, int offy)
Definition: vf_find_rect.c:95
AV_WRITE_UNCODED_FRAME_QUERY
@ AV_WRITE_UNCODED_FRAME_QUERY
Query whether the feature is possible on this stream.
Definition: mux.h:95
AVPacket
This structure stores compressed data.
Definition: packet.h:351
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
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.
Definition: mux_utils.c:117
AVWriteUncodedFrameFlags
AVWriteUncodedFrameFlags
Flags for AVFormatContext.write_uncoded_frame()
Definition: mux.h:89