Don't specify internal aspect ratio in the ISDCF name for trailers, as per
authorCarl Hetherington <cth@carlh.net>
Wed, 11 Jun 2014 08:19:09 +0000 (09:19 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 11 Jun 2014 08:19:09 +0000 (09:19 +0100)
http://digitalcinemanamingconvention.com/appendix_7.asp

Reported-by: Ivan Pullman
src/lib/film.cc
test/isdcf_name_test.cc

index fd3e78c35874ca41683deb4706fa34b6ddd73174..5b709ab1c70a43891f4f5e7bfb00c76321a050db 100644 (file)
@@ -557,17 +557,20 @@ Film::isdcf_name (bool if_created_now) const
           and uses the first bit of content only.
        */
 
-       ContentList cl = content ();
-       Ratio const * content_ratio = 0;
-       for (ContentList::const_iterator i = cl.begin(); i != cl.end(); ++i) {
-               shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (*i);
-               if (vc && (content_ratio == 0 || vc->scale().ratio() != content_ratio)) {
-                       content_ratio = vc->scale().ratio();
+       /* The standard says we don't do this for trailers, for some strange reason */
+       if (dcp_content_type() && dcp_content_type()->libdcp_kind() != libdcp::TRAILER) {
+               ContentList cl = content ();
+               Ratio const * content_ratio = 0;
+               for (ContentList::const_iterator i = cl.begin(); i != cl.end(); ++i) {
+                       shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (*i);
+                       if (vc && (content_ratio == 0 || vc->scale().ratio() != content_ratio)) {
+                               content_ratio = vc->scale().ratio();
+                       }
+               }
+               
+               if (content_ratio && content_ratio != container()) {
+                       d << "-" << content_ratio->isdcf_name();
                }
-       }
-
-       if (content_ratio && content_ratio != container()) {
-               d << "-" << content_ratio->isdcf_name();
        }
 
        if (!dm.audio_language.empty ()) {
index 65f89c0f4e2cbae2a66694fcd0fae6a7671b6c62..dd1b64162a7051f564513a17f362e39e2398b7f9 100644 (file)
@@ -70,19 +70,24 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test)
        film->set_interop (false);
        BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_S_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF");
 
-       /* Test interior aspect ratio */
+       /* Test interior aspect ratio: shouldn't be shown with trailers */
 
        shared_ptr<ImageContent> content (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
        film->examine_and_add_content (content);
        wait_for_jobs ();
        content->set_scale (VideoContentScale (Ratio::from_id ("133")));
        film->set_container (Ratio::from_id ("185"));
-       BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_F-133_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF");
+       BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_F_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF");
 
+       /* But should be shown for anything else */
+
+       film->set_dcp_content_type (DCPContentType::from_isdcf_name ("XSN"));
+       BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_XSN-2_F-133_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF");
+       
        /* Test 3D */
 
        film->set_three_d (true);
-       BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2-3D_F-133_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE-3D_VF");
+       BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_XSN-2-3D_F-133_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE-3D_VF");
 
        /* Test content type modifiers */
 
@@ -95,6 +100,6 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test)
        m.mastered_luminance = "4fl";
        film->set_isdcf_metadata (m);
        film->set_video_frame_rate (48);
-       BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2-Temp-Pre-RedBand-MyChain-2D-4fl-48_F-133_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF");
+       BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_XSN-2-Temp-Pre-RedBand-MyChain-2D-4fl-48_F-133_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF");
 }