| OLD | NEW |
| 1 /* | 1 /* |
| 2 * copyright (c) 2001 Fabrice Bellard | 2 * copyright (c) 2001 Fabrice Bellard |
| 3 * | 3 * |
| 4 * This file is part of FFmpeg. | 4 * This file is part of FFmpeg. |
| 5 * | 5 * |
| 6 * FFmpeg is free software; you can redistribute it and/or | 6 * FFmpeg is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Lesser General Public | 7 * modify it under the terms of the GNU Lesser General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2.1 of the License, or (at your option) any later version. | 9 * version 2.1 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| 11 * FFmpeg is distributed in the hope that it will be useful, | 11 * FFmpeg is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Lesser General Public License for more details. | 14 * Lesser General Public License for more details. |
| 15 * | 15 * |
| 16 * You should have received a copy of the GNU Lesser General Public | 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 | 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 | 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #ifndef AVFORMAT_AVFORMAT_H | 21 #ifndef AVFORMAT_AVFORMAT_H |
| 22 #define AVFORMAT_AVFORMAT_H | 22 #define AVFORMAT_AVFORMAT_H |
| 23 | 23 |
| 24 #define LIBAVFORMAT_VERSION_MAJOR 52 | 24 #define LIBAVFORMAT_VERSION_MAJOR 52 |
| 25 #define LIBAVFORMAT_VERSION_MINOR 23 | 25 #define LIBAVFORMAT_VERSION_MINOR 32 |
| 26 #define LIBAVFORMAT_VERSION_MICRO 1 | 26 #define LIBAVFORMAT_VERSION_MICRO 0 |
| 27 | 27 |
| 28 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ | 28 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |
| 29 LIBAVFORMAT_VERSION_MINOR, \ | 29 LIBAVFORMAT_VERSION_MINOR, \ |
| 30 LIBAVFORMAT_VERSION_MICRO) | 30 LIBAVFORMAT_VERSION_MICRO) |
| 31 #define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ | 31 #define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ |
| 32 LIBAVFORMAT_VERSION_MINOR, \ | 32 LIBAVFORMAT_VERSION_MINOR, \ |
| 33 LIBAVFORMAT_VERSION_MICRO) | 33 LIBAVFORMAT_VERSION_MICRO) |
| 34 #define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT | 34 #define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT |
| 35 | 35 |
| 36 #define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) | 36 #define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * Returns the LIBAVFORMAT_VERSION_INT constant. | 39 * Returns the LIBAVFORMAT_VERSION_INT constant. |
| 40 */ | 40 */ |
| 41 unsigned avformat_version(void); | 41 unsigned avformat_version(void); |
| 42 | 42 |
| 43 #include <time.h> | 43 #include <time.h> |
| 44 #include <stdio.h> /* FILE */ | 44 #include <stdio.h> /* FILE */ |
| 45 #include "libavcodec/avcodec.h" | 45 #include "libavcodec/avcodec.h" |
| 46 | 46 |
| 47 #include "avio.h" | 47 #include "avio.h" |
| 48 | 48 |
| 49 struct AVFormatContext; |
| 50 |
| 49 | 51 |
| 50 /* | 52 /* |
| 51 * Public Metadata API. | 53 * Public Metadata API. |
| 52 * The metadata API allows libavformat to export metadata tags to a client | 54 * The metadata API allows libavformat to export metadata tags to a client |
| 53 * application using a sequence of key/value pairs. | 55 * application using a sequence of key/value pairs. |
| 54 * Important concepts to keep in mind: | 56 * Important concepts to keep in mind: |
| 55 * 1. Keys are unique; there can never be 2 tags with the same key. This is | 57 * 1. Keys are unique; there can never be 2 tags with the same key. This is |
| 56 * also meant semantically, i.e., a demuxer should not knowingly produce | 58 * also meant semantically, i.e., a demuxer should not knowingly produce |
| 57 * several keys that are literally different but semantically identical. | 59 * several keys that are literally different but semantically identical. |
| 58 * E.g., key=Author5, key=Author6. In this example, all authors must be | 60 * E.g., key=Author5, key=Author6. In this example, all authors must be |
| 59 * placed in the same tag. | 61 * placed in the same tag. |
| 60 * 2. Metadata is flat, not hierarchical; there are no subtags. If you | 62 * 2. Metadata is flat, not hierarchical; there are no subtags. If you |
| 61 * want to store, e.g., the email address of the child of producer Alice | 63 * want to store, e.g., the email address of the child of producer Alice |
| 62 * and actor Bob, that could have key=alice_and_bobs_childs_email_address. | 64 * and actor Bob, that could have key=alice_and_bobs_childs_email_address. |
| 63 * 3. A tag whose value is localized for a particular language is appended | 65 * 3. A tag whose value is localized for a particular language is appended |
| 64 * with a dash character ('-') and the ISO 639 3-letter language code. | 66 * with a dash character ('-') and the ISO 639 3-letter language code. |
| 65 * For example: Author-ger=Michael, Author-eng=Mike | 67 * For example: Author-ger=Michael, Author-eng=Mike |
| 66 * The original/default language is in the unqualified "Author" tag. | 68 * The original/default language is in the unqualified "Author" tag. |
| 67 * A demuxer should set a default if it sets any translated tag. | 69 * A demuxer should set a default if it sets any translated tag. |
| 68 */ | 70 */ |
| 69 | 71 |
| 70 #define AV_METADATA_IGNORE_CASE 1 | 72 #define AV_METADATA_MATCH_CASE 1 |
| 71 #define AV_METADATA_IGNORE_SUFFIX 2 | 73 #define AV_METADATA_IGNORE_SUFFIX 2 |
| 72 | 74 |
| 73 typedef struct { | 75 typedef struct { |
| 74 char *key; | 76 char *key; |
| 75 char *value; | 77 char *value; |
| 76 }AVMetadataTag; | 78 }AVMetadataTag; |
| 77 | 79 |
| 78 typedef struct AVMetadata AVMetadata; | 80 typedef struct AVMetadata AVMetadata; |
| 81 typedef struct AVMetadataConv AVMetadataConv; |
| 79 | 82 |
| 80 /** | 83 /** |
| 81 * gets a metadata element with matching key. | 84 * Gets a metadata element with matching key. |
| 82 * @param prev set to the previous matching element to find the next. | 85 * @param prev Set to the previous matching element to find the next. |
| 83 * @param flags allows case as well as suffix insensitive comparissions. | 86 * @param flags Allows case as well as suffix-insensitive comparisons. |
| 84 * @return found tag or NULL, changing key or value leads to undefined behavior. | 87 * @return Found tag or NULL, changing key or value leads to undefined behavior. |
| 85 */ | 88 */ |
| 86 AVMetadataTag * | 89 AVMetadataTag * |
| 87 av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int f
lags); | 90 av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int f
lags); |
| 88 | 91 |
| 89 /** | 92 /** |
| 90 * sets the given tag in m, overwriting an existing tag. | 93 * Sets the given tag in m, overwriting an existing tag. |
| 91 * @param tag tag to add to m, key and value will be av_strduped. | 94 * @param key tag key to add to m (will be av_strduped) |
| 92 * @return >= 0 if success otherwise error code that is <0. | 95 * @param value tag value to add to m (will be av_strduped) |
| 96 * @return >= 0 on success otherwise an error code <0 |
| 93 */ | 97 */ |
| 94 int av_metadata_set(AVMetadata **m, AVMetadataTag tag); | 98 int av_metadata_set(AVMetadata **pm, const char *key, const char *value); |
| 95 | 99 |
| 96 /** | 100 /** |
| 97 * Free all the memory allocated for an AVMetadata struct. | 101 * Convert all the metadata sets from ctx according to the source and |
| 102 * destination conversion tables. |
| 103 * @param d_conv destination tags format conversion table |
| 104 * @param s_conv source tags format conversion table |
| 105 */ |
| 106 void av_metadata_conv(struct AVFormatContext *ctx,const AVMetadataConv *d_conv, |
| 107 const AVMetadataConv *s_conv); |
| 108 |
| 109 /** |
| 110 * Frees all the memory allocated for an AVMetadata struct. |
| 98 */ | 111 */ |
| 99 void av_metadata_free(AVMetadata **m); | 112 void av_metadata_free(AVMetadata **m); |
| 100 | 113 |
| 101 | 114 |
| 102 /* packet functions */ | 115 /* packet functions */ |
| 103 | 116 |
| 104 typedef struct AVPacket { | 117 typedef struct AVPacket { |
| 105 /** | 118 /** |
| 106 * Presentation timestamp in time_base units. | 119 * Presentation timestamp in time_base units; the time at which the |
| 107 * This is the time at which the decompressed packet will be presented | 120 * decompressed packet will be presented to the user. |
| 108 * to the user. | |
| 109 * Can be AV_NOPTS_VALUE if it is not stored in the file. | 121 * Can be AV_NOPTS_VALUE if it is not stored in the file. |
| 110 * pts MUST be larger or equal to dts as presentation cannot happen before | 122 * pts MUST be larger or equal to dts as presentation cannot happen before |
| 111 * decompression, unless one wants to view hex dumps. Some formats misuse | 123 * decompression, unless one wants to view hex dumps. Some formats misuse |
| 112 * the terms dts and pts/cts to mean something different, these timestamps | 124 * the terms dts and pts/cts to mean something different. Such timestamps |
| 113 * must be converted to true pts/dts before they are stored in AVPacket. | 125 * must be converted to true pts/dts before they are stored in AVPacket. |
| 114 */ | 126 */ |
| 115 int64_t pts; | 127 int64_t pts; |
| 116 /** | 128 /** |
| 117 * Decompression timestamp in time_base units. | 129 * Decompression timestamp in time_base units; the time at which the |
| 118 * This is the time at which the packet is decompressed. | 130 * packet is decompressed. |
| 119 * Can be AV_NOPTS_VALUE if it is not stored in the file. | 131 * Can be AV_NOPTS_VALUE if it is not stored in the file. |
| 120 */ | 132 */ |
| 121 int64_t dts; | 133 int64_t dts; |
| 122 uint8_t *data; | 134 uint8_t *data; |
| 123 int size; | 135 int size; |
| 124 int stream_index; | 136 int stream_index; |
| 125 int flags; | 137 int flags; |
| 126 /** | 138 /** |
| 127 * Duration of this packet in time_base units, 0 if unknown. | 139 * Duration of this packet in time_base units, 0 if unknown. |
| 128 * Equals next_pts - this_pts in presentation order. | 140 * Equals next_pts - this_pts in presentation order. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 pkt->destruct(pkt); | 214 pkt->destruct(pkt); |
| 203 } | 215 } |
| 204 } | 216 } |
| 205 | 217 |
| 206 /*************************************************/ | 218 /*************************************************/ |
| 207 /* fractional numbers for exact pts handling */ | 219 /* fractional numbers for exact pts handling */ |
| 208 | 220 |
| 209 /** | 221 /** |
| 210 * The exact value of the fractional number is: 'val + num / den'. | 222 * The exact value of the fractional number is: 'val + num / den'. |
| 211 * num is assumed to be 0 <= num < den. | 223 * num is assumed to be 0 <= num < den. |
| 212 * @deprecated Use AVRational instead. | 224 */ |
| 213 */ | |
| 214 typedef struct AVFrac { | 225 typedef struct AVFrac { |
| 215 int64_t val, num, den; | 226 int64_t val, num, den; |
| 216 } AVFrac; | 227 } AVFrac; |
| 217 | 228 |
| 218 /*************************************************/ | 229 /*************************************************/ |
| 219 /* input/output formats */ | 230 /* input/output formats */ |
| 220 | 231 |
| 221 struct AVCodecTag; | 232 struct AVCodecTag; |
| 222 | 233 |
| 223 struct AVFormatContext; | |
| 224 | |
| 225 /** This structure contains the data a format has to probe a file. */ | 234 /** This structure contains the data a format has to probe a file. */ |
| 226 typedef struct AVProbeData { | 235 typedef struct AVProbeData { |
| 227 const char *filename; | 236 const char *filename; |
| 228 unsigned char *buf; | 237 unsigned char *buf; |
| 229 int buf_size; | 238 int buf_size; |
| 230 } AVProbeData; | 239 } AVProbeData; |
| 231 | 240 |
| 232 #define AVPROBE_SCORE_MAX 100 ///< Maximum score, half of that is
used for file-extension-based detection. | 241 #define AVPROBE_SCORE_MAX 100 ///< maximum score, half of that is
used for file-extension-based detection |
| 233 #define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the en
d of the probe buffer | 242 #define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the en
d of the probe buffer |
| 234 | 243 |
| 235 typedef struct AVFormatParameters { | 244 typedef struct AVFormatParameters { |
| 236 AVRational time_base; | 245 AVRational time_base; |
| 237 int sample_rate; | 246 int sample_rate; |
| 238 int channels; | 247 int channels; |
| 239 int width; | 248 int width; |
| 240 int height; | 249 int height; |
| 241 enum PixelFormat pix_fmt; | 250 enum PixelFormat pix_fmt; |
| 242 int channel; /**< Used to select DV channel. */ | 251 int channel; /**< Used to select DV channel. */ |
| (...skipping 14 matching lines...) Expand all Loading... |
| 257 //! Demuxer will use url_fopen, no opened file should be provided by the caller. | 266 //! Demuxer will use url_fopen, no opened file should be provided by the caller. |
| 258 #define AVFMT_NOFILE 0x0001 | 267 #define AVFMT_NOFILE 0x0001 |
| 259 #define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */ | 268 #define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */ |
| 260 #define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */ | 269 #define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */ |
| 261 #define AVFMT_RAWPICTURE 0x0020 /**< Format wants AVPicture structure for | 270 #define AVFMT_RAWPICTURE 0x0020 /**< Format wants AVPicture structure for |
| 262 raw picture data. */ | 271 raw picture data. */ |
| 263 #define AVFMT_GLOBALHEADER 0x0040 /**< Format wants global header. */ | 272 #define AVFMT_GLOBALHEADER 0x0040 /**< Format wants global header. */ |
| 264 #define AVFMT_NOTIMESTAMPS 0x0080 /**< Format does not need / have any timestam
ps. */ | 273 #define AVFMT_NOTIMESTAMPS 0x0080 /**< Format does not need / have any timestam
ps. */ |
| 265 #define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */ | 274 #define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */ |
| 266 #define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities.
*/ | 275 #define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities.
*/ |
| 276 #define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */ |
| 267 | 277 |
| 268 typedef struct AVOutputFormat { | 278 typedef struct AVOutputFormat { |
| 269 const char *name; | 279 const char *name; |
| 270 /** | 280 /** |
| 271 * Descriptive name for the format, meant to be more human-readable | 281 * Descriptive name for the format, meant to be more human-readable |
| 272 * than \p name. You \e should use the NULL_IF_CONFIG_SMALL() macro | 282 * than \p name. You \e should use the NULL_IF_CONFIG_SMALL() macro |
| 273 * to define it. | 283 * to define it. |
| 274 */ | 284 */ |
| 275 const char *long_name; | 285 const char *long_name; |
| 276 const char *mime_type; | 286 const char *mime_type; |
| 277 const char *extensions; /**< comma-separated filename extensions */ | 287 const char *extensions; /**< comma-separated filename extensions */ |
| 278 /** Size of private data so that it can be allocated in the wrapper. */ | 288 /** size of private data so that it can be allocated in the wrapper */ |
| 279 int priv_data_size; | 289 int priv_data_size; |
| 280 /* output support */ | 290 /* output support */ |
| 281 enum CodecID audio_codec; /**< default audio codec */ | 291 enum CodecID audio_codec; /**< default audio codec */ |
| 282 enum CodecID video_codec; /**< default video codec */ | 292 enum CodecID video_codec; /**< default video codec */ |
| 283 int (*write_header)(struct AVFormatContext *); | 293 int (*write_header)(struct AVFormatContext *); |
| 284 int (*write_packet)(struct AVFormatContext *, AVPacket *pkt); | 294 int (*write_packet)(struct AVFormatContext *, AVPacket *pkt); |
| 285 int (*write_trailer)(struct AVFormatContext *); | 295 int (*write_trailer)(struct AVFormatContext *); |
| 286 /** can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER */ | 296 /** can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER */ |
| 287 int flags; | 297 int flags; |
| 288 /** Currently only used to set pixel format if not YUV420P. */ | 298 /** Currently only used to set pixel format if not YUV420P. */ |
| 289 int (*set_parameters)(struct AVFormatContext *, AVFormatParameters *); | 299 int (*set_parameters)(struct AVFormatContext *, AVFormatParameters *); |
| 290 int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, | 300 int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, |
| 291 AVPacket *in, int flush); | 301 AVPacket *in, int flush); |
| 292 | 302 |
| 293 /** | 303 /** |
| 294 * List of supported codec_id-codec_tag pairs, ordered by "better | 304 * List of supported codec_id-codec_tag pairs, ordered by "better |
| 295 * choice first". The arrays are all CODEC_ID_NONE terminated. | 305 * choice first". The arrays are all terminated by CODEC_ID_NONE. |
| 296 */ | 306 */ |
| 297 const struct AVCodecTag * const *codec_tag; | 307 const struct AVCodecTag * const *codec_tag; |
| 298 | 308 |
| 299 enum CodecID subtitle_codec; /**< default subtitle codec */ | 309 enum CodecID subtitle_codec; /**< default subtitle codec */ |
| 300 | 310 |
| 311 const AVMetadataConv *metadata_conv; |
| 312 |
| 301 /* private fields */ | 313 /* private fields */ |
| 302 struct AVOutputFormat *next; | 314 struct AVOutputFormat *next; |
| 303 } AVOutputFormat; | 315 } AVOutputFormat; |
| 304 | 316 |
| 305 typedef struct AVInputFormat { | 317 typedef struct AVInputFormat { |
| 306 const char *name; | 318 const char *name; |
| 307 /** | 319 /** |
| 308 * Descriptive name for the format, meant to be more human-readable | 320 * Descriptive name for the format, meant to be more human-readable |
| 309 * than \p name. You \e should use the NULL_IF_CONFIG_SMALL() macro | 321 * than \p name. You \e should use the NULL_IF_CONFIG_SMALL() macro |
| 310 * to define it. | 322 * to define it. |
| 311 */ | 323 */ |
| 312 const char *long_name; | 324 const char *long_name; |
| 313 /** Size of private data so that it can be allocated in the wrapper. */ | 325 /** Size of private data so that it can be allocated in the wrapper. */ |
| 314 int priv_data_size; | 326 int priv_data_size; |
| 315 /** | 327 /** |
| 316 * Tell if a given file has a chance of being parsed by this format. | 328 * Tell if a given file has a chance of being parsed as this format. |
| 317 * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes | 329 * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes |
| 318 * big so you do not have to check for that unless you need more. | 330 * big so you do not have to check for that unless you need more. |
| 319 */ | 331 */ |
| 320 int (*read_probe)(AVProbeData *); | 332 int (*read_probe)(AVProbeData *); |
| 321 /** Read the format header and initialize the AVFormatContext | 333 /** Read the format header and initialize the AVFormatContext |
| 322 structure. Return 0 if OK. 'ap' if non-NULL contains | 334 structure. Return 0 if OK. 'ap' if non-NULL contains |
| 323 additional parameters. Only used in raw format right | 335 additional parameters. Only used in raw format right |
| 324 now. 'av_new_stream' should be called to create new streams. */ | 336 now. 'av_new_stream' should be called to create new streams. */ |
| 325 int (*read_header)(struct AVFormatContext *, | 337 int (*read_header)(struct AVFormatContext *, |
| 326 AVFormatParameters *ap); | 338 AVFormatParameters *ap); |
| 327 /** Read one packet and put it in 'pkt'. pts and flags are also | 339 /** Read one packet and put it in 'pkt'. pts and flags are also |
| 328 set. 'av_new_stream' can be called only if the flag | 340 set. 'av_new_stream' can be called only if the flag |
| 329 AVFMTCTX_NOHEADER is used. */ | 341 AVFMTCTX_NOHEADER is used. */ |
| 330 int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); | 342 int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); |
| 331 /** Close the stream. The AVFormatContext and AVStreams are not | 343 /** Close the stream. The AVFormatContext and AVStreams are not |
| 332 freed by this function */ | 344 freed by this function */ |
| 333 int (*read_close)(struct AVFormatContext *); | 345 int (*read_close)(struct AVFormatContext *); |
| 346 |
| 347 #if LIBAVFORMAT_VERSION_MAJOR < 53 |
| 334 /** | 348 /** |
| 335 * Seek to a given timestamp relative to the frames in | 349 * Seek to a given timestamp relative to the frames in |
| 336 * stream component stream_index. | 350 * stream component stream_index. |
| 337 * @param stream_index must not be -1 | 351 * @param stream_index Must not be -1. |
| 338 * @param flags selects which direction should be preferred if no exact | 352 * @param flags Selects which direction should be preferred if no exact |
| 339 * match is available | 353 * match is available. |
| 340 * @return >= 0 on success (but not necessarily the new offset) | 354 * @return >= 0 on success (but not necessarily the new offset) |
| 341 */ | 355 */ |
| 342 int (*read_seek)(struct AVFormatContext *, | 356 int (*read_seek)(struct AVFormatContext *, |
| 343 int stream_index, int64_t timestamp, int flags); | 357 int stream_index, int64_t timestamp, int flags); |
| 358 #endif |
| 344 /** | 359 /** |
| 345 * Gets the next timestamp in stream[stream_index].time_base units. | 360 * Gets the next timestamp in stream[stream_index].time_base units. |
| 346 * @return the timestamp or AV_NOPTS_VALUE if an error occurred | 361 * @return the timestamp or AV_NOPTS_VALUE if an error occurred |
| 347 */ | 362 */ |
| 348 int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index, | 363 int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index, |
| 349 int64_t *pos, int64_t pos_limit); | 364 int64_t *pos, int64_t pos_limit); |
| 350 /** Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER. */ | 365 /** Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER. */ |
| 351 int flags; | 366 int flags; |
| 352 /** If extensions are defined, then no probe is done. You should | 367 /** If extensions are defined, then no probe is done. You should |
| 353 usually not use extension format guessing because it is not | 368 usually not use extension format guessing because it is not |
| 354 reliable enough */ | 369 reliable enough */ |
| 355 const char *extensions; | 370 const char *extensions; |
| 356 /** General purpose read-only value that the format can use. */ | 371 /** General purpose read-only value that the format can use. */ |
| 357 int value; | 372 int value; |
| 358 | 373 |
| 359 /** Start/resume playing - only meaningful if using a network-based format | 374 /** Start/resume playing - only meaningful if using a network-based format |
| 360 (RTSP). */ | 375 (RTSP). */ |
| 361 int (*read_play)(struct AVFormatContext *); | 376 int (*read_play)(struct AVFormatContext *); |
| 362 | 377 |
| 363 /** Pause playing - only meaningful if using a network-based format | 378 /** Pause playing - only meaningful if using a network-based format |
| 364 (RTSP). */ | 379 (RTSP). */ |
| 365 int (*read_pause)(struct AVFormatContext *); | 380 int (*read_pause)(struct AVFormatContext *); |
| 366 | 381 |
| 367 const struct AVCodecTag * const *codec_tag; | 382 const struct AVCodecTag * const *codec_tag; |
| 368 | 383 |
| 384 /** |
| 385 * Seek to timestamp ts. |
| 386 * Seeking will be done so that the point from which all active streams |
| 387 * can be presented successfully will be closest to ts and within min/max_ts
. |
| 388 * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL
. |
| 389 */ |
| 390 int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_t
s, int64_t ts, int64_t max_ts, int flags); |
| 391 |
| 392 const AVMetadataConv *metadata_conv; |
| 393 |
| 369 /* private fields */ | 394 /* private fields */ |
| 370 struct AVInputFormat *next; | 395 struct AVInputFormat *next; |
| 371 } AVInputFormat; | 396 } AVInputFormat; |
| 372 | 397 |
| 373 enum AVStreamParseType { | 398 enum AVStreamParseType { |
| 374 AVSTREAM_PARSE_NONE, | 399 AVSTREAM_PARSE_NONE, |
| 375 AVSTREAM_PARSE_FULL, /**< full parsing and repack */ | 400 AVSTREAM_PARSE_FULL, /**< full parsing and repack */ |
| 376 AVSTREAM_PARSE_HEADERS, /**< Only parse headers, do not repack. */ | 401 AVSTREAM_PARSE_HEADERS, /**< Only parse headers, do not repack. */ |
| 377 AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps
for frames not starting on a packet boundary */ | 402 AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps
for frames not starting on a packet boundary */ |
| 378 }; | 403 }; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 398 * New fields can be added to the end with minor version bumps. | 423 * New fields can be added to the end with minor version bumps. |
| 399 * Removal, reordering and changes to existing fields require a major | 424 * Removal, reordering and changes to existing fields require a major |
| 400 * version bump. | 425 * version bump. |
| 401 * sizeof(AVStream) must not be used outside libav*. | 426 * sizeof(AVStream) must not be used outside libav*. |
| 402 */ | 427 */ |
| 403 typedef struct AVStream { | 428 typedef struct AVStream { |
| 404 int index; /**< stream index in AVFormatContext */ | 429 int index; /**< stream index in AVFormatContext */ |
| 405 int id; /**< format-specific stream ID */ | 430 int id; /**< format-specific stream ID */ |
| 406 AVCodecContext *codec; /**< codec context */ | 431 AVCodecContext *codec; /**< codec context */ |
| 407 /** | 432 /** |
| 408 * Real base frame rate of the stream. | 433 * Real base framerate of the stream. |
| 409 * This is the lowest frame rate with which all timestamps can be | 434 * This is the lowest framerate with which all timestamps can be |
| 410 * represented accurately (it is the least common multiple of all | 435 * represented accurately (it is the least common multiple of all |
| 411 * frame rates in the stream). Note, this value is just a guess! | 436 * framerates in the stream). Note, this value is just a guess! |
| 412 * For example if the time base is 1/90000 and all frames have either | 437 * For example, if the time base is 1/90000 and all frames have either |
| 413 * approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1. | 438 * approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1. |
| 414 */ | 439 */ |
| 415 AVRational r_frame_rate; | 440 AVRational r_frame_rate; |
| 416 void *priv_data; | 441 void *priv_data; |
| 417 | 442 |
| 418 /* internal data used in av_find_stream_info() */ | 443 /* internal data used in av_find_stream_info() */ |
| 419 int64_t first_dts; | 444 int64_t first_dts; |
| 420 /** encoding: pts generation when outputting stream */ | 445 /** encoding: pts generation when outputting stream */ |
| 421 struct AVFrac pts; | 446 struct AVFrac pts; |
| 422 | 447 |
| 423 /** | 448 /** |
| 424 * This is the fundamental unit of time (in seconds) in terms | 449 * This is the fundamental unit of time (in seconds) in terms |
| 425 * of which frame timestamps are represented. For fixed-fps content, | 450 * of which frame timestamps are represented. For fixed-fps content, |
| 426 * time base should be 1/frame rate and timestamp increments should be 1. | 451 * time base should be 1/framerate and timestamp increments should be 1. |
| 427 */ | 452 */ |
| 428 AVRational time_base; | 453 AVRational time_base; |
| 429 int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ | 454 int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ |
| 430 /* ffmpeg.c private use */ | 455 /* ffmpeg.c private use */ |
| 431 int stream_copy; /**< If set, just copy stream. */ | 456 int stream_copy; /**< If set, just copy stream. */ |
| 432 enum AVDiscard discard; ///< Selects which packets can be discarded at will
and do not need to be demuxed. | 457 enum AVDiscard discard; ///< Selects which packets can be discarded at will
and do not need to be demuxed. |
| 433 //FIXME move stuff to a flags field? | 458 //FIXME move stuff to a flags field? |
| 434 /** Quality, as it has been removed from AVCodecContext and put in AVVideoFr
ame. | 459 /** Quality, as it has been removed from AVCodecContext and put in AVVideoFr
ame. |
| 435 * MN: dunno if that is the right place for it */ | 460 * MN: dunno if that is the right place for it */ |
| 436 float quality; | 461 float quality; |
| 437 /** | 462 /** |
| 438 * Decoding: pts of the first frame of the stream, in stream time base. | 463 * Decoding: pts of the first frame of the stream, in stream time base. |
| 439 * Only set this if you are absolutely 100% sure that the value you set | 464 * Only set this if you are absolutely 100% sure that the value you set |
| 440 * it to really is the pts of the first frame. | 465 * it to really is the pts of the first frame. |
| 441 * This may be undefined (AV_NOPTS_VALUE). | 466 * This may be undefined (AV_NOPTS_VALUE). |
| 442 * @note The ASF header does NOT contain a correct start_time the ASF | 467 * @note The ASF header does NOT contain a correct start_time the ASF |
| 443 * demuxer must NOT set this. | 468 * demuxer must NOT set this. |
| 444 */ | 469 */ |
| 445 int64_t start_time; | 470 int64_t start_time; |
| 446 /** | 471 /** |
| 447 * Decoding: duration of the stream, in stream time base. | 472 * Decoding: duration of the stream, in stream time base. |
| 448 * If a source file does not specify a duration, but does specify | 473 * If a source file does not specify a duration, but does specify |
| 449 * a bitrate, this value will be estimated from bitrate and file size. | 474 * a bitrate, this value will be estimated from bitrate and file size. |
| 450 */ | 475 */ |
| 451 int64_t duration; | 476 int64_t duration; |
| 452 | 477 |
| 478 #if LIBAVFORMAT_VERSION_INT < (53<<16) |
| 453 char language[4]; /** ISO 639 3-letter language code (empty string if undefi
ned) */ | 479 char language[4]; /** ISO 639 3-letter language code (empty string if undefi
ned) */ |
| 480 #endif |
| 454 | 481 |
| 455 /* av_read_frame() support */ | 482 /* av_read_frame() support */ |
| 456 enum AVStreamParseType need_parsing; | 483 enum AVStreamParseType need_parsing; |
| 457 struct AVCodecParserContext *parser; | 484 struct AVCodecParserContext *parser; |
| 458 | 485 |
| 459 int64_t cur_dts; | 486 int64_t cur_dts; |
| 460 int last_IP_duration; | 487 int last_IP_duration; |
| 461 int64_t last_IP_pts; | 488 int64_t last_IP_pts; |
| 462 /* av_seek_frame() support */ | 489 /* av_seek_frame() support */ |
| 463 AVIndexEntry *index_entries; /**< Only used if the format does not | 490 AVIndexEntry *index_entries; /**< Only used if the format does not |
| 464 support seeking natively. */ | 491 support seeking natively. */ |
| 465 int nb_index_entries; | 492 int nb_index_entries; |
| 466 unsigned int index_entries_allocated_size; | 493 unsigned int index_entries_allocated_size; |
| 467 | 494 |
| 468 int64_t nb_frames; ///< number of frames in this stream if k
nown or 0 | 495 int64_t nb_frames; ///< number of frames in this stream if k
nown or 0 |
| 469 | 496 |
| 470 #if LIBAVFORMAT_VERSION_INT < (53<<16) | 497 #if LIBAVFORMAT_VERSION_INT < (53<<16) |
| 471 int64_t unused[4+1]; | 498 int64_t unused[4+1]; |
| 472 #endif | |
| 473 | 499 |
| 474 char *filename; /**< source filename of the stream */ | 500 char *filename; /**< source filename of the stream */ |
| 501 #endif |
| 475 | 502 |
| 476 int disposition; /**< AV_DISPOSITION_* bit field */ | 503 int disposition; /**< AV_DISPOSITION_* bit field */ |
| 477 | 504 |
| 478 AVProbeData probe_data; | 505 AVProbeData probe_data; |
| 479 #define MAX_REORDER_DELAY 16 | 506 #define MAX_REORDER_DELAY 16 |
| 480 int64_t pts_buffer[MAX_REORDER_DELAY+1]; | 507 int64_t pts_buffer[MAX_REORDER_DELAY+1]; |
| 481 | 508 |
| 482 /** | 509 /** |
| 483 * sample aspect ratio (0 if unknown) | 510 * sample aspect ratio (0 if unknown) |
| 484 * - encoding: Set by user. | 511 * - encoding: Set by user. |
| 485 * - decoding: Set by libavformat. | 512 * - decoding: Set by libavformat. |
| 486 */ | 513 */ |
| 487 AVRational sample_aspect_ratio; | 514 AVRational sample_aspect_ratio; |
| 488 | 515 |
| 489 AVMetadata *metadata; | 516 AVMetadata *metadata; |
| 517 |
| 518 /* av_read_frame() support */ |
| 519 const uint8_t *cur_ptr; |
| 520 int cur_len; |
| 521 AVPacket cur_pkt; |
| 522 |
| 523 // Timestamp generation support: |
| 524 /** |
| 525 * Timestamp corresponding to the last dts sync point. |
| 526 * |
| 527 * Initialized when AVCodecParserContext.dts_sync_point >= 0 and |
| 528 * a DTS is received from the underlying container. Otherwise set to |
| 529 * AV_NOPTS_VALUE by default. |
| 530 */ |
| 531 int64_t reference_dts; |
| 490 } AVStream; | 532 } AVStream; |
| 491 | 533 |
| 492 #define AV_PROGRAM_RUNNING 1 | 534 #define AV_PROGRAM_RUNNING 1 |
| 493 | 535 |
| 494 /** | 536 /** |
| 495 * New fields can be added to the end with minor version bumps. | 537 * New fields can be added to the end with minor version bumps. |
| 496 * Removal, reordering and changes to existing fields require a major | 538 * Removal, reordering and changes to existing fields require a major |
| 497 * version bump. | 539 * version bump. |
| 498 * sizeof(AVProgram) must not be used outside libav*. | 540 * sizeof(AVProgram) must not be used outside libav*. |
| 499 */ | 541 */ |
| 500 typedef struct AVProgram { | 542 typedef struct AVProgram { |
| 501 int id; | 543 int id; |
| 544 #if LIBAVFORMAT_VERSION_INT < (53<<16) |
| 502 char *provider_name; ///< network name for DVB streams | 545 char *provider_name; ///< network name for DVB streams |
| 503 char *name; ///< service name for DVB streams | 546 char *name; ///< service name for DVB streams |
| 547 #endif |
| 504 int flags; | 548 int flags; |
| 505 enum AVDiscard discard; ///< selects which program to discard and whi
ch to feed to the caller | 549 enum AVDiscard discard; ///< selects which program to discard and whi
ch to feed to the caller |
| 506 unsigned int *stream_index; | 550 unsigned int *stream_index; |
| 507 unsigned int nb_stream_indexes; | 551 unsigned int nb_stream_indexes; |
| 508 AVMetadata *metadata; | 552 AVMetadata *metadata; |
| 509 } AVProgram; | 553 } AVProgram; |
| 510 | 554 |
| 511 #define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present | 555 #define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present |
| 512 (streams are added dynamically) */ | 556 (streams are added dynamically) */ |
| 513 | 557 |
| 514 typedef struct AVChapter { | 558 typedef struct AVChapter { |
| 515 int id; ///< unique ID to identify the chapter | 559 int id; ///< unique ID to identify the chapter |
| 516 AVRational time_base; ///< time base in which the start/end timestamps are
specified | 560 AVRational time_base; ///< time base in which the start/end timestamps are
specified |
| 517 int64_t start, end; ///< chapter start/end time in time_base units | 561 int64_t start, end; ///< chapter start/end time in time_base units |
| 562 #if LIBAVFORMAT_VERSION_INT < (53<<16) |
| 518 char *title; ///< chapter title | 563 char *title; ///< chapter title |
| 564 #endif |
| 519 AVMetadata *metadata; | 565 AVMetadata *metadata; |
| 520 } AVChapter; | 566 } AVChapter; |
| 521 | 567 |
| 522 #define MAX_STREAMS 20 | 568 #define MAX_STREAMS 20 |
| 523 | 569 |
| 524 /** | 570 /** |
| 525 * Format I/O context. | 571 * Format I/O context. |
| 526 * New fields can be added to the end with minor version bumps. | 572 * New fields can be added to the end with minor version bumps. |
| 527 * Removal, reordering and changes to existing fields require a major | 573 * Removal, reordering and changes to existing fields require a major |
| 528 * version bump. | 574 * version bump. |
| 529 * sizeof(AVFormatContext) must not be used outside libav*. | 575 * sizeof(AVFormatContext) must not be used outside libav*. |
| 530 */ | 576 */ |
| 531 typedef struct AVFormatContext { | 577 typedef struct AVFormatContext { |
| 532 const AVClass *av_class; /**< Set by av_alloc_format_context. */ | 578 const AVClass *av_class; /**< Set by avformat_alloc_context. */ |
| 533 /* Can only be iformat or oformat, not both at the same time. */ | 579 /* Can only be iformat or oformat, not both at the same time. */ |
| 534 struct AVInputFormat *iformat; | 580 struct AVInputFormat *iformat; |
| 535 struct AVOutputFormat *oformat; | 581 struct AVOutputFormat *oformat; |
| 536 void *priv_data; | 582 void *priv_data; |
| 537 ByteIOContext *pb; | 583 ByteIOContext *pb; |
| 538 unsigned int nb_streams; | 584 unsigned int nb_streams; |
| 539 AVStream *streams[MAX_STREAMS]; | 585 AVStream *streams[MAX_STREAMS]; |
| 540 char filename[1024]; /**< input or output filename */ | 586 char filename[1024]; /**< input or output filename */ |
| 541 /* stream info */ | 587 /* stream info */ |
| 542 int64_t timestamp; | 588 int64_t timestamp; |
| 589 #if LIBAVFORMAT_VERSION_INT < (53<<16) |
| 543 char title[512]; | 590 char title[512]; |
| 544 char author[512]; | 591 char author[512]; |
| 545 char copyright[512]; | 592 char copyright[512]; |
| 546 char comment[512]; | 593 char comment[512]; |
| 547 char album[512]; | 594 char album[512]; |
| 548 int year; /**< ID3 year, 0 if none */ | 595 int year; /**< ID3 year, 0 if none */ |
| 549 int track; /**< track number, 0 if none */ | 596 int track; /**< track number, 0 if none */ |
| 550 char genre[32]; /**< ID3 genre */ | 597 char genre[32]; /**< ID3 genre */ |
| 598 #endif |
| 551 | 599 |
| 552 int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */ | 600 int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */ |
| 553 /* private data for pts handling (do not modify directly). */ | 601 /* private data for pts handling (do not modify directly). */ |
| 554 /** This buffer is only needed when packets were already buffered but | 602 /** This buffer is only needed when packets were already buffered but |
| 555 not decoded, for example to get the codec parameters in MPEG | 603 not decoded, for example to get the codec parameters in MPEG |
| 556 streams. */ | 604 streams. */ |
| 557 struct AVPacketList *packet_buffer; | 605 struct AVPacketList *packet_buffer; |
| 558 | 606 |
| 559 /** Decoding: position of the first frame of the component, in | 607 /** Decoding: position of the first frame of the component, in |
| 560 AV_TIME_BASE fractional seconds. NEVER set this value directly: | 608 AV_TIME_BASE fractional seconds. NEVER set this value directly: |
| 561 It is deduced from the AVStream values. */ | 609 It is deduced from the AVStream values. */ |
| 562 int64_t start_time; | 610 int64_t start_time; |
| 563 /** Decoding: duration of the stream, in AV_TIME_BASE fractional | 611 /** Decoding: duration of the stream, in AV_TIME_BASE fractional |
| 564 seconds. NEVER set this value directly: it is deduced from the | 612 seconds. NEVER set this value directly: it is deduced from the |
| 565 AVStream values. */ | 613 AVStream values. */ |
| 566 int64_t duration; | 614 int64_t duration; |
| 567 /** decoding: total file size, 0 if unknown */ | 615 /** decoding: total file size, 0 if unknown */ |
| 568 int64_t file_size; | 616 int64_t file_size; |
| 569 /** Decoding: total stream bitrate in bit/s, 0 if not | 617 /** Decoding: total stream bitrate in bit/s, 0 if not |
| 570 available. Never set it directly if the file_size and the | 618 available. Never set it directly if the file_size and the |
| 571 duration are known as ffmpeg can compute it automatically. */ | 619 duration are known as FFmpeg can compute it automatically. */ |
| 572 int bit_rate; | 620 int bit_rate; |
| 573 | 621 |
| 574 /* av_read_frame() support */ | 622 /* av_read_frame() support */ |
| 575 AVStream *cur_st; | 623 AVStream *cur_st; |
| 576 const uint8_t *cur_ptr; | 624 #if LIBAVFORMAT_VERSION_INT < (53<<16) |
| 577 int cur_len; | 625 const uint8_t *cur_ptr_deprecated; |
| 578 AVPacket cur_pkt; | 626 int cur_len_deprecated; |
| 627 AVPacket cur_pkt_deprecated; |
| 628 #endif |
| 579 | 629 |
| 580 /* av_seek_frame() support */ | 630 /* av_seek_frame() support */ |
| 581 int64_t data_offset; /** offset of the first packet */ | 631 int64_t data_offset; /** offset of the first packet */ |
| 582 int index_built; | 632 int index_built; |
| 583 | 633 |
| 584 int mux_rate; | 634 int mux_rate; |
| 585 int packet_size; | 635 int packet_size; |
| 586 int preload; | 636 int preload; |
| 587 int max_delay; | 637 int max_delay; |
| 588 | 638 |
| 589 #define AVFMT_NOOUTPUTLOOP -1 | 639 #define AVFMT_NOOUTPUTLOOP -1 |
| 590 #define AVFMT_INFINITEOUTPUTLOOP 0 | 640 #define AVFMT_INFINITEOUTPUTLOOP 0 |
| 591 /** number of times to loop output in formats that support it */ | 641 /** number of times to loop output in formats that support it */ |
| 592 int loop_output; | 642 int loop_output; |
| 593 | 643 |
| 594 int flags; | 644 int flags; |
| 595 #define AVFMT_FLAG_GENPTS 0x0001 ///< Generate pts if missing even if it r
equires parsing future frames. | 645 #define AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requ
ires parsing future frames. |
| 596 #define AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index. | 646 #define AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index. |
| 597 #define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets fr
om input. | 647 #define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets fr
om input. |
| 598 | 648 |
| 599 int loop_input; | 649 int loop_input; |
| 600 /** Decoding: size of data to probe; encoding: unused. */ | 650 /** decoding: size of data to probe; encoding: unused. */ |
| 601 unsigned int probesize; | 651 unsigned int probesize; |
| 602 | 652 |
| 603 /** | 653 /** |
| 604 * Maximum time (in AV_TIME_BASE units) during which the input should | 654 * Maximum time (in AV_TIME_BASE units) during which the input should |
| 605 * be analyzed in av_find_stream_info(). | 655 * be analyzed in av_find_stream_info(). |
| 606 */ | 656 */ |
| 607 int max_analyze_duration; | 657 int max_analyze_duration; |
| 608 | 658 |
| 609 const uint8_t *key; | 659 const uint8_t *key; |
| 610 int keylen; | 660 int keylen; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 622 * Demuxing: Set by user. | 672 * Demuxing: Set by user. |
| 623 */ | 673 */ |
| 624 enum CodecID audio_codec_id; | 674 enum CodecID audio_codec_id; |
| 625 /** | 675 /** |
| 626 * Forced subtitle codec_id. | 676 * Forced subtitle codec_id. |
| 627 * Demuxing: Set by user. | 677 * Demuxing: Set by user. |
| 628 */ | 678 */ |
| 629 enum CodecID subtitle_codec_id; | 679 enum CodecID subtitle_codec_id; |
| 630 | 680 |
| 631 /** | 681 /** |
| 632 * Maximum amount of memory in bytes to use per stream for the index. | 682 * Maximum amount of memory in bytes to use for the index of each stream. |
| 633 * If the needed index exceeds this size, entries will be discarded as | 683 * If the index exceeds this size, entries will be discarded as |
| 634 * needed to maintain a smaller size. This can lead to slower or less | 684 * needed to maintain a smaller size. This can lead to slower or less |
| 635 * accurate seeking (depends on demuxer). | 685 * accurate seeking (depends on demuxer). |
| 636 * Demuxers for which a full in-memory index is mandatory will ignore | 686 * Demuxers for which a full in-memory index is mandatory will ignore |
| 637 * this. | 687 * this. |
| 638 * muxing : unused | 688 * muxing : unused |
| 639 * demuxing: set by user | 689 * demuxing: set by user |
| 640 */ | 690 */ |
| 641 unsigned int max_index_size; | 691 unsigned int max_index_size; |
| 642 | 692 |
| 643 /** | 693 /** |
| (...skipping 28 matching lines...) Expand all Loading... |
| 672 typedef struct AVPacketList { | 722 typedef struct AVPacketList { |
| 673 AVPacket pkt; | 723 AVPacket pkt; |
| 674 struct AVPacketList *next; | 724 struct AVPacketList *next; |
| 675 } AVPacketList; | 725 } AVPacketList; |
| 676 | 726 |
| 677 #if LIBAVFORMAT_VERSION_INT < (53<<16) | 727 #if LIBAVFORMAT_VERSION_INT < (53<<16) |
| 678 extern AVInputFormat *first_iformat; | 728 extern AVInputFormat *first_iformat; |
| 679 extern AVOutputFormat *first_oformat; | 729 extern AVOutputFormat *first_oformat; |
| 680 #endif | 730 #endif |
| 681 | 731 |
| 732 /** |
| 733 * If f is NULL, returns the first registered input format, |
| 734 * if f is non-NULL, returns the next registered input format after f |
| 735 * or NULL if f is the last one. |
| 736 */ |
| 682 AVInputFormat *av_iformat_next(AVInputFormat *f); | 737 AVInputFormat *av_iformat_next(AVInputFormat *f); |
| 738 |
| 739 /** |
| 740 * If f is NULL, returns the first registered output format, |
| 741 * if f is non-NULL, returns the next registered output format after f |
| 742 * or NULL if f is the last one. |
| 743 */ |
| 683 AVOutputFormat *av_oformat_next(AVOutputFormat *f); | 744 AVOutputFormat *av_oformat_next(AVOutputFormat *f); |
| 684 | 745 |
| 685 enum CodecID av_guess_image2_codec(const char *filename); | 746 enum CodecID av_guess_image2_codec(const char *filename); |
| 686 | 747 |
| 687 /* XXX: use automatic init with either ELF sections or C file parser */ | 748 /* XXX: Use automatic init with either ELF sections or C file parser */ |
| 688 /* modules */ | 749 /* modules. */ |
| 689 | 750 |
| 690 /* utils.c */ | 751 /* utils.c */ |
| 691 void av_register_input_format(AVInputFormat *format); | 752 void av_register_input_format(AVInputFormat *format); |
| 692 void av_register_output_format(AVOutputFormat *format); | 753 void av_register_output_format(AVOutputFormat *format); |
| 693 AVOutputFormat *guess_stream_format(const char *short_name, | 754 AVOutputFormat *guess_stream_format(const char *short_name, |
| 694 const char *filename, | 755 const char *filename, |
| 695 const char *mime_type); | 756 const char *mime_type); |
| 696 AVOutputFormat *guess_format(const char *short_name, | 757 AVOutputFormat *guess_format(const char *short_name, |
| 697 const char *filename, | 758 const char *filename, |
| 698 const char *mime_type); | 759 const char *mime_type); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 * | 804 * |
| 744 * @param avcl A pointer to an arbitrary struct of which the first field is a | 805 * @param avcl A pointer to an arbitrary struct of which the first field is a |
| 745 * pointer to an AVClass struct. | 806 * pointer to an AVClass struct. |
| 746 * @param level The importance level of the message, lower values signifying | 807 * @param level The importance level of the message, lower values signifying |
| 747 * higher importance. | 808 * higher importance. |
| 748 * @param pkt packet to dump | 809 * @param pkt packet to dump |
| 749 * @param dump_payload True if the payload must be displayed, too. | 810 * @param dump_payload True if the payload must be displayed, too. |
| 750 */ | 811 */ |
| 751 void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload); | 812 void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload); |
| 752 | 813 |
| 814 /** |
| 815 * Initialize libavformat and register all the muxers, demuxers and |
| 816 * protocols. If you do not call this function, then you can select |
| 817 * exactly which formats you want to support. |
| 818 * |
| 819 * @see av_register_input_format() |
| 820 * @see av_register_output_format() |
| 821 * @see av_register_protocol() |
| 822 */ |
| 753 void av_register_all(void); | 823 void av_register_all(void); |
| 754 | 824 |
| 755 /** codec tag <-> codec id */ | 825 /** codec tag <-> codec id */ |
| 756 enum CodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int
tag); | 826 enum CodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int
tag); |
| 757 unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum CodecI
D id); | 827 unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum CodecI
D id); |
| 758 | 828 |
| 759 /* media file input */ | 829 /* media file input */ |
| 760 | 830 |
| 761 /** | 831 /** |
| 762 * Finds AVInputFormat based on the short name of the input format. | 832 * Finds AVInputFormat based on the short name of the input format. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 788 * @param fmt If non-NULL, force the file format to use. | 858 * @param fmt If non-NULL, force the file format to use. |
| 789 * @param buf_size optional buffer size (zero if default is OK) | 859 * @param buf_size optional buffer size (zero if default is OK) |
| 790 * @param ap Additional parameters needed when opening the file | 860 * @param ap Additional parameters needed when opening the file |
| 791 * (NULL if default). | 861 * (NULL if default). |
| 792 * @return 0 if OK, AVERROR_xxx otherwise | 862 * @return 0 if OK, AVERROR_xxx otherwise |
| 793 */ | 863 */ |
| 794 int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, | 864 int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, |
| 795 AVInputFormat *fmt, | 865 AVInputFormat *fmt, |
| 796 int buf_size, | 866 int buf_size, |
| 797 AVFormatParameters *ap); | 867 AVFormatParameters *ap); |
| 868 |
| 869 #if LIBAVFORMAT_VERSION_MAJOR < 53 |
| 870 /** |
| 871 * @deprecated Use avformat_alloc_context() instead. |
| 872 */ |
| 873 attribute_deprecated AVFormatContext *av_alloc_format_context(void); |
| 874 #endif |
| 875 |
| 798 /** | 876 /** |
| 799 * Allocate an AVFormatContext. | 877 * Allocate an AVFormatContext. |
| 800 * Can be freed with av_free() but do not forget to free everything you | 878 * Can be freed with av_free() but do not forget to free everything you |
| 801 * explicitly allocated as well! | 879 * explicitly allocated as well! |
| 802 */ | 880 */ |
| 803 AVFormatContext *av_alloc_format_context(void); | 881 AVFormatContext *avformat_alloc_context(void); |
| 804 | 882 |
| 805 /** | 883 /** |
| 806 * Read packets of a media file to get stream information. This | 884 * Read packets of a media file to get stream information. This |
| 807 * is useful for file formats with no headers such as MPEG. This | 885 * is useful for file formats with no headers such as MPEG. This |
| 808 * function also computes the real frame rate in case of MPEG-2 repeat | 886 * function also computes the real framerate in case of MPEG-2 repeat |
| 809 * frame mode. | 887 * frame mode. |
| 810 * The logical file position is not changed by this function; | 888 * The logical file position is not changed by this function; |
| 811 * examined packets may be buffered for later processing. | 889 * examined packets may be buffered for later processing. |
| 812 * | 890 * |
| 813 * @param ic media file handle | 891 * @param ic media file handle |
| 814 * @return >=0 if OK, AVERROR_xxx on error | 892 * @return >=0 if OK, AVERROR_xxx on error |
| 815 * @todo Let the user decide somehow what information is needed so that | 893 * @todo Let the user decide somehow what information is needed so that |
| 816 * we do not waste time getting stuff the user does not need. | 894 * we do not waste time getting stuff the user does not need. |
| 817 */ | 895 */ |
| 818 int av_find_stream_info(AVFormatContext *ic); | 896 int av_find_stream_info(AVFormatContext *ic); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 834 * | 912 * |
| 835 * The returned packet is valid | 913 * The returned packet is valid |
| 836 * until the next av_read_frame() or until av_close_input_file() and | 914 * until the next av_read_frame() or until av_close_input_file() and |
| 837 * must be freed with av_free_packet. For video, the packet contains | 915 * must be freed with av_free_packet. For video, the packet contains |
| 838 * exactly one frame. For audio, it contains an integer number of | 916 * exactly one frame. For audio, it contains an integer number of |
| 839 * frames if each frame has a known fixed size (e.g. PCM or ADPCM | 917 * frames if each frame has a known fixed size (e.g. PCM or ADPCM |
| 840 * data). If the audio frames have a variable size (e.g. MPEG audio), | 918 * data). If the audio frames have a variable size (e.g. MPEG audio), |
| 841 * then it contains one frame. | 919 * then it contains one frame. |
| 842 * | 920 * |
| 843 * pkt->pts, pkt->dts and pkt->duration are always set to correct | 921 * pkt->pts, pkt->dts and pkt->duration are always set to correct |
| 844 * values in AVStream.timebase units (and guessed if the format cannot | 922 * values in AVStream.time_base units (and guessed if the format cannot |
| 845 * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format | 923 * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format |
| 846 * has B-frames, so it is better to rely on pkt->dts if you do not | 924 * has B-frames, so it is better to rely on pkt->dts if you do not |
| 847 * decompress the payload. | 925 * decompress the payload. |
| 848 * | 926 * |
| 849 * @return 0 if OK, < 0 on error or end of file | 927 * @return 0 if OK, < 0 on error or end of file |
| 850 */ | 928 */ |
| 851 int av_read_frame(AVFormatContext *s, AVPacket *pkt); | 929 int av_read_frame(AVFormatContext *s, AVPacket *pkt); |
| 852 | 930 |
| 853 /** | 931 /** |
| 854 * Seek to the key frame at timestamp. | 932 * Seek to the keyframe at timestamp. |
| 855 * 'timestamp' in 'stream_index'. | 933 * 'timestamp' in 'stream_index'. |
| 856 * @param stream_index If stream_index is (-1), a default | 934 * @param stream_index If stream_index is (-1), a default |
| 857 * stream is selected, and timestamp is automatically converted | 935 * stream is selected, and timestamp is automatically converted |
| 858 * from AV_TIME_BASE units to the stream specific time_base. | 936 * from AV_TIME_BASE units to the stream specific time_base. |
| 859 * @param timestamp Timestamp in AVStream.time_base units | 937 * @param timestamp Timestamp in AVStream.time_base units |
| 860 * or, if no stream is specified, in AV_TIME_BASE units. | 938 * or, if no stream is specified, in AV_TIME_BASE units. |
| 861 * @param flags flags which select direction and seeking mode | 939 * @param flags flags which select direction and seeking mode |
| 862 * @return >= 0 on success | 940 * @return >= 0 on success |
| 863 */ | 941 */ |
| 864 int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, | 942 int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, |
| 865 int flags); | 943 int flags); |
| 866 | 944 |
| 867 /** | 945 /** |
| 868 * Start playing a network based stream (e.g. RTSP stream) at the | 946 * Seek to timestamp ts. |
| 947 * Seeking will be done so that the point from which all active streams |
| 948 * can be presented successfully will be closest to ts and within min/max_ts. |
| 949 * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. |
| 950 * |
| 951 * If flags contain AVSEEK_FLAG_BYTE, then all timestamps are in bytes and |
| 952 * are the file position (this may not be supported by all demuxers). |
| 953 * If flags contain AVSEEK_FLAG_FRAME, then all timestamps are in frames |
| 954 * in the stream with stream_index (this may not be supported by all demuxers). |
| 955 * Otherwise all timestamps are in units of the stream selected by stream_index |
| 956 * or if stream_index is -1, in AV_TIME_BASE units. |
| 957 * If flags contain AVSEEK_FLAG_ANY, then non-keyframes are treated as |
| 958 * keyframes (this may not be supported by all demuxers). |
| 959 * |
| 960 * @param stream_index index of the stream which is used as time base reference |
| 961 * @param min_ts smallest acceptable timestamp |
| 962 * @param ts target timestamp |
| 963 * @param max_ts largest acceptable timestamp |
| 964 * @param flags flags |
| 965 * @returns >=0 on success, error code otherwise |
| 966 * |
| 967 * @NOTE This is part of the new seek API which is still under construction. |
| 968 * Thus do not use this yet. It may change at any time, do not expect |
| 969 * ABI compatibility yet! |
| 970 */ |
| 971 int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int
64_t ts, int64_t max_ts, int flags); |
| 972 |
| 973 /** |
| 974 * Start playing a network-based stream (e.g. RTSP stream) at the |
| 869 * current position. | 975 * current position. |
| 870 */ | 976 */ |
| 871 int av_read_play(AVFormatContext *s); | 977 int av_read_play(AVFormatContext *s); |
| 872 | 978 |
| 873 /** | 979 /** |
| 874 * Pause a network based stream (e.g. RTSP stream). | 980 * Pause a network-based stream (e.g. RTSP stream). |
| 875 * | 981 * |
| 876 * Use av_read_play() to resume it. | 982 * Use av_read_play() to resume it. |
| 877 */ | 983 */ |
| 878 int av_read_pause(AVFormatContext *s); | 984 int av_read_pause(AVFormatContext *s); |
| 879 | 985 |
| 880 /** | 986 /** |
| 881 * Free a AVFormatContext allocated by av_open_input_stream. | 987 * Free a AVFormatContext allocated by av_open_input_stream. |
| 882 * @param s context to free | 988 * @param s context to free |
| 883 */ | 989 */ |
| 884 void av_close_input_stream(AVFormatContext *s); | 990 void av_close_input_stream(AVFormatContext *s); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond | 1048 * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond |
| 943 * to the timestamp which is <= the requested one, if backward | 1049 * to the timestamp which is <= the requested one, if backward |
| 944 * is 0, then it will be >= | 1050 * is 0, then it will be >= |
| 945 * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise | 1051 * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise |
| 946 * @return < 0 if no such timestamp could be found | 1052 * @return < 0 if no such timestamp could be found |
| 947 */ | 1053 */ |
| 948 int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); | 1054 int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); |
| 949 | 1055 |
| 950 /** | 1056 /** |
| 951 * Ensures the index uses less memory than the maximum specified in | 1057 * Ensures the index uses less memory than the maximum specified in |
| 952 * AVFormatContext.max_index_size, by discarding entries if it grows | 1058 * AVFormatContext.max_index_size by discarding entries if it grows |
| 953 * too large. | 1059 * too large. |
| 954 * This function is not part of the public API and should only be called | 1060 * This function is not part of the public API and should only be called |
| 955 * by demuxers. | 1061 * by demuxers. |
| 956 */ | 1062 */ |
| 957 void ff_reduce_index(AVFormatContext *s, int stream_index); | 1063 void ff_reduce_index(AVFormatContext *s, int stream_index); |
| 958 | 1064 |
| 959 /** | 1065 /** |
| 960 * Add an index entry into a sorted list. Update the entry if the list | 1066 * Add an index entry into a sorted list. Update the entry if the list |
| 961 * already contains it. | 1067 * already contains it. |
| 962 * | 1068 * |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 * @param pkt The packet, which contains the stream_index, buf/buf_size, | 1129 * @param pkt The packet, which contains the stream_index, buf/buf_size, |
| 1024 dts/pts, ... | 1130 dts/pts, ... |
| 1025 * @return < 0 on error, = 0 if OK, 1 if end of stream wanted | 1131 * @return < 0 on error, = 0 if OK, 1 if end of stream wanted |
| 1026 */ | 1132 */ |
| 1027 int av_write_frame(AVFormatContext *s, AVPacket *pkt); | 1133 int av_write_frame(AVFormatContext *s, AVPacket *pkt); |
| 1028 | 1134 |
| 1029 /** | 1135 /** |
| 1030 * Writes a packet to an output media file ensuring correct interleaving. | 1136 * Writes a packet to an output media file ensuring correct interleaving. |
| 1031 * | 1137 * |
| 1032 * The packet must contain one audio or video frame. | 1138 * The packet must contain one audio or video frame. |
| 1033 * If the packets are already correctly interleaved the application should | 1139 * If the packets are already correctly interleaved, the application should |
| 1034 * call av_write_frame() instead as it is slightly faster. It is also important | 1140 * call av_write_frame() instead as it is slightly faster. It is also important |
| 1035 * to keep in mind that completely non-interleaved input will need huge amounts | 1141 * to keep in mind that completely non-interleaved input will need huge amounts |
| 1036 * of memory to interleave with this, so it is preferable to interleave at the | 1142 * of memory to interleave with this, so it is preferable to interleave at the |
| 1037 * demuxer level. | 1143 * demuxer level. |
| 1038 * | 1144 * |
| 1039 * @param s media file handle | 1145 * @param s media file handle |
| 1040 * @param pkt The packet, which contains the stream_index, buf/buf_size, | 1146 * @param pkt The packet, which contains the stream_index, buf/buf_size, |
| 1041 dts/pts, ... | 1147 dts/pts, ... |
| 1042 * @return < 0 on error, = 0 if OK, 1 if end of stream wanted | 1148 * @return < 0 on error, = 0 if OK, 1 if end of stream wanted |
| 1043 */ | 1149 */ |
| 1044 int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt); | 1150 int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt); |
| 1045 | 1151 |
| 1046 /** | 1152 /** |
| 1047 * Interleave a packet per dts in an output media file. | 1153 * Interleave a packet per dts in an output media file. |
| 1048 * | 1154 * |
| 1049 * Packets with pkt->destruct == av_destruct_packet will be freed inside this | 1155 * Packets with pkt->destruct == av_destruct_packet will be freed inside this |
| 1050 * function, so they cannot be used after it, note calling av_free_packet() | 1156 * function, so they cannot be used after it. Note that calling av_free_packet() |
| 1051 * on them is still safe. | 1157 * on them is still safe. |
| 1052 * | 1158 * |
| 1053 * @param s media file handle | 1159 * @param s media file handle |
| 1054 * @param out the interleaved packet will be output here | 1160 * @param out the interleaved packet will be output here |
| 1055 * @param in the input packet | 1161 * @param in the input packet |
| 1056 * @param flush 1 if no further packets are available as input and all | 1162 * @param flush 1 if no further packets are available as input and all |
| 1057 * remaining packets should be output | 1163 * remaining packets should be output |
| 1058 * @return 1 if a packet was output, 0 if no packet could be output, | 1164 * @return 1 if a packet was output, 0 if no packet could be output, |
| 1059 * < 0 if an error occurred | 1165 * < 0 if an error occurred |
| 1060 */ | 1166 */ |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1079 | 1185 |
| 1080 #if LIBAVFORMAT_VERSION_MAJOR < 53 | 1186 #if LIBAVFORMAT_VERSION_MAJOR < 53 |
| 1081 /** | 1187 /** |
| 1082 * Parses width and height out of string str. | 1188 * Parses width and height out of string str. |
| 1083 * @deprecated Use av_parse_video_frame_size instead. | 1189 * @deprecated Use av_parse_video_frame_size instead. |
| 1084 */ | 1190 */ |
| 1085 attribute_deprecated int parse_image_size(int *width_ptr, int *height_ptr, | 1191 attribute_deprecated int parse_image_size(int *width_ptr, int *height_ptr, |
| 1086 const char *str); | 1192 const char *str); |
| 1087 | 1193 |
| 1088 /** | 1194 /** |
| 1089 * Converts frame rate from string to a fraction. | 1195 * Converts framerate from a string to a fraction. |
| 1090 * @deprecated Use av_parse_video_frame_rate instead. | 1196 * @deprecated Use av_parse_video_frame_rate instead. |
| 1091 */ | 1197 */ |
| 1092 attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base, | 1198 attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base, |
| 1093 const char *arg); | 1199 const char *arg); |
| 1094 #endif | 1200 #endif |
| 1095 | 1201 |
| 1096 /** | 1202 /** |
| 1097 * Parses \p datestr and returns a corresponding number of microseconds. | 1203 * Parses \p datestr and returns a corresponding number of microseconds. |
| 1098 * @param datestr String representing a date or a duration. | 1204 * @param datestr String representing a date or a duration. |
| 1099 * - If a date the syntax is: | 1205 * - If a date the syntax is: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1120 * date. | 1226 * date. |
| 1121 */ | 1227 */ |
| 1122 int64_t parse_date(const char *datestr, int duration); | 1228 int64_t parse_date(const char *datestr, int duration); |
| 1123 | 1229 |
| 1124 /** Gets the current time in microseconds. */ | 1230 /** Gets the current time in microseconds. */ |
| 1125 int64_t av_gettime(void); | 1231 int64_t av_gettime(void); |
| 1126 | 1232 |
| 1127 /* ffm-specific for ffserver */ | 1233 /* ffm-specific for ffserver */ |
| 1128 #define FFM_PACKET_SIZE 4096 | 1234 #define FFM_PACKET_SIZE 4096 |
| 1129 int64_t ffm_read_write_index(int fd); | 1235 int64_t ffm_read_write_index(int fd); |
| 1130 void ffm_write_write_index(int fd, int64_t pos); | 1236 int ffm_write_write_index(int fd, int64_t pos); |
| 1131 void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size); | 1237 void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size); |
| 1132 | 1238 |
| 1133 /** | 1239 /** |
| 1134 * Attempts to find a specific tag in a URL. | 1240 * Attempts to find a specific tag in a URL. |
| 1135 * | 1241 * |
| 1136 * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. | 1242 * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. |
| 1137 * Return 1 if found. | 1243 * Return 1 if found. |
| 1138 */ | 1244 */ |
| 1139 int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); | 1245 int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); |
| 1140 | 1246 |
| 1141 /** | 1247 /** |
| 1142 * Returns in 'buf' the path with '%d' replaced by number. | 1248 * Returns in 'buf' the path with '%d' replaced by a number. |
| 1143 * | 1249 * |
| 1144 * Also handles the '%0nd' format where 'n' is the total number | 1250 * Also handles the '%0nd' format where 'n' is the total number |
| 1145 * of digits and '%%'. | 1251 * of digits and '%%'. |
| 1146 * | 1252 * |
| 1147 * @param buf destination buffer | 1253 * @param buf destination buffer |
| 1148 * @param buf_size destination buffer size | 1254 * @param buf_size destination buffer size |
| 1149 * @param path numbered sequence string | 1255 * @param path numbered sequence string |
| 1150 * @param number frame number | 1256 * @param number frame number |
| 1151 * @return 0 if OK, -1 on format error | 1257 * @return 0 if OK, -1 on format error |
| 1152 */ | 1258 */ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1172 * @param n_files number of AVCodecContexts contained in ac | 1278 * @param n_files number of AVCodecContexts contained in ac |
| 1173 * @param buff buffer where the SDP will be stored (must be allocated by | 1279 * @param buff buffer where the SDP will be stored (must be allocated by |
| 1174 * the caller) | 1280 * the caller) |
| 1175 * @param size the size of the buffer | 1281 * @param size the size of the buffer |
| 1176 * @return 0 if OK, AVERROR_xxx on error | 1282 * @return 0 if OK, AVERROR_xxx on error |
| 1177 */ | 1283 */ |
| 1178 int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size); | 1284 int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size); |
| 1179 | 1285 |
| 1180 #ifdef HAVE_AV_CONFIG_H | 1286 #ifdef HAVE_AV_CONFIG_H |
| 1181 | 1287 |
| 1182 void ff_dynarray_add(unsigned long **tab_ptr, int *nb_ptr, unsigned long elem); | 1288 void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem); |
| 1183 | 1289 |
| 1184 #ifdef __GNUC__ | 1290 #ifdef __GNUC__ |
| 1185 #define dynarray_add(tab, nb_ptr, elem)\ | 1291 #define dynarray_add(tab, nb_ptr, elem)\ |
| 1186 do {\ | 1292 do {\ |
| 1187 __typeof__(tab) _tab = (tab);\ | 1293 __typeof__(tab) _tab = (tab);\ |
| 1188 __typeof__(elem) _elem = (elem);\ | 1294 __typeof__(elem) _elem = (elem);\ |
| 1189 (void)sizeof(**_tab == _elem); /* check that types are compatible */\ | 1295 (void)sizeof(**_tab == _elem); /* check that types are compatible */\ |
| 1190 ff_dynarray_add((unsigned long **)_tab, nb_ptr, (unsigned long)_elem);\ | 1296 ff_dynarray_add((intptr_t **)_tab, nb_ptr, (intptr_t)_elem);\ |
| 1191 } while(0) | 1297 } while(0) |
| 1192 #else | 1298 #else |
| 1193 #define dynarray_add(tab, nb_ptr, elem)\ | 1299 #define dynarray_add(tab, nb_ptr, elem)\ |
| 1194 do {\ | 1300 do {\ |
| 1195 ff_dynarray_add((unsigned long **)(tab), nb_ptr, (unsigned long)(elem));\ | 1301 ff_dynarray_add((intptr_t **)(tab), nb_ptr, (intptr_t)(elem));\ |
| 1196 } while(0) | 1302 } while(0) |
| 1197 #endif | 1303 #endif |
| 1198 | 1304 |
| 1199 time_t mktimegm(struct tm *tm); | 1305 time_t mktimegm(struct tm *tm); |
| 1200 struct tm *brktimegm(time_t secs, struct tm *tm); | 1306 struct tm *brktimegm(time_t secs, struct tm *tm); |
| 1201 const char *small_strptime(const char *p, const char *fmt, | 1307 const char *small_strptime(const char *p, const char *fmt, |
| 1202 struct tm *dt); | 1308 struct tm *dt); |
| 1203 | 1309 |
| 1204 struct in_addr; | 1310 struct in_addr; |
| 1205 int resolve_host(struct in_addr *sin_addr, const char *hostname); | 1311 int resolve_host(struct in_addr *sin_addr, const char *hostname); |
| 1206 | 1312 |
| 1207 void url_split(char *proto, int proto_size, | 1313 void url_split(char *proto, int proto_size, |
| 1208 char *authorization, int authorization_size, | 1314 char *authorization, int authorization_size, |
| 1209 char *hostname, int hostname_size, | 1315 char *hostname, int hostname_size, |
| 1210 int *port_ptr, | 1316 int *port_ptr, |
| 1211 char *path, int path_size, | 1317 char *path, int path_size, |
| 1212 const char *url); | 1318 const char *url); |
| 1213 | 1319 |
| 1214 int match_ext(const char *filename, const char *extensions); | 1320 int match_ext(const char *filename, const char *extensions); |
| 1215 | 1321 |
| 1216 #endif /* HAVE_AV_CONFIG_H */ | 1322 #endif /* HAVE_AV_CONFIG_H */ |
| 1217 | 1323 |
| 1218 #endif /* AVFORMAT_AVFORMAT_H */ | 1324 #endif /* AVFORMAT_AVFORMAT_H */ |
| OLD | NEW |