summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-12-09 18:42:07 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-09 19:12:34 +0100
commite3d95b54dbaf02b1c6ecdad67dbbf83562025be8 (patch)
treeb0b884665834ef9f9466085d80c723c4c2ff49c6 /libavformat
parent76d851b65619e5a0fe4cc5248a6858287fe890b4 (diff)
probe: belive protocol content type if set and avoid lengthly probing.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 0f13304cd9..3439d2c62b 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -413,6 +413,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
{
AVProbeData pd = { filename ? filename : "", NULL, -offset };
unsigned char *buf = NULL;
+ uint8_t *demuxer_name;
int ret = 0, probe_size, buf_offset = 0;
if (!max_probe_size) {
@@ -427,6 +428,10 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
return AVERROR(EINVAL);
}
+ if (!*fmt && pb && pb->av_class && av_opt_get(pb, "demuxer", AV_OPT_SEARCH_CHILDREN, &demuxer_name) >= 0 && demuxer_name) {
+ *fmt = av_find_input_format(demuxer_name);
+ }
+
for(probe_size= PROBE_BUF_MIN; probe_size<=max_probe_size && !*fmt;
probe_size = FFMIN(probe_size<<1, FFMAX(max_probe_size, probe_size+1))) {
int score = probe_size < max_probe_size ? AVPROBE_SCORE_RETRY : 0;