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 #ifdef DEBUG
00030 # define hex_dump_debug(class, buf, size) av_hex_dump_log(class, AV_LOG_DEBUG, buf, size)
00031 #else
00032 # define hex_dump_debug(class, buf, size)
00033 #endif
00034
00035 typedef struct AVCodecTag {
00036 enum CodecID id;
00037 unsigned int tag;
00038 } AVCodecTag;
00039
00040 void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem);
00041
00042 #ifdef __GNUC__
00043 #define dynarray_add(tab, nb_ptr, elem)\
00044 do {\
00045 __typeof__(tab) _tab = (tab);\
00046 __typeof__(elem) _elem = (elem);\
00047 (void)sizeof(**_tab == _elem); \
00048 ff_dynarray_add((intptr_t **)_tab, nb_ptr, (intptr_t)_elem);\
00049 } while(0)
00050 #else
00051 #define dynarray_add(tab, nb_ptr, elem)\
00052 do {\
00053 ff_dynarray_add((intptr_t **)(tab), nb_ptr, (intptr_t)(elem));\
00054 } while(0)
00055 #endif
00056
00057 struct tm *brktimegm(time_t secs, struct tm *tm);
00058
00059 char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase);
00060
00069 int ff_hex_to_data(uint8_t *data, const char *p);
00070
00071 void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx);
00072
00077 void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
00078 int (*compare)(AVFormatContext *, AVPacket *, AVPacket *));
00079
00080 void ff_read_frame_flush(AVFormatContext *s);
00081
00082 #define NTP_OFFSET 2208988800ULL
00083 #define NTP_OFFSET_US (NTP_OFFSET * 1000000ULL)
00084
00086 uint64_t ff_ntp_time(void);
00087
00109 int ff_url_join(char *str, int size, const char *proto,
00110 const char *authorization, const char *hostname,
00111 int port, const char *fmt, ...) av_printf_format(7, 8);
00112
00130 void ff_sdp_write_media(char *buff, int size, AVCodecContext *c,
00131 const char *dest_addr, const char *dest_type,
00132 int port, int ttl, AVFormatContext *fmt);
00133
00145 int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt,
00146 AVFormatContext *src);
00147
00151 int ff_get_v_length(uint64_t val);
00152
00156 void ff_put_v(AVIOContext *bc, uint64_t val);
00157
00169 int ff_get_line(AVIOContext *s, char *buf, int maxlen);
00170
00171 #define SPACE_CHARS " \t\r\n"
00172
00183 typedef void (*ff_parse_key_val_cb)(void *context, const char *key,
00184 int key_len, char **dest, int *dest_len);
00194 void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf,
00195 void *context);
00196
00201 int ff_find_stream_index(AVFormatContext *s, int id);
00202
00206 int ff_index_search_timestamp(const AVIndexEntry *entries, int nb_entries,
00207 int64_t wanted_timestamp, int flags);
00208
00212 int ff_add_index_entry(AVIndexEntry **index_entries,
00213 int *nb_index_entries,
00214 unsigned int *index_entries_allocated_size,
00215 int64_t pos, int64_t timestamp, int size, int distance, int flags);
00216
00228 AVChapter *avpriv_new_chapter(AVFormatContext *s, int id, AVRational time_base,
00229 int64_t start, int64_t end, const char *title);
00230
00236 void ff_reduce_index(AVFormatContext *s, int stream_index);
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246 void ff_make_absolute_url(char *buf, int size, const char *base,
00247 const char *rel);
00248
00249 enum CodecID ff_guess_image2_codec(const char *filename);
00250
00254 int64_t ff_iso8601_to_unix_time(const char *datestr);
00255
00263 int ff_seek_frame_binary(AVFormatContext *s, int stream_index,
00264 int64_t target_ts, int flags);
00265
00274 void ff_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp);
00275
00282 int64_t ff_gen_search(AVFormatContext *s, int stream_index,
00283 int64_t target_ts, int64_t pos_min,
00284 int64_t pos_max, int64_t pos_limit,
00285 int64_t ts_min, int64_t ts_max,
00286 int flags, int64_t *ts_ret,
00287 int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t ));
00288
00299 void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits,
00300 unsigned int pts_num, unsigned int pts_den);
00301
00306 int ff_add_param_change(AVPacket *pkt, int32_t channels,
00307 uint64_t channel_layout, int32_t sample_rate,
00308 int32_t width, int32_t height);
00309
00310 #endif