diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-03-04 20:22:47 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-03-04 20:22:47 +0000 |
| commit | 1b1bc528ee5ca1fee1bd33f9fb6f79cd551e3b33 (patch) | |
| tree | d60b9fb573dd8d6ab89036fb8788cd1b1c69aada /src/lib/ffmpeg_examiner.cc | |
| parent | 6d8bcba724be622739a749064466901486304cee (diff) | |
New DCPTime/ContentTime types.
Diffstat (limited to 'src/lib/ffmpeg_examiner.cc')
| -rw-r--r-- | src/lib/ffmpeg_examiner.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index e439566a1..3de62ad07 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -102,14 +102,14 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c) } } -optional<double> +optional<ContentTime> FFmpegExaminer::frame_time (AVStream* s) const { - optional<double> t; + optional<ContentTime> t; int64_t const bet = av_frame_get_best_effort_timestamp (_frame); if (bet != AV_NOPTS_VALUE) { - t = bet * av_q2d (s->time_base); + t = ContentTime (bet * av_q2d (s->time_base)); } return t; @@ -133,12 +133,12 @@ FFmpegExaminer::video_size () const return dcp::Size (video_codec_context()->width, video_codec_context()->height); } -/** @return Length (in video frames) according to our content's header */ -VideoFrame +/** @return Length according to our content's header */ +ContentTime FFmpegExaminer::video_length () const { - VideoFrame const length = (double (_format_context->duration) / AV_TIME_BASE) * video_frame_rate(); - return max (1, length); + ContentTime const length = ContentTime::from_seconds (double (_format_context->duration) / AV_TIME_BASE); + return ContentTime (1, length.get ()); } string |
