Commit a82ba7d3 authored by conrad's avatar conrad

oggdec: Fix duration calculation if the last page in a file has no granule

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@22890 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 9f26c8f8
...@@ -431,7 +431,7 @@ static int ...@@ -431,7 +431,7 @@ static int
ogg_get_length (AVFormatContext * s) ogg_get_length (AVFormatContext * s)
{ {
struct ogg *ogg = s->priv_data; struct ogg *ogg = s->priv_data;
int idx = -1, i; int i;
int64_t size, end; int64_t size, end;
if(url_is_streamed(s->pb)) if(url_is_streamed(s->pb))
...@@ -451,15 +451,12 @@ ogg_get_length (AVFormatContext * s) ...@@ -451,15 +451,12 @@ ogg_get_length (AVFormatContext * s)
while (!ogg_read_page (s, &i)){ while (!ogg_read_page (s, &i)){
if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 && if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
ogg->streams[i].codec) ogg->streams[i].codec) {
idx = i; s->streams[i]->duration =
} ogg_gptopts (s, i, ogg->streams[i].granule, NULL);
if (s->streams[i]->start_time != AV_NOPTS_VALUE)
if (idx != -1){ s->streams[i]->duration -= s->streams[i]->start_time;
s->streams[idx]->duration = }
ogg_gptopts (s, idx, ogg->streams[idx].granule, NULL);
if (s->streams[idx]->start_time != AV_NOPTS_VALUE)
s->streams[idx]->duration -= s->streams[idx]->start_time;
} }
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