summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_examiner.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-05-10 15:06:19 +0100
committerCarl Hetherington <cth@carlh.net>2016-05-18 11:50:29 +0100
commit3db1df492e1009ee28641cdc593a139df156e8d7 (patch)
tree7d86e74117a701515f381ee707d7699acab7b2dc /src/lib/ffmpeg_examiner.cc
parent4fe27489ad67267081d048b45a4df9ee37541fde (diff)
Store audio length in AudioStream.
Diffstat (limited to 'src/lib/ffmpeg_examiner.cc')
-rw-r--r--src/lib/ffmpeg_examiner.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc
index 44d6a87df..bf9bafbfa 100644
--- a/src/lib/ffmpeg_examiner.cc
+++ b/src/lib/ffmpeg_examiner.cc
@@ -61,9 +61,17 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c, shared_ptr<Jo
s->codec->channel_layout = av_get_default_channel_layout (s->codec->channels);
}
+ DCPOMATIC_ASSERT (_format_context->duration != AV_NOPTS_VALUE);
+
_audio_streams.push_back (
shared_ptr<FFmpegAudioStream> (
- new FFmpegAudioStream (audio_stream_name (s), s->id, s->codec->sample_rate, s->codec->channels)
+ new FFmpegAudioStream (
+ audio_stream_name (s),
+ s->id,
+ s->codec->sample_rate,
+ (double (_format_context->duration) / AV_TIME_BASE) * s->codec->sample_rate,
+ s->codec->channels
+ )
)
);