Fix a few crashes.
authorCarl Hetherington <cth@carlh.net>
Wed, 11 May 2016 00:41:39 +0000 (01:41 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 18 May 2016 10:50:29 +0000 (11:50 +0100)
src/lib/ffmpeg_content.cc
test/4k_test.cc

index 564200c87d1ca24d970ebe45a5768c999c4b3746..8bcc0986d0eb7f89bbed9cc83adfcdfcaa537aa3 100644 (file)
@@ -349,9 +349,15 @@ FFmpegContent::identifier () const
 {
        SafeStringStream s;
 
-       s << Content::identifier() << "_"
-         << video->identifier() << "_"
-         << subtitle->identifier();
+       s << Content::identifier();
+
+       if (video) {
+               s << "_" << video->identifier();
+       }
+
+       if (subtitle) {
+               s << "_" << subtitle->identifier();
+       }
 
        boost::mutex::scoped_lock lm (_mutex);
 
@@ -536,8 +542,12 @@ vector<shared_ptr<FFmpegAudioStream> >
 FFmpegContent::ffmpeg_audio_streams () const
 {
        vector<shared_ptr<FFmpegAudioStream> > fa;
-       BOOST_FOREACH (AudioStreamPtr i, audio->streams()) {
-               fa.push_back (dynamic_pointer_cast<FFmpegAudioStream> (i));
+
+       if (audio) {
+               BOOST_FOREACH (AudioStreamPtr i, audio->streams()) {
+                       fa.push_back (dynamic_pointer_cast<FFmpegAudioStream> (i));
+               }
        }
+
        return fa;
 }
index 9ad2dfb58fa4f4da6ebfe9524086835868ad10dd..db6e4f62f45e934ac5317b6eb2035ee397a40572 100644 (file)
@@ -38,13 +38,14 @@ BOOST_AUTO_TEST_CASE (fourk_test)
        shared_ptr<Film> film = new_test_film ("4k_test");
        film->set_name ("4k_test");
        shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/test.mp4"));
-       c->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
        film->set_resolution (RESOLUTION_4K);
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
        film->set_container (Ratio::from_id ("185"));
        film->examine_and_add_content (c);
        wait_for_jobs ();
 
+       c->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
+
        film->make_dcp ();
        wait_for_jobs ();