Don't create decoders if they are not necessary.
authorCarl Hetherington <cth@carlh.net>
Mon, 3 Jul 2017 12:09:48 +0000 (13:09 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 3 Jul 2017 12:09:48 +0000 (13:09 +0100)
src/lib/dcp_decoder.cc

index 0b99e8dd08f36f42d60da9e6559241db00b32411..c7294bda75dada03fa9f203597f33b0b35d4e231 100644 (file)
@@ -54,9 +54,12 @@ DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c, shared_ptr<Log> log)
        , _decode_referenced (false)
 {
        video.reset (new VideoDecoder (this, c, log));
-       audio.reset (new AudioDecoder (this, c->audio, log));
-
-       subtitle.reset (new SubtitleDecoder (this, c->subtitle, log));
+       if (c->audio) {
+               audio.reset (new AudioDecoder (this, c->audio, log));
+       }
+       if (c->subtitle) {
+               subtitle.reset (new SubtitleDecoder (this, c->subtitle, log));
+       }
 
        shared_ptr<dcp::CPL> cpl;
        BOOST_FOREACH (shared_ptr<dcp::CPL> i, cpls ()) {