summaryrefslogtreecommitdiff
path: root/libavformat/internal.h
diff options
context:
space:
mode:
authorMicah F. Galizia <micahgalizia@gmail.com>2010-03-07 22:42:11 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-03-07 22:42:11 +0000
commit4245c6ec4ec357fb7bac781d78f9c7d6fa1c8ce7 (patch)
tree1c97dd710eb4748923941c25ae00516679730f26 /libavformat/internal.h
parent6580d5e377cf7a54589fd7dcb6c754ef271ad8d5 (diff)
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). Patch by Micah F. Galizia printf("%s%s@%s.%s", "micah", "galizia", "gmail", "com"). Originally committed as revision 22296 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/internal.h')
-rw-r--r--libavformat/internal.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 685b550673..1f19001343 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -37,4 +37,24 @@ void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
void av_read_frame_flush(AVFormatContext *s);
+/**
+ * Probes a bytestream to determine the input format. Each time a
+ * probe returns with a score that is too low, the probe buffer size
+ * is increased and another attempt is made. When the maximum probe
+ * size is reached, the input format with the highest score is
+ * returned.
+ *
+ * @param pb the bytestream to probe, it may be closed and opened again
+ * @param fmt the input format is put here
+ * @param filename the filename of the stream
+ * @param logctx the log context
+ * @param offset the offset within the bytestream to probe from
+ * @param max_probe_size the maximum probe buffer size (zero for default)
+ * @return 0 if OK, a negative value corresponding to an AVERROR(xxx)
+ * code otherwise
+ */
+int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt,
+ const char *filename, void *logctx,
+ unsigned int offset, unsigned int max_probe_size);
+
#endif /* AVFORMAT_INTERNAL_H */