Fix incorrect container size when loading a VF/OV combination into the player.
[dcpomatic.git] / src / tools / dcpomatic_player.cc
index 19768e292242657457d9b74159bebb622688cb0f..2fe9aca8b83f585d88b0a73537c5b09467501207 100644 (file)
@@ -213,19 +213,12 @@ public:
                        return;
                }
 
-               if (dcp->subtitle) {
-                       dcp->subtitle->set_use (true);
-               }
+               setup_from_dcp (dcp);
 
                if (dcp->three_d()) {
                        _film->set_three_d (true);
                }
 
-               Ratio const * r = Ratio::nearest_from_ratio(dcp->video->size().ratio());
-               if (r) {
-                       _film->set_container(r);
-               }
-
                _viewer->set_film (_film);
                _viewer->set_position (DCPTime ());
                _info->triggered_update ();
@@ -364,10 +357,7 @@ private:
                        DCPOMATIC_ASSERT (dcp);
                        dcp->add_ov (wx_to_std(c->GetPath()));
                        dcp->examine (shared_ptr<Job>());
-                       /* Maybe we just gained some subtitles */
-                       if (dcp->subtitle) {
-                               dcp->subtitle->set_use (true);
-                       }
+                       setup_from_dcp (dcp);
                }
 
                c->Destroy ();
@@ -594,6 +584,22 @@ private:
                _viewer->forward_frame ();
        }
 
+private:
+
+       void setup_from_dcp (shared_ptr<DCPContent> dcp)
+       {
+               if (dcp->subtitle) {
+                       dcp->subtitle->set_use (true);
+               }
+
+               if (dcp->video) {
+                       Ratio const * r = Ratio::nearest_from_ratio(dcp->video->size().ratio());
+                       if (r) {
+                               _film->set_container(r);
+                       }
+               }
+       }
+
        bool _update_news_requested;
        PlayerInformation* _info;
        wxPreferencesEditor* _config_dialog;