Mercurial > libavformat.hg
annotate internal.h @ 6006:86f5c95d5ca6 libavformat
In ts demuxer, output pes packet as soon as they are complete.
This is needed for subtitles where packets are infrequent.
Patch by Janne Grunau, janne-ffmpeg at jannau dot net.
author | bcoudurier |
---|---|
date | Tue, 18 May 2010 17:28:07 +0000 |
parents | 28ca2d77f997 |
children | b740f4918397 |
rev | line source |
---|---|
3788
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
1 /* |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
2 * copyright (c) 2001 Fabrice Bellard |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
3 * |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
4 * This file is part of FFmpeg. |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
5 * |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
6 * FFmpeg is free software; you can redistribute it and/or |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
7 * modify it under the terms of the GNU Lesser General Public |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
8 * License as published by the Free Software Foundation; either |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
9 * version 2.1 of the License, or (at your option) any later version. |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
10 * |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
11 * FFmpeg is distributed in the hope that it will be useful, |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
14 * Lesser General Public License for more details. |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
15 * |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
16 * You should have received a copy of the GNU Lesser General Public |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
17 * License along with FFmpeg; if not, write to the Free Software |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
19 */ |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
20 |
3852 | 21 #ifndef AVFORMAT_INTERNAL_H |
22 #define AVFORMAT_INTERNAL_H | |
3788
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
23 |
3981
ff78dd8e198a
Fix 'make checkheaders', based on a patch by Diego Petten, flameeyes gmail com.
diego
parents:
3852
diff
changeset
|
24 #include <stdint.h> |
4059
59db9e761b38
Move declaration of av_set_program_name and av_program_add_stream_index
diego
parents:
3981
diff
changeset
|
25 #include "avformat.h" |
3981
ff78dd8e198a
Fix 'make checkheaders', based on a patch by Diego Petten, flameeyes gmail com.
diego
parents:
3852
diff
changeset
|
26 |
5946
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
27 void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem); |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
28 |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
29 #ifdef __GNUC__ |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
30 #define dynarray_add(tab, nb_ptr, elem)\ |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
31 do {\ |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
32 __typeof__(tab) _tab = (tab);\ |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
33 __typeof__(elem) _elem = (elem);\ |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
34 (void)sizeof(**_tab == _elem); /* check that types are compatible */\ |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
35 ff_dynarray_add((intptr_t **)_tab, nb_ptr, (intptr_t)_elem);\ |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
36 } while(0) |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
37 #else |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
38 #define dynarray_add(tab, nb_ptr, elem)\ |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
39 do {\ |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
40 ff_dynarray_add((intptr_t **)(tab), nb_ptr, (intptr_t)(elem));\ |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
41 } while(0) |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
42 #endif |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
43 |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
44 time_t mktimegm(struct tm *tm); |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
45 struct tm *brktimegm(time_t secs, struct tm *tm); |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
46 const char *small_strptime(const char *p, const char *fmt, |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
47 struct tm *dt); |
28ca2d77f997
Move the internal function declarations in avformat.h to internal.h.
stefano
parents:
5883
diff
changeset
|
48 |
5883 | 49 char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase); |
3788
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
50 |
5852
36b46032fad5
rename av_program_add_stream_index to ff_program_add_stream_index
aurel
parents:
5841
diff
changeset
|
51 void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx); |
4059
59db9e761b38
Move declaration of av_set_program_name and av_program_add_stream_index
diego
parents:
3981
diff
changeset
|
52 |
4418
d5119d75439d
Move declaration of ff_interleave_add_packet to internal.h.
bcoudurier
parents:
4059
diff
changeset
|
53 /** |
d5119d75439d
Move declaration of ff_interleave_add_packet to internal.h.
bcoudurier
parents:
4059
diff
changeset
|
54 * Add packet to AVFormatContext->packet_buffer list, determining its |
d5119d75439d
Move declaration of ff_interleave_add_packet to internal.h.
bcoudurier
parents:
4059
diff
changeset
|
55 * interleaved position using compare() function argument. |
d5119d75439d
Move declaration of ff_interleave_add_packet to internal.h.
bcoudurier
parents:
4059
diff
changeset
|
56 */ |
d5119d75439d
Move declaration of ff_interleave_add_packet to internal.h.
bcoudurier
parents:
4059
diff
changeset
|
57 void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, |
d5119d75439d
Move declaration of ff_interleave_add_packet to internal.h.
bcoudurier
parents:
4059
diff
changeset
|
58 int (*compare)(AVFormatContext *, AVPacket *, AVPacket *)); |
d5119d75439d
Move declaration of ff_interleave_add_packet to internal.h.
bcoudurier
parents:
4059
diff
changeset
|
59 |
5853 | 60 void ff_read_frame_flush(AVFormatContext *s); |
5761
058a0e362dbe
Move av_read_frame_flush() prototype to lavf/internal.h
mru
parents:
4428
diff
changeset
|
61 |
5841 | 62 #define NTP_OFFSET 2208988800ULL |
63 #define NTP_OFFSET_US (NTP_OFFSET * 1000000ULL) | |
64 | |
5807
f4ca0041b4f4
Make the ntp_time function available to other parts of libavformat, as ff_ntp_time
mstorsjo
parents:
5774
diff
changeset
|
65 /** Gets the current time since NTP epoch in microseconds. */ |
f4ca0041b4f4
Make the ntp_time function available to other parts of libavformat, as ff_ntp_time
mstorsjo
parents:
5774
diff
changeset
|
66 uint64_t ff_ntp_time(void); |
f4ca0041b4f4
Make the ntp_time function available to other parts of libavformat, as ff_ntp_time
mstorsjo
parents:
5774
diff
changeset
|
67 |
5836
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
68 /** |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
69 * Probes a bytestream to determine the input format. Each time a probe returns |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
70 * with a score that is too low, the probe buffer size is increased and another |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
71 * attempt is made. When the maximum probe size is reached, the input format |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
72 * with the highest score is returned. |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
73 * |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
74 * @param pb the bytestream to probe, it may be closed and opened again |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
75 * @param fmt the input format is put here |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
76 * @param filename the filename of the stream |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
77 * @param logctx the log context |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
78 * @param offset the offset within the bytestream to probe from |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
79 * @param max_probe_size the maximum probe buffer size (zero for default) |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
80 * @return 0 in case of success, a negative value corresponding to an |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
81 * AVERROR code otherwise |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
82 */ |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
83 int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt, |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
84 const char *filename, void *logctx, |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
85 unsigned int offset, unsigned int max_probe_size); |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
86 |
5837
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
87 /** |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
88 * Splits a URL string into components. To reassemble components back into |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
89 * a URL, use ff_url_join instead of using snprintf directly. |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
90 * |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
91 * The pointers to buffers for storing individual components may be null, |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
92 * in order to ignore that component. Buffers for components not found are |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
93 * set to empty strings. If the port isn't found, it is set to a negative |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
94 * value. |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
95 * |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
96 * @see ff_url_join |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
97 * |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
98 * @param proto the buffer for the protocol |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
99 * @param proto_size the size of the proto buffer |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
100 * @param authorization the buffer for the authorization |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
101 * @param authorization_size the size of the authorization buffer |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
102 * @param hostname the buffer for the host name |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
103 * @param hostname_size the size of the hostname buffer |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
104 * @param port_ptr a pointer to store the port number in |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
105 * @param path the buffer for the path |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
106 * @param path_size the size of the path buffer |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
107 * @param url the URL to split |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
108 */ |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
109 void ff_url_split(char *proto, int proto_size, |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
110 char *authorization, int authorization_size, |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
111 char *hostname, int hostname_size, |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
112 int *port_ptr, |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
113 char *path, int path_size, |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
114 const char *url); |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
115 |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
116 /** |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
117 * Assembles a URL string from components. This is the reverse operation |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
118 * of ff_url_split. |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
119 * |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
120 * Note, this requires networking to be initialized, so the caller must |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
121 * ensure ff_network_init has been called. |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
122 * |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
123 * @see ff_url_split |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
124 * |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
125 * @param str the buffer to fill with the url |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
126 * @param size the size of the str buffer |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
127 * @param proto the protocol identifier, if null, the separator |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
128 * after the identifier is left out, too |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
129 * @param authorization an optional authorization string, may be null |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
130 * @param hostname the host name string |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
131 * @param port the port number, left out from the string if negative |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
132 * @param fmt a generic format string for everything to add after the |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
133 * host/port, may be null |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
134 * @return the number of characters written to the destination buffer |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
135 */ |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
136 int ff_url_join(char *str, int size, const char *proto, |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
137 const char *authorization, const char *hostname, |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
138 int port, const char *fmt, ...); |
d605f589f0be
move ff_url_split() and ff_url_join() declarations to internal.h
aurel
parents:
5836
diff
changeset
|
139 |
3852 | 140 #endif /* AVFORMAT_INTERNAL_H */ |