summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-01-23 17:34:26 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-01-23 17:34:26 +0000
commita44b3c4da859efacddca3a58ecbc6ad477b929ed (patch)
tree40bf89132cdb398ccf6b6c98ab47b920295ceb6b /libavformat
parent683ab79ca036036fef4b9432ffe50901f92c0a8c (diff)
make av_find_stream_info() duration user selectable
Originally committed as revision 7669 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avformat.h5
-rw-r--r--libavformat/utils.c6
2 files changed, 7 insertions, 4 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index b3c398e8d2..480df999e2 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -373,6 +373,11 @@ typedef struct AVFormatContext {
int loop_input;
/* decoding: size of data to probe; encoding unused */
unsigned int probesize;
+
+ /**
+ * maximum duration in AV_TIME_BASE units over which the input should be analyzed in av_find_stream_info()
+ */
+ int max_analyze_duration;
} AVFormatContext;
typedef struct AVPacketList {
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 4467ddaca3..69b3cea628 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -329,6 +329,7 @@ static const AVOption options[]={
{"genpts", "generate pts", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_GENPTS, INT_MIN, INT_MAX, D, "fflags"},
{"track", " set the track number", OFFSET(track), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, E},
{"year", "set the year", OFFSET(year), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, E},
+{"analyzeduration", NULL, OFFSET(max_analyze_duration), FF_OPT_TYPE_INT, 3*AV_TIME_BASE, 0, INT_MAX, D},
{NULL},
};
@@ -1757,9 +1758,6 @@ static int try_decode_frame(AVStream *st, const uint8_t *data, int size)
/* absolute maximum size we read until we abort */
#define MAX_READ_SIZE 5000000
-/* maximum duration until we stop analysing the stream */
-#define MAX_STREAM_DURATION ((int)(AV_TIME_BASE * 3.0))
-
#define MAX_STD_TIMEBASES (60*12+5)
static int get_std_framerate(int i){
if(i<60*12) return i*1001;
@@ -1942,7 +1940,7 @@ int av_find_stream_info(AVFormatContext *ic)
(st->codec->codec_id == CODEC_ID_MPEG4 && !st->need_parsing))*/)
try_decode_frame(st, pkt->data, pkt->size);
- if (av_rescale_q(st->codec_info_duration, st->time_base, AV_TIME_BASE_Q) >= MAX_STREAM_DURATION) {
+ if (av_rescale_q(st->codec_info_duration, st->time_base, AV_TIME_BASE_Q) >= ic->max_analyze_duration) {
break;
}
count++;