Use make_shared<>.
[dcpomatic.git] / test / time_calculation_test.cc
index e9aa37f1e34b3149e581d2b93c25c66a14779f7b..bf21e5476d47e807c756e07ef4adc53f77eb4ab0 100644 (file)
@@ -1,19 +1,20 @@
 /*
     Copyright (C) 2015-2016 Carl Hetherington <cth@carlh.net>
 
-    This program is free software; you can redistribute it and/or modify
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    This program is distributed in the hope that it will be useful,
+    DCP-o-matic is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
 
 */
 
 #include "lib/audio_content.h"
 #include "test.h"
 #include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using std::string;
 using std::list;
 using boost::shared_ptr;
+using boost::make_shared;
 
 static string const xml = "<Content>"
        "<Type>FFmpeg</Type>"
@@ -42,7 +45,7 @@ static string const xml = "<Content>"
        "<VideoWidth>1280</VideoWidth>"
        "<VideoHeight>720</VideoHeight>"
        "<VideoFrameRate>25</VideoFrameRate>"
-       "<VideoFrameType>0</VideoFrameType>"
+       "<VideoFrameType>2d</VideoFrameType>"
        "<LeftCrop>0</LeftCrop>"
        "<RightCrop>0</RightCrop>"
        "<TopCrop>0</TopCrop>"
@@ -122,11 +125,11 @@ BOOST_AUTO_TEST_CASE (ffmpeg_time_calculation_test)
 {
        shared_ptr<Film> film = new_test_film ("ffmpeg_time_calculation_test");
 
-       shared_ptr<cxml::Document> doc (new cxml::Document);
+       shared_ptr<cxml::Document> doc = make_shared<cxml::Document> ();
        doc->read_string (xml);
 
        list<string> notes;
-       shared_ptr<FFmpegContent> content (new FFmpegContent (film, doc, film->state_version(), notes));
+       shared_ptr<FFmpegContent> content = boost::make_shared<FFmpegContent> (film, doc, film->state_version(), notes);
 
        /* 25fps content, 25fps DCP */
        film->set_video_frame_rate (25);
@@ -175,15 +178,15 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1)
 {
        shared_ptr<Film> film = new_test_film ("player_time_calculation_test1");
 
-       shared_ptr<cxml::Document> doc (new cxml::Document);
+       shared_ptr<cxml::Document> doc = make_shared<cxml::Document> ();
        doc->read_string (xml);
 
        list<string> notes;
-       shared_ptr<FFmpegContent> content (new FFmpegContent (film, doc, film->state_version(), notes));
+       shared_ptr<FFmpegContent> content = boost::make_shared<FFmpegContent> (film, doc, film->state_version(), notes);
        film->set_sequence (false);
        film->add_content (content);
 
-       shared_ptr<Player> player (new Player (film, film->playlist ()));
+       shared_ptr<Player> player = make_shared<Player> (film, film->playlist ());
 
        /* Position 0, no trim, content rate = DCP rate */
        content->set_position (DCPTime ());
@@ -380,15 +383,15 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2)
 {
        shared_ptr<Film> film = new_test_film ("player_time_calculation_test2");
 
-       shared_ptr<cxml::Document> doc (new cxml::Document);
+       shared_ptr<cxml::Document> doc = make_shared<cxml::Document> ();
        doc->read_string (xml);
 
        list<string> notes;
-       shared_ptr<FFmpegContent> content (new FFmpegContent (film, doc, film->state_version(), notes));
+       shared_ptr<FFmpegContent> content = boost::make_shared<FFmpegContent> (film, doc, film->state_version(), notes);
        film->set_sequence (false);
        film->add_content (content);
 
-       shared_ptr<Player> player (new Player (film, film->playlist ()));
+       shared_ptr<Player> player = make_shared<Player> (film, film->playlist ());
 
        /* Position 0, no trim, content rate = DCP rate */
        content->set_position (DCPTime ());
@@ -556,16 +559,16 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3)
 {
        shared_ptr<Film> film = new_test_film ("player_time_calculation_test3");
 
-       shared_ptr<cxml::Document> doc (new cxml::Document);
+       shared_ptr<cxml::Document> doc = make_shared<cxml::Document> ();
        doc->read_string (xml);
 
        list<string> notes;
-       shared_ptr<FFmpegContent> content (new FFmpegContent (film, doc, film->state_version(), notes));
+       shared_ptr<FFmpegContent> content = boost::make_shared<FFmpegContent> (film, doc, film->state_version(), notes);
        AudioStreamPtr stream = content->audio->streams().front();
        film->set_sequence (false);
        film->add_content (content);
 
-       shared_ptr<Player> player (new Player (film, film->playlist ()));
+       shared_ptr<Player> player = make_shared<Player> (film, film->playlist ());
 
        /* Position 0, no trim, video/audio content rate = video/audio DCP rate */
        content->set_position (DCPTime ());