ffmpeg / libavformat / avformat.h @ e8723e24
History | View | Annotate | Download (51 KB)
1 | 04d7f601 | Diego Biurrun | /*
|
---|---|---|---|
2 | * copyright (c) 2001 Fabrice Bellard
|
||
3 | *
|
||
4 | b78e7197 | Diego Biurrun | * This file is part of FFmpeg.
|
5 | *
|
||
6 | * FFmpeg is free software; you can redistribute it and/or
|
||
7 | 04d7f601 | Diego Biurrun | * modify it under the terms of the GNU Lesser General Public
|
8 | * License as published by the Free Software Foundation; either
|
||
9 | b78e7197 | Diego Biurrun | * version 2.1 of the License, or (at your option) any later version.
|
10 | 04d7f601 | Diego Biurrun | *
|
11 | b78e7197 | Diego Biurrun | * FFmpeg is distributed in the hope that it will be useful,
|
12 | 04d7f601 | Diego Biurrun | * 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 | b78e7197 | Diego Biurrun | * License along with FFmpeg; if not, write to the Free Software
|
18 | 04d7f601 | Diego Biurrun | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
19 | */
|
||
20 | |||
21 | 98790382 | Stefano Sabatini | #ifndef AVFORMAT_AVFORMAT_H
|
22 | #define AVFORMAT_AVFORMAT_H
|
||
23 | de6d9b64 | Fabrice Bellard | |
24 | 800c289a | Måns Rullgård | #define LIBAVFORMAT_VERSION_MAJOR 52 |
25 | e8723e24 | Rafaël Carré | #define LIBAVFORMAT_VERSION_MINOR 76 |
26 | a2403986 | Zhentan Feng | #define LIBAVFORMAT_VERSION_MICRO 0 |
27 | e97ac1e6 | Måns Rullgård | |
28 | 800c289a | Måns Rullgård | #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
29 | LIBAVFORMAT_VERSION_MINOR, \ |
||
30 | LIBAVFORMAT_VERSION_MICRO) |
||
31 | #define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \
|
||
32 | LIBAVFORMAT_VERSION_MINOR, \ |
||
33 | LIBAVFORMAT_VERSION_MICRO) |
||
34 | 5aa083ee | Michael Niedermayer | #define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT
|
35 | 8026c3b5 | Alex Beregszaszi | |
36 | 5aa083ee | Michael Niedermayer | #define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) |
37 | 4b1f4f23 | Juanjo | |
38 | c97429e2 | Stefano Sabatini | /**
|
39 | f2e77e4b | Art Clarke | * I return the LIBAVFORMAT_VERSION_INT constant. You got
|
40 | * a fucking problem with that, douchebag?
|
||
41 | c97429e2 | Stefano Sabatini | */
|
42 | unsigned avformat_version(void); |
||
43 | |||
44 | c1736936 | Diego Biurrun | /**
|
45 | 49bd8e4b | Måns Rullgård | * Return the libavformat build-time configuration.
|
46 | c1736936 | Diego Biurrun | */
|
47 | 41600690 | Stefano Sabatini | const char *avformat_configuration(void); |
48 | c1736936 | Diego Biurrun | |
49 | /**
|
||
50 | 49bd8e4b | Måns Rullgård | * Return the libavformat license.
|
51 | c1736936 | Diego Biurrun | */
|
52 | 41600690 | Stefano Sabatini | const char *avformat_license(void); |
53 | c1736936 | Diego Biurrun | |
54 | f71869a4 | Fabrice Bellard | #include <time.h> |
55 | 67070e4f | Zdenek Kabelac | #include <stdio.h> /* FILE */ |
56 | 76a448ed | Måns Rullgård | #include "libavcodec/avcodec.h" |
57 | de6d9b64 | Fabrice Bellard | |
58 | #include "avio.h" |
||
59 | |||
60 | f610a9f2 | Aurelien Jacobs | struct AVFormatContext;
|
61 | |||
62 | a6d18a0e | Michael Niedermayer | |
63 | /*
|
||
64 | ea29242c | Mike Melanson | * Public Metadata API.
|
65 | * The metadata API allows libavformat to export metadata tags to a client
|
||
66 | 61648423 | Anton Khirnov | * application using a sequence of key/value pairs. Like all strings in FFmpeg,
|
67 | * metadata must be stored as UTF-8 encoded Unicode. Note that metadata
|
||
68 | * exported by demuxers isn't checked to be valid UTF-8 in most cases.
|
||
69 | ea29242c | Mike Melanson | * Important concepts to keep in mind:
|
70 | * 1. Keys are unique; there can never be 2 tags with the same key. This is
|
||
71 | * also meant semantically, i.e., a demuxer should not knowingly produce
|
||
72 | * several keys that are literally different but semantically identical.
|
||
73 | * E.g., key=Author5, key=Author6. In this example, all authors must be
|
||
74 | * placed in the same tag.
|
||
75 | * 2. Metadata is flat, not hierarchical; there are no subtags. If you
|
||
76 | * want to store, e.g., the email address of the child of producer Alice
|
||
77 | * and actor Bob, that could have key=alice_and_bobs_childs_email_address.
|
||
78 | ca76a119 | Anton Khirnov | * 3. Several modifiers can be applied to the tag name. This is done by
|
79 | * appending a dash character ('-') and the modifier name in the order
|
||
80 | * they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng.
|
||
81 | * a) language -- a tag whose value is localized for a particular language
|
||
82 | * is appended with the ISO 639-2/B 3-letter language code.
|
||
83 | * For example: Author-ger=Michael, Author-eng=Mike
|
||
84 | * The original/default language is in the unqualified "Author" tag.
|
||
85 | * A demuxer should set a default if it sets any translated tag.
|
||
86 | * b) sorting -- a modified version of a tag that should be used for
|
||
87 | * sorting will have '-sort' appended. E.g. artist="The Beatles",
|
||
88 | * artist-sort="Beatles, The".
|
||
89 | *
|
||
90 | * 4. Tag names are normally exported exactly as stored in the container to
|
||
91 | * allow lossless remuxing to the same format. For container-independent
|
||
92 | * handling of metadata, av_metadata_conv() can convert it to ffmpeg generic
|
||
93 | * format. Follows a list of generic tag names:
|
||
94 | *
|
||
95 | * album -- name of the set this work belongs to
|
||
96 | * album_artist -- main creator of the set/album, if different from artist.
|
||
97 | * e.g. "Various Artists" for compilation albums.
|
||
98 | * artist -- main creator of the work
|
||
99 | * comment -- any additional description of the file.
|
||
100 | * composer -- who composed the work, if different from artist.
|
||
101 | * copyright -- name of copyright holder.
|
||
102 | * date -- date when the work was created, preferably in ISO 8601.
|
||
103 | * disc -- number of a subset, e.g. disc in a multi-disc collection.
|
||
104 | * encoder -- name/settings of the software/hardware that produced the file.
|
||
105 | * encoded_by -- person/group who created the file.
|
||
106 | * filename -- original name of the file.
|
||
107 | * genre -- <self-evident>.
|
||
108 | * language -- main language in which the work is performed, preferably
|
||
109 | * in ISO 639-2 format.
|
||
110 | * performer -- artist who performed the work, if different from artist.
|
||
111 | * E.g for "Also sprach Zarathustra", artist would be "Richard
|
||
112 | * Strauss" and performer "London Philharmonic Orchestra".
|
||
113 | * publisher -- name of the label/publisher.
|
||
114 | * title -- name of the work.
|
||
115 | * track -- number of this work in the set, can be in form current/total.
|
||
116 | a6d18a0e | Michael Niedermayer | */
|
117 | |||
118 | 48a81c0f | Aurelien Jacobs | #define AV_METADATA_MATCH_CASE 1 |
119 | a6d18a0e | Michael Niedermayer | #define AV_METADATA_IGNORE_SUFFIX 2 |
120 | a181981e | Michael Niedermayer | #define AV_METADATA_DONT_STRDUP_KEY 4 |
121 | #define AV_METADATA_DONT_STRDUP_VAL 8 |
||
122 | 56a8242f | Ronald S. Bultje | #define AV_METADATA_DONT_OVERWRITE 16 ///< Don't overwrite existing tags. |
123 | a6d18a0e | Michael Niedermayer | |
124 | typedef struct { |
||
125 | char *key;
|
||
126 | char *value;
|
||
127 | bc1d2afb | Aurelien Jacobs | }AVMetadataTag; |
128 | a6d18a0e | Michael Niedermayer | |
129 | e232c252 | Aurelien Jacobs | typedef struct AVMetadata AVMetadata; |
130 | f610a9f2 | Aurelien Jacobs | typedef struct AVMetadataConv AVMetadataConv; |
131 | a6d18a0e | Michael Niedermayer | |
132 | /**
|
||
133 | 49bd8e4b | Måns Rullgård | * Get a metadata element with matching key.
|
134 | 22e77e44 | Diego Biurrun | * @param prev Set to the previous matching element to find the next.
|
135 | 66b6c745 | Stefano Sabatini | * If set to NULL the first matching element is returned.
|
136 | 22e77e44 | Diego Biurrun | * @param flags Allows case as well as suffix-insensitive comparisons.
|
137 | * @return Found tag or NULL, changing key or value leads to undefined behavior.
|
||
138 | a6d18a0e | Michael Niedermayer | */
|
139 | bc1d2afb | Aurelien Jacobs | AVMetadataTag * |
140 | e232c252 | Aurelien Jacobs | av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int flags); |
141 | a6d18a0e | Michael Niedermayer | |
142 | a181981e | Michael Niedermayer | #if LIBAVFORMAT_VERSION_MAJOR == 52 |
143 | a6d18a0e | Michael Niedermayer | /**
|
144 | 49bd8e4b | Måns Rullgård | * Set the given tag in m, overwriting an existing tag.
|
145 | 22e77e44 | Diego Biurrun | * @param key tag key to add to m (will be av_strduped)
|
146 | * @param value tag value to add to m (will be av_strduped)
|
||
147 | * @return >= 0 on success otherwise an error code <0
|
||
148 | 2ef6c124 | Stefano Sabatini | * @deprecated Use av_metadata_set2() instead.
|
149 | a6d18a0e | Michael Niedermayer | */
|
150 | 2ef6c124 | Stefano Sabatini | attribute_deprecated int av_metadata_set(AVMetadata **pm, const char *key, const char *value); |
151 | a181981e | Michael Niedermayer | #endif
|
152 | |||
153 | /**
|
||
154 | 49bd8e4b | Måns Rullgård | * Set the given tag in m, overwriting an existing tag.
|
155 | a181981e | Michael Niedermayer | * @param key tag key to add to m (will be av_strduped depending on flags)
|
156 | 160c896c | Anton Khirnov | * @param value tag value to add to m (will be av_strduped depending on flags).
|
157 | * Passing a NULL value will cause an existing tag to be deleted.
|
||
158 | a181981e | Michael Niedermayer | * @return >= 0 on success otherwise an error code <0
|
159 | */
|
||
160 | int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags); |
||
161 | a6d18a0e | Michael Niedermayer | |
162 | 094d9df7 | Aurelien Jacobs | /**
|
163 | 49bd8e4b | Måns Rullgård | * Convert all the metadata sets from ctx according to the source and
|
164 | ca76a119 | Anton Khirnov | * destination conversion tables. If one of the tables is NULL, then
|
165 | * tags are converted to/from ffmpeg generic tag names.
|
||
166 | f610a9f2 | Aurelien Jacobs | * @param d_conv destination tags format conversion table
|
167 | * @param s_conv source tags format conversion table
|
||
168 | */
|
||
169 | void av_metadata_conv(struct AVFormatContext *ctx,const AVMetadataConv *d_conv, |
||
170 | const AVMetadataConv *s_conv);
|
||
171 | |||
172 | /**
|
||
173 | 49bd8e4b | Måns Rullgård | * Free all the memory allocated for an AVMetadata struct.
|
174 | 094d9df7 | Aurelien Jacobs | */
|
175 | void av_metadata_free(AVMetadata **m);
|
||
176 | |||
177 | a6d18a0e | Michael Niedermayer | |
178 | de6d9b64 | Fabrice Bellard | /* packet functions */
|
179 | |||
180 | 3217cb42 | Panagiotis Issaris | |
181 | /**
|
||
182 | 49bd8e4b | Måns Rullgård | * Allocate and read the payload of a packet and initialize its
|
183 | d1b9adf2 | Stefano Sabatini | * fields with default values.
|
184 | 3217cb42 | Panagiotis Issaris | *
|
185 | * @param pkt packet
|
||
186 | 4f57fa8c | Diego Biurrun | * @param size desired payload size
|
187 | * @return >0 (read size) if OK, AVERROR_xxx otherwise
|
||
188 | 3217cb42 | Panagiotis Issaris | */
|
189 | 2692067a | Michael Niedermayer | int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size); |
190 | 3217cb42 | Panagiotis Issaris | |
191 | de6d9b64 | Fabrice Bellard | |
192 | /*************************************************/
|
||
193 | 916c80e9 | Fabrice Bellard | /* fractional numbers for exact pts handling */
|
194 | |||
195 | 671adb17 | Mark Cox | /**
|
196 | 4f57fa8c | Diego Biurrun | * The exact value of the fractional number is: 'val + num / den'.
|
197 | * num is assumed to be 0 <= num < den.
|
||
198 | 4c08b2bd | Stefano Sabatini | */
|
199 | 916c80e9 | Fabrice Bellard | typedef struct AVFrac { |
200 | 115329f1 | Diego Biurrun | int64_t val, num, den; |
201 | 52e57500 | Diego Biurrun | } AVFrac; |
202 | 916c80e9 | Fabrice Bellard | |
203 | /*************************************************/
|
||
204 | b9a281db | Fabrice Bellard | /* input/output formats */
|
205 | de6d9b64 | Fabrice Bellard | |
206 | 7caf0cc6 | Michael Niedermayer | struct AVCodecTag;
|
207 | |||
208 | 4f57fa8c | Diego Biurrun | /** This structure contains the data a format has to probe a file. */
|
209 | b9a281db | Fabrice Bellard | typedef struct AVProbeData { |
210 | 5c91a675 | Zdenek Kabelac | const char *filename; |
211 | e5f58f81 | shinya.tesutosan@hotmail.com | unsigned char *buf; /**< Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero. */ |
212 | int buf_size; /**< Size of buf except extra allocated bytes */ |
||
213 | b9a281db | Fabrice Bellard | } AVProbeData; |
214 | |||
215 | 22e77e44 | Diego Biurrun | #define AVPROBE_SCORE_MAX 100 ///< maximum score, half of that is used for file-extension-based detection |
216 | 87e87886 | Michael Niedermayer | #define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer |
217 | de6d9b64 | Fabrice Bellard | |
218 | typedef struct AVFormatParameters { |
||
219 | c0df9d75 | Michael Niedermayer | AVRational time_base; |
220 | de6d9b64 | Fabrice Bellard | int sample_rate;
|
221 | int channels;
|
||
222 | int width;
|
||
223 | int height;
|
||
224 | 4606ac8d | Zdenek Kabelac | enum PixelFormat pix_fmt;
|
225 | 4f57fa8c | Diego Biurrun | int channel; /**< Used to select DV channel. */ |
226 | const char *standard; /**< TV standard, NTSC, PAL, SECAM */ |
||
227 | unsigned int mpeg2ts_raw:1; /**< Force raw MPEG-2 transport stream output, if possible. */ |
||
228 | unsigned int mpeg2ts_compute_pcr:1; /**< Compute exact PCR for each transport |
||
229 | 72e043dd | Erik Hovland | stream packet (only meaningful if
|
230 | 4f57fa8c | Diego Biurrun | mpeg2ts_raw is TRUE). */
|
231 | unsigned int initial_pause:1; /**< Do not begin to play the stream |
||
232 | immediately (RTSP only). */
|
||
233 | 72e043dd | Erik Hovland | unsigned int prealloced_context:1; |
234 | 71957315 | Michael Niedermayer | #if LIBAVFORMAT_VERSION_INT < (53<<16) |
235 | 5b6d5596 | Michael Niedermayer | enum CodecID video_codec_id;
|
236 | enum CodecID audio_codec_id;
|
||
237 | 71957315 | Michael Niedermayer | #endif
|
238 | de6d9b64 | Fabrice Bellard | } AVFormatParameters; |
239 | |||
240 | 4f57fa8c | Diego Biurrun | //! Demuxer will use url_fopen, no opened file should be provided by the caller.
|
241 | 40d9c544 | Reimar Döffinger | #define AVFMT_NOFILE 0x0001 |
242 | 4f57fa8c | Diego Biurrun | #define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */ |
243 | #define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */ |
||
244 | #define AVFMT_RAWPICTURE 0x0020 /**< Format wants AVPicture structure for |
||
245 | raw picture data. */
|
||
246 | #define AVFMT_GLOBALHEADER 0x0040 /**< Format wants global header. */ |
||
247 | #define AVFMT_NOTIMESTAMPS 0x0080 /**< Format does not need / have any timestamps. */ |
||
248 | #define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */ |
||
249 | #define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities. */ |
||
250 | 25918212 | Michael Niedermayer | #define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */ |
251 | ab5a0175 | Michael Niedermayer | #define AVFMT_NODIMENSIONS 0x0800 /**< Format does not need width/height */ |
252 | b9a281db | Fabrice Bellard | |
253 | typedef struct AVOutputFormat { |
||
254 | de6d9b64 | Fabrice Bellard | const char *name; |
255 | bde15e74 | Stefano Sabatini | /**
|
256 | * Descriptive name for the format, meant to be more human-readable
|
||
257 | 819174fa | Stefano Sabatini | * than name. You should use the NULL_IF_CONFIG_SMALL() macro
|
258 | bde15e74 | Stefano Sabatini | * to define it.
|
259 | */
|
||
260 | de6d9b64 | Fabrice Bellard | const char *long_name; |
261 | const char *mime_type; |
||
262 | 4f57fa8c | Diego Biurrun | const char *extensions; /**< comma-separated filename extensions */ |
263 | 22e77e44 | Diego Biurrun | /** size of private data so that it can be allocated in the wrapper */
|
264 | b9a281db | Fabrice Bellard | int priv_data_size;
|
265 | de6d9b64 | Fabrice Bellard | /* output support */
|
266 | 43d414ba | Panagiotis Issaris | enum CodecID audio_codec; /**< default audio codec */ |
267 | enum CodecID video_codec; /**< default video codec */ |
||
268 | de6d9b64 | Fabrice Bellard | int (*write_header)(struct AVFormatContext *); |
269 | e928649b | Michael Niedermayer | int (*write_packet)(struct AVFormatContext *, AVPacket *pkt); |
270 | de6d9b64 | Fabrice Bellard | int (*write_trailer)(struct AVFormatContext *); |
271 | 43d414ba | Panagiotis Issaris | /** can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER */
|
272 | b9a281db | Fabrice Bellard | int flags;
|
273 | 4f57fa8c | Diego Biurrun | /** Currently only used to set pixel format if not YUV420P. */
|
274 | 290c5fa6 | Fabrice Bellard | int (*set_parameters)(struct AVFormatContext *, AVFormatParameters *); |
275 | 78cb7273 | Diego Biurrun | int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, |
276 | AVPacket *in, int flush);
|
||
277 | 7caf0cc6 | Michael Niedermayer | |
278 | /**
|
||
279 | 78cb7273 | Diego Biurrun | * List of supported codec_id-codec_tag pairs, ordered by "better
|
280 | 22e77e44 | Diego Biurrun | * choice first". The arrays are all terminated by CODEC_ID_NONE.
|
281 | 7caf0cc6 | Michael Niedermayer | */
|
282 | c1854592 | Reimar Döffinger | const struct AVCodecTag * const *codec_tag; |
283 | 7caf0cc6 | Michael Niedermayer | |
284 | 11bf3847 | Aurelien Jacobs | enum CodecID subtitle_codec; /**< default subtitle codec */ |
285 | |||
286 | 719e721a | Aurelien Jacobs | const AVMetadataConv *metadata_conv;
|
287 | f610a9f2 | Aurelien Jacobs | |
288 | b9a281db | Fabrice Bellard | /* private fields */
|
289 | struct AVOutputFormat *next;
|
||
290 | } AVOutputFormat; |
||
291 | de6d9b64 | Fabrice Bellard | |
292 | b9a281db | Fabrice Bellard | typedef struct AVInputFormat { |
293 | const char *name; |
||
294 | bde15e74 | Stefano Sabatini | /**
|
295 | * Descriptive name for the format, meant to be more human-readable
|
||
296 | 819174fa | Stefano Sabatini | * than name. You should use the NULL_IF_CONFIG_SMALL() macro
|
297 | bde15e74 | Stefano Sabatini | * to define it.
|
298 | */
|
||
299 | b9a281db | Fabrice Bellard | const char *long_name; |
300 | 4f57fa8c | Diego Biurrun | /** Size of private data so that it can be allocated in the wrapper. */
|
301 | b9a281db | Fabrice Bellard | int priv_data_size;
|
302 | 65d7d68b | Michael Niedermayer | /**
|
303 | 22e77e44 | Diego Biurrun | * Tell if a given file has a chance of being parsed as this format.
|
304 | 5d81d641 | Diego Biurrun | * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes
|
305 | * big so you do not have to check for that unless you need more.
|
||
306 | 65d7d68b | Michael Niedermayer | */
|
307 | b9a281db | Fabrice Bellard | int (*read_probe)(AVProbeData *);
|
308 | 4f57fa8c | Diego Biurrun | /** Read the format header and initialize the AVFormatContext
|
309 | structure. Return 0 if OK. 'ap' if non-NULL contains
|
||
310 | additional parameters. Only used in raw format right
|
||
311 | b9a281db | Fabrice Bellard | now. 'av_new_stream' should be called to create new streams. */
|
312 | de6d9b64 | Fabrice Bellard | int (*read_header)(struct AVFormatContext *, |
313 | AVFormatParameters *ap); |
||
314 | 4f57fa8c | Diego Biurrun | /** Read one packet and put it in 'pkt'. pts and flags are also
|
315 | b9a281db | Fabrice Bellard | set. 'av_new_stream' can be called only if the flag
|
316 | 6883ebe4 | Reimar Döffinger | AVFMTCTX_NOHEADER is used.
|
317 | @return 0 on success, < 0 on error.
|
||
318 | When returning an error, pkt must not have been allocated
|
||
319 | or must be freed before returning */
|
||
320 | de6d9b64 | Fabrice Bellard | int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); |
321 | 4f57fa8c | Diego Biurrun | /** Close the stream. The AVFormatContext and AVStreams are not
|
322 | de6d9b64 | Fabrice Bellard | freed by this function */
|
323 | int (*read_close)(struct AVFormatContext *); |
||
324 | 1de2db8f | Michael Niedermayer | |
325 | #if LIBAVFORMAT_VERSION_MAJOR < 53 |
||
326 | 115329f1 | Diego Biurrun | /**
|
327 | 4f57fa8c | Diego Biurrun | * Seek to a given timestamp relative to the frames in
|
328 | * stream component stream_index.
|
||
329 | 22e77e44 | Diego Biurrun | * @param stream_index Must not be -1.
|
330 | * @param flags Selects which direction should be preferred if no exact
|
||
331 | * match is available.
|
||
332 | 05ce0f11 | Maksym Veremeyenko | * @return >= 0 on success (but not necessarily the new offset)
|
333 | 3ba1438d | Michael Niedermayer | */
|
334 | 115329f1 | Diego Biurrun | int (*read_seek)(struct AVFormatContext *, |
335 | 3ba1438d | Michael Niedermayer | int stream_index, int64_t timestamp, int flags); |
336 | 1de2db8f | Michael Niedermayer | #endif
|
337 | 8d14a25c | Michael Niedermayer | /**
|
338 | 4f57fa8c | Diego Biurrun | * Gets the next timestamp in stream[stream_index].time_base units.
|
339 | d9526386 | Diego Biurrun | * @return the timestamp or AV_NOPTS_VALUE if an error occurred
|
340 | 8d14a25c | Michael Niedermayer | */
|
341 | int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index, |
||
342 | int64_t *pos, int64_t pos_limit); |
||
343 | 4f57fa8c | Diego Biurrun | /** Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER. */
|
344 | de6d9b64 | Fabrice Bellard | int flags;
|
345 | 4f57fa8c | Diego Biurrun | /** If extensions are defined, then no probe is done. You should
|
346 | b9a281db | Fabrice Bellard | usually not use extension format guessing because it is not
|
347 | reliable enough */
|
||
348 | const char *extensions; |
||
349 | 4f57fa8c | Diego Biurrun | /** General purpose read-only value that the format can use. */
|
350 | b9a281db | Fabrice Bellard | int value;
|
351 | fb2758c8 | Fabrice Bellard | |
352 | 49bd8e4b | Måns Rullgård | /** Start/resume playing - only meaningful if using a network-based format
|
353 | 4f57fa8c | Diego Biurrun | (RTSP). */
|
354 | fb2758c8 | Fabrice Bellard | int (*read_play)(struct AVFormatContext *); |
355 | |||
356 | 49bd8e4b | Måns Rullgård | /** Pause playing - only meaningful if using a network-based format
|
357 | 4f57fa8c | Diego Biurrun | (RTSP). */
|
358 | fb2758c8 | Fabrice Bellard | int (*read_pause)(struct AVFormatContext *); |
359 | |||
360 | c1854592 | Reimar Döffinger | const struct AVCodecTag * const *codec_tag; |
361 | 7caf0cc6 | Michael Niedermayer | |
362 | 1de2db8f | Michael Niedermayer | /**
|
363 | 49bd8e4b | Måns Rullgård | * Seek to timestamp ts.
|
364 | 1de2db8f | Michael Niedermayer | * Seeking will be done so that the point from which all active streams
|
365 | * can be presented successfully will be closest to ts and within min/max_ts.
|
||
366 | * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
|
||
367 | */
|
||
368 | 882fb0a3 | Michael Niedermayer | int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); |
369 | 1de2db8f | Michael Niedermayer | |
370 | 719e721a | Aurelien Jacobs | const AVMetadataConv *metadata_conv;
|
371 | f610a9f2 | Aurelien Jacobs | |
372 | b9a281db | Fabrice Bellard | /* private fields */
|
373 | struct AVInputFormat *next;
|
||
374 | } AVInputFormat; |
||
375 | de6d9b64 | Fabrice Bellard | |
376 | 57004ff1 | Aurelien Jacobs | enum AVStreamParseType {
|
377 | AVSTREAM_PARSE_NONE, |
||
378 | AVSTREAM_PARSE_FULL, /**< full parsing and repack */
|
||
379 | 4f57fa8c | Diego Biurrun | AVSTREAM_PARSE_HEADERS, /**< Only parse headers, do not repack. */
|
380 | 78cb7273 | Diego Biurrun | AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on a packet boundary */
|
381 | 74a6df59 | Alex Converse | AVSTREAM_PARSE_FULL_ONCE, /**< full parsing and repack of the first frame only, only implemented for H.264 currently */
|
382 | 57004ff1 | Aurelien Jacobs | }; |
383 | |||
384 | fb2758c8 | Fabrice Bellard | typedef struct AVIndexEntry { |
385 | int64_t pos; |
||
386 | int64_t timestamp; |
||
387 | #define AVINDEX_KEYFRAME 0x0001 |
||
388 | 30a43f2d | Michael Niedermayer | int flags:2; |
389 | 4f57fa8c | Diego Biurrun | int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs. 32 bytes due to possible 8-byte alignment). |
390 | int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */ |
||
391 | fb2758c8 | Fabrice Bellard | } AVIndexEntry; |
392 | |||
393 | 90c2295b | Evgeniy Stepanov | #define AV_DISPOSITION_DEFAULT 0x0001 |
394 | #define AV_DISPOSITION_DUB 0x0002 |
||
395 | #define AV_DISPOSITION_ORIGINAL 0x0004 |
||
396 | #define AV_DISPOSITION_COMMENT 0x0008 |
||
397 | #define AV_DISPOSITION_LYRICS 0x0010 |
||
398 | #define AV_DISPOSITION_KARAOKE 0x0020 |
||
399 | 7a617a86 | Aurelien Jacobs | /** Track should be used during playback by default.
|
400 | Useful for subtitle track that should be displayed
|
||
401 | even when user did not explicitly ask for subtitles. */
|
||
402 | #define AV_DISPOSITION_FORCED 0x0040 |
||
403 | 90c2295b | Evgeniy Stepanov | |
404 | ba66ae94 | Michael Niedermayer | /**
|
405 | * Stream structure.
|
||
406 | * New fields can be added to the end with minor version bumps.
|
||
407 | 8bfb108b | Diego Biurrun | * Removal, reordering and changes to existing fields require a major
|
408 | ba66ae94 | Michael Niedermayer | * version bump.
|
409 | 8bfb108b | Diego Biurrun | * sizeof(AVStream) must not be used outside libav*.
|
410 | ba66ae94 | Michael Niedermayer | */
|
411 | de6d9b64 | Fabrice Bellard | typedef struct AVStream { |
412 | 43d414ba | Panagiotis Issaris | int index; /**< stream index in AVFormatContext */ |
413 | 4f57fa8c | Diego Biurrun | int id; /**< format-specific stream ID */ |
414 | 43d414ba | Panagiotis Issaris | AVCodecContext *codec; /**< codec context */
|
415 | b4b87d48 | Michael Niedermayer | /**
|
416 | 22e77e44 | Diego Biurrun | * Real base framerate of the stream.
|
417 | * This is the lowest framerate with which all timestamps can be
|
||
418 | 864ff8c1 | Ramiro Polla | * represented accurately (it is the least common multiple of all
|
419 | 22e77e44 | Diego Biurrun | * framerates in the stream). Note, this value is just a guess!
|
420 | * For example, if the time base is 1/90000 and all frames have either
|
||
421 | 4f57fa8c | Diego Biurrun | * approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1.
|
422 | b4b87d48 | Michael Niedermayer | */
|
423 | AVRational r_frame_rate; |
||
424 | de6d9b64 | Fabrice Bellard | void *priv_data;
|
425 | 82583548 | Michael Niedermayer | |
426 | b9a281db | Fabrice Bellard | /* internal data used in av_find_stream_info() */
|
427 | 82583548 | Michael Niedermayer | int64_t first_dts; |
428 | 4f57fa8c | Diego Biurrun | /** encoding: pts generation when outputting stream */
|
429 | a9fd2b19 | Måns Rullgård | struct AVFrac pts;
|
430 | 5b28c8c3 | Michael Niedermayer | |
431 | /**
|
||
432 | 8bfb108b | Diego Biurrun | * This is the fundamental unit of time (in seconds) in terms
|
433 | * of which frame timestamps are represented. For fixed-fps content,
|
||
434 | 22e77e44 | Diego Biurrun | * time base should be 1/framerate and timestamp increments should be 1.
|
435 | 5b28c8c3 | Michael Niedermayer | */
|
436 | 9ee91c2f | Michael Niedermayer | AVRational time_base; |
437 | 43d414ba | Panagiotis Issaris | int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ |
438 | a48b7a6b | Fabrice Bellard | /* ffmpeg.c private use */
|
439 | 4f57fa8c | Diego Biurrun | int stream_copy; /**< If set, just copy stream. */ |
440 | enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed. |
||
441 | b4aea108 | Michael Niedermayer | //FIXME move stuff to a flags field?
|
442 | 4f57fa8c | Diego Biurrun | /** Quality, as it has been removed from AVCodecContext and put in AVVideoFrame.
|
443 | 755bfeab | Diego Biurrun | * MN: dunno if that is the right place for it */
|
444 | 115329f1 | Diego Biurrun | float quality;
|
445 | 6d96a9b9 | Michael Niedermayer | /**
|
446 | 8bfb108b | Diego Biurrun | * Decoding: pts of the first frame of the stream, in stream time base.
|
447 | * Only set this if you are absolutely 100% sure that the value you set
|
||
448 | * it to really is the pts of the first frame.
|
||
449 | 4854c253 | Neil Brown | * This may be undefined (AV_NOPTS_VALUE).
|
450 | 8bfb108b | Diego Biurrun | * @note The ASF header does NOT contain a correct start_time the ASF
|
451 | * demuxer must NOT set this.
|
||
452 | 6d96a9b9 | Michael Niedermayer | */
|
453 | 115329f1 | Diego Biurrun | int64_t start_time; |
454 | e26381b6 | Neil Brown | /**
|
455 | 8bfb108b | Diego Biurrun | * Decoding: duration of the stream, in stream time base.
|
456 | e26381b6 | Neil Brown | * If a source file does not specify a duration, but does specify
|
457 | 4f57fa8c | Diego Biurrun | * a bitrate, this value will be estimated from bitrate and file size.
|
458 | e26381b6 | Neil Brown | */
|
459 | ee404803 | Fabrice Bellard | int64_t duration; |
460 | fb2758c8 | Fabrice Bellard | |
461 | 827f7e28 | Aurelien Jacobs | #if LIBAVFORMAT_VERSION_INT < (53<<16) |
462 | 7e030c47 | Michael Niedermayer | char language[4]; /** ISO 639-2/B 3-letter language code (empty string if undefined) */ |
463 | 827f7e28 | Aurelien Jacobs | #endif
|
464 | 09730260 | Fabrice Bellard | |
465 | fb2758c8 | Fabrice Bellard | /* av_read_frame() support */
|
466 | 57004ff1 | Aurelien Jacobs | enum AVStreamParseType need_parsing;
|
467 | fb2758c8 | Fabrice Bellard | struct AVCodecParserContext *parser;
|
468 | 6ec87caa | Fabrice Bellard | |
469 | fb2758c8 | Fabrice Bellard | int64_t cur_dts; |
470 | 635fbcb1 | Michael Niedermayer | int last_IP_duration;
|
471 | int64_t last_IP_pts; |
||
472 | fb2758c8 | Fabrice Bellard | /* av_seek_frame() support */
|
473 | 4f57fa8c | Diego Biurrun | AVIndexEntry *index_entries; /**< Only used if the format does not
|
474 | support seeking natively. */
|
||
475 | fb2758c8 | Fabrice Bellard | int nb_index_entries;
|
476 | 191e8ca7 | Måns Rullgård | unsigned int index_entries_allocated_size; |
477 | 115329f1 | Diego Biurrun | |
478 | b4b87d48 | Michael Niedermayer | int64_t nb_frames; ///< number of frames in this stream if known or 0
|
479 | 504ee036 | Michael Niedermayer | |
480 | 0d84a8f6 | Baptiste Coudurier | #if LIBAVFORMAT_VERSION_INT < (53<<16) |
481 | int64_t unused[4+1]; |
||
482 | f8d7c9d3 | Evgeniy Stepanov | |
483 | char *filename; /**< source filename of the stream */ |
||
484 | 827f7e28 | Aurelien Jacobs | #endif
|
485 | 90c2295b | Evgeniy Stepanov | |
486 | 4f57fa8c | Diego Biurrun | int disposition; /**< AV_DISPOSITION_* bit field */ |
487 | 0bef08e5 | Michael Niedermayer | |
488 | AVProbeData probe_data; |
||
489 | 0d84a8f6 | Baptiste Coudurier | #define MAX_REORDER_DELAY 16 |
490 | int64_t pts_buffer[MAX_REORDER_DELAY+1];
|
||
491 | c30a4489 | Aurelien Jacobs | |
492 | /**
|
||
493 | * sample aspect ratio (0 if unknown)
|
||
494 | * - encoding: Set by user.
|
||
495 | * - decoding: Set by libavformat.
|
||
496 | */
|
||
497 | AVRational sample_aspect_ratio; |
||
498 | f526adaf | Aurelien Jacobs | |
499 | e232c252 | Aurelien Jacobs | AVMetadata *metadata; |
500 | 3a41c2f7 | Michael Niedermayer | |
501 | 31769dad | Víctor Paesa | /* Intended mostly for av_read_frame() support. Not supposed to be used by */
|
502 | /* external applications; try to use something else if at all possible. */
|
||
503 | 3a41c2f7 | Michael Niedermayer | const uint8_t *cur_ptr;
|
504 | int cur_len;
|
||
505 | AVPacket cur_pkt; |
||
506 | 27ca0a79 | Ivan Schreter | |
507 | // Timestamp generation support:
|
||
508 | /**
|
||
509 | * Timestamp corresponding to the last dts sync point.
|
||
510 | *
|
||
511 | * Initialized when AVCodecParserContext.dts_sync_point >= 0 and
|
||
512 | * a DTS is received from the underlying container. Otherwise set to
|
||
513 | * AV_NOPTS_VALUE by default.
|
||
514 | */
|
||
515 | int64_t reference_dts; |
||
516 | 86cb7e33 | Baptiste Coudurier | |
517 | /**
|
||
518 | * Number of packets to buffer for codec probing
|
||
519 | * NOT PART OF PUBLIC API
|
||
520 | */
|
||
521 | 48616887 | Carl Eugen Hoyos | #define MAX_PROBE_PACKETS 2500 |
522 | 86cb7e33 | Baptiste Coudurier | int probe_packets;
|
523 | ddce56ef | Michael Niedermayer | |
524 | /**
|
||
525 | e07b882b | Michael Niedermayer | * last packet in packet_buffer for this stream when muxing.
|
526 | ddce56ef | Michael Niedermayer | * used internally, NOT PART OF PUBLIC API, dont read or write from outside of libav*
|
527 | */
|
||
528 | e07b882b | Michael Niedermayer | struct AVPacketList *last_in_packet_buffer;
|
529 | 02b398ef | Michael Niedermayer | |
530 | /**
|
||
531 | * Average framerate
|
||
532 | */
|
||
533 | AVRational avg_frame_rate; |
||
534 | 6c6e6ef5 | Michael Niedermayer | |
535 | /**
|
||
536 | * Number of frames that have been demuxed during av_find_stream_info()
|
||
537 | */
|
||
538 | int codec_info_nb_frames;
|
||
539 | de6d9b64 | Fabrice Bellard | } AVStream; |
540 | |||
541 | 15afa396 | Nico Sabbi | #define AV_PROGRAM_RUNNING 1 |
542 | |||
543 | ba66ae94 | Michael Niedermayer | /**
|
544 | * New fields can be added to the end with minor version bumps.
|
||
545 | 8bfb108b | Diego Biurrun | * Removal, reordering and changes to existing fields require a major
|
546 | ba66ae94 | Michael Niedermayer | * version bump.
|
547 | 8bfb108b | Diego Biurrun | * sizeof(AVProgram) must not be used outside libav*.
|
548 | ba66ae94 | Michael Niedermayer | */
|
549 | 15afa396 | Nico Sabbi | typedef struct AVProgram { |
550 | int id;
|
||
551 | 827f7e28 | Aurelien Jacobs | #if LIBAVFORMAT_VERSION_INT < (53<<16) |
552 | 4f57fa8c | Diego Biurrun | char *provider_name; ///< network name for DVB streams |
553 | char *name; ///< service name for DVB streams |
||
554 | 827f7e28 | Aurelien Jacobs | #endif
|
555 | 15afa396 | Nico Sabbi | int flags;
|
556 | enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller |
||
557 | 526efa10 | Nico Sabbi | unsigned int *stream_index; |
558 | unsigned int nb_stream_indexes; |
||
559 | e232c252 | Aurelien Jacobs | AVMetadata *metadata; |
560 | 15afa396 | Nico Sabbi | } AVProgram; |
561 | |||
562 | 43d414ba | Panagiotis Issaris | #define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present |
563 | da24c5e3 | Fabrice Bellard | (streams are added dynamically) */
|
564 | |||
565 | 79d7836a | Anton Khirnov | typedef struct AVChapter { |
566 | 4f57fa8c | Diego Biurrun | int id; ///< unique ID to identify the chapter |
567 | AVRational time_base; ///< time base in which the start/end timestamps are specified
|
||
568 | 8931e7b4 | Michael Niedermayer | int64_t start, end; ///< chapter start/end time in time_base units
|
569 | 827f7e28 | Aurelien Jacobs | #if LIBAVFORMAT_VERSION_INT < (53<<16) |
570 | c2fb6be4 | Michael Niedermayer | char *title; ///< chapter title |
571 | 827f7e28 | Aurelien Jacobs | #endif
|
572 | e232c252 | Aurelien Jacobs | AVMetadata *metadata; |
573 | 79d7836a | Anton Khirnov | } AVChapter; |
574 | |||
575 | ad5cc780 | Jai Menon | #if LIBAVFORMAT_VERSION_MAJOR < 53 |
576 | de6d9b64 | Fabrice Bellard | #define MAX_STREAMS 20 |
577 | ad5cc780 | Jai Menon | #endif
|
578 | de6d9b64 | Fabrice Bellard | |
579 | 252f17e2 | Michael Niedermayer | /**
|
580 | 4f57fa8c | Diego Biurrun | * Format I/O context.
|
581 | 252f17e2 | Michael Niedermayer | * New fields can be added to the end with minor version bumps.
|
582 | 8bfb108b | Diego Biurrun | * Removal, reordering and changes to existing fields require a major
|
583 | 252f17e2 | Michael Niedermayer | * version bump.
|
584 | 8bfb108b | Diego Biurrun | * sizeof(AVFormatContext) must not be used outside libav*.
|
585 | 252f17e2 | Michael Niedermayer | */
|
586 | de6d9b64 | Fabrice Bellard | typedef struct AVFormatContext { |
587 | 1447aac4 | avcoder | const AVClass *av_class; /**< Set by avformat_alloc_context. */ |
588 | 4f57fa8c | Diego Biurrun | /* Can only be iformat or oformat, not both at the same time. */
|
589 | b9a281db | Fabrice Bellard | struct AVInputFormat *iformat;
|
590 | struct AVOutputFormat *oformat;
|
||
591 | de6d9b64 | Fabrice Bellard | void *priv_data;
|
592 | 899681cd | Björn Axelsson | ByteIOContext *pb; |
593 | db69c2e5 | Diego Biurrun | unsigned int nb_streams; |
594 | de6d9b64 | Fabrice Bellard | AVStream *streams[MAX_STREAMS]; |
595 | 43d414ba | Panagiotis Issaris | char filename[1024]; /**< input or output filename */ |
596 | de6d9b64 | Fabrice Bellard | /* stream info */
|
597 | 4568325a | Roman Shaposhnik | int64_t timestamp; |
598 | 827f7e28 | Aurelien Jacobs | #if LIBAVFORMAT_VERSION_INT < (53<<16) |
599 | de6d9b64 | Fabrice Bellard | char title[512]; |
600 | char author[512]; |
||
601 | char copyright[512]; |
||
602 | char comment[512]; |
||
603 | 6a58e151 | Fabrice Bellard | char album[512]; |
604 | 43d414ba | Panagiotis Issaris | int year; /**< ID3 year, 0 if none */ |
605 | int track; /**< track number, 0 if none */ |
||
606 | char genre[32]; /**< ID3 genre */ |
||
607 | 827f7e28 | Aurelien Jacobs | #endif
|
608 | 6a58e151 | Fabrice Bellard | |
609 | 4f57fa8c | Diego Biurrun | int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */ |
610 | /* private data for pts handling (do not modify directly). */
|
||
611 | 43d414ba | Panagiotis Issaris | /** This buffer is only needed when packets were already buffered but
|
612 | 4f57fa8c | Diego Biurrun | not decoded, for example to get the codec parameters in MPEG
|
613 | streams. */
|
||
614 | ee404803 | Fabrice Bellard | struct AVPacketList *packet_buffer;
|
615 | |||
616 | 4f57fa8c | Diego Biurrun | /** Decoding: position of the first frame of the component, in
|
617 | ee404803 | Fabrice Bellard | AV_TIME_BASE fractional seconds. NEVER set this value directly:
|
618 | 4f57fa8c | Diego Biurrun | It is deduced from the AVStream values. */
|
619 | 115329f1 | Diego Biurrun | int64_t start_time; |
620 | 4f57fa8c | Diego Biurrun | /** Decoding: duration of the stream, in AV_TIME_BASE fractional
|
621 | 37f57ab4 | Michael Niedermayer | seconds. Only set this value if you know none of the individual stream
|
622 | durations and also dont set any of them. This is deduced from the
|
||
623 | AVStream values if not set. */
|
||
624 | ee404803 | Fabrice Bellard | int64_t duration; |
625 | 4f57fa8c | Diego Biurrun | /** decoding: total file size, 0 if unknown */
|
626 | ee404803 | Fabrice Bellard | int64_t file_size; |
627 | 4f57fa8c | Diego Biurrun | /** Decoding: total stream bitrate in bit/s, 0 if not
|
628 | ee404803 | Fabrice Bellard | available. Never set it directly if the file_size and the
|
629 | 22e77e44 | Diego Biurrun | duration are known as FFmpeg can compute it automatically. */
|
630 | ee404803 | Fabrice Bellard | int bit_rate;
|
631 | fb2758c8 | Fabrice Bellard | |
632 | /* av_read_frame() support */
|
||
633 | AVStream *cur_st; |
||
634 | 3a41c2f7 | Michael Niedermayer | #if LIBAVFORMAT_VERSION_INT < (53<<16) |
635 | const uint8_t *cur_ptr_deprecated;
|
||
636 | int cur_len_deprecated;
|
||
637 | AVPacket cur_pkt_deprecated; |
||
638 | #endif
|
||
639 | fb2758c8 | Fabrice Bellard | |
640 | /* av_seek_frame() support */
|
||
641 | 43d414ba | Panagiotis Issaris | int64_t data_offset; /** offset of the first packet */
|
642 | fb2758c8 | Fabrice Bellard | int index_built;
|
643 | 115329f1 | Diego Biurrun | |
644 | 2db3c638 | Michael Niedermayer | int mux_rate;
|
645 | 92400be2 | Ronald S. Bultje | unsigned int packet_size; |
646 | 17c88cb0 | Michael Niedermayer | int preload;
|
647 | int max_delay;
|
||
648 | 8108551a | Todd Kirby | |
649 | 115329f1 | Diego Biurrun | #define AVFMT_NOOUTPUTLOOP -1 |
650 | #define AVFMT_INFINITEOUTPUTLOOP 0 |
||
651 | 43d414ba | Panagiotis Issaris | /** number of times to loop output in formats that support it */
|
652 | 8108551a | Todd Kirby | int loop_output;
|
653 | 115329f1 | Diego Biurrun | |
654 | 30bc6613 | Michael Niedermayer | int flags;
|
655 | 22e77e44 | Diego Biurrun | #define AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requires parsing future frames. |
656 | 4f57fa8c | Diego Biurrun | #define AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index. |
657 | #define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets from input. |
||
658 | c55806e3 | Michael Niedermayer | #define AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS |
659 | fe8344a2 | Michael Niedermayer | #define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container |
660 | #define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled |
||
661 | 796ac233 | Martin Storsjö | #define AVFMT_FLAG_RTP_HINT 0x0040 ///< Add RTP hinting to the output file |
662 | 5894e1bb | Víctor Paesa | |
663 | int loop_input;
|
||
664 | 22e77e44 | Diego Biurrun | /** decoding: size of data to probe; encoding: unused. */
|
665 | 9e6c9470 | Nico Sabbi | unsigned int probesize; |
666 | a44b3c4d | Michael Niedermayer | |
667 | /**
|
||
668 | 4f57fa8c | Diego Biurrun | * Maximum time (in AV_TIME_BASE units) during which the input should
|
669 | * be analyzed in av_find_stream_info().
|
||
670 | a44b3c4d | Michael Niedermayer | */
|
671 | int max_analyze_duration;
|
||
672 | c964c2c7 | Reimar Döffinger | |
673 | const uint8_t *key;
|
||
674 | int keylen;
|
||
675 | 15afa396 | Nico Sabbi | |
676 | unsigned int nb_programs; |
||
677 | AVProgram **programs; |
||
678 | 62600469 | Michael Niedermayer | |
679 | /**
|
||
680 | * Forced video codec_id.
|
||
681 | 4f57fa8c | Diego Biurrun | * Demuxing: Set by user.
|
682 | 62600469 | Michael Niedermayer | */
|
683 | enum CodecID video_codec_id;
|
||
684 | /**
|
||
685 | * Forced audio codec_id.
|
||
686 | 4f57fa8c | Diego Biurrun | * Demuxing: Set by user.
|
687 | 62600469 | Michael Niedermayer | */
|
688 | enum CodecID audio_codec_id;
|
||
689 | /**
|
||
690 | * Forced subtitle codec_id.
|
||
691 | 4f57fa8c | Diego Biurrun | * Demuxing: Set by user.
|
692 | 62600469 | Michael Niedermayer | */
|
693 | enum CodecID subtitle_codec_id;
|
||
694 | 3dea63bd | Paul Kelly | |
695 | /**
|
||
696 | 22e77e44 | Diego Biurrun | * Maximum amount of memory in bytes to use for the index of each stream.
|
697 | * If the index exceeds this size, entries will be discarded as
|
||
698 | 3dea63bd | Paul Kelly | * needed to maintain a smaller size. This can lead to slower or less
|
699 | * accurate seeking (depends on demuxer).
|
||
700 | 4f57fa8c | Diego Biurrun | * Demuxers for which a full in-memory index is mandatory will ignore
|
701 | 3dea63bd | Paul Kelly | * this.
|
702 | * muxing : unused
|
||
703 | * demuxing: set by user
|
||
704 | */
|
||
705 | unsigned int max_index_size; |
||
706 | ab8ab30c | Ramiro Polla | |
707 | /**
|
||
708 | ffa71b2b | Ramiro Polla | * Maximum amount of memory in bytes to use for buffering frames
|
709 | 4f57fa8c | Diego Biurrun | * obtained from realtime capture devices.
|
710 | ab8ab30c | Ramiro Polla | */
|
711 | unsigned int max_picture_buffer; |
||
712 | 79d7836a | Anton Khirnov | |
713 | fbabf1e9 | Michael Niedermayer | unsigned int nb_chapters; |
714 | 79d7836a | Anton Khirnov | AVChapter **chapters; |
715 | 45b2b05f | Michael Niedermayer | |
716 | /**
|
||
717 | 4f57fa8c | Diego Biurrun | * Flags to enable debugging.
|
718 | 45b2b05f | Michael Niedermayer | */
|
719 | int debug;
|
||
720 | #define FF_FDEBUG_TS 0x0001 |
||
721 | 0bef08e5 | Michael Niedermayer | |
722 | /**
|
||
723 | 4f57fa8c | Diego Biurrun | * Raw packets from the demuxer, prior to parsing and decoding.
|
724 | 0bef08e5 | Michael Niedermayer | * This buffer is used for buffering packets until the codec can
|
725 | * be identified, as parsing cannot be done without knowing the
|
||
726 | * codec.
|
||
727 | */
|
||
728 | struct AVPacketList *raw_packet_buffer;
|
||
729 | 5c5b1731 | Måns Rullgård | struct AVPacketList *raw_packet_buffer_end;
|
730 | |||
731 | struct AVPacketList *packet_buffer_end;
|
||
732 | 47146dfb | Michael Niedermayer | |
733 | e232c252 | Aurelien Jacobs | AVMetadata *metadata; |
734 | af122d6a | Baptiste Coudurier | |
735 | /**
|
||
736 | * Remaining size available for raw_packet_buffer, in bytes.
|
||
737 | * NOT PART OF PUBLIC API
|
||
738 | */
|
||
739 | 48616887 | Carl Eugen Hoyos | #define RAW_PACKET_BUFFER_SIZE 2500000 |
740 | af122d6a | Baptiste Coudurier | int raw_packet_buffer_remaining_size;
|
741 | b8819c85 | Martin Storsjö | |
742 | /**
|
||
743 | * Start time of the stream in real world time, in microseconds
|
||
744 | * since the unix epoch (00:00 1st January 1970). That is, pts=0
|
||
745 | * in the stream was captured at this real world time.
|
||
746 | * - encoding: Set by user.
|
||
747 | * - decoding: Unused.
|
||
748 | */
|
||
749 | int64_t start_time_realtime; |
||
750 | de6d9b64 | Fabrice Bellard | } AVFormatContext; |
751 | |||
752 | typedef struct AVPacketList { |
||
753 | AVPacket pkt; |
||
754 | struct AVPacketList *next;
|
||
755 | } AVPacketList; |
||
756 | |||
757 | 84be6e72 | Michael Niedermayer | #if LIBAVFORMAT_VERSION_INT < (53<<16) |
758 | b9a281db | Fabrice Bellard | extern AVInputFormat *first_iformat;
|
759 | extern AVOutputFormat *first_oformat;
|
||
760 | 84be6e72 | Michael Niedermayer | #endif
|
761 | |||
762 | aeedac95 | Stefano Sabatini | /**
|
763 | * If f is NULL, returns the first registered input format,
|
||
764 | 22e77e44 | Diego Biurrun | * if f is non-NULL, returns the next registered input format after f
|
765 | aeedac95 | Stefano Sabatini | * or NULL if f is the last one.
|
766 | */
|
||
767 | 84be6e72 | Michael Niedermayer | AVInputFormat *av_iformat_next(AVInputFormat *f); |
768 | aeedac95 | Stefano Sabatini | |
769 | /**
|
||
770 | * If f is NULL, returns the first registered output format,
|
||
771 | 22e77e44 | Diego Biurrun | * if f is non-NULL, returns the next registered output format after f
|
772 | aeedac95 | Stefano Sabatini | * or NULL if f is the last one.
|
773 | */
|
||
774 | 84be6e72 | Michael Niedermayer | AVOutputFormat *av_oformat_next(AVOutputFormat *f); |
775 | de6d9b64 | Fabrice Bellard | |
776 | 5b6d5596 | Michael Niedermayer | enum CodecID av_guess_image2_codec(const char *filename); |
777 | 290c5fa6 | Fabrice Bellard | |
778 | 22e77e44 | Diego Biurrun | /* XXX: Use automatic init with either ELF sections or C file parser */
|
779 | /* modules. */
|
||
780 | de6d9b64 | Fabrice Bellard | |
781 | b9a281db | Fabrice Bellard | /* utils.c */
|
782 | void av_register_input_format(AVInputFormat *format);
|
||
783 | void av_register_output_format(AVOutputFormat *format);
|
||
784 | 1642ee43 | Stefano Sabatini | #if LIBAVFORMAT_VERSION_MAJOR < 53 |
785 | attribute_deprecated AVOutputFormat *guess_stream_format(const char *short_name, |
||
786 | 78cb7273 | Diego Biurrun | const char *filename, |
787 | const char *mime_type); |
||
788 | a1f547b9 | Stefano Sabatini | |
789 | /**
|
||
790 | * @deprecated Use av_guess_format() instead.
|
||
791 | */
|
||
792 | attribute_deprecated AVOutputFormat *guess_format(const char *short_name, |
||
793 | const char *filename, |
||
794 | const char *mime_type); |
||
795 | 1642ee43 | Stefano Sabatini | #endif
|
796 | f48b0fa2 | Stefano Sabatini | |
797 | /**
|
||
798 | 49bd8e4b | Måns Rullgård | * Return the output format in the list of registered output formats
|
799 | * which best matches the provided parameters, or return NULL if
|
||
800 | f48b0fa2 | Stefano Sabatini | * there is no match.
|
801 | *
|
||
802 | * @param short_name if non-NULL checks if short_name matches with the
|
||
803 | * names of the registered formats
|
||
804 | * @param filename if non-NULL checks if filename terminates with the
|
||
805 | * extensions of the registered formats
|
||
806 | * @param mime_type if non-NULL checks if mime_type matches with the
|
||
807 | * MIME type of the registered formats
|
||
808 | */
|
||
809 | a1f547b9 | Stefano Sabatini | AVOutputFormat *av_guess_format(const char *short_name, |
810 | 94b1f338 | Stefano Sabatini | const char *filename, |
811 | const char *mime_type); |
||
812 | 3217cb42 | Panagiotis Issaris | |
813 | /**
|
||
814 | 49bd8e4b | Måns Rullgård | * Guess the codec ID based upon muxer and filename.
|
815 | 3217cb42 | Panagiotis Issaris | */
|
816 | 115329f1 | Diego Biurrun | enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, |
817 | 78cb7273 | Diego Biurrun | const char *filename, const char *mime_type, |
818 | 72415b2a | Stefano Sabatini | enum AVMediaType type);
|
819 | de6d9b64 | Fabrice Bellard | |
820 | 3217cb42 | Panagiotis Issaris | /**
|
821 | 49bd8e4b | Måns Rullgård | * Send a nice hexadecimal dump of a buffer to the specified file stream.
|
822 | 750f0e1f | Panagiotis Issaris | *
|
823 | * @param f The file stream pointer where the dump should be sent to.
|
||
824 | 3217cb42 | Panagiotis Issaris | * @param buf buffer
|
825 | * @param size buffer size
|
||
826 | 750f0e1f | Panagiotis Issaris | *
|
827 | * @see av_hex_dump_log, av_pkt_dump, av_pkt_dump_log
|
||
828 | 3217cb42 | Panagiotis Issaris | */
|
829 | fb2758c8 | Fabrice Bellard | void av_hex_dump(FILE *f, uint8_t *buf, int size); |
830 | 3217cb42 | Panagiotis Issaris | |
831 | /**
|
||
832 | 49bd8e4b | Måns Rullgård | * Send a nice hexadecimal dump of a buffer to the log.
|
833 | 750f0e1f | Panagiotis Issaris | *
|
834 | * @param avcl A pointer to an arbitrary struct of which the first field is a
|
||
835 | * pointer to an AVClass struct.
|
||
836 | * @param level The importance level of the message, lower values signifying
|
||
837 | * higher importance.
|
||
838 | * @param buf buffer
|
||
839 | * @param size buffer size
|
||
840 | *
|
||
841 | * @see av_hex_dump, av_pkt_dump, av_pkt_dump_log
|
||
842 | */
|
||
843 | void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size); |
||
844 | |||
845 | /**
|
||
846 | 49bd8e4b | Måns Rullgård | * Send a nice dump of a packet to the specified file stream.
|
847 | 750f0e1f | Panagiotis Issaris | *
|
848 | * @param f The file stream pointer where the dump should be sent to.
|
||
849 | 3217cb42 | Panagiotis Issaris | * @param pkt packet to dump
|
850 | 4f57fa8c | Diego Biurrun | * @param dump_payload True if the payload must be displayed, too.
|
851 | 3217cb42 | Panagiotis Issaris | */
|
852 | fb2758c8 | Fabrice Bellard | void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); |
853 | de6d9b64 | Fabrice Bellard | |
854 | 750f0e1f | Panagiotis Issaris | /**
|
855 | 49bd8e4b | Måns Rullgård | * Send a nice dump of a packet to the log.
|
856 | 750f0e1f | Panagiotis Issaris | *
|
857 | * @param avcl A pointer to an arbitrary struct of which the first field is a
|
||
858 | * pointer to an AVClass struct.
|
||
859 | * @param level The importance level of the message, lower values signifying
|
||
860 | * higher importance.
|
||
861 | * @param pkt packet to dump
|
||
862 | 4f57fa8c | Diego Biurrun | * @param dump_payload True if the payload must be displayed, too.
|
863 | 750f0e1f | Panagiotis Issaris | */
|
864 | void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload); |
||
865 | |||
866 | 4815e246 | Stefano Sabatini | /**
|
867 | 49bd8e4b | Måns Rullgård | * Initialize libavformat and register all the muxers, demuxers and
|
868 | 4815e246 | Stefano Sabatini | * protocols. If you do not call this function, then you can select
|
869 | * exactly which formats you want to support.
|
||
870 | *
|
||
871 | * @see av_register_input_format()
|
||
872 | * @see av_register_output_format()
|
||
873 | 5d377501 | Stefano Sabatini | * @see av_register_protocol()
|
874 | 4815e246 | Stefano Sabatini | */
|
875 | 94988531 | Fabrice Bellard | void av_register_all(void); |
876 | de6d9b64 | Fabrice Bellard | |
877 | 7693b93e | Stefano Sabatini | /**
|
878 | 49bd8e4b | Måns Rullgård | * Get the CodecID for the given codec tag tag.
|
879 | 7693b93e | Stefano Sabatini | * If no codec id is found returns CODEC_ID_NONE.
|
880 | *
|
||
881 | * @param tags list of supported codec_id-codec_tag pairs, as stored
|
||
882 | * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag
|
||
883 | */
|
||
884 | 15545a09 | Stefano Sabatini | enum CodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag); |
885 | 7693b93e | Stefano Sabatini | |
886 | /**
|
||
887 | 49bd8e4b | Måns Rullgård | * Get the codec tag for the given codec id id.
|
888 | 7693b93e | Stefano Sabatini | * If no codec tag is found returns 0.
|
889 | *
|
||
890 | * @param tags list of supported codec_id-codec_tag pairs, as stored
|
||
891 | * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag
|
||
892 | */
|
||
893 | 15545a09 | Stefano Sabatini | unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum CodecID id); |
894 | 7caf0cc6 | Michael Niedermayer | |
895 | b9a281db | Fabrice Bellard | /* media file input */
|
896 | 3217cb42 | Panagiotis Issaris | |
897 | /**
|
||
898 | 49bd8e4b | Måns Rullgård | * Find AVInputFormat based on the short name of the input format.
|
899 | 3217cb42 | Panagiotis Issaris | */
|
900 | b9a281db | Fabrice Bellard | AVInputFormat *av_find_input_format(const char *short_name); |
901 | 3217cb42 | Panagiotis Issaris | |
902 | /**
|
||
903 | 49bd8e4b | Måns Rullgård | * Guess the file format.
|
904 | 3217cb42 | Panagiotis Issaris | *
|
905 | 4f57fa8c | Diego Biurrun | * @param is_opened Whether the file is already opened; determines whether
|
906 | * demuxers with or without AVFMT_NOFILE are probed.
|
||
907 | 3217cb42 | Panagiotis Issaris | */
|
908 | 94988531 | Fabrice Bellard | AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened);
|
909 | 3217cb42 | Panagiotis Issaris | |
910 | /**
|
||
911 | 49bd8e4b | Måns Rullgård | * Guess the file format.
|
912 | 8e2ee182 | Reimar Döffinger | *
|
913 | * @param is_opened Whether the file is already opened; determines whether
|
||
914 | * demuxers with or without AVFMT_NOFILE are probed.
|
||
915 | c99d506b | Reimar Döffinger | * @param score_max A probe score larger that this is required to accept a
|
916 | * detection, the variable is set to the actual detection
|
||
917 | * score afterwards.
|
||
918 | * If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended
|
||
919 | 8e2ee182 | Reimar Döffinger | * to retry with a larger probe buffer.
|
920 | */
|
||
921 | AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max); |
||
922 | |||
923 | /**
|
||
924 | 49bd8e4b | Måns Rullgård | * Allocate all the structures needed to read an input stream.
|
925 | 3217cb42 | Panagiotis Issaris | * This does not open the needed codecs for decoding the stream[s].
|
926 | */
|
||
927 | 115329f1 | Diego Biurrun | int av_open_input_stream(AVFormatContext **ic_ptr,
|
928 | ByteIOContext *pb, const char *filename, |
||
929 | da24c5e3 | Fabrice Bellard | AVInputFormat *fmt, AVFormatParameters *ap); |
930 | 3217cb42 | Panagiotis Issaris | |
931 | /**
|
||
932 | 49bd8e4b | Måns Rullgård | * Open a media file as input. The codecs are not opened. Only the file
|
933 | 3217cb42 | Panagiotis Issaris | * header (if present) is read.
|
934 | *
|
||
935 | 4f57fa8c | Diego Biurrun | * @param ic_ptr The opened media file handle is put here.
|
936 | * @param filename filename to open
|
||
937 | * @param fmt If non-NULL, force the file format to use.
|
||
938 | 3217cb42 | Panagiotis Issaris | * @param buf_size optional buffer size (zero if default is OK)
|
939 | 78cb7273 | Diego Biurrun | * @param ap Additional parameters needed when opening the file
|
940 | * (NULL if default).
|
||
941 | 4f57fa8c | Diego Biurrun | * @return 0 if OK, AVERROR_xxx otherwise
|
942 | 3217cb42 | Panagiotis Issaris | */
|
943 | 115329f1 | Diego Biurrun | int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, |
944 | b9a281db | Fabrice Bellard | AVInputFormat *fmt, |
945 | int buf_size,
|
||
946 | AVFormatParameters *ap); |
||
947 | 88a28965 | Stefano Sabatini | |
948 | #if LIBAVFORMAT_VERSION_MAJOR < 53 |
||
949 | /**
|
||
950 | * @deprecated Use avformat_alloc_context() instead.
|
||
951 | */
|
||
952 | attribute_deprecated AVFormatContext *av_alloc_format_context(void);
|
||
953 | #endif
|
||
954 | |||
955 | 88808c60 | Michael Niedermayer | /**
|
956 | 49bd8e4b | Måns Rullgård | * Allocate an AVFormatContext.
|
957 | 5d81d641 | Diego Biurrun | * Can be freed with av_free() but do not forget to free everything you
|
958 | 88808c60 | Michael Niedermayer | * explicitly allocated as well!
|
959 | */
|
||
960 | 88a28965 | Stefano Sabatini | AVFormatContext *avformat_alloc_context(void);
|
961 | b9a281db | Fabrice Bellard | |
962 | 3217cb42 | Panagiotis Issaris | /**
|
963 | 49bd8e4b | Måns Rullgård | * Read packets of a media file to get stream information. This
|
964 | 3217cb42 | Panagiotis Issaris | * is useful for file formats with no headers such as MPEG. This
|
965 | 22e77e44 | Diego Biurrun | * function also computes the real framerate in case of MPEG-2 repeat
|
966 | 3217cb42 | Panagiotis Issaris | * frame mode.
|
967 | * The logical file position is not changed by this function;
|
||
968 | * examined packets may be buffered for later processing.
|
||
969 | *
|
||
970 | * @param ic media file handle
|
||
971 | 4f57fa8c | Diego Biurrun | * @return >=0 if OK, AVERROR_xxx on error
|
972 | * @todo Let the user decide somehow what information is needed so that
|
||
973 | * we do not waste time getting stuff the user does not need.
|
||
974 | 3217cb42 | Panagiotis Issaris | */
|
975 | b9a281db | Fabrice Bellard | int av_find_stream_info(AVFormatContext *ic);
|
976 | 3217cb42 | Panagiotis Issaris | |
977 | /**
|
||
978 | 49bd8e4b | Måns Rullgård | * Read a transport packet from a media file.
|
979 | 3217cb42 | Panagiotis Issaris | *
|
980 | 864ff8c1 | Ramiro Polla | * This function is obsolete and should never be used.
|
981 | 3217cb42 | Panagiotis Issaris | * Use av_read_frame() instead.
|
982 | *
|
||
983 | * @param s media file handle
|
||
984 | * @param pkt is filled
|
||
985 | 4f57fa8c | Diego Biurrun | * @return 0 if OK, AVERROR_xxx on error
|
986 | 3217cb42 | Panagiotis Issaris | */
|
987 | de6d9b64 | Fabrice Bellard | int av_read_packet(AVFormatContext *s, AVPacket *pkt);
|
988 | 3217cb42 | Panagiotis Issaris | |
989 | /**
|
||
990 | 49bd8e4b | Måns Rullgård | * Return the next frame of a stream.
|
991 | 3217cb42 | Panagiotis Issaris | *
|
992 | * The returned packet is valid
|
||
993 | * until the next av_read_frame() or until av_close_input_file() and
|
||
994 | * must be freed with av_free_packet. For video, the packet contains
|
||
995 | * exactly one frame. For audio, it contains an integer number of
|
||
996 | * frames if each frame has a known fixed size (e.g. PCM or ADPCM
|
||
997 | * data). If the audio frames have a variable size (e.g. MPEG audio),
|
||
998 | * then it contains one frame.
|
||
999 | *
|
||
1000 | * pkt->pts, pkt->dts and pkt->duration are always set to correct
|
||
1001 | 22e77e44 | Diego Biurrun | * values in AVStream.time_base units (and guessed if the format cannot
|
1002 | 4f57fa8c | Diego Biurrun | * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format
|
1003 | * has B-frames, so it is better to rely on pkt->dts if you do not
|
||
1004 | 3217cb42 | Panagiotis Issaris | * decompress the payload.
|
1005 | *
|
||
1006 | 4f57fa8c | Diego Biurrun | * @return 0 if OK, < 0 on error or end of file
|
1007 | 3217cb42 | Panagiotis Issaris | */
|
1008 | fb2758c8 | Fabrice Bellard | int av_read_frame(AVFormatContext *s, AVPacket *pkt);
|
1009 | 3217cb42 | Panagiotis Issaris | |
1010 | /**
|
||
1011 | 49bd8e4b | Måns Rullgård | * Seek to the keyframe at timestamp.
|
1012 | 3217cb42 | Panagiotis Issaris | * 'timestamp' in 'stream_index'.
|
1013 | * @param stream_index If stream_index is (-1), a default
|
||
1014 | * stream is selected, and timestamp is automatically converted
|
||
1015 | * from AV_TIME_BASE units to the stream specific time_base.
|
||
1016 | 4f57fa8c | Diego Biurrun | * @param timestamp Timestamp in AVStream.time_base units
|
1017 | * or, if no stream is specified, in AV_TIME_BASE units.
|
||
1018 | 3217cb42 | Panagiotis Issaris | * @param flags flags which select direction and seeking mode
|
1019 | * @return >= 0 on success
|
||
1020 | */
|
||
1021 | 78cb7273 | Diego Biurrun | int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, |
1022 | int flags);
|
||
1023 | 3217cb42 | Panagiotis Issaris | |
1024 | /**
|
||
1025 | 49bd8e4b | Måns Rullgård | * Seek to timestamp ts.
|
1026 | d04768fa | Michael Niedermayer | * Seeking will be done so that the point from which all active streams
|
1027 | * can be presented successfully will be closest to ts and within min/max_ts.
|
||
1028 | * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
|
||
1029 | *
|
||
1030 | 22e77e44 | Diego Biurrun | * If flags contain AVSEEK_FLAG_BYTE, then all timestamps are in bytes and
|
1031 | d04768fa | Michael Niedermayer | * are the file position (this may not be supported by all demuxers).
|
1032 | 22e77e44 | Diego Biurrun | * If flags contain AVSEEK_FLAG_FRAME, then all timestamps are in frames
|
1033 | d04768fa | Michael Niedermayer | * in the stream with stream_index (this may not be supported by all demuxers).
|
1034 | 22e77e44 | Diego Biurrun | * Otherwise all timestamps are in units of the stream selected by stream_index
|
1035 | * or if stream_index is -1, in AV_TIME_BASE units.
|
||
1036 | * If flags contain AVSEEK_FLAG_ANY, then non-keyframes are treated as
|
||
1037 | d04768fa | Michael Niedermayer | * keyframes (this may not be supported by all demuxers).
|
1038 | *
|
||
1039 | 22e77e44 | Diego Biurrun | * @param stream_index index of the stream which is used as time base reference
|
1040 | d04768fa | Michael Niedermayer | * @param min_ts smallest acceptable timestamp
|
1041 | * @param ts target timestamp
|
||
1042 | * @param max_ts largest acceptable timestamp
|
||
1043 | * @param flags flags
|
||
1044 | 32e543f8 | Benoit Fouet | * @return >=0 on success, error code otherwise
|
1045 | 998b6f7c | Michael Niedermayer | *
|
1046 | 8a4d7a30 | Diego Biurrun | * @note This is part of the new seek API which is still under construction.
|
1047 | 22e77e44 | Diego Biurrun | * Thus do not use this yet. It may change at any time, do not expect
|
1048 | * ABI compatibility yet!
|
||
1049 | d04768fa | Michael Niedermayer | */
|
1050 | int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); |
||
1051 | |||
1052 | /**
|
||
1053 | 49bd8e4b | Måns Rullgård | * Start playing a network-based stream (e.g. RTSP stream) at the
|
1054 | 4f57fa8c | Diego Biurrun | * current position.
|
1055 | 3217cb42 | Panagiotis Issaris | */
|
1056 | fb2758c8 | Fabrice Bellard | int av_read_play(AVFormatContext *s);
|
1057 | 3217cb42 | Panagiotis Issaris | |
1058 | /**
|
||
1059 | 49bd8e4b | Måns Rullgård | * Pause a network-based stream (e.g. RTSP stream).
|
1060 | 3217cb42 | Panagiotis Issaris | *
|
1061 | * Use av_read_play() to resume it.
|
||
1062 | */
|
||
1063 | fb2758c8 | Fabrice Bellard | int av_read_pause(AVFormatContext *s);
|
1064 | 3217cb42 | Panagiotis Issaris | |
1065 | /**
|
||
1066 | 49bd8e4b | Måns Rullgård | * Free a AVFormatContext allocated by av_open_input_stream.
|
1067 | 2506fd54 | Reimar Döffinger | * @param s context to free
|
1068 | */
|
||
1069 | void av_close_input_stream(AVFormatContext *s);
|
||
1070 | |||
1071 | /**
|
||
1072 | 49bd8e4b | Måns Rullgård | * Close a media file (but not its codecs).
|
1073 | 3217cb42 | Panagiotis Issaris | *
|
1074 | * @param s media file handle
|
||
1075 | */
|
||
1076 | de6d9b64 | Fabrice Bellard | void av_close_input_file(AVFormatContext *s);
|
1077 | 3217cb42 | Panagiotis Issaris | |
1078 | /**
|
||
1079 | 49bd8e4b | Måns Rullgård | * Add a new stream to a media file.
|
1080 | 3217cb42 | Panagiotis Issaris | *
|
1081 | * Can only be called in the read_header() function. If the flag
|
||
1082 | * AVFMTCTX_NOHEADER is in the format context, then new streams
|
||
1083 | * can be added in read_packet too.
|
||
1084 | *
|
||
1085 | * @param s media file handle
|
||
1086 | 4f57fa8c | Diego Biurrun | * @param id file-format-dependent stream ID
|
1087 | 3217cb42 | Panagiotis Issaris | */
|
1088 | b9a281db | Fabrice Bellard | AVStream *av_new_stream(AVFormatContext *s, int id);
|
1089 | 15afa396 | Nico Sabbi | AVProgram *av_new_program(AVFormatContext *s, int id);
|
1090 | 3217cb42 | Panagiotis Issaris | |
1091 | /**
|
||
1092 | 49bd8e4b | Måns Rullgård | * Add a new chapter.
|
1093 | 79d7836a | Anton Khirnov | * This function is NOT part of the public API
|
1094 | 4f57fa8c | Diego Biurrun | * and should ONLY be used by demuxers.
|
1095 | 79d7836a | Anton Khirnov | *
|
1096 | * @param s media file handle
|
||
1097 | 4f57fa8c | Diego Biurrun | * @param id unique ID for this chapter
|
1098 | abd2256d | Michael Niedermayer | * @param start chapter start time in time_base units
|
1099 | * @param end chapter end time in time_base units
|
||
1100 | 79d7836a | Anton Khirnov | * @param title chapter title
|
1101 | 5c37f43a | Michael Niedermayer | *
|
1102 | 4f57fa8c | Diego Biurrun | * @return AVChapter or NULL on error
|
1103 | 79d7836a | Anton Khirnov | */
|
1104 | 78cb7273 | Diego Biurrun | AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base,
|
1105 | int64_t start, int64_t end, const char *title); |
||
1106 | 79d7836a | Anton Khirnov | |
1107 | /**
|
||
1108 | 49bd8e4b | Måns Rullgård | * Set the pts for a given stream.
|
1109 | 3217cb42 | Panagiotis Issaris | *
|
1110 | * @param s stream
|
||
1111 | * @param pts_wrap_bits number of bits effectively used by the pts
|
||
1112 | * (used for wrap control, 33 is the value for MPEG)
|
||
1113 | * @param pts_num numerator to convert to seconds (MPEG: 1)
|
||
1114 | * @param pts_den denominator to convert to seconds (MPEG: 90000)
|
||
1115 | */
|
||
1116 | 9ee91c2f | Michael Niedermayer | void av_set_pts_info(AVStream *s, int pts_wrap_bits, |
1117 | dec14949 | Michael Niedermayer | unsigned int pts_num, unsigned int pts_den); |
1118 | de6d9b64 | Fabrice Bellard | |
1119 | 3ba1438d | Michael Niedermayer | #define AVSEEK_FLAG_BACKWARD 1 ///< seek backward |
1120 | #define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes |
||
1121 | 4f57fa8c | Diego Biurrun | #define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non-keyframes |
1122 | 2bf74f49 | Aurelien Jacobs | #define AVSEEK_FLAG_FRAME 8 ///< seeking based on frame number |
1123 | 3ba1438d | Michael Niedermayer | |
1124 | b754978a | Michael Niedermayer | int av_find_default_stream_index(AVFormatContext *s);
|
1125 | 3217cb42 | Panagiotis Issaris | |
1126 | /**
|
||
1127 | 49bd8e4b | Måns Rullgård | * Get the index for a specific timestamp.
|
1128 | 4f57fa8c | Diego Biurrun | * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond
|
1129 | * to the timestamp which is <= the requested one, if backward
|
||
1130 | * is 0, then it will be >=
|
||
1131 | 3217cb42 | Panagiotis Issaris | * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise
|
1132 | * @return < 0 if no such timestamp could be found
|
||
1133 | */
|
||
1134 | dc56fc38 | Michael Niedermayer | int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); |
1135 | 3217cb42 | Panagiotis Issaris | |
1136 | /**
|
||
1137 | 49bd8e4b | Måns Rullgård | * Ensure the index uses less memory than the maximum specified in
|
1138 | 22e77e44 | Diego Biurrun | * AVFormatContext.max_index_size by discarding entries if it grows
|
1139 | 3dea63bd | Paul Kelly | * too large.
|
1140 | * This function is not part of the public API and should only be called
|
||
1141 | * by demuxers.
|
||
1142 | */
|
||
1143 | void ff_reduce_index(AVFormatContext *s, int stream_index); |
||
1144 | |||
1145 | /**
|
||
1146 | 49bd8e4b | Måns Rullgård | * Add an index entry into a sorted list. Update the entry if the list
|
1147 | 4f57fa8c | Diego Biurrun | * already contains it.
|
1148 | 3217cb42 | Panagiotis Issaris | *
|
1149 | 4f57fa8c | Diego Biurrun | * @param timestamp timestamp in the time base of the given stream
|
1150 | 3217cb42 | Panagiotis Issaris | */
|
1151 | 78cb7273 | Diego Biurrun | int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp,
|
1152 | int size, int distance, int flags); |
||
1153 | 3217cb42 | Panagiotis Issaris | |
1154 | /**
|
||
1155 | 49bd8e4b | Måns Rullgård | * Perform a binary search using av_index_search_timestamp() and
|
1156 | 3673f4ab | Aurelien Jacobs | * AVInputFormat.read_timestamp().
|
1157 | 78cb7273 | Diego Biurrun | * This is not supposed to be called directly by a user application,
|
1158 | * but by demuxers.
|
||
1159 | 3217cb42 | Panagiotis Issaris | * @param target_ts target timestamp in the time base of the given stream
|
1160 | * @param stream_index stream number
|
||
1161 | */
|
||
1162 | 78cb7273 | Diego Biurrun | int av_seek_frame_binary(AVFormatContext *s, int stream_index, |
1163 | int64_t target_ts, int flags);
|
||
1164 | 3217cb42 | Panagiotis Issaris | |
1165 | /**
|
||
1166 | 49bd8e4b | Måns Rullgård | * Update cur_dts of all streams based on the given timestamp and AVStream.
|
1167 | 3217cb42 | Panagiotis Issaris | *
|
1168 | 4f57fa8c | Diego Biurrun | * Stream ref_st unchanged, others set cur_dts in their native time base.
|
1169 | * Only needed for timestamp wrapping or if (dts not set and pts!=dts).
|
||
1170 | 3217cb42 | Panagiotis Issaris | * @param timestamp new dts expressed in time_base of param ref_st
|
1171 | * @param ref_st reference stream giving time_base of param timestamp
|
||
1172 | */
|
||
1173 | 22ffac70 | Reimar Döffinger | void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp);
|
1174 | 3217cb42 | Panagiotis Issaris | |
1175 | /**
|
||
1176 | 49bd8e4b | Måns Rullgård | * Perform a binary search using read_timestamp().
|
1177 | 78cb7273 | Diego Biurrun | * This is not supposed to be called directly by a user application,
|
1178 | * but by demuxers.
|
||
1179 | 3217cb42 | Panagiotis Issaris | * @param target_ts target timestamp in the time base of the given stream
|
1180 | * @param stream_index stream number
|
||
1181 | */
|
||
1182 | 78cb7273 | Diego Biurrun | int64_t av_gen_search(AVFormatContext *s, int stream_index,
|
1183 | int64_t target_ts, int64_t pos_min, |
||
1184 | int64_t pos_max, int64_t pos_limit, |
||
1185 | int64_t ts_min, int64_t ts_max, |
||
1186 | int flags, int64_t *ts_ret,
|
||
1187 | int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t )); |
||
1188 | b754978a | Michael Niedermayer | |
1189 | 43d414ba | Panagiotis Issaris | /** media file output */
|
1190 | 290c5fa6 | Fabrice Bellard | int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap);
|
1191 | 3217cb42 | Panagiotis Issaris | |
1192 | /**
|
||
1193 | f3bfe388 | Måns Rullgård | * Split a URL string into components.
|
1194 | *
|
||
1195 | * The pointers to buffers for storing individual components may be null,
|
||
1196 | * in order to ignore that component. Buffers for components not found are
|
||
1197 | * set to empty strings. If the port is not found, it is set to a negative
|
||
1198 | * value.
|
||
1199 | *
|
||
1200 | * @param proto the buffer for the protocol
|
||
1201 | * @param proto_size the size of the proto buffer
|
||
1202 | * @param authorization the buffer for the authorization
|
||
1203 | * @param authorization_size the size of the authorization buffer
|
||
1204 | * @param hostname the buffer for the host name
|
||
1205 | * @param hostname_size the size of the hostname buffer
|
||
1206 | * @param port_ptr a pointer to store the port number in
|
||
1207 | * @param path the buffer for the path
|
||
1208 | * @param path_size the size of the path buffer
|
||
1209 | * @param url the URL to split
|
||
1210 | */
|
||
1211 | void av_url_split(char *proto, int proto_size, |
||
1212 | char *authorization, int authorization_size, |
||
1213 | char *hostname, int hostname_size, |
||
1214 | int *port_ptr,
|
||
1215 | char *path, int path_size, |
||
1216 | const char *url); |
||
1217 | |||
1218 | /**
|
||
1219 | 49bd8e4b | Måns Rullgård | * Allocate the stream private data and write the stream header to an
|
1220 | 755bfeab | Diego Biurrun | * output media file.
|
1221 | 3217cb42 | Panagiotis Issaris | *
|
1222 | * @param s media file handle
|
||
1223 | 4f57fa8c | Diego Biurrun | * @return 0 if OK, AVERROR_xxx on error
|
1224 | 3217cb42 | Panagiotis Issaris | */
|
1225 | b9a281db | Fabrice Bellard | int av_write_header(AVFormatContext *s);
|
1226 | 3217cb42 | Panagiotis Issaris | |
1227 | /**
|
||
1228 | 49bd8e4b | Måns Rullgård | * Write a packet to an output media file.
|
1229 | 3217cb42 | Panagiotis Issaris | *
|
1230 | * The packet shall contain one audio or video frame.
|
||
1231 | 78cb7273 | Diego Biurrun | * The packet must be correctly interleaved according to the container
|
1232 | * specification, if not then av_interleaved_write_frame must be used.
|
||
1233 | 3217cb42 | Panagiotis Issaris | *
|
1234 | * @param s media file handle
|
||
1235 | 78cb7273 | Diego Biurrun | * @param pkt The packet, which contains the stream_index, buf/buf_size,
|
1236 | dts/pts, ...
|
||
1237 | 4f57fa8c | Diego Biurrun | * @return < 0 on error, = 0 if OK, 1 if end of stream wanted
|
1238 | 3217cb42 | Panagiotis Issaris | */
|
1239 | e928649b | Michael Niedermayer | int av_write_frame(AVFormatContext *s, AVPacket *pkt);
|
1240 | 3217cb42 | Panagiotis Issaris | |
1241 | /**
|
||
1242 | 49bd8e4b | Måns Rullgård | * Write a packet to an output media file ensuring correct interleaving.
|
1243 | 3217cb42 | Panagiotis Issaris | *
|
1244 | * The packet must contain one audio or video frame.
|
||
1245 | 22e77e44 | Diego Biurrun | * If the packets are already correctly interleaved, the application should
|
1246 | 90b5b51e | Diego Biurrun | * call av_write_frame() instead as it is slightly faster. It is also important
|
1247 | * to keep in mind that completely non-interleaved input will need huge amounts
|
||
1248 | * of memory to interleave with this, so it is preferable to interleave at the
|
||
1249 | * demuxer level.
|
||
1250 | 3217cb42 | Panagiotis Issaris | *
|
1251 | * @param s media file handle
|
||
1252 | 78cb7273 | Diego Biurrun | * @param pkt The packet, which contains the stream_index, buf/buf_size,
|
1253 | dts/pts, ...
|
||
1254 | 4f57fa8c | Diego Biurrun | * @return < 0 on error, = 0 if OK, 1 if end of stream wanted
|
1255 | 3217cb42 | Panagiotis Issaris | */
|
1256 | 3c895fc0 | Michael Niedermayer | int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
|
1257 | 3217cb42 | Panagiotis Issaris | |
1258 | /**
|
||
1259 | 49bd8e4b | Måns Rullgård | * Interleave a packet per dts in an output media file.
|
1260 | 3217cb42 | Panagiotis Issaris | *
|
1261 | 78cb7273 | Diego Biurrun | * Packets with pkt->destruct == av_destruct_packet will be freed inside this
|
1262 | 22e77e44 | Diego Biurrun | * function, so they cannot be used after it. Note that calling av_free_packet()
|
1263 | 78cb7273 | Diego Biurrun | * on them is still safe.
|
1264 | 3217cb42 | Panagiotis Issaris | *
|
1265 | * @param s media file handle
|
||
1266 | * @param out the interleaved packet will be output here
|
||
1267 | 9a58234f | Diego Biurrun | * @param pkt the input packet
|
1268 | 3217cb42 | Panagiotis Issaris | * @param flush 1 if no further packets are available as input and all
|
1269 | * remaining packets should be output
|
||
1270 | * @return 1 if a packet was output, 0 if no packet could be output,
|
||
1271 | d9526386 | Diego Biurrun | * < 0 if an error occurred
|
1272 | 3217cb42 | Panagiotis Issaris | */
|
1273 | 78cb7273 | Diego Biurrun | int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
|
1274 | AVPacket *pkt, int flush);
|
||
1275 | e928649b | Michael Niedermayer | |
1276 | 3217cb42 | Panagiotis Issaris | /**
|
1277 | 49bd8e4b | Måns Rullgård | * Write the stream trailer to an output media file and free the
|
1278 | 2b75bde6 | Stefano Sabatini | * file private data.
|
1279 | 3217cb42 | Panagiotis Issaris | *
|
1280 | dc76fe13 | Reimar Döffinger | * May only be called after a successful call to av_write_header.
|
1281 | *
|
||
1282 | 3217cb42 | Panagiotis Issaris | * @param s media file handle
|
1283 | 4f57fa8c | Diego Biurrun | * @return 0 if OK, AVERROR_xxx on error
|
1284 | 3217cb42 | Panagiotis Issaris | */
|
1285 | b9a281db | Fabrice Bellard | int av_write_trailer(AVFormatContext *s);
|
1286 | de6d9b64 | Fabrice Bellard | |
1287 | void dump_format(AVFormatContext *ic,
|
||
1288 | 115329f1 | Diego Biurrun | int index,
|
1289 | de6d9b64 | Fabrice Bellard | const char *url, |
1290 | int is_output);
|
||
1291 | 3217cb42 | Panagiotis Issaris | |
1292 | 1ca9133f | Stefano Sabatini | #if LIBAVFORMAT_VERSION_MAJOR < 53 |
1293 | 3217cb42 | Panagiotis Issaris | /**
|
1294 | 49bd8e4b | Måns Rullgård | * Parse width and height out of string str.
|
1295 | 26ef3220 | Stefano Sabatini | * @deprecated Use av_parse_video_frame_size instead.
|
1296 | 3217cb42 | Panagiotis Issaris | */
|
1297 | 78cb7273 | Diego Biurrun | attribute_deprecated int parse_image_size(int *width_ptr, int *height_ptr, |
1298 | const char *str); |
||
1299 | 3217cb42 | Panagiotis Issaris | |
1300 | /**
|
||
1301 | 49bd8e4b | Måns Rullgård | * Convert framerate from a string to a fraction.
|
1302 | 26ef3220 | Stefano Sabatini | * @deprecated Use av_parse_video_frame_rate instead.
|
1303 | 3217cb42 | Panagiotis Issaris | */
|
1304 | 78cb7273 | Diego Biurrun | attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base, |
1305 | const char *arg); |
||
1306 | 1ca9133f | Stefano Sabatini | #endif
|
1307 | 3217cb42 | Panagiotis Issaris | |
1308 | /**
|
||
1309 | 49bd8e4b | Måns Rullgård | * Parse datestr and return a corresponding number of microseconds.
|
1310 | f9436161 | Stefano Sabatini | * @param datestr String representing a date or a duration.
|
1311 | * - If a date the syntax is:
|
||
1312 | 3217cb42 | Panagiotis Issaris | * @code
|
1313 | fcd10c4f | Stefano Sabatini | * now|{[{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH[:MM[:SS[.m...]]]}|{HH[MM[SS[.m...]]]}}[Z|z]}
|
1314 | 3217cb42 | Panagiotis Issaris | * @endcode
|
1315 | fcd10c4f | Stefano Sabatini | * If the value is "now" it takes the current time.
|
1316 | 4f57fa8c | Diego Biurrun | * Time is local time unless Z is appended, in which case it is
|
1317 | f9436161 | Stefano Sabatini | * interpreted as UTC.
|
1318 | 4f57fa8c | Diego Biurrun | * If the year-month-day part is not specified it takes the current
|
1319 | f9436161 | Stefano Sabatini | * year-month-day.
|
1320 | 49bd8e4b | Måns Rullgård | * @return the number of microseconds since 1st of January, 1970 up to
|
1321 | 819174fa | Stefano Sabatini | * the time of the parsed date or INT64_MIN if datestr cannot be
|
1322 | f9436161 | Stefano Sabatini | * successfully parsed.
|
1323 | * - If a duration the syntax is:
|
||
1324 | * @code
|
||
1325 | * [-]HH[:MM[:SS[.m...]]]
|
||
1326 | * [-]S+[.m...]
|
||
1327 | * @endcode
|
||
1328 | 49bd8e4b | Måns Rullgård | * @return the number of microseconds contained in a time interval
|
1329 | 819174fa | Stefano Sabatini | * with the specified duration or INT64_MIN if datestr cannot be
|
1330 | 7338d368 | Diego Biurrun | * successfully parsed.
|
1331 | 819174fa | Stefano Sabatini | * @param duration Flag which tells how to interpret datestr, if
|
1332 | * not zero datestr is interpreted as a duration, otherwise as a
|
||
1333 | f9436161 | Stefano Sabatini | * date.
|
1334 | 3217cb42 | Panagiotis Issaris | */
|
1335 | 0c1a9eda | Zdenek Kabelac | int64_t parse_date(const char *datestr, int duration); |
1336 | de6d9b64 | Fabrice Bellard | |
1337 | 49bd8e4b | Måns Rullgård | /** Get the current time in microseconds. */
|
1338 | 0c1a9eda | Zdenek Kabelac | int64_t av_gettime(void);
|
1339 | 94988531 | Fabrice Bellard | |
1340 | 4f57fa8c | Diego Biurrun | /* ffm-specific for ffserver */
|
1341 | de6d9b64 | Fabrice Bellard | #define FFM_PACKET_SIZE 4096 |
1342 | bc5c918e | Diego Biurrun | int64_t ffm_read_write_index(int fd);
|
1343 | 6fcce4f9 | Patrik Kullman | int ffm_write_write_index(int fd, int64_t pos); |
1344 | bc5c918e | Diego Biurrun | void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size);
|
1345 | de6d9b64 | Fabrice Bellard | |
1346 | 3217cb42 | Panagiotis Issaris | /**
|
1347 | 49bd8e4b | Måns Rullgård | * Attempt to find a specific tag in a URL.
|
1348 | 3217cb42 | Panagiotis Issaris | *
|
1349 | * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done.
|
||
1350 | * Return 1 if found.
|
||
1351 | */
|
||
1352 | de6d9b64 | Fabrice Bellard | int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); |
1353 | |||
1354 | 3217cb42 | Panagiotis Issaris | /**
|
1355 | 49bd8e4b | Måns Rullgård | * Return in 'buf' the path with '%d' replaced by a number.
|
1356 | 4f57fa8c | Diego Biurrun | *
|
1357 | 3217cb42 | Panagiotis Issaris | * Also handles the '%0nd' format where 'n' is the total number
|
1358 | * of digits and '%%'.
|
||
1359 | *
|
||
1360 | * @param buf destination buffer
|
||
1361 | * @param buf_size destination buffer size
|
||
1362 | * @param path numbered sequence string
|
||
1363 | 8ea0e802 | Panagiotis Issaris | * @param number frame number
|
1364 | 4f57fa8c | Diego Biurrun | * @return 0 if OK, -1 on format error
|
1365 | 3217cb42 | Panagiotis Issaris | */
|
1366 | 5c07cf53 | Michel Bardiaux | int av_get_frame_filename(char *buf, int buf_size, |
1367 | const char *path, int number); |
||
1368 | 3217cb42 | Panagiotis Issaris | |
1369 | /**
|
||
1370 | 49bd8e4b | Måns Rullgård | * Check whether filename actually is a numbered sequence generator.
|
1371 | 3217cb42 | Panagiotis Issaris | *
|
1372 | * @param filename possible numbered sequence string
|
||
1373 | 4f57fa8c | Diego Biurrun | * @return 1 if a valid numbered sequence string, 0 otherwise
|
1374 | 3217cb42 | Panagiotis Issaris | */
|
1375 | 5c07cf53 | Michel Bardiaux | int av_filename_number_test(const char *filename); |
1376 | 96baaa6a | Fabrice Bellard | |
1377 | c5388c07 | Luca Abeni | /**
|
1378 | 49bd8e4b | Måns Rullgård | * Generate an SDP for an RTP session.
|
1379 | c5388c07 | Luca Abeni | *
|
1380 | * @param ac array of AVFormatContexts describing the RTP streams. If the
|
||
1381 | * array is composed by only one context, such context can contain
|
||
1382 | * multiple AVStreams (one AVStream per RTP stream). Otherwise,
|
||
1383 | * all the contexts in the array (an AVCodecContext per RTP stream)
|
||
1384 | 4f57fa8c | Diego Biurrun | * must contain only one AVStream.
|
1385 | 8767b80f | Luca Abeni | * @param n_files number of AVCodecContexts contained in ac
|
1386 | * @param buff buffer where the SDP will be stored (must be allocated by
|
||
1387 | 4f57fa8c | Diego Biurrun | * the caller)
|
1388 | 8767b80f | Luca Abeni | * @param size the size of the buffer
|
1389 | 4f57fa8c | Diego Biurrun | * @return 0 if OK, AVERROR_xxx on error
|
1390 | c5388c07 | Luca Abeni | */
|
1391 | 8767b80f | Luca Abeni | int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size); |
1392 | c5388c07 | Luca Abeni | |
1393 | 1a70d127 | Stefano Sabatini | /**
|
1394 | 49bd8e4b | Måns Rullgård | * Return a positive value if the given filename has one of the given
|
1395 | 1a70d127 | Stefano Sabatini | * extensions, 0 otherwise.
|
1396 | *
|
||
1397 | * @param extensions a comma-separated list of filename extensions
|
||
1398 | */
|
||
1399 | int av_match_ext(const char *filename, const char *extensions); |
||
1400 | |||
1401 | 98790382 | Stefano Sabatini | #endif /* AVFORMAT_AVFORMAT_H */ |