diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-04-26 21:35:02 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-04-26 21:35:02 +0100 |
| commit | d851e5d3fd3e5af48c7e464a305c9d0001999700 (patch) | |
| tree | b0b492079c7addf898acb4aa1b9dd72b1f1efeeb /src/lib/playlist.cc | |
| parent | ef5bc177625b9365c42cbabf3f3e45d6689305b5 (diff) | |
Fix content length reporting; fix crash when player has audio disabled.
Diffstat (limited to 'src/lib/playlist.cc')
| -rw-r--r-- | src/lib/playlist.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index e32788951..3c69ae15f 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -276,3 +276,15 @@ Playlist::video_digest () const return md5_digest (t.c_str(), t.length()); } + +ContentVideoFrame +Playlist::content_length () const +{ + float const vfr = video_frame_rate() > 0 ? video_frame_rate() : 24; + int const afr = audio_frame_rate() > 0 ? audio_frame_rate() : 48000; + + return max ( + video_length(), + ContentVideoFrame (audio_length() * vfr / afr) + ); +} |
