00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef AVFORMAT_INTERNAL_H
00022 #define AVFORMAT_INTERNAL_H
00023
00024 #include <stdint.h>
00025 #include "avformat.h"
00026
00027 #define MAX_URL_SIZE 4096
00028
00029 typedef struct AVCodecTag {
00030 enum CodecID id;
00031 unsigned int tag;
00032 } AVCodecTag;
00033
00034 void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem);
00035
00036 #ifdef __GNUC__
00037 #define dynarray_add(tab, nb_ptr, elem)\
00038 do {\
00039 __typeof__(tab) _tab = (tab);\
00040 __typeof__(elem) _elem = (elem);\
00041 (void)sizeof(**_tab == _elem); \
00042 ff_dynarray_add((intptr_t **)_tab, nb_ptr, (intptr_t)_elem);\
00043 } while(0)
00044 #else
00045 #define dynarray_add(tab, nb_ptr, elem)\
00046 do {\
00047 ff_dynarray_add((intptr_t **)(tab), nb_ptr, (intptr_t)(elem));\
00048 } while(0)
00049 #endif
00050
00051 struct tm *brktimegm(time_t secs, struct tm *tm);
00052
00053 char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase);
00054
00063 int ff_hex_to_data(uint8_t *data, const char *p);
00064
00065 void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx);
00066
00071 void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
00072 int (*compare)(AVFormatContext *, AVPacket *, AVPacket *));
00073
00074 void ff_read_frame_flush(AVFormatContext *s);
00075
00076 #define NTP_OFFSET 2208988800ULL
00077 #define NTP_OFFSET_US (NTP_OFFSET * 1000000ULL)
00078
00080 uint64_t ff_ntp_time(void);
00081
00082 #if FF_API_URL_SPLIT
00083
00086 void ff_url_split(char *proto, int proto_size,
00087 char *authorization, int authorization_size,
00088 char *hostname, int hostname_size,
00089 int *port_ptr,
00090 char *path, int path_size,
00091 const char *url);
00092 #endif
00093
00115 int ff_url_join(char *str, int size, const char *proto,
00116 const char *authorization, const char *hostname,
00117 int port, const char *fmt, ...);
00118
00134 void ff_sdp_write_media(char *buff, int size, AVCodecContext *c,
00135 const char *dest_addr, const char *dest_type,
00136 int port, int ttl);
00137
00149 int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt,
00150 AVFormatContext *src);
00151
00155 int ff_get_v_length(uint64_t val);
00156
00160 void ff_put_v(AVIOContext *bc, uint64_t val);
00161
00173 int ff_get_line(AVIOContext *s, char *buf, int maxlen);
00174
00175 #define SPACE_CHARS " \t\r\n"
00176
00187 typedef void (*ff_parse_key_val_cb)(void *context, const char *key,
00188 int key_len, char **dest, int *dest_len);
00198 void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf,
00199 void *context);
00200
00205 int ff_find_stream_index(AVFormatContext *s, int id);
00206
00210 int ff_index_search_timestamp(const AVIndexEntry *entries, int nb_entries,
00211 int64_t wanted_timestamp, int flags);
00212
00216 int ff_add_index_entry(AVIndexEntry **index_entries,
00217 int *nb_index_entries,
00218 unsigned int *index_entries_allocated_size,
00219 int64_t pos, int64_t timestamp, int size, int distance, int flags);
00220
00232 AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base,
00233 int64_t start, int64_t end, const char *title);
00234
00240 void ff_reduce_index(AVFormatContext *s, int stream_index);
00241
00242 #endif