| 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_INTERNAL_H | 21 #ifndef AVFORMAT_INTERNAL_H |
| 22 #define AVFORMAT_INTERNAL_H | 22 #define AVFORMAT_INTERNAL_H |
| 23 | 23 |
| 24 #include <stdint.h> | 24 #include <stdint.h> |
| 25 #include "avformat.h" | 25 #include "avformat.h" |
| 26 | 26 |
| 27 #define MAX_URL_SIZE 4096 |
| 28 |
| 27 typedef struct AVCodecTag { | 29 typedef struct AVCodecTag { |
| 28 enum CodecID id; | 30 enum CodecID id; |
| 29 unsigned int tag; | 31 unsigned int tag; |
| 30 } AVCodecTag; | 32 } AVCodecTag; |
| 31 | 33 |
| 32 void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem); | 34 void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem); |
| 33 | 35 |
| 34 #ifdef __GNUC__ | 36 #ifdef __GNUC__ |
| 35 #define dynarray_add(tab, nb_ptr, elem)\ | 37 #define dynarray_add(tab, nb_ptr, elem)\ |
| 36 do {\ | 38 do {\ |
| 37 __typeof__(tab) _tab = (tab);\ | 39 __typeof__(tab) _tab = (tab);\ |
| 38 __typeof__(elem) _elem = (elem);\ | 40 __typeof__(elem) _elem = (elem);\ |
| 39 (void)sizeof(**_tab == _elem); /* check that types are compatible */\ | 41 (void)sizeof(**_tab == _elem); /* check that types are compatible */\ |
| 40 ff_dynarray_add((intptr_t **)_tab, nb_ptr, (intptr_t)_elem);\ | 42 ff_dynarray_add((intptr_t **)_tab, nb_ptr, (intptr_t)_elem);\ |
| 41 } while(0) | 43 } while(0) |
| 42 #else | 44 #else |
| 43 #define dynarray_add(tab, nb_ptr, elem)\ | 45 #define dynarray_add(tab, nb_ptr, elem)\ |
| 44 do {\ | 46 do {\ |
| 45 ff_dynarray_add((intptr_t **)(tab), nb_ptr, (intptr_t)(elem));\ | 47 ff_dynarray_add((intptr_t **)(tab), nb_ptr, (intptr_t)(elem));\ |
| 46 } while(0) | 48 } while(0) |
| 47 #endif | 49 #endif |
| 48 | 50 |
| 49 time_t mktimegm(struct tm *tm); | 51 time_t mktimegm(struct tm *tm); |
| 50 struct tm *brktimegm(time_t secs, struct tm *tm); | 52 struct tm *brktimegm(time_t secs, struct tm *tm); |
| 51 const char *small_strptime(const char *p, const char *fmt, | 53 const char *small_strptime(const char *p, const char *fmt, |
| 52 struct tm *dt); | 54 struct tm *dt); |
| 53 | 55 |
| 54 char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase); | 56 char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase); |
| 55 | 57 |
| 58 /** |
| 59 * Parse a string of hexadecimal strings. Any space between the hexadecimal |
| 60 * digits is ignored. |
| 61 * |
| 62 * @param data if non-null, the parsed data is written to this pointer |
| 63 * @param p the string to parse |
| 64 * @return the number of bytes written (or to be written, if data is null) |
| 65 */ |
| 66 int ff_hex_to_data(uint8_t *data, const char *p); |
| 67 |
| 56 void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int i
dx); | 68 void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int i
dx); |
| 57 | 69 |
| 58 /** | 70 /** |
| 59 * Add packet to AVFormatContext->packet_buffer list, determining its | 71 * Add packet to AVFormatContext->packet_buffer list, determining its |
| 60 * interleaved position using compare() function argument. | 72 * interleaved position using compare() function argument. |
| 61 */ | 73 */ |
| 62 void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, | 74 void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, |
| 63 int (*compare)(AVFormatContext *, AVPacket *, AVPa
cket *)); | 75 int (*compare)(AVFormatContext *, AVPacket *, AVPa
cket *)); |
| 64 | 76 |
| 65 void ff_read_frame_flush(AVFormatContext *s); | 77 void ff_read_frame_flush(AVFormatContext *s); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 * Append the media-specific SDP fragment for the media stream c | 142 * Append the media-specific SDP fragment for the media stream c |
| 131 * to the buffer buff. | 143 * to the buffer buff. |
| 132 * | 144 * |
| 133 * Note, the buffer needs to be initialized, since it is appended to | 145 * Note, the buffer needs to be initialized, since it is appended to |
| 134 * existing content. | 146 * existing content. |
| 135 * | 147 * |
| 136 * @param buff the buffer to append the SDP fragment to | 148 * @param buff the buffer to append the SDP fragment to |
| 137 * @param size the size of the buff buffer | 149 * @param size the size of the buff buffer |
| 138 * @param c the AVCodecContext of the media to describe | 150 * @param c the AVCodecContext of the media to describe |
| 139 * @param dest_addr the destination address of the media stream, may be NULL | 151 * @param dest_addr the destination address of the media stream, may be NULL |
| 152 * @param dest_type the destination address type, may be NULL |
| 140 * @param port the destination port of the media stream, 0 if unknown | 153 * @param port the destination port of the media stream, 0 if unknown |
| 141 * @param ttl the time to live of the stream, 0 if not multicast | 154 * @param ttl the time to live of the stream, 0 if not multicast |
| 142 */ | 155 */ |
| 143 void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, | 156 void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, |
| 144 const char *dest_addr, int port, int ttl); | 157 const char *dest_addr, const char *dest_type, |
| 158 int port, int ttl); |
| 145 | 159 |
| 146 /** | 160 /** |
| 147 * Write a packet to another muxer than the one the user originally | 161 * Write a packet to another muxer than the one the user originally |
| 148 * intended. Useful when chaining muxers, where one muxer internally | 162 * intended. Useful when chaining muxers, where one muxer internally |
| 149 * writes a received packet to another muxer. | 163 * writes a received packet to another muxer. |
| 150 * | 164 * |
| 151 * @param dst the muxer to write the packet to | 165 * @param dst the muxer to write the packet to |
| 152 * @param dst_stream the stream index within dst to write the packet to | 166 * @param dst_stream the stream index within dst to write the packet to |
| 153 * @param pkt the packet to be written | 167 * @param pkt the packet to be written |
| 154 * @param src the muxer the packet originally was intended for | 168 * @param src the muxer the packet originally was intended for |
| (...skipping 20 matching lines...) Expand all Loading... |
| 175 * @param s the read-only ByteIOContext | 189 * @param s the read-only ByteIOContext |
| 176 * @param buf buffer to store the read line | 190 * @param buf buffer to store the read line |
| 177 * @param maxlen size of the buffer | 191 * @param maxlen size of the buffer |
| 178 * @return the length of the string written in the buffer, not including the | 192 * @return the length of the string written in the buffer, not including the |
| 179 * final \0 | 193 * final \0 |
| 180 */ | 194 */ |
| 181 int ff_get_line(ByteIOContext *s, char *buf, int maxlen); | 195 int ff_get_line(ByteIOContext *s, char *buf, int maxlen); |
| 182 | 196 |
| 183 #define SPACE_CHARS " \t\r\n" | 197 #define SPACE_CHARS " \t\r\n" |
| 184 | 198 |
| 199 /** |
| 200 * Callback function type for ff_parse_key_value. |
| 201 * |
| 202 * @param key a pointer to the key |
| 203 * @param key_len the number of bytes that belong to the key, including the '=' |
| 204 * char |
| 205 * @param dest return the destination pointer for the value in *dest, may |
| 206 * be null to ignore the value |
| 207 * @param dest_len the length of the *dest buffer |
| 208 */ |
| 209 typedef void (*ff_parse_key_val_cb)(void *context, const char *key, |
| 210 int key_len, char **dest, int *dest_len); |
| 211 /** |
| 212 * Parse a string with comma-separated key=value pairs. The value strings |
| 213 * may be quoted and may contain escaped characters within quoted strings. |
| 214 * |
| 215 * @param str the string to parse |
| 216 * @param callback_get_buf function that returns where to store the |
| 217 * unescaped value string. |
| 218 * @param context the opaque context pointer to pass to callback_get_buf |
| 219 */ |
| 220 void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf, |
| 221 void *context); |
| 222 |
| 185 #endif /* AVFORMAT_INTERNAL_H */ | 223 #endif /* AVFORMAT_INTERNAL_H */ |
| OLD | NEW |