| 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 * |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 * Important concepts to keep in mind: | 56 * Important concepts to keep in mind: |
| 57 * 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 |
| 58 * also meant semantically, i.e., a demuxer should not knowingly produce | 58 * also meant semantically, i.e., a demuxer should not knowingly produce |
| 59 * several keys that are literally different but semantically identical. | 59 * several keys that are literally different but semantically identical. |
| 60 * 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 |
| 61 * placed in the same tag. | 61 * placed in the same tag. |
| 62 * 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 |
| 63 * 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 |
| 64 * 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. |
| 65 * 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 |
| 66 * with a dash character ('-') and the ISO 639 3-letter language code. | 66 * with a dash character ('-') and the ISO 639-2/B 3-letter language code. |
| 67 * For example: Author-ger=Michael, Author-eng=Mike | 67 * For example: Author-ger=Michael, Author-eng=Mike |
| 68 * The original/default language is in the unqualified "Author" tag. | 68 * The original/default language is in the unqualified "Author" tag. |
| 69 * 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. |
| 70 */ | 70 */ |
| 71 | 71 |
| 72 #define AV_METADATA_MATCH_CASE 1 | 72 #define AV_METADATA_MATCH_CASE 1 |
| 73 #define AV_METADATA_IGNORE_SUFFIX 2 | 73 #define AV_METADATA_IGNORE_SUFFIX 2 |
| 74 | 74 |
| 75 typedef struct { | 75 typedef struct { |
| 76 char *key; | 76 char *key; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 107 const AVMetadataConv *s_conv); | 107 const AVMetadataConv *s_conv); |
| 108 | 108 |
| 109 /** | 109 /** |
| 110 * Frees all the memory allocated for an AVMetadata struct. | 110 * Frees all the memory allocated for an AVMetadata struct. |
| 111 */ | 111 */ |
| 112 void av_metadata_free(AVMetadata **m); | 112 void av_metadata_free(AVMetadata **m); |
| 113 | 113 |
| 114 | 114 |
| 115 /* packet functions */ | 115 /* packet functions */ |
| 116 | 116 |
| 117 typedef struct AVPacket { | |
| 118 /** | |
| 119 * Presentation timestamp in time_base units; the time at which the | |
| 120 * decompressed packet will be presented to the user. | |
| 121 * Can be AV_NOPTS_VALUE if it is not stored in the file. | |
| 122 * pts MUST be larger or equal to dts as presentation cannot happen before | |
| 123 * decompression, unless one wants to view hex dumps. Some formats misuse | |
| 124 * the terms dts and pts/cts to mean something different. Such timestamps | |
| 125 * must be converted to true pts/dts before they are stored in AVPacket. | |
| 126 */ | |
| 127 int64_t pts; | |
| 128 /** | |
| 129 * Decompression timestamp in time_base units; the time at which the | |
| 130 * packet is decompressed. | |
| 131 * Can be AV_NOPTS_VALUE if it is not stored in the file. | |
| 132 */ | |
| 133 int64_t dts; | |
| 134 uint8_t *data; | |
| 135 int size; | |
| 136 int stream_index; | |
| 137 int flags; | |
| 138 /** | |
| 139 * Duration of this packet in time_base units, 0 if unknown. | |
| 140 * Equals next_pts - this_pts in presentation order. | |
| 141 */ | |
| 142 int duration; | |
| 143 void (*destruct)(struct AVPacket *); | |
| 144 void *priv; | |
| 145 int64_t pos; ///< byte position in stream, -1 if
unknown | |
| 146 | |
| 147 /** | |
| 148 * Time difference in stream time base units from the pts of this | |
| 149 * packet to the point at which the output from the decoder has converged | |
| 150 * independent from the availability of previous frames. That is, the | |
| 151 * frames are virtually identical no matter if decoding started from | |
| 152 * the very first frame or from this keyframe. | |
| 153 * Is AV_NOPTS_VALUE if unknown. | |
| 154 * This field is not the display duration of the current packet. | |
| 155 * | |
| 156 * The purpose of this field is to allow seeking in streams that have no | |
| 157 * keyframes in the conventional sense. It corresponds to the | |
| 158 * recovery point SEI in H.264 and match_time_delta in NUT. It is also | |
| 159 * essential for some types of subtitle streams to ensure that all | |
| 160 * subtitles are correctly displayed after seeking. | |
| 161 */ | |
| 162 int64_t convergence_duration; | |
| 163 } AVPacket; | |
| 164 #define PKT_FLAG_KEY 0x0001 | |
| 165 | |
| 166 void av_destruct_packet_nofree(AVPacket *pkt); | |
| 167 | |
| 168 /** | |
| 169 * Default packet destructor. | |
| 170 */ | |
| 171 void av_destruct_packet(AVPacket *pkt); | |
| 172 | |
| 173 /** | |
| 174 * Initialize optional fields of a packet with default values. | |
| 175 * | |
| 176 * @param pkt packet | |
| 177 */ | |
| 178 void av_init_packet(AVPacket *pkt); | |
| 179 | |
| 180 /** | |
| 181 * Allocate the payload of a packet and initialize its fields with | |
| 182 * default values. | |
| 183 * | |
| 184 * @param pkt packet | |
| 185 * @param size wanted payload size | |
| 186 * @return 0 if OK, AVERROR_xxx otherwise | |
| 187 */ | |
| 188 int av_new_packet(AVPacket *pkt, int size); | |
| 189 | 117 |
| 190 /** | 118 /** |
| 191 * Allocate and read the payload of a packet and initialize its fields with | 119 * Allocate and read the payload of a packet and initialize its fields with |
| 192 * default values. | 120 * default values. |
| 193 * | 121 * |
| 194 * @param pkt packet | 122 * @param pkt packet |
| 195 * @param size desired payload size | 123 * @param size desired payload size |
| 196 * @return >0 (read size) if OK, AVERROR_xxx otherwise | 124 * @return >0 (read size) if OK, AVERROR_xxx otherwise |
| 197 */ | 125 */ |
| 198 int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size); | 126 int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size); |
| 199 | 127 |
| 200 /** | |
| 201 * @warning This is a hack - the packet memory allocation stuff is broken. The | |
| 202 * packet is allocated if it was not really allocated. | |
| 203 */ | |
| 204 int av_dup_packet(AVPacket *pkt); | |
| 205 | |
| 206 /** | |
| 207 * Free a packet. | |
| 208 * | |
| 209 * @param pkt packet to free | |
| 210 */ | |
| 211 static inline void av_free_packet(AVPacket *pkt) | |
| 212 { | |
| 213 if (pkt && pkt->destruct) { | |
| 214 pkt->destruct(pkt); | |
| 215 } | |
| 216 } | |
| 217 | 128 |
| 218 /*************************************************/ | 129 /*************************************************/ |
| 219 /* fractional numbers for exact pts handling */ | 130 /* fractional numbers for exact pts handling */ |
| 220 | 131 |
| 221 /** | 132 /** |
| 222 * The exact value of the fractional number is: 'val + num / den'. | 133 * The exact value of the fractional number is: 'val + num / den'. |
| 223 * num is assumed to be 0 <= num < den. | 134 * num is assumed to be 0 <= num < den. |
| 224 */ | 135 */ |
| 225 typedef struct AVFrac { | 136 typedef struct AVFrac { |
| 226 int64_t val, num, den; | 137 int64_t val, num, den; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 */ | 242 */ |
| 332 int (*read_probe)(AVProbeData *); | 243 int (*read_probe)(AVProbeData *); |
| 333 /** Read the format header and initialize the AVFormatContext | 244 /** Read the format header and initialize the AVFormatContext |
| 334 structure. Return 0 if OK. 'ap' if non-NULL contains | 245 structure. Return 0 if OK. 'ap' if non-NULL contains |
| 335 additional parameters. Only used in raw format right | 246 additional parameters. Only used in raw format right |
| 336 now. 'av_new_stream' should be called to create new streams. */ | 247 now. 'av_new_stream' should be called to create new streams. */ |
| 337 int (*read_header)(struct AVFormatContext *, | 248 int (*read_header)(struct AVFormatContext *, |
| 338 AVFormatParameters *ap); | 249 AVFormatParameters *ap); |
| 339 /** Read one packet and put it in 'pkt'. pts and flags are also | 250 /** Read one packet and put it in 'pkt'. pts and flags are also |
| 340 set. 'av_new_stream' can be called only if the flag | 251 set. 'av_new_stream' can be called only if the flag |
| 341 AVFMTCTX_NOHEADER is used. */ | 252 AVFMTCTX_NOHEADER is used. |
| 253 @return 0 on success, < 0 on error. |
| 254 When returning an error, pkt must not have been allocated |
| 255 or must be freed before returning */ |
| 342 int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); | 256 int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); |
| 343 /** Close the stream. The AVFormatContext and AVStreams are not | 257 /** Close the stream. The AVFormatContext and AVStreams are not |
| 344 freed by this function */ | 258 freed by this function */ |
| 345 int (*read_close)(struct AVFormatContext *); | 259 int (*read_close)(struct AVFormatContext *); |
| 346 | 260 |
| 347 #if LIBAVFORMAT_VERSION_MAJOR < 53 | 261 #if LIBAVFORMAT_VERSION_MAJOR < 53 |
| 348 /** | 262 /** |
| 349 * Seek to a given timestamp relative to the frames in | 263 * Seek to a given timestamp relative to the frames in |
| 350 * stream component stream_index. | 264 * stream component stream_index. |
| 351 * @param stream_index Must not be -1. | 265 * @param stream_index Must not be -1. |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 */ | 383 */ |
| 470 int64_t start_time; | 384 int64_t start_time; |
| 471 /** | 385 /** |
| 472 * Decoding: duration of the stream, in stream time base. | 386 * Decoding: duration of the stream, in stream time base. |
| 473 * If a source file does not specify a duration, but does specify | 387 * If a source file does not specify a duration, but does specify |
| 474 * a bitrate, this value will be estimated from bitrate and file size. | 388 * a bitrate, this value will be estimated from bitrate and file size. |
| 475 */ | 389 */ |
| 476 int64_t duration; | 390 int64_t duration; |
| 477 | 391 |
| 478 #if LIBAVFORMAT_VERSION_INT < (53<<16) | 392 #if LIBAVFORMAT_VERSION_INT < (53<<16) |
| 479 char language[4]; /** ISO 639 3-letter language code (empty string if undefi
ned) */ | 393 char language[4]; /** ISO 639-2/B 3-letter language code (empty string if un
defined) */ |
| 480 #endif | 394 #endif |
| 481 | 395 |
| 482 /* av_read_frame() support */ | 396 /* av_read_frame() support */ |
| 483 enum AVStreamParseType need_parsing; | 397 enum AVStreamParseType need_parsing; |
| 484 struct AVCodecParserContext *parser; | 398 struct AVCodecParserContext *parser; |
| 485 | 399 |
| 486 int64_t cur_dts; | 400 int64_t cur_dts; |
| 487 int last_IP_duration; | 401 int last_IP_duration; |
| 488 int64_t last_IP_pts; | 402 int64_t last_IP_pts; |
| 489 /* av_seek_frame() support */ | 403 /* av_seek_frame() support */ |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1315 char *hostname, int hostname_size, | 1229 char *hostname, int hostname_size, |
| 1316 int *port_ptr, | 1230 int *port_ptr, |
| 1317 char *path, int path_size, | 1231 char *path, int path_size, |
| 1318 const char *url); | 1232 const char *url); |
| 1319 | 1233 |
| 1320 int match_ext(const char *filename, const char *extensions); | 1234 int match_ext(const char *filename, const char *extensions); |
| 1321 | 1235 |
| 1322 #endif /* HAVE_AV_CONFIG_H */ | 1236 #endif /* HAVE_AV_CONFIG_H */ |
| 1323 | 1237 |
| 1324 #endif /* AVFORMAT_AVFORMAT_H */ | 1238 #endif /* AVFORMAT_AVFORMAT_H */ |
| OLD | NEW |