aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/oggdec.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2012-08-05 09:41:20 +0200
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2012-08-05 19:47:52 +0200
commita4163b2d6583396845e06b1b976c3a981eb8cb1c (patch)
tree5bb64dd71ad94fa58c693d462b7ab0699e6d122c /libavformat/oggdec.c
parentf5f98727b361c62d3962cef37a100db95d62b702 (diff)
downloadffmpeg-a4163b2d6583396845e06b1b976c3a981eb8cb1c.tar.gz
oggdec: simplify start time calculation code.
Also slightly more correct behaviour in case streams_left for some reason is 0 from the start. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavformat/oggdec.c')
-rw-r--r--libavformat/oggdec.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 0a4650158d..cb149ed63a 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -526,9 +526,10 @@ static int ogg_get_length(AVFormatContext *s)
avio_seek (s->pb, s->data_offset, SEEK_SET);
ogg_reset(s);
i = -1;
- while (!ogg_packet(s, &i, NULL, NULL, NULL)) {
- if(i>=0) {
- int64_t pts = ogg_calc_pts(s, i, NULL);
+ while (streams_left > 0 && !ogg_packet(s, &i, NULL, NULL, NULL)) {
+ int64_t pts;
+ if (i < 0) continue;
+ pts = ogg_calc_pts(s, i, NULL);
if (pts != AV_NOPTS_VALUE && s->streams[i]->start_time == AV_NOPTS_VALUE && !ogg->streams[i].got_start){
s->streams[i]->duration -= pts;
ogg->streams[i].got_start= 1;
@@ -537,9 +538,6 @@ static int ogg_get_length(AVFormatContext *s)
ogg->streams[i].got_start= 1;
streams_left--;
}
- }
- if(streams_left<=0)
- break;
}
ogg_restore (s, 0);