Mercurial > libavformat.hg
annotate internal.h @ 5836:2997c88028cd libavformat
Move the probe loop from av_open_input_file() into its own method
av_probe_input_buffer() so that it can be reused. Here are a few
differences to the original way things were probed:
- maximum probe buffer size can be specified as a parameter.
- offset within the stream to probe from can be specified as a parameter.
- instead of seeking back to the start each time a probe fails, stream
data is appended to the reallocated buffer. This lowers the amount
of data read from the stream (there is no repetition) and results in
fewer closed and reopened streams (when seeking fails).
New attempt after r22296, which was revert in r22315 due to a FATE
failure.
See the thread:
Subject: [FFmpeg-devel] [PATCH] Move av_open_input_file probe loop to its own method
Date: 2010-03-05 03:23:57 GMT
Patch by Micah F. Galizia printf("%s%s@%s.%s", "micah", "galizia", "gmail", "com").
author | stefano |
---|---|
date | Sun, 14 Mar 2010 22:40:16 +0000 |
parents | f4ca0041b4f4 |
children | d605f589f0be |
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 |
3788
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
27 char *ff_data_to_hex(char *buf, const uint8_t *src, int size); |
ca6df1ecb412
Export data_to_hex() as private API in lavf, rename to ff_data_to_hex() and
rbultje
parents:
diff
changeset
|
28 |
4059
59db9e761b38
Move declaration of av_set_program_name and av_program_add_stream_index
diego
parents:
3981
diff
changeset
|
29 void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx); |
59db9e761b38
Move declaration of av_set_program_name and av_program_add_stream_index
diego
parents:
3981
diff
changeset
|
30 |
4418
d5119d75439d
Move declaration of ff_interleave_add_packet to internal.h.
bcoudurier
parents:
4059
diff
changeset
|
31 /** |
d5119d75439d
Move declaration of ff_interleave_add_packet to internal.h.
bcoudurier
parents:
4059
diff
changeset
|
32 * 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
|
33 * interleaved position using compare() function argument. |
d5119d75439d
Move declaration of ff_interleave_add_packet to internal.h.
bcoudurier
parents:
4059
diff
changeset
|
34 */ |
d5119d75439d
Move declaration of ff_interleave_add_packet to internal.h.
bcoudurier
parents:
4059
diff
changeset
|
35 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
|
36 int (*compare)(AVFormatContext *, AVPacket *, AVPacket *)); |
d5119d75439d
Move declaration of ff_interleave_add_packet to internal.h.
bcoudurier
parents:
4059
diff
changeset
|
37 |
5761
058a0e362dbe
Move av_read_frame_flush() prototype to lavf/internal.h
mru
parents:
4428
diff
changeset
|
38 void av_read_frame_flush(AVFormatContext *s); |
058a0e362dbe
Move av_read_frame_flush() prototype to lavf/internal.h
mru
parents:
4428
diff
changeset
|
39 |
5807
f4ca0041b4f4
Make the ntp_time function available to other parts of libavformat, as ff_ntp_time
mstorsjo
parents:
5774
diff
changeset
|
40 /** 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
|
41 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
|
42 |
5836
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
43 /** |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
44 * 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
|
45 * 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
|
46 * 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
|
47 * 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
|
48 * |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
49 * @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
|
50 * @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
|
51 * @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
|
52 * @param logctx the log context |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
53 * @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
|
54 * @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
|
55 * @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
|
56 * AVERROR code otherwise |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
57 */ |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
58 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
|
59 const char *filename, void *logctx, |
2997c88028cd
Move the probe loop from av_open_input_file() into its own method
stefano
parents:
5807
diff
changeset
|
60 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
|
61 |
3852 | 62 #endif /* AVFORMAT_INTERNAL_H */ |