}
_external_audio_stream = ExternalAudioStream::create ();
-
- read_metadata ();
+
+ if (must_exist) {
+ read_metadata ();
+ }
_log = new FileLog (file ("log"));
set_dci_date_today ();
oe->video_range = make_pair (dcp_trim_start(), dcp_trim_start() + dcp_length().get());
if (audio_stream()) {
oe->audio_range = make_pair (
- video_frames_to_audio_frames (oe->video_range.get().first, audio_stream()->sample_rate(), frames_per_second()),
- video_frames_to_audio_frames (oe->video_range.get().second, audio_stream()->sample_rate(), frames_per_second())
+
+ video_frames_to_audio_frames (
+ oe->video_range.get().first,
+ dcp_audio_sample_rate (audio_stream()->sample_rate()),
+ dcp_frame_rate (frames_per_second()).frames_per_second
+ ),
+
+ video_frames_to_audio_frames (
+ oe->video_range.get().second,
+ dcp_audio_sample_rate (audio_stream()->sample_rate()),
+ dcp_frame_rate (frames_per_second()).frames_per_second
+ )
);
}
boost::optional<int> audio_sample_rate;
boost::optional<int> audio_stream_index;
boost::optional<int> subtitle_stream_index;
-
+
ifstream f (file ("metadata").c_str());
+ if (!f.good()) {
+ throw OpenFileError (file("metadata"));
+ }
+
multimap<string, string> kv = read_key_value (f);
/* We need version before anything else */
return rint (t);
}
-boost::optional<SourceFrame>
+boost::optional<int>
Film::dcp_length () const
{
if (content_type() == STILL) {
}
if (!length()) {
- return boost::optional<SourceFrame> ();
+ return boost::optional<int> ();
}
return length().get() - dcp_trim_start() - dcp_trim_end();
_content_audio_stream = shared_ptr<AudioStream> ();
_subtitle_stream = shared_ptr<SubtitleStream> ();
+ /* Start off using content audio */
+ set_use_content_audio (true);
+
/* Create a temporary decoder so that we can get information
about the content.
*/
set_format (Format::from_id ("185"));
break;
}
+
+ /* Still image DCPs must use external audio */
+ if (content_type() == STILL) {
+ set_use_content_audio (false);
+ }
}
void