Commit a4163b2d authored by Reimar Döffinger's avatar Reimar Döffinger

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: 's avatarReimar Döffinger <Reimar.Doeffinger@gmx.de>
parent f5f98727
...@@ -526,9 +526,10 @@ static int ogg_get_length(AVFormatContext *s) ...@@ -526,9 +526,10 @@ static int ogg_get_length(AVFormatContext *s)
avio_seek (s->pb, s->data_offset, SEEK_SET); avio_seek (s->pb, s->data_offset, SEEK_SET);
ogg_reset(s); ogg_reset(s);
i = -1; i = -1;
while (!ogg_packet(s, &i, NULL, NULL, NULL)) { while (streams_left > 0 && !ogg_packet(s, &i, NULL, NULL, NULL)) {
if(i>=0) { int64_t pts;
int64_t pts = ogg_calc_pts(s, i, NULL); 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){ if (pts != AV_NOPTS_VALUE && s->streams[i]->start_time == AV_NOPTS_VALUE && !ogg->streams[i].got_start){
s->streams[i]->duration -= pts; s->streams[i]->duration -= pts;
ogg->streams[i].got_start= 1; ogg->streams[i].got_start= 1;
...@@ -537,9 +538,6 @@ static int ogg_get_length(AVFormatContext *s) ...@@ -537,9 +538,6 @@ static int ogg_get_length(AVFormatContext *s)
ogg->streams[i].got_start= 1; ogg->streams[i].got_start= 1;
streams_left--; streams_left--;
} }
}
if(streams_left<=0)
break;
} }
ogg_restore (s, 0); ogg_restore (s, 0);
......
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