diff options
author | 2013-05-03 20:26:48 +0200 | |
---|---|---|
committer | 2013-05-05 18:44:24 +0200 | |
commit | 4ba4d6ef3fe49978c76ecca008478cd1f5d97125 (patch) | |
tree | 033efbed63b44d54e7ea247fee63c10b707218cb | |
parent | 4d14a42997154861e541c34d25a26d272fcbd152 (diff) |
demux: report stream time info instead of demuxer info if possible
Needed for bluray and dvd. demux_mpg (used for dvd playback) did this
manually for the time length.
-rw-r--r-- | demux/demux.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/demux/demux.c b/demux/demux.c index 9622c2412a..eeaa92c266 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -1384,17 +1384,20 @@ int demuxer_chapter_count(demuxer_t *demuxer) double demuxer_get_time_length(struct demuxer *demuxer) { - double get_time_ans; + double len; + if (stream_control(demuxer->stream, STREAM_CTRL_GET_TIME_LENGTH, &len) > 0) + return len; // <= 0 means DEMUXER_CTRL_NOTIMPL or DEMUXER_CTRL_DONTKNOW - if (demux_control(demuxer, DEMUXER_CTRL_GET_TIME_LENGTH, - (void *) &get_time_ans) > 0) - return get_time_ans; + if (demux_control(demuxer, DEMUXER_CTRL_GET_TIME_LENGTH, &len) > 0) + return len; return -1; } double demuxer_get_start_time(struct demuxer *demuxer) { double time; + if (stream_control(demuxer->stream, STREAM_CTRL_GET_START_TIME, &time) > 0) + return time; if (demux_control(demuxer, DEMUXER_CTRL_GET_START_TIME, &time) > 0) return time; return 0; |