diff options
Diffstat (limited to 'libavformat/oggdec.c')
-rw-r--r-- | libavformat/oggdec.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 3d03a5f974..cd5592208a 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -45,6 +45,7 @@ static const struct ogg_codec * const ogg_codecs[] = { &ff_vorbis_codec, &ff_theora_codec, &ff_flac_codec, + &ff_celt_codec, &ff_old_dirac_codec, &ff_old_flac_codec, &ff_ogm_video_codec, @@ -213,7 +214,7 @@ static int ogg_read_page(AVFormatContext *s, int *str) break; c = avio_r8(bc); - if (bc->eof_reached) + if (url_feof(bc)) return AVERROR_EOF; sync[sp++ & 3] = c; }while (i++ < MAX_PAGE_SIZE); @@ -361,8 +362,6 @@ static int ogg_packet(AVFormatContext *s, int *str, int *dstart, int *dsize, } }while (!complete); - av_dlog(s, "ogg_packet: idx %i, frame size %i, start %i\n", - idx, os->psize, os->pstart); if (os->granule == -1) av_log(s, AV_LOG_WARNING, "Page at %"PRId64" is missing granule\n", os->page_pos); @@ -412,6 +411,8 @@ static int ogg_packet(AVFormatContext *s, int *str, int *dstart, int *dsize, *fpos = os->sync_pos; os->pstart += os->psize; os->psize = 0; + if(os->pstart == os->bufpos) + os->bufpos = os->pstart = 0; os->sync_pos = os->page_pos; } @@ -479,6 +480,18 @@ static int ogg_get_length(AVFormatContext *s) ogg_restore (s, 0); + ogg_save (s); + avio_seek (s->pb, 0, SEEK_SET); + 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; + } + } + ogg_restore (s, 0); + return 0; } |