Commit 904c401d authored by michael's avatar michael

av_find_stream_info() end check fixes

  10l (wrong time base)
  use timestamps if duration isnt available


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@4301 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 04aa213b
...@@ -1797,7 +1797,7 @@ int av_find_stream_info(AVFormatContext *ic) ...@@ -1797,7 +1797,7 @@ int av_find_stream_info(AVFormatContext *ic)
if (pkt->duration != 0) if (pkt->duration != 0)
st->codec_info_nb_frames++; st->codec_info_nb_frames++;
if(st->codec.codec_type == CODEC_TYPE_VIDEO){ {
int index= pkt->stream_index; int index= pkt->stream_index;
int64_t last= last_dts[index]; int64_t last= last_dts[index];
int64_t duration= pkt->dts - last; int64_t duration= pkt->dts - last;
...@@ -1811,6 +1811,8 @@ int av_find_stream_info(AVFormatContext *ic) ...@@ -1811,6 +1811,8 @@ int av_find_stream_info(AVFormatContext *ic)
duration_sum[index] += duration; duration_sum[index] += duration;
duration_count[index]+= factor; duration_count[index]+= factor;
} }
if(st->codec_info_nb_frames == 0)
st->codec_info_duration += duration;
} }
last_dts[pkt->stream_index]= pkt->dts; last_dts[pkt->stream_index]= pkt->dts;
} }
...@@ -1835,7 +1837,7 @@ int av_find_stream_info(AVFormatContext *ic) ...@@ -1835,7 +1837,7 @@ int av_find_stream_info(AVFormatContext *ic)
(st->codec.codec_id == CODEC_ID_MPEG4 && !st->need_parsing))*/) (st->codec.codec_id == CODEC_ID_MPEG4 && !st->need_parsing))*/)
try_decode_frame(st, pkt->data, pkt->size); try_decode_frame(st, pkt->data, pkt->size);
if (st->codec_info_duration >= MAX_STREAM_DURATION) { if (av_rescale_q(st->codec_info_duration, st->time_base, AV_TIME_BASE_Q) >= MAX_STREAM_DURATION) {
break; break;
} }
count++; count++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment