changeset 37114:a4c2668dadb6

demuxer: Fall back to asking the stream layer for length. The bitrate-based estimate seem to be easily 2x off for some blurays for example.
author reimar
date Tue, 27 May 2014 19:22:09 +0000
parents f5b5c7246439
children a0a13230b8d1
files libmpdemux/demuxer.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demuxer.c	Tue May 27 19:22:07 2014 +0000
+++ b/libmpdemux/demuxer.c	Tue May 27 19:22:09 2014 +0000
@@ -1495,7 +1495,8 @@
     sh_audio_t *sh_audio = demuxer->audio->sh;
     // <= 0 means DEMUXER_CTRL_NOTIMPL or DEMUXER_CTRL_DONTKNOW
     if (demux_control
-        (demuxer, DEMUXER_CTRL_GET_TIME_LENGTH, (void *) &get_time_ans) <= 0) {
+        (demuxer, DEMUXER_CTRL_GET_TIME_LENGTH, (void *) &get_time_ans) <= 0 &&
+        stream_control(demuxer->stream, STREAM_CTRL_GET_TIME_LENGTH, (void *)&get_time_ans) != STREAM_OK) {
         if (sh_video && sh_video->i_bps && sh_audio && sh_audio->i_bps)
             get_time_ans = (double) (demuxer->movi_end -
                                      demuxer->movi_start) / (sh_video->i_bps +