comparison 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
comparison
equal deleted inserted replaced
5835:a92c2f3c87e8 5836:2997c88028cd
38 void av_read_frame_flush(AVFormatContext *s); 38 void av_read_frame_flush(AVFormatContext *s);
39 39
40 /** Gets the current time since NTP epoch in microseconds. */ 40 /** Gets the current time since NTP epoch in microseconds. */
41 uint64_t ff_ntp_time(void); 41 uint64_t ff_ntp_time(void);
42 42
43 /**
44 * Probes a bytestream to determine the input format. Each time a probe returns
45 * with a score that is too low, the probe buffer size is increased and another
46 * attempt is made. When the maximum probe size is reached, the input format
47 * with the highest score is returned.
48 *
49 * @param pb the bytestream to probe, it may be closed and opened again
50 * @param fmt the input format is put here
51 * @param filename the filename of the stream
52 * @param logctx the log context
53 * @param offset the offset within the bytestream to probe from
54 * @param max_probe_size the maximum probe buffer size (zero for default)
55 * @return 0 in case of success, a negative value corresponding to an
56 * AVERROR code otherwise
57 */
58 int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt,
59 const char *filename, void *logctx,
60 unsigned int offset, unsigned int max_probe_size);
61
43 #endif /* AVFORMAT_INTERNAL_H */ 62 #endif /* AVFORMAT_INTERNAL_H */