|
|
|
@ -452,6 +452,7 @@ static int ogg_get_length(AVFormatContext *s) |
|
|
|
|
struct ogg *ogg = s->priv_data; |
|
|
|
|
int i; |
|
|
|
|
int64_t size, end; |
|
|
|
|
int streams_left=0; |
|
|
|
|
|
|
|
|
|
if(!s->pb->seekable) |
|
|
|
|
return 0; |
|
|
|
@ -473,8 +474,14 @@ static int ogg_get_length(AVFormatContext *s) |
|
|
|
|
ogg->streams[i].codec) { |
|
|
|
|
s->streams[i]->duration = |
|
|
|
|
ogg_gptopts (s, i, ogg->streams[i].granule, NULL); |
|
|
|
|
if (s->streams[i]->start_time != AV_NOPTS_VALUE) |
|
|
|
|
if (s->streams[i]->start_time != AV_NOPTS_VALUE){ |
|
|
|
|
s->streams[i]->duration -= s->streams[i]->start_time; |
|
|
|
|
streams_left-= (ogg->streams[i].got_start==-1); |
|
|
|
|
ogg->streams[i].got_start= 1; |
|
|
|
|
}else if(!ogg->streams[i].got_start){ |
|
|
|
|
ogg->streams[i].got_start= -1; |
|
|
|
|
streams_left++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -485,9 +492,14 @@ static int ogg_get_length(AVFormatContext *s) |
|
|
|
|
while (!ogg_read_page (s, &i)){ |
|
|
|
|
if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 && |
|
|
|
|
ogg->streams[i].codec) { |
|
|
|
|
s->streams[i]->duration -= |
|
|
|
|
ogg_gptopts (s, i, ogg->streams[i].granule, NULL); |
|
|
|
|
break; |
|
|
|
|
if(s->streams[i]->duration && s->streams[i]->start_time == AV_NOPTS_VALUE && !ogg->streams[i].got_start){ |
|
|
|
|
s->streams[i]->duration -= |
|
|
|
|
ogg_gptopts (s, i, ogg->streams[i].granule, NULL); |
|
|
|
|
ogg->streams[i].got_start= 1; |
|
|
|
|
streams_left--; |
|
|
|
|
} |
|
|
|
|
if(streams_left<=0) |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
ogg_restore (s, 0); |
|
|
|
|