Use make_shared<>.
authorCarl Hetherington <cth@carlh.net>
Tue, 21 Jun 2016 00:14:06 +0000 (01:14 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 21 Jun 2016 00:14:06 +0000 (01:14 +0100)
107 files changed:
src/lib/analyse_audio_job.cc
src/lib/atmos_mxf_content.cc
src/lib/audio_analysis.cc
src/lib/audio_buffers.cc
src/lib/audio_content.cc
src/lib/audio_decoder.cc
src/lib/audio_decoder_stream.cc
src/lib/audio_delay.cc
src/lib/audio_filter.cc
src/lib/audio_filter_graph.cc
src/lib/cinema.cc
src/lib/cinema_kdms.cc
src/lib/config.cc
src/lib/dcp_content.cc
src/lib/dcp_decoder.cc
src/lib/dcp_subtitle_content.cc
src/lib/dcp_video.cc
src/lib/decoder_factory.cc
src/lib/encode_server.cc
src/lib/encode_server_finder.cc
src/lib/ffmpeg_content.cc
src/lib/ffmpeg_decoder.cc
src/lib/ffmpeg_examiner.cc
src/lib/film.cc
src/lib/image.cc
src/lib/image_content.cc
src/lib/image_proxy.cc
src/lib/j2k_image_proxy.cc
src/lib/json_server.cc
src/lib/log.cc
src/lib/mid_side_decoder.cc
src/lib/player.cc
src/lib/reel_writer.cc
src/lib/render_subtitles.cc
src/lib/resampler.cc
src/lib/server.cc
src/lib/subtitle_content.cc
src/lib/text_subtitle_content.cc
src/lib/transcode_job.cc
src/lib/upmixer_a.cc
src/lib/upmixer_b.cc
src/lib/video_content.cc
src/lib/video_decoder.cc
src/lib/video_filter_graph.cc
src/lib/video_mxf_content.cc
src/lib/video_mxf_decoder.cc
src/tools/dcpomatic.cc
src/tools/dcpomatic_batch.cc
src/tools/dcpomatic_create.cc
src/tools/dcpomatic_kdm.cc
src/tools/server_test.cc
src/wx/audio_panel.cc
src/wx/colour_conversion_editor.cc
src/wx/content_menu.cc
src/wx/hints_dialog.cc
src/wx/job_manager_view.cc
src/wx/report_problem_dialog.cc
src/wx/screens_panel.cc
src/wx/timeline.cc
test/4k_test.cc
test/audio_analysis_test.cc
test/audio_decoder_test.cc
test/audio_delay_test.cc
test/audio_filter_test.cc
test/audio_processor_delay_test.cc
test/audio_processor_test.cc
test/black_fill_test.cc
test/burnt_subtitle_test.cc
test/client_server_test.cc
test/colour_conversion_test.cc
test/dcp_subtitle_test.cc
test/ffmpeg_audio_only_test.cc
test/ffmpeg_audio_test.cc
test/ffmpeg_dcp_test.cc
test/ffmpeg_decoder_seek_test.cc
test/ffmpeg_decoder_sequential_test.cc
test/ffmpeg_examiner_test.cc
test/ffmpeg_pts_offset_test.cc
test/film_metadata_test.cc
test/frame_rate_test.cc
test/image_test.cc
test/import_dcp_test.cc
test/interrupt_encoder_test.cc
test/isdcf_name_test.cc
test/job_test.cc
test/make_black_test.cc
test/play_test.cc
test/player_test.cc
test/recover_test.cc
test/reels_test.cc
test/repeat_frame_test.cc
test/resampler_test.cc
test/scaling_test.cc
test/seek_zero_test.cc
test/silence_padding_test.cc
test/skip_frame_test.cc
test/srt_subtitle_test.cc
test/ssa_subtitle_test.cc
test/test.cc
test/threed_test.cc
test/time_calculation_test.cc
test/upmixer_a_test.cc
test/vf_test.cc
test/video_content_scale_test.cc
test/video_decoder_fill_test.cc
test/video_mxf_content_test.cc
test/xml_subtitle_test.cc

index 8d0accf0f62804bd4dfc44604621470774b9d681..ffe7c0fc710719aff2ecdea6afd1c2438030c360 100644 (file)
@@ -36,6 +36,7 @@ extern "C" {
 #endif
 }
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 #include "i18n.h"
@@ -46,6 +47,7 @@ using std::min;
 using std::cout;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
+using boost::make_shared;
 
 int const AnalyseAudioJob::_num_points = 1024;
 
@@ -90,7 +92,7 @@ AnalyseAudioJob::json_name () const
 void
 AnalyseAudioJob::run ()
 {
-       shared_ptr<Player> player (new Player (_film, _playlist));
+       shared_ptr<Player> player = make_shared<Player> (_film, _playlist);
        player->set_ignore_video ();
        player->set_fast ();
        player->set_play_referenced ();
index f8cc05178ef2d4349580237d462bd39dfafcfdbc..870fca56ed8c5c753eeccd61bcdb69d473dc7652 100644 (file)
 #include <dcp/atmos_asset.h>
 #include <dcp/exceptions.h>
 #include <libxml++/libxml++.h>
+#include <boost/make_shared.hpp>
 
 #include "i18n.h"
 
 using std::list;
 using std::string;
 using boost::shared_ptr;
+using boost::make_shared;
 
 AtmosMXFContent::AtmosMXFContent (shared_ptr<const Film> film, boost::filesystem::path path)
        : Content (film, path)
@@ -48,7 +50,7 @@ bool
 AtmosMXFContent::valid_mxf (boost::filesystem::path path)
 {
        try {
-               shared_ptr<dcp::AtmosAsset> a (new dcp::AtmosAsset (path));
+               shared_ptr<dcp::AtmosAsset> a = make_shared<dcp::AtmosAsset> (path);
                return true;
        } catch (dcp::MXFFileError& e) {
 
@@ -64,7 +66,7 @@ AtmosMXFContent::examine (shared_ptr<Job> job)
 {
        job->set_progress_unknown ();
        Content::examine (job);
-       shared_ptr<dcp::AtmosAsset> a (new dcp::AtmosAsset (path(0)));
+       shared_ptr<dcp::AtmosAsset> a = make_shared<dcp::AtmosAsset> (path(0));
 
        {
                boost::mutex::scoped_lock lm (_mutex);
index 1863e38eeae85bf633c79151dc335fd4e3d9be09..b133dec3def90ab2d74517364d24ea637ed27cc2 100644 (file)
@@ -27,6 +27,7 @@
 #include <libxml++/libxml++.h>
 #include <boost/filesystem.hpp>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <stdint.h>
 #include <cmath>
 #include <cstdio>
@@ -41,6 +42,7 @@ using std::cout;
 using std::max;
 using std::list;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::dynamic_pointer_cast;
 
 AudioAnalysis::AudioAnalysis (int channels)
@@ -112,7 +114,7 @@ AudioAnalysis::points (int c) const
 void
 AudioAnalysis::write (boost::filesystem::path filename)
 {
-       shared_ptr<xmlpp::Document> doc (new xmlpp::Document);
+       shared_ptr<xmlpp::Document> doc = make_shared<xmlpp::Document> ();
        xmlpp::Element* root = doc->create_root_node ("AudioAnalysis");
 
        BOOST_FOREACH (vector<AudioPoint>& i, _data) {
index 2ab8e187e3a32f9c3566a669990899cb2caf5649..4c3c2d4a7a20515b8f58d4acbf17d1feb18b2039 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "audio_buffers.h"
 #include "dcpomatic_assert.h"
+#include <boost/make_shared.hpp>
 #include <cassert>
 #include <cstring>
 #include <cmath>
@@ -27,6 +28,7 @@
 
 using std::bad_alloc;
 using boost::shared_ptr;
+using boost::make_shared;
 
 /** Construct an AudioBuffers.  Audio data is undefined after this constructor.
  *  @param channels Number of channels.
@@ -305,7 +307,7 @@ AudioBuffers::apply_gain (float dB)
 shared_ptr<AudioBuffers>
 AudioBuffers::channel (int c) const
 {
-       shared_ptr<AudioBuffers> o (new AudioBuffers (1, frames ()));
+       shared_ptr<AudioBuffers> o = make_shared<AudioBuffers> (1, frames ());
        o->copy_channel_from (this, c, 0);
        return o;
 }
@@ -320,7 +322,7 @@ AudioBuffers::copy_channel_from (AudioBuffers const * from, int from_channel, in
 shared_ptr<AudioBuffers>
 AudioBuffers::clone () const
 {
-       shared_ptr<AudioBuffers> b (new AudioBuffers (channels (), frames ()));
+       shared_ptr<AudioBuffers> b = make_shared<AudioBuffers> (channels (), frames ());
        b->copy_from (this, frames (), 0, 0);
        return b;
 }
index 7a4ca63a90f7703214e8403b3e1907a80d1a0916..57f878b71b1bd53c224256d203b6da21ae9529cc 100644 (file)
@@ -75,6 +75,7 @@ AudioContent::from_xml (Content* parent, cxml::ConstNodePtr node, int version)
                return shared_ptr<AudioContent> ();
        }
 
+       /* Can't use make_shared here as the constructor is private */
        return shared_ptr<AudioContent> (new AudioContent (parent, node));
 }
 
index 8c395cb89a0074aa171c3eb06b39c6bc4c00d508..fa9fe9711f2cf91692b1d3d140b7a799900240ed 100644 (file)
@@ -23,6 +23,7 @@
 #include "audio_decoder_stream.h"
 #include "audio_content.h"
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 #include "i18n.h"
 using std::cout;
 using std::map;
 using boost::shared_ptr;
+using boost::make_shared;
 
 AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr<const AudioContent> content, bool fast, shared_ptr<Log> log)
        : _ignore (false)
        , _fast (fast)
 {
        BOOST_FOREACH (AudioStreamPtr i, content->streams ()) {
-               _streams[i] = shared_ptr<AudioDecoderStream> (new AudioDecoderStream (content, i, parent, fast, log));
+               _streams[i] = make_shared<AudioDecoderStream> (content, i, parent, fast, log);
        }
 }
 
index 1bfc65871da4d2bdd962d0258a8d24e90b6f66f9..527610cdf9116d4cc0ebd241ad2ac9da6c6b716b 100644 (file)
@@ -28,6 +28,7 @@
 #include "log.h"
 #include "audio_content.h"
 #include "compose.hpp"
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 #include "i18n.h"
@@ -39,6 +40,7 @@ using std::min;
 using std::max;
 using boost::optional;
 using boost::shared_ptr;
+using boost::make_shared;
 
 AudioDecoderStream::AudioDecoderStream (shared_ptr<const AudioContent> content, AudioStreamPtr stream, Decoder* decoder, bool fast, shared_ptr<Log> log)
        : _content (content)
@@ -56,7 +58,7 @@ AudioDecoderStream::AudioDecoderStream (shared_ptr<const AudioContent> content,
 void
 AudioDecoderStream::reset_decoded ()
 {
-       _decoded = ContentAudio (shared_ptr<AudioBuffers> (new AudioBuffers (_stream->channels(), 0)), 0);
+       _decoded = ContentAudio (make_shared<AudioBuffers> (_stream->channels(), 0), 0);
 }
 
 ContentAudio
@@ -118,7 +120,7 @@ AudioDecoderStream::get (Frame frame, Frame length, bool accurate)
        Frame const to_return = max ((Frame) 0, min (available, length));
 
        /* Copy our data to the output */
-       shared_ptr<AudioBuffers> out (new AudioBuffers (_decoded.audio->channels(), to_return));
+       shared_ptr<AudioBuffers> out = make_shared<AudioBuffers> (_decoded.audio->channels(), to_return);
        out->copy_from (_decoded.audio.get(), to_return, decoded_offset, 0);
 
        Frame const remaining = max ((Frame) 0, available - to_return);
@@ -157,7 +159,7 @@ AudioDecoderStream::audio (shared_ptr<const AudioBuffers> data, ContentTime time
                Frame const delta_frames = delta.frames_round (frame_rate);
                if (delta_frames > 0) {
                        /* This data comes after the seek time.  Pad the data with some silence. */
-                       shared_ptr<AudioBuffers> padded (new AudioBuffers (data->channels(), data->frames() + delta_frames));
+                       shared_ptr<AudioBuffers> padded = make_shared<AudioBuffers> (data->channels(), data->frames() + delta_frames);
                        padded->make_silent ();
                        padded->copy_from (data.get(), data->frames(), 0, delta_frames);
                        data = padded;
@@ -172,7 +174,7 @@ AudioDecoderStream::audio (shared_ptr<const AudioBuffers> data, ContentTime time
                                */
                                return;
                        }
-                       shared_ptr<AudioBuffers> trimmed (new AudioBuffers (data->channels(), to_keep));
+                       shared_ptr<AudioBuffers> trimmed = make_shared<AudioBuffers> (data->channels(), to_keep);
                        trimmed->copy_from (data.get(), to_keep, to_discard, 0);
                        data = trimmed;
                        time += ContentTime::from_frames (to_discard, frame_rate);
index 893773ddd27a5304539ff3d2e0d95f59f7394cb7..e33d9879b1f2fe20064e93cbcbff8688c277e69d 100644 (file)
 #include "audio_delay.h"
 #include "audio_buffers.h"
 #include "dcpomatic_assert.h"
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 
 AudioDelay::AudioDelay (int samples)
        : _samples (samples)
@@ -38,7 +40,7 @@ AudioDelay::run (shared_ptr<const AudioBuffers> in)
        /* You can't call this with varying channel counts */
        DCPOMATIC_ASSERT (!_tail || in->channels() == _tail->channels());
 
-       shared_ptr<AudioBuffers> out (new AudioBuffers (in->channels(), in->frames()));
+       shared_ptr<AudioBuffers> out = make_shared<AudioBuffers> (in->channels(), in->frames());
 
        if (in->frames() > _samples) {
 
index 44345fc9d11f4e817865a402266d2b2bedff1b41..4203d074c148be49a25ee610e19c1b3574ebf9bd 100644 (file)
 
 #include "audio_filter.h"
 #include "audio_buffers.h"
+#include <boost/make_shared.hpp>
 #include <cmath>
 
 using std::min;
 using boost::shared_ptr;
+using boost::make_shared;
 
 /** @return array of floats which the caller must destroy with delete[] */
 float *
@@ -75,7 +77,7 @@ AudioFilter::~AudioFilter ()
 shared_ptr<AudioBuffers>
 AudioFilter::run (shared_ptr<const AudioBuffers> in)
 {
-       shared_ptr<AudioBuffers> out (new AudioBuffers (in->channels(), in->frames()));
+       shared_ptr<AudioBuffers> out = make_shared<AudioBuffers> (in->channels(), in->frames());
 
        if (!_tail) {
                _tail.reset (new AudioBuffers (in->channels(), _M + 1));
index 87a158a4e356c7af9dd0cd26f19ab6df29668e18..f27befb035a814f1c677e9b6c48020b8a2e88526 100644 (file)
@@ -25,12 +25,14 @@ extern "C" {
 #include <libavfilter/buffersink.h>
 #include <libavfilter/buffersrc.h>
 }
+#include <boost/make_shared.hpp>
 
 #include "i18n.h"
 
 using std::string;
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 
 AudioFilterGraph::AudioFilterGraph (int sample_rate, int channels)
        : _sample_rate (sample_rate)
@@ -113,7 +115,7 @@ AudioFilterGraph::process (shared_ptr<const AudioBuffers> buffers)
                   the constructor) so we need to create new buffers with some extra
                   silent channels.
                */
-               shared_ptr<AudioBuffers> extended_buffers (new AudioBuffers (process_channels, buffers->frames()));
+               shared_ptr<AudioBuffers> extended_buffers = make_shared<AudioBuffers> (process_channels, buffers->frames());
                for (int i = 0; i < buffers->channels(); ++i) {
                        extended_buffers->copy_channel_from (buffers.get(), i, i);
                }
index 469cf2e6b2de20d56687e91ff42cf2d3c1f5a452..3f1750621cea6166b1144b23fc754ce4972fbaf3 100644 (file)
 #include <dcp/raw_convert.h>
 #include <libxml++/libxml++.h>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::list;
 using std::string;
 using boost::shared_ptr;
+using boost::make_shared;
 
 Cinema::Cinema (cxml::ConstNodePtr node)
        : name (node->string_child ("Name"))
@@ -56,7 +58,7 @@ Cinema::read_screens (cxml::ConstNodePtr node)
 {
        list<cxml::NodePtr> s = node->node_children ("Screen");
        for (list<cxml::NodePtr>::iterator i = s.begin(); i != s.end(); ++i) {
-               add_screen (shared_ptr<Screen> (new Screen (*i)));
+               add_screen (make_shared<Screen> (*i));
        }
 }
 
index 84cd9c18f83a9b6bd6c9665da6eb929b158b4b92..b32da4d6ede6133f7b29e6f5f6ffb86794febe38 100644 (file)
@@ -29,6 +29,7 @@
 #include "log.h"
 #include <zip.h>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 
 #include "i18n.h"
 
@@ -37,6 +38,7 @@ using std::cout;
 using std::string;
 using std::runtime_error;
 using boost::shared_ptr;
+using boost::make_shared;
 
 void
 CinemaKDMs::make_zip_file (string film_name, boost::filesystem::path zip_file) const
@@ -53,7 +55,7 @@ CinemaKDMs::make_zip_file (string film_name, boost::filesystem::path zip_file) c
        list<shared_ptr<string> > kdm_strings;
 
        BOOST_FOREACH (ScreenKDM const & i, screen_kdms) {
-               shared_ptr<string> kdm (new string (i.kdm.as_xml ()));
+               shared_ptr<string> kdm = boost::make_shared<string> (i.kdm.as_xml ());
                kdm_strings.push_back (kdm);
 
                struct zip_source* source = zip_source_buffer (zip, kdm->c_str(), kdm->length(), 0);
index 891d832a24c6575a6e4b1130bb149334416e673b..8e1997325593f6845889bfc6096858593ecfb738 100644 (file)
@@ -39,6 +39,7 @@
 #include <boost/algorithm/string.hpp>
 #include <boost/foreach.hpp>
 #include <boost/thread.hpp>
+#include <boost/make_shared.hpp>
 #include <cstdlib>
 #include <fstream>
 #include <iostream>
@@ -55,6 +56,7 @@ using std::remove;
 using std::exception;
 using std::cerr;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::optional;
 using boost::algorithm::trim;
 
@@ -267,7 +269,7 @@ Config::read ()
 
        cxml::NodePtr signer = f.optional_node_child ("Signer");
        if (signer) {
-               shared_ptr<dcp::CertificateChain> c (new dcp::CertificateChain ());
+               shared_ptr<dcp::CertificateChain> c = make_shared<dcp::CertificateChain> ();
                /* Read the signing certificates and private key in from the config file */
                BOOST_FOREACH (cxml::NodePtr i, signer->node_children ("Certificate")) {
                        c->add (dcp::Certificate (i->content ()));
@@ -281,7 +283,7 @@ Config::read ()
 
        cxml::NodePtr decryption = f.optional_node_child ("Decryption");
        if (decryption) {
-               shared_ptr<dcp::CertificateChain> c (new dcp::CertificateChain ());
+               shared_ptr<dcp::CertificateChain> c = make_shared<dcp::CertificateChain> ();
                BOOST_FOREACH (cxml::NodePtr i, decryption->node_children ("Certificate")) {
                        c->add (dcp::Certificate (i->content ()));
                }
@@ -559,7 +561,7 @@ Config::read_cinemas (cxml::Document const & f)
                /* Slightly grotty two-part construction of Cinema here so that we can use
                   shared_from_this.
                */
-               shared_ptr<Cinema> cinema (new Cinema (*i));
+               shared_ptr<Cinema> cinema = make_shared<Cinema> (*i);
                cinema->read_screens (*i);
                _cinemas.push_back (cinema);
        }
index 295f33b3c4560955ecac9d2d8201945153fadc8e..dbbd65077b85c871457f994164274b5bb2603dcf 100644 (file)
@@ -35,6 +35,7 @@
 #include <dcp/reel.h>
 #include <libxml++/libxml++.h>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <iterator>
 #include <iostream>
 
@@ -47,6 +48,7 @@ using std::pair;
 using std::vector;
 using std::list;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::scoped_ptr;
 using boost::optional;
 using boost::function;
@@ -132,7 +134,7 @@ DCPContent::examine (shared_ptr<Job> job)
        job->set_progress_unknown ();
        Content::examine (job);
 
-       shared_ptr<DCPExaminer> examiner (new DCPExaminer (shared_from_this ()));
+       shared_ptr<DCPExaminer> examiner = make_shared<DCPExaminer> (shared_from_this ());
        video->take_from_examiner (examiner);
        set_default_colour_conversion ();
 
index e7e88d3191e9bf2a3ecfaa0f0f8108b1cf7e4613..3bf7c1464c82b298a45c3913581f687e4f3fba58 100644 (file)
 #include <dcp/sound_frame.h>
 #include <dcp/sound_asset_reader.h>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::list;
 using std::cout;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
+using boost::make_shared;
 
 DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c, shared_ptr<Log> log, bool fast)
        : _dcp_content (c)
@@ -94,15 +96,15 @@ DCPDecoder::pass (PassReason reason, bool)
                shared_ptr<dcp::PictureAsset> asset = (*_reel)->main_picture()->asset ();
                int64_t const entry_point = (*_reel)->main_picture()->entry_point ();
                if (_mono_reader) {
-                       video->give (shared_ptr<ImageProxy> (new J2KImageProxy (_mono_reader->get_frame (entry_point + frame), asset->size())), _offset + frame);
+                       video->give (make_shared<J2KImageProxy> (_mono_reader->get_frame (entry_point + frame), asset->size()), _offset + frame);
                } else {
                        video->give (
-                               shared_ptr<ImageProxy> (new J2KImageProxy (_stereo_reader->get_frame (entry_point + frame), asset->size(), dcp::EYE_LEFT)),
+                               make_shared<J2KImageProxy> (_stereo_reader->get_frame (entry_point + frame), asset->size(), dcp::EYE_LEFT),
                                _offset + frame
                                );
 
                        video->give (
-                               shared_ptr<ImageProxy> (new J2KImageProxy (_stereo_reader->get_frame (entry_point + frame), asset->size(), dcp::EYE_RIGHT)),
+                               make_shared<J2KImageProxy> (_stereo_reader->get_frame (entry_point + frame), asset->size(), dcp::EYE_RIGHT),
                                _offset + frame
                                );
                }
@@ -115,7 +117,7 @@ DCPDecoder::pass (PassReason reason, bool)
 
                int const channels = _dcp_content->audio->stream()->channels ();
                int const frames = sf->size() / (3 * channels);
-               shared_ptr<AudioBuffers> data (new AudioBuffers (channels, frames));
+               shared_ptr<AudioBuffers> data = make_shared<AudioBuffers> (channels, frames);
                for (int i = 0; i < frames; ++i) {
                        for (int j = 0; j < channels; ++j) {
                                data->data()[j][i] = static_cast<int> ((from[0] << 8) | (from[1] << 16) | (from[2] << 24)) / static_cast<float> (INT_MAX - 256);
index e7057efc4b59528585e77965d88233d52275cf7b..b361b941907551b160913bbe4121d872c8187661 100644 (file)
@@ -28,6 +28,7 @@
 #include <dcp/interop_load_font_node.h>
 #include <libxml++/libxml++.h>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 
 #include "i18n.h"
 
@@ -35,6 +36,7 @@ using std::string;
 using std::list;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
+using boost::make_shared;
 
 DCPSubtitleContent::DCPSubtitleContent (shared_ptr<const Film> film, boost::filesystem::path path)
        : Content (film, path)
@@ -76,7 +78,7 @@ DCPSubtitleContent::examine (shared_ptr<Job> job)
        _length = ContentTime::from_seconds (sc->latest_subtitle_out().as_seconds ());
 
        BOOST_FOREACH (shared_ptr<dcp::LoadFontNode> i, sc->load_font_nodes ()) {
-               subtitle->add_font (shared_ptr<Font> (new Font (i->id)));
+               subtitle->add_font (boost::make_shared<Font> (i->id));
        }
 }
 
index be69f3eedc1255740f221379b53c229a8833688b..6d270dab2613a1881e851ca747a935d95c3ab84a 100644 (file)
@@ -47,6 +47,7 @@
 #include <libxml++/libxml++.h>
 #include <boost/asio.hpp>
 #include <boost/thread.hpp>
+#include <boost/make_shared.hpp>
 #include <stdint.h>
 #include <iomanip>
 #include <iostream>
@@ -60,6 +61,7 @@
 using std::string;
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 using dcp::Size;
 using dcp::Data;
 
@@ -158,7 +160,7 @@ DCPVideo::encode_remotely (EncodeServerDescription serv, int timeout)
        boost::asio::ip::tcp::resolver::query query (serv.host_name(), raw_convert<string> (Config::instance()->server_port_base ()));
        boost::asio::ip::tcp::resolver::iterator endpoint_iterator = resolver.resolve (query);
 
-       shared_ptr<Socket> socket (new Socket (timeout));
+       shared_ptr<Socket> socket = make_shared<Socket> (timeout);
 
        socket->connect (*endpoint_iterator);
 
index dc01a043a56cf49aa1df7c0baf311be1aa6e9301..ec0140b0c1933ac1eee8bd991aa2f236928d9bb3 100644 (file)
 #include "video_mxf_content.h"
 #include "video_mxf_decoder.h"
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 
 using std::list;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
+using boost::make_shared;
 
 shared_ptr<Decoder>
 decoder_factory (shared_ptr<const Content> content, shared_ptr<Log> log, bool fast)
 {
        shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (content);
        if (fc) {
-               return shared_ptr<Decoder> (new FFmpegDecoder (fc, log, fast));
+               return make_shared<FFmpegDecoder> (fc, log, fast);
        }
 
        shared_ptr<const DCPContent> dc = dynamic_pointer_cast<const DCPContent> (content);
        if (dc) {
-               return shared_ptr<Decoder> (new DCPDecoder (dc, log, fast));
+               return make_shared<DCPDecoder> (dc, log, fast);
        }
 
        shared_ptr<const ImageContent> ic = dynamic_pointer_cast<const ImageContent> (content);
        if (ic) {
-               return shared_ptr<Decoder> (new ImageDecoder (ic, log));
+               return make_shared<ImageDecoder> (ic, log);
        }
 
        shared_ptr<const TextSubtitleContent> rc = dynamic_pointer_cast<const TextSubtitleContent> (content);
        if (rc) {
-               return shared_ptr<Decoder> (new TextSubtitleDecoder (rc));
+               return make_shared<TextSubtitleDecoder> (rc);
        }
 
        shared_ptr<const DCPSubtitleContent> dsc = dynamic_pointer_cast<const DCPSubtitleContent> (content);
        if (dsc) {
-               return shared_ptr<Decoder> (new DCPSubtitleDecoder (dsc));
+               return make_shared<DCPSubtitleDecoder> (dsc);
        }
 
        shared_ptr<const VideoMXFContent> vmc = dynamic_pointer_cast<const VideoMXFContent> (content);
        if (vmc) {
-               return shared_ptr<Decoder> (new VideoMXFDecoder (vmc, log));
+               return make_shared<VideoMXFDecoder> (vmc, log);
        }
 
        return shared_ptr<Decoder> ();
index f318da03b5c2878dc5be5f3d30e74244ebcdf57e..635913cc29ec8d304390389241f18a81fc06cd0c 100644 (file)
@@ -41,6 +41,7 @@
 #include <boost/algorithm/string.hpp>
 #include <boost/scoped_array.hpp>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <string>
 #include <vector>
 #include <iostream>
@@ -63,6 +64,7 @@ using boost::thread;
 using boost::bind;
 using boost::scoped_array;
 using boost::optional;
+using boost::make_shared;
 using dcp::Size;
 using dcp::Data;
 
@@ -108,7 +110,7 @@ EncodeServer::process (shared_ptr<Socket> socket, struct timeval& after_read, st
        socket->read (reinterpret_cast<uint8_t*> (buffer.get()), length);
 
        string s (buffer.get());
-       shared_ptr<cxml::Document> xml (new cxml::Document ("EncodingRequest"));
+       shared_ptr<cxml::Document> xml = make_shared<cxml::Document> ("EncodingRequest");
        xml->read_string (s);
        /* This is a double-check; the server shouldn't even be on the candidate list
           if it is the wrong version, but it doesn't hurt to make sure here.
@@ -119,7 +121,7 @@ EncodeServer::process (shared_ptr<Socket> socket, struct timeval& after_read, st
                return -1;
        }
 
-       shared_ptr<PlayerVideo> pvf (new PlayerVideo (xml, socket));
+       shared_ptr<PlayerVideo> pvf = make_shared<PlayerVideo> (xml, socket);
 
        DCPVideo dcp_video_frame (pvf, xml, _log);
 
@@ -264,7 +266,7 @@ EncodeServer::broadcast_received ()
                if (_verbose) {
                        cout << "Offering services to master " << _broadcast.send_endpoint.address().to_string () << "\n";
                }
-               shared_ptr<Socket> socket (new Socket);
+               shared_ptr<Socket> socket = make_shared<Socket> ();
                try {
                        socket->connect (boost::asio::ip::tcp::endpoint (_broadcast.send_endpoint.address(), Config::instance()->server_port_base() + 1));
                        socket->write (xml.length() + 1);
index 7491d9ef7cc3d578ffd7ecbd8be7e80d87c7fb70..a017a0af1f2613dd98253d1e6f0f35d10c90598b 100644 (file)
@@ -28,6 +28,7 @@
 #include "raw_convert.h"
 #include <libcxml/cxml.h>
 #include <boost/lambda/lambda.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 #include "i18n.h"
@@ -39,6 +40,7 @@ using std::cout;
 using boost::shared_ptr;
 using boost::scoped_array;
 using boost::weak_ptr;
+using boost::make_shared;
 
 EncodeServerFinder* EncodeServerFinder::_instance = 0;
 
@@ -151,7 +153,7 @@ catch (...)
 void
 EncodeServerFinder::start_accept ()
 {
-       shared_ptr<Socket> socket (new Socket ());
+       shared_ptr<Socket> socket = make_shared<Socket> ();
        _listen_acceptor->async_accept (
                socket->socket(),
                boost::bind (&EncodeServerFinder::handle_accept, this, boost::asio::placeholders::error, socket)
@@ -174,7 +176,7 @@ EncodeServerFinder::handle_accept (boost::system::error_code ec, shared_ptr<Sock
        socket->read (reinterpret_cast<uint8_t*> (buffer.get()), length);
 
        string s (buffer.get());
-       shared_ptr<cxml::Document> xml (new cxml::Document ("ServerAvailable"));
+       shared_ptr<cxml::Document> xml = make_shared<cxml::Document> ("ServerAvailable");
        xml->read_string (s);
 
        string const ip = socket->socket().remote_endpoint().address().to_string ();
index b34fdf6aa811bd48fbfecf8a69b25c80ae51eafa..f3a4c4c4fc7893441267ea6d916f2fcadec98059 100644 (file)
@@ -42,6 +42,7 @@ extern "C" {
 }
 #include <libxml++/libxml++.h>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 #include "i18n.h"
@@ -56,6 +57,7 @@ using std::pair;
 using std::make_pair;
 using std::max;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::dynamic_pointer_cast;
 using boost::optional;
 
@@ -78,7 +80,7 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, cxml::ConstNodePtr no
 
        list<cxml::NodePtr> c = node->node_children ("SubtitleStream");
        for (list<cxml::NodePtr>::const_iterator i = c.begin(); i != c.end(); ++i) {
-               _subtitle_streams.push_back (shared_ptr<FFmpegSubtitleStream> (new FFmpegSubtitleStream (*i, version)));
+               _subtitle_streams.push_back (make_shared<FFmpegSubtitleStream> (*i, version));
                if ((*i)->optional_number_child<int> ("Selected")) {
                        _subtitle_stream = _subtitle_streams.back ();
                }
@@ -86,7 +88,7 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, cxml::ConstNodePtr no
 
        c = node->node_children ("AudioStream");
        for (list<cxml::NodePtr>::const_iterator i = c.begin(); i != c.end(); ++i) {
-               shared_ptr<FFmpegAudioStream> as (new FFmpegAudioStream (*i, version));
+               shared_ptr<FFmpegAudioStream> as = make_shared<FFmpegAudioStream> (*i, version);
                audio->add_stream (as);
                if (version < 11 && !(*i)->optional_node_child ("Selected")) {
                        /* This is an old file and this stream is not selected, so un-map it */
@@ -210,7 +212,7 @@ FFmpegContent::examine (shared_ptr<Job> job)
 
        Content::examine (job);
 
-       shared_ptr<FFmpegExaminer> examiner (new FFmpegExaminer (shared_from_this (), job));
+       shared_ptr<FFmpegExaminer> examiner = make_shared<FFmpegExaminer> (shared_from_this (), job);
 
        if (examiner->has_video ()) {
                video.reset (new VideoContent (this));
index df6b7416b35a2fc521846ed91ec490e6faaef45d..69ed7ac125f961828a748ce68d2886e5849eea36 100644 (file)
@@ -50,6 +50,7 @@ extern "C" {
 }
 #include <boost/foreach.hpp>
 #include <boost/algorithm/string.hpp>
+#include <boost/make_shared.hpp>
 #include <vector>
 #include <iomanip>
 #include <iostream>
@@ -71,6 +72,7 @@ using std::pair;
 using std::max;
 using std::map;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::is_any_of;
 using boost::split;
 using dcp::Size;
@@ -175,7 +177,7 @@ FFmpegDecoder::deinterleave_audio (shared_ptr<FFmpegAudioStream> stream) const
        */
        int const total_samples = size / bytes_per_audio_sample (stream);
        int const frames = total_samples / stream->channels();
-       shared_ptr<AudioBuffers> audio (new AudioBuffers (stream->channels(), frames));
+       shared_ptr<AudioBuffers> audio = make_shared<AudioBuffers> (stream->channels(), frames);
 
        switch (audio_sample_format (stream)) {
        case AV_SAMPLE_FMT_U8:
@@ -452,7 +454,7 @@ FFmpegDecoder::decode_video_packet ()
                if (i->second != AV_NOPTS_VALUE) {
                        double const pts = i->second * av_q2d (_format_context->streams[_video_stream.get()]->time_base) + _pts_offset.seconds ();
                        video->give (
-                               shared_ptr<ImageProxy> (new RawImageProxy (image)),
+                               make_shared<RawImageProxy> (image),
                                llrint (pts * _ffmpeg_content->active_video_frame_rate ())
                                );
                } else {
@@ -532,7 +534,7 @@ FFmpegDecoder::decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTimeP
        /* Note RGBA is expressed little-endian, so the first byte in the word is R, second
           G, third B, fourth A.
        */
-       shared_ptr<Image> image (new Image (AV_PIX_FMT_RGBA, dcp::Size (rect->w, rect->h), true));
+       shared_ptr<Image> image = make_shared<Image> (AV_PIX_FMT_RGBA, dcp::Size (rect->w, rect->h), true);
 
 #ifdef DCPOMATIC_HAVE_AVSUBTITLERECT_PICT
        /* Start of the first line in the subtitle */
index 18a87f40e591ab0e27d66b88d2677ea75043bae4..2e48810b1ed87779a9bd6e5f53d1df5931cc4a89 100644 (file)
@@ -32,6 +32,7 @@ extern "C" {
 #include "util.h"
 #include "safe_stringstream.h"
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 #include "i18n.h"
@@ -40,6 +41,7 @@ using std::string;
 using std::cout;
 using std::max;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::optional;
 
 /** @param job job that the examiner is operating in, or 0 */
@@ -80,7 +82,7 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c, shared_ptr<Jo
                                );
 
                } else if (s->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
-                       _subtitle_streams.push_back (shared_ptr<FFmpegSubtitleStream> (new FFmpegSubtitleStream (subtitle_stream_name (s), s->id)));
+                       _subtitle_streams.push_back (boost::make_shared<FFmpegSubtitleStream> (subtitle_stream_name (s), s->id));
                }
        }
 
index 3cd3f0f21e7ec5c4e9546569b142a8b21155740b..3378b2042818a4f716f589c3aef2655c310f3120 100644 (file)
@@ -62,6 +62,7 @@
 #include <boost/filesystem.hpp>
 #include <boost/algorithm/string.hpp>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <boost/regex.hpp>
 #include <unistd.h>
 #include <stdexcept>
@@ -89,6 +90,7 @@ using boost::weak_ptr;
 using boost::dynamic_pointer_cast;
 using boost::optional;
 using boost::is_any_of;
+using boost::make_shared;
 
 #define LOG_GENERAL(...) log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
 #define LOG_GENERAL_NC(...) log()->log (__VA_ARGS__, LogEntry::TYPE_GENERAL);
@@ -318,21 +320,21 @@ Film::make_dcp ()
                throw MissingSettingError (_("name"));
        }
 
-       JobManager::instance()->add (shared_ptr<Job> (new TranscodeJob (shared_from_this())));
+       JobManager::instance()->add (make_shared<TranscodeJob> (shared_from_this()));
 }
 
 /** Start a job to send our DCP to the configured TMS */
 void
 Film::send_dcp_to_tms ()
 {
-       shared_ptr<Job> j (new UploadJob (shared_from_this()));
+       shared_ptr<Job> j = make_shared<UploadJob> (shared_from_this());
        JobManager::instance()->add (j);
 }
 
 shared_ptr<xmlpp::Document>
 Film::metadata () const
 {
-       shared_ptr<xmlpp::Document> doc (new xmlpp::Document);
+       shared_ptr<xmlpp::Document> doc = make_shared<xmlpp::Document> ();
        xmlpp::Element* root = doc->create_root_node ("Metadata");
 
        root->add_child("Version")->add_child_text (raw_convert<string> (current_state_version));
@@ -1003,7 +1005,7 @@ Film::content () const
 void
 Film::examine_content (shared_ptr<Content> c)
 {
-       shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c));
+       shared_ptr<Job> j = make_shared<ExamineContentJob> (shared_from_this(), c);
        JobManager::instance()->add (j);
 }
 
@@ -1014,7 +1016,7 @@ Film::examine_and_add_content (shared_ptr<Content> c)
                run_ffprobe (c->path(0), file ("ffprobe.log"), _log);
        }
 
-       shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c));
+       shared_ptr<Job> j = make_shared<ExamineContentJob> (shared_from_this(), c);
 
        _job_connections.push_back (
                j->Finished.connect (bind (&Film::maybe_add_content, this, weak_ptr<Job> (j), weak_ptr<Content> (c)))
@@ -1038,7 +1040,7 @@ Film::maybe_add_content (weak_ptr<Job> j, weak_ptr<Content> c)
 
        add_content (content);
        if (Config::instance()->automatic_audio_analysis() && content->audio) {
-               shared_ptr<Playlist> playlist (new Playlist);
+               shared_ptr<Playlist> playlist = make_shared<Playlist> ();
                playlist->add (content);
                boost::signals2::connection c;
                JobManager::instance()->analyse_audio (
@@ -1180,7 +1182,7 @@ Film::make_kdm (
        dcp::Formulation formulation
        ) const
 {
-       shared_ptr<const dcp::CPL> cpl (new dcp::CPL (cpl_file));
+       shared_ptr<const dcp::CPL> cpl = make_shared<dcp::CPL> (cpl_file);
        shared_ptr<const dcp::CertificateChain> signer = Config::instance()->signer_chain ();
        if (!signer->valid ()) {
                throw InvalidSignerError ();
index 71a3a5bccd9b174b5ffea94f7eecbac250265952..1107f0a4077964ef07b67e221ade50d98f9b0fcb 100644 (file)
@@ -34,6 +34,7 @@ extern "C" {
 #include <libavutil/pixdesc.h>
 #include <libavutil/frame.h>
 }
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 #include "i18n.h"
@@ -45,6 +46,7 @@ using std::cerr;
 using std::list;
 using std::runtime_error;
 using boost::shared_ptr;
+using boost::make_shared;
 using dcp::Size;
 
 int
@@ -149,7 +151,7 @@ Image::crop_scale_window (
           To get around this, we ask Image to overallocate its buffers by the overrun.
        */
 
-       shared_ptr<Image> out (new Image (out_format, out_size, out_aligned, (out_size.width - inter_size.width) / 2));
+       shared_ptr<Image> out = make_shared<Image> (out_format, out_size, out_aligned, (out_size.width - inter_size.width) / 2);
        out->make_black ();
 
        /* Size of the image after any crop */
@@ -227,7 +229,7 @@ Image::scale (dcp::Size out_size, dcp::YUVToRGB yuv_to_rgb, AVPixelFormat out_fo
        */
        DCPOMATIC_ASSERT (aligned ());
 
-       shared_ptr<Image> scaled (new Image (out_format, out_size, out_aligned));
+       shared_ptr<Image> scaled = make_shared<Image> (out_format, out_size, out_aligned);
 
        struct SwsContext* scale_context = sws_getContext (
                size().width, size().height, pixel_format(),
@@ -819,7 +821,7 @@ merge (list<PositionImage> images)
                all.extend (dcpomatic::Rect<int> (i->position, i->image->size().width, i->image->size().height));
        }
 
-       shared_ptr<Image> merged (new Image (images.front().image->pixel_format (), dcp::Size (all.width, all.height), true));
+       shared_ptr<Image> merged = make_shared<Image> (images.front().image->pixel_format (), dcp::Size (all.width, all.height), true);
        merged->make_transparent ();
        for (list<PositionImage>::const_iterator i = images.begin(); i != images.end(); ++i) {
                merged->alpha_blend (i->image, i->position - all.position());
index d4e73677113dd72a64396ae1bb0c6822d1f5fb60..ca8bd380f1c6259821a46129e84ca684cda830b1 100644 (file)
@@ -31,6 +31,7 @@
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 #include "i18n.h"
@@ -39,6 +40,7 @@ using std::string;
 using std::cout;
 using std::list;
 using boost::shared_ptr;
+using boost::make_shared;
 
 ImageContent::ImageContent (shared_ptr<const Film> film, boost::filesystem::path p)
        : Content (film)
@@ -119,7 +121,7 @@ ImageContent::examine (shared_ptr<Job> job)
        shared_ptr<const Film> film = _film.lock ();
        DCPOMATIC_ASSERT (film);
 
-       shared_ptr<ImageExaminer> examiner (new ImageExaminer (film, shared_from_this(), job));
+       shared_ptr<ImageExaminer> examiner = make_shared<ImageExaminer> (film, shared_from_this(), job);
        video->take_from_examiner (examiner);
        set_default_colour_conversion ();
 }
index 3a09cb8e8cd0cbce273bea7a66403178d34800a8..69c296605cd8fb6dfa7c8afd995b9dc72097445f 100644 (file)
@@ -27,6 +27,7 @@
 #include "cross.h"
 #include <dcp/util.h>
 #include <libcxml/cxml.h>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 #include "i18n.h"
 using std::cout;
 using std::string;
 using boost::shared_ptr;
+using boost::make_shared;
 
 shared_ptr<ImageProxy>
 image_proxy_factory (shared_ptr<cxml::Node> xml, shared_ptr<Socket> socket)
 {
        if (xml->string_child("Type") == N_("Raw")) {
-               return shared_ptr<ImageProxy> (new RawImageProxy (xml, socket));
+               return make_shared<RawImageProxy> (xml, socket);
        } else if (xml->string_child("Type") == N_("Magick")) {
-               return shared_ptr<MagickImageProxy> (new MagickImageProxy (xml, socket));
+               return make_shared<MagickImageProxy> (xml, socket);
        } else if (xml->string_child("Type") == N_("J2K")) {
-               return shared_ptr<J2KImageProxy> (new J2KImageProxy (xml, socket));
+               return make_shared<J2KImageProxy> (xml, socket);
        }
 
        throw NetworkError (_("Unexpected image type received by server"));
index 44b5ebea7f6d67cce56f367e7d917f5173e4fcc1..35d70162ccfb014b695d5ef65f8b9d48488a2499 100644 (file)
@@ -30,6 +30,7 @@
 #include <dcp/j2k.h>
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 #include "i18n.h"
@@ -39,6 +40,7 @@ using std::cout;
 using boost::shared_ptr;
 using boost::optional;
 using boost::dynamic_pointer_cast;
+using boost::make_shared;
 using dcp::Data;
 
 /** Construct a J2KImageProxy from a JPEG2000 file */
@@ -107,7 +109,7 @@ J2KImageProxy::image (optional<dcp::NoteHandler>) const
                }
        }
 
-       shared_ptr<Image> image (new Image (pixel_format(), _size, true));
+       shared_ptr<Image> image = make_shared<Image> (pixel_format(), _size, true);
 
        /* Copy data in whatever format (sRGB or XYZ) into our Image; I'm assuming
           the data is 12-bit either way.
index 0006201e66c3b6a04bb52d01c4fa222ad55d3a37..6e53f9819c3fcddd2bc1c21324705037556ef5ef 100644 (file)
@@ -27,6 +27,7 @@
 #include "util.h"
 #include "film.h"
 #include "transcode_job.h"
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::string;
@@ -35,6 +36,7 @@ using std::map;
 using std::list;
 using boost::thread;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::dynamic_pointer_cast;
 using boost::asio::ip::tcp;
 
@@ -61,7 +63,7 @@ try
        tcp::acceptor a (io_service, tcp::endpoint (tcp::v4 (), port));
        while (true) {
                try {
-                       shared_ptr<tcp::socket> s (new tcp::socket (io_service));
+                       shared_ptr<tcp::socket> s = make_shared<tcp::socket> (io_service);
                        a.accept (*s);
                        handle (s);
                }
index b7edd4e29d93d0a0cde0c9c87f1c77e5b11fecea..769852044348cebbbafc37ba66c02656928bb513 100644 (file)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "safe_stringstream.h"
 #include "string_log_entry.h"
+#include <boost/make_shared.hpp>
 #include <time.h>
 #include <cstdio>
 
@@ -35,6 +36,7 @@
 using std::string;
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 
 Log::Log ()
        : _types (0)
@@ -71,7 +73,7 @@ Log::log (string message, int type)
                return;
        }
 
-       shared_ptr<StringLogEntry> e (new StringLogEntry (type, message));
+       shared_ptr<StringLogEntry> e = boost::make_shared<StringLogEntry> (type, message);
 
        do_log (e);
 }
@@ -81,13 +83,13 @@ Log::dcp_log (dcp::NoteType type, string m)
 {
        switch (type) {
        case dcp::DCP_PROGRESS:
-               do_log (shared_ptr<const LogEntry> (new StringLogEntry (LogEntry::TYPE_GENERAL, m)));
+               do_log (boost::make_shared<const StringLogEntry> (LogEntry::TYPE_GENERAL, m));
                break;
        case dcp::DCP_ERROR:
-               do_log (shared_ptr<const LogEntry> (new StringLogEntry (LogEntry::TYPE_ERROR, m)));
+               do_log (boost::make_shared<const StringLogEntry> (LogEntry::TYPE_ERROR, m));
                break;
        case dcp::DCP_NOTE:
-               do_log (shared_ptr<const LogEntry> (new StringLogEntry (LogEntry::TYPE_WARNING, m)));
+               do_log (boost::make_shared<const StringLogEntry> (LogEntry::TYPE_WARNING, m));
                break;
        }
 }
index b9b8dd098c9459e2524de2633c36520632631956..8d5dc1875b76c2bf38e66181b206c588fecd0b84 100644 (file)
@@ -21,6 +21,7 @@
 #include "mid_side_decoder.h"
 #include "audio_buffers.h"
 #include "audio_mapping.h"
+#include <boost/make_shared.hpp>
 
 #include "i18n.h"
 
@@ -28,6 +29,7 @@ using std::string;
 using std::min;
 using std::vector;
 using boost::shared_ptr;
+using boost::make_shared;
 
 string
 MidSideDecoder::name () const
@@ -50,14 +52,14 @@ MidSideDecoder::out_channels () const
 shared_ptr<AudioProcessor>
 MidSideDecoder::clone (int) const
 {
-       return shared_ptr<AudioProcessor> (new MidSideDecoder ());
+       return make_shared<MidSideDecoder> ();
 }
 
 shared_ptr<AudioBuffers>
 MidSideDecoder::run (shared_ptr<const AudioBuffers> in, int channels)
 {
        int const N = min (channels, 3);
-       shared_ptr<AudioBuffers> out (new AudioBuffers (channels, in->frames ()));
+       shared_ptr<AudioBuffers> out = make_shared<AudioBuffers> (channels, in->frames ());
        for (int i = 0; i < in->frames(); ++i) {
                float const left = in->data()[0][i];
                float const right = in->data()[1][i];
index 30313d39dd23bb57445cf43ff8a45f7b9c2d8b00..1d3e22e2094435f0488237ebb179357a40533076 100644 (file)
@@ -52,6 +52,7 @@
 #include <dcp/reel_subtitle_asset.h>
 #include <dcp/reel_picture_asset.h>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <stdint.h>
 #include <algorithm>
 #include <iostream>
@@ -71,6 +72,7 @@ using std::map;
 using std::make_pair;
 using std::copy;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::weak_ptr;
 using boost::dynamic_pointer_cast;
 using boost::optional;
@@ -139,7 +141,7 @@ Player::setup_pieces ()
                        decoder->audio->set_ignore ();
                }
 
-               _pieces.push_back (shared_ptr<Piece> (new Piece (i, decoder, frc)));
+               _pieces.push_back (make_shared<Piece> (i, decoder, frc));
        }
 
        _have_valid_pieces = true;
@@ -278,7 +280,7 @@ Player::black_player_video_frame (DCPTime time) const
 {
        return shared_ptr<PlayerVideo> (
                new PlayerVideo (
-                       shared_ptr<const ImageProxy> (new RawImageProxy (_black_image)),
+                       make_shared<RawImageProxy> (_black_image),
                        time,
                        Crop (),
                        optional<double> (),
@@ -413,7 +415,7 @@ Player::get_audio (DCPTime time, DCPTime length, bool accurate)
 
        Frame const length_frames = length.frames_round (_film->audio_frame_rate ());
 
-       shared_ptr<AudioBuffers> audio (new AudioBuffers (_film->audio_channels(), length_frames));
+       shared_ptr<AudioBuffers> audio = make_shared<AudioBuffers> (_film->audio_channels(), length_frames);
        audio->make_silent ();
 
        list<shared_ptr<Piece> > ov = overlaps (time, time + length, has_audio);
@@ -470,13 +472,13 @@ Player::get_audio (DCPTime time, DCPTime length, bool accurate)
 
                        /* Gain */
                        if (i->content->audio->gain() != 0) {
-                               shared_ptr<AudioBuffers> gain (new AudioBuffers (all.audio));
+                               shared_ptr<AudioBuffers> gain = make_shared<AudioBuffers> (all.audio);
                                gain->apply_gain (i->content->audio->gain ());
                                all.audio = gain;
                        }
 
                        /* Remap channels */
-                       shared_ptr<AudioBuffers> dcp_mapped (new AudioBuffers (_film->audio_channels(), all.audio->frames()));
+                       shared_ptr<AudioBuffers> dcp_mapped = make_shared<AudioBuffers> (_film->audio_channels(), all.audio->frames());
                        dcp_mapped->make_silent ();
                        AudioMapping map = j->mapping ();
                        for (int i = 0; i < map.input_channels(); ++i) {
index e6533d2cc292ca0e9c49f8da78a41f0604b5a276..eff5c48eeede1342e2b61f2dee07abb9f3abbd74 100644 (file)
@@ -42,6 +42,7 @@
 #include <dcp/interop_subtitle_asset.h>
 #include <dcp/smpte_subtitle_asset.h>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 
 #include "i18n.h"
 
@@ -54,6 +55,7 @@ using std::list;
 using std::string;
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::optional;
 using boost::dynamic_pointer_cast;
 using dcp::Data;
@@ -303,7 +305,7 @@ ReelWriter::finish ()
 shared_ptr<dcp::Reel>
 ReelWriter::create_reel (list<ReferencedReelAsset> const & refs, list<shared_ptr<Font> > const & fonts)
 {
-       shared_ptr<dcp::Reel> reel (new dcp::Reel ());
+       shared_ptr<dcp::Reel> reel = make_shared<dcp::Reel> ();
 
        shared_ptr<dcp::ReelPictureAsset> reel_picture_asset;
 
@@ -336,7 +338,7 @@ ReelWriter::create_reel (list<ReferencedReelAsset> const & refs, list<shared_ptr
 
        if (_sound_asset) {
                /* We have made a sound asset of our own.  Put it into the reel */
-               reel->add (shared_ptr<dcp::ReelSoundAsset> (new dcp::ReelSoundAsset (_sound_asset, 0)));
+               reel->add (make_shared<dcp::ReelSoundAsset> (_sound_asset, 0));
        } else {
                /* We don't have a sound asset of our own; hopefully we have one to reference */
                BOOST_FOREACH (ReferencedReelAsset j, refs) {
@@ -460,13 +462,13 @@ ReelWriter::write (PlayerSubtitles subs)
                        lang = "Unknown";
                }
                if (_film->interop ()) {
-                       shared_ptr<dcp::InteropSubtitleAsset> s (new dcp::InteropSubtitleAsset ());
+                       shared_ptr<dcp::InteropSubtitleAsset> s = make_shared<dcp::InteropSubtitleAsset> ();
                        s->set_movie_title (_film->name ());
                        s->set_language (lang);
                        s->set_reel_number ("1");
                        _subtitle_asset = s;
                } else {
-                       shared_ptr<dcp::SMPTESubtitleAsset> s (new dcp::SMPTESubtitleAsset ());
+                       shared_ptr<dcp::SMPTESubtitleAsset> s = make_shared<dcp::SMPTESubtitleAsset> ();
                        s->set_content_title_text (_film->name ());
                        s->set_language (lang);
                        s->set_edit_rate (dcp::Fraction (_film->video_frame_rate (), 1));
index 76aa092297d9c880a6a5949f78354d953e249e93..94a6b837b2f5981e583b0a93bc4d53f9446e7491 100644 (file)
@@ -28,6 +28,7 @@
 #include <cairomm/cairomm.h>
 #include <pangomm.h>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::list;
@@ -39,6 +40,7 @@ using std::pair;
 using std::cerr;
 using std::make_pair;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::optional;
 
 static FcConfig* fc_config = 0;
@@ -80,7 +82,7 @@ render_line (list<dcp::SubtitleString> subtitles, list<shared_ptr<Font> > fonts,
        /* ...and add a bit more for luck */
        height += target.height / 11;
 
-       shared_ptr<Image> image (new Image (AV_PIX_FMT_RGBA, dcp::Size (target.width, height), false));
+       shared_ptr<Image> image = make_shared<Image> (AV_PIX_FMT_RGBA, dcp::Size (target.width, height), false);
        image->make_black ();
 
 #ifdef DCPOMATIC_HAVE_FORMAT_STRIDE_FOR_WIDTH
index db5552d15ab3159b17510ca1295704d8806507a0..4476d9f1f9b2220cab1160ae876246e301a49661 100644 (file)
@@ -24,6 +24,7 @@
 #include "compose.hpp"
 #include "dcpomatic_assert.h"
 #include <samplerate.h>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 #include "i18n.h"
@@ -33,6 +34,7 @@ using std::pair;
 using std::make_pair;
 using std::runtime_error;
 using boost::shared_ptr;
+using boost::make_shared;
 
 /** @param in Input sampling rate (Hz)
  *  @param out Output sampling rate (Hz)
@@ -62,7 +64,7 @@ Resampler::run (shared_ptr<const AudioBuffers> in)
        int in_frames = in->frames ();
        int in_offset = 0;
        int out_offset = 0;
-       shared_ptr<AudioBuffers> resampled (new AudioBuffers (_channels, 0));
+       shared_ptr<AudioBuffers> resampled = make_shared<AudioBuffers> (_channels, 0);
 
        while (in_frames > 0) {
 
@@ -136,7 +138,7 @@ Resampler::run (shared_ptr<const AudioBuffers> in)
 shared_ptr<const AudioBuffers>
 Resampler::flush ()
 {
-       shared_ptr<AudioBuffers> out (new AudioBuffers (_channels, 0));
+       shared_ptr<AudioBuffers> out = make_shared<AudioBuffers> (_channels, 0);
        int out_offset = 0;
        int64_t const output_size = 65536;
 
index 09e0a4bd0524cf91c6a4db010859713bda2d081f..d90ec9116dcf9ed5e1fa5d75e12063c3a9c4072a 100644 (file)
 
 #include "server.h"
 #include "dcpomatic_socket.h"
+#include <boost/make_shared.hpp>
 
 #include "i18n.h"
 
 using boost::shared_ptr;
+using boost::make_shared;
 
 Server::Server (int port)
        : _terminate (false)
@@ -56,7 +58,7 @@ Server::start_accept ()
                }
        }
 
-       shared_ptr<Socket> socket (new Socket);
+       shared_ptr<Socket> socket = make_shared<Socket> ();
        _acceptor.async_accept (socket->socket (), boost::bind (&Server::handle_accept, this, socket, boost::asio::placeholders::error));
 }
 
index 5b3b453b6eaf12d7614c0a3b6beb2f2b87da3bdb..9fd49831fd7f6b98914307501afe3d5def8ec2eb 100644 (file)
@@ -28,6 +28,7 @@
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 #include "i18n.h"
@@ -37,6 +38,7 @@ using std::vector;
 using std::cout;
 using std::list;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::dynamic_pointer_cast;
 
 int const SubtitleContentProperty::X_OFFSET = 500;
@@ -84,6 +86,7 @@ SubtitleContent::from_xml (Content* parent, cxml::ConstNodePtr node, int version
                return shared_ptr<SubtitleContent> ();
        }
 
+       /* Can't use make_shared here as the constructor is private */
        return shared_ptr<SubtitleContent> (new SubtitleContent (parent, node, version));
 }
 
@@ -130,7 +133,7 @@ SubtitleContent::SubtitleContent (Content* parent, cxml::ConstNodePtr node, int
 
        list<cxml::NodePtr> fonts = node->node_children ("Font");
        for (list<cxml::NodePtr>::const_iterator i = fonts.begin(); i != fonts.end(); ++i) {
-               _fonts.push_back (shared_ptr<Font> (new Font (*i)));
+               _fonts.push_back (make_shared<Font> (*i));
        }
 
        connect_to_fonts ();
index 24a328d088e3c05001f9be31f2f1b614233010da..ea56ac7bb0c9d531f19e8e96cae29ff9fb2e80b4 100644 (file)
@@ -26,6 +26,7 @@
 #include "raw_convert.h"
 #include "subtitle_content.h"
 #include <libxml++/libxml++.h>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 #include "i18n.h"
@@ -33,6 +34,7 @@
 using std::string;
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 
 TextSubtitleContent::TextSubtitleContent (shared_ptr<const Film> film, boost::filesystem::path path)
        : Content (film, path)
@@ -58,7 +60,7 @@ TextSubtitleContent::examine (boost::shared_ptr<Job> job)
 
        boost::mutex::scoped_lock lm (_mutex);
        _length = s.length ();
-       subtitle->add_font (shared_ptr<Font> (new Font (TEXT_FONT_ID)));
+       subtitle->add_font (make_shared<Font> (TEXT_FONT_ID));
 }
 
 string
index 7144f70d5127242fd7dca122e94713f1b761d2ff..5e41253b8fe7c96cc8811a51a9091b438df3bf2a 100644 (file)
@@ -30,6 +30,7 @@
 #include "log.h"
 #include "safe_stringstream.h"
 #include "compose.hpp"
+#include <boost/make_shared.hpp>
 #include <iostream>
 #include <iomanip>
 
@@ -44,6 +45,7 @@ using std::fixed;
 using std::setprecision;
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 
 /** @param s Film to use.
  */
@@ -90,7 +92,7 @@ TranscodeJob::run ()
                _transcoder.reset ();
 
                if (_film->upload_after_make_dcp ()) {
-                       shared_ptr<Job> job (new UploadJob (_film));
+                       shared_ptr<Job> job = make_shared<UploadJob> (_film);
                        JobManager::instance()->add (job);
                }
 
index a1221e5ac580e78b5acc6966169458189583c628..e390487d44c92887ff3d7cfdb4185e29e853719e 100644 (file)
@@ -21,6 +21,7 @@
 #include "upmixer_a.h"
 #include "audio_buffers.h"
 #include "audio_mapping.h"
+#include <boost/make_shared.hpp>
 
 #include "i18n.h"
 
@@ -28,6 +29,7 @@ using std::string;
 using std::min;
 using std::vector;
 using boost::shared_ptr;
+using boost::make_shared;
 
 UpmixerA::UpmixerA (int sampling_rate)
        : _left (0.02, 1900.0 / sampling_rate, 4800.0 / sampling_rate)
@@ -61,7 +63,7 @@ UpmixerA::out_channels () const
 shared_ptr<AudioProcessor>
 UpmixerA::clone (int sampling_rate) const
 {
-       return shared_ptr<AudioProcessor> (new UpmixerA (sampling_rate));
+       return make_shared<UpmixerA> (sampling_rate);
 }
 
 shared_ptr<AudioBuffers>
@@ -85,7 +87,7 @@ UpmixerA::run (shared_ptr<const AudioBuffers> in, int channels)
        all_out.push_back (_ls.run (in_L));
        all_out.push_back (_rs.run (in_R));
 
-       shared_ptr<AudioBuffers> out (new AudioBuffers (channels, in->frames ()));
+       shared_ptr<AudioBuffers> out = make_shared<AudioBuffers> (channels, in->frames ());
        int const N = min (channels, 6);
 
        for (int i = 0; i < N; ++i) {
index 90e1267cdb7af8021ac9ab16484ee340e24b3c28..65452424ad066dcf0bd8551414e66f43d4552ba2 100644 (file)
@@ -21,6 +21,7 @@
 #include "upmixer_b.h"
 #include "audio_buffers.h"
 #include "audio_mapping.h"
+#include <boost/make_shared.hpp>
 
 #include "i18n.h"
 
@@ -28,6 +29,7 @@ using std::string;
 using std::min;
 using std::vector;
 using boost::shared_ptr;
+using boost::make_shared;
 
 UpmixerB::UpmixerB (int sampling_rate)
        : _lfe (0.01, 150.0 / sampling_rate)
@@ -58,13 +60,13 @@ UpmixerB::out_channels () const
 shared_ptr<AudioProcessor>
 UpmixerB::clone (int sampling_rate) const
 {
-       return shared_ptr<AudioProcessor> (new UpmixerB (sampling_rate));
+       return make_shared<UpmixerB> (sampling_rate);
 }
 
 shared_ptr<AudioBuffers>
 UpmixerB::run (shared_ptr<const AudioBuffers> in, int channels)
 {
-       shared_ptr<AudioBuffers> out (new AudioBuffers (channels, in->frames()));
+       shared_ptr<AudioBuffers> out = make_shared<AudioBuffers> (channels, in->frames());
 
        /* L + R minus 6dB (in terms of amplitude) */
        shared_ptr<AudioBuffers> in_LR = in->channel(0);
@@ -94,7 +96,7 @@ UpmixerB::run (shared_ptr<const AudioBuffers> in, int channels)
        shared_ptr<AudioBuffers> S;
        if (channels > 4) {
                /* Ls is L - R with some delay */
-               shared_ptr<AudioBuffers> sub (new AudioBuffers (1, in->frames()));
+               shared_ptr<AudioBuffers> sub = make_shared<AudioBuffers> (1, in->frames());
                sub->copy_channel_from (in.get(), 0, 0);
                float* p = sub->data (0);
                float const * q = in->data (1);
index a59e9669d62de990b6f4b9359476ee17bededcb4..ae6cb64dd9889820ec060ea61781651267903ed0 100644 (file)
@@ -83,6 +83,7 @@ VideoContent::from_xml (Content* parent, cxml::ConstNodePtr node, int version)
                return shared_ptr<VideoContent> ();
        }
 
+       /* Can't use make_shared here as the constructor is private */
        return shared_ptr<VideoContent> (new VideoContent (parent, node, version));
 }
 
index edc746010f082a0558617763798544b750a940d1..fbc8de9ae4edc8b78ddc9124d8dd722b73bea2e8 100644 (file)
@@ -25,6 +25,7 @@
 #include "log.h"
 #include "compose.hpp"
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 #include "i18n.h"
@@ -34,6 +35,7 @@ using std::list;
 using std::max;
 using std::back_inserter;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::optional;
 
 VideoDecoder::VideoDecoder (Decoder* parent, shared_ptr<const Content> c, shared_ptr<Log> log)
@@ -166,7 +168,7 @@ VideoDecoder::fill_one_eye (Frame from, Frame to, Eyes eye)
        }
 
        /* Fill with black... */
-       shared_ptr<const ImageProxy> filler_image (new RawImageProxy (_black_image));
+       shared_ptr<const ImageProxy> filler_image = make_shared<RawImageProxy> (_black_image);
        Part filler_part = PART_WHOLE;
 
        /* ...unless there's some video we can fill with */
@@ -192,8 +194,8 @@ void
 VideoDecoder::fill_both_eyes (VideoFrame from, VideoFrame to)
 {
        /* Fill with black... */
-       shared_ptr<const ImageProxy> filler_left_image (new RawImageProxy (_black_image));
-       shared_ptr<const ImageProxy> filler_right_image (new RawImageProxy (_black_image));
+       shared_ptr<const ImageProxy> filler_left_image = make_shared<RawImageProxy> (_black_image);
+       shared_ptr<const ImageProxy> filler_right_image = make_shared<RawImageProxy> (_black_image);
        Part filler_left_part = PART_WHOLE;
        Part filler_right_part = PART_WHOLE;
 
index 201150560bb1ffaae82a7c72e8c97c3682a2eab1..b6b3c2668095c444d77c74fd6ae9b4d59ac9a777 100644 (file)
@@ -25,6 +25,7 @@ extern "C" {
 #include <libavfilter/buffersrc.h>
 #include <libavfilter/buffersink.h>
 }
+#include <boost/make_shared.hpp>
 
 #include "i18n.h"
 
@@ -34,6 +35,7 @@ using std::vector;
 using std::string;
 using std::make_pair;
 using boost::shared_ptr;
+using boost::make_shared;
 
 VideoFilterGraph::VideoFilterGraph (dcp::Size s, AVPixelFormat p)
        : _size (s)
@@ -51,7 +53,7 @@ VideoFilterGraph::process (AVFrame* frame)
        list<pair<shared_ptr<Image>, int64_t> > images;
 
        if (_copy) {
-               images.push_back (make_pair (shared_ptr<Image> (new Image (frame)), av_frame_get_best_effort_timestamp (frame)));
+               images.push_back (make_pair (make_shared<Image> (frame), av_frame_get_best_effort_timestamp (frame)));
        } else {
                int r = av_buffersrc_write_frame (_buffer_src_context, frame);
                if (r < 0) {
@@ -63,7 +65,7 @@ VideoFilterGraph::process (AVFrame* frame)
                                break;
                        }
 
-                       images.push_back (make_pair (shared_ptr<Image> (new Image (_frame)), av_frame_get_best_effort_timestamp (_frame)));
+                       images.push_back (make_pair (make_shared<Image> (_frame), av_frame_get_best_effort_timestamp (_frame)));
                        av_frame_unref (_frame);
                }
        }
@@ -117,4 +119,3 @@ VideoFilterGraph::sink_name () const
 {
        return "buffersink";
 }
-
index d86fc4cf6e296ead657f49b98f9ab275a49f463c..f5fab485e023ac2103958fe5bf36ebc94b82f199 100644 (file)
 #include <dcp/stereo_picture_asset.h>
 #include <dcp/exceptions.h>
 #include <libxml++/libxml++.h>
+#include <boost/make_shared.hpp>
 
 #include "i18n.h"
 
 using std::list;
 using std::string;
 using boost::shared_ptr;
+using boost::make_shared;
 
 VideoMXFContent::VideoMXFContent (shared_ptr<const Film> film, boost::filesystem::path path)
        : Content (film, path)
@@ -51,7 +53,7 @@ bool
 VideoMXFContent::valid_mxf (boost::filesystem::path path)
 {
        try {
-               shared_ptr<dcp::MonoPictureAsset> mp (new dcp::MonoPictureAsset (path));
+               shared_ptr<dcp::MonoPictureAsset> mp = make_shared<dcp::MonoPictureAsset> (path);
                return true;
        } catch (dcp::MXFFileError& e) {
 
@@ -60,7 +62,7 @@ VideoMXFContent::valid_mxf (boost::filesystem::path path)
        }
 
        try {
-               shared_ptr<dcp::StereoPictureAsset> sp (new dcp::StereoPictureAsset (path));
+               shared_ptr<dcp::StereoPictureAsset> sp = make_shared<dcp::StereoPictureAsset> (path);
                return true;
        } catch (dcp::MXFFileError& e) {
 
@@ -79,7 +81,7 @@ VideoMXFContent::examine (shared_ptr<Job> job)
        Content::examine (job);
 
        video.reset (new VideoContent (this));
-       shared_ptr<VideoMXFExaminer> examiner (new VideoMXFExaminer (shared_from_this ()));
+       shared_ptr<VideoMXFExaminer> examiner = make_shared<VideoMXFExaminer> (shared_from_this ());
        video->take_from_examiner (examiner);
 }
 
index 938d7deaf5c540668e0316b3a45cb99bf5b31501..24f5c31eaee228b59e3fb857f59b66373b1600a1 100644 (file)
 #include <dcp/stereo_picture_asset.h>
 #include <dcp/stereo_picture_asset_reader.h>
 #include <dcp/exceptions.h>
+#include <boost/make_shared.hpp>
 
 using boost::shared_ptr;
+using boost::make_shared;
 
 VideoMXFDecoder::VideoMXFDecoder (shared_ptr<const VideoMXFContent> content, shared_ptr<Log> log)
        : _content (content)
@@ -77,10 +79,10 @@ VideoMXFDecoder::pass (PassReason, bool)
        }
 
        if (_mono_reader) {
-               video->give (shared_ptr<ImageProxy> (new J2KImageProxy (_mono_reader->get_frame(frame), _size)), frame);
+               video->give (make_shared<J2KImageProxy> (_mono_reader->get_frame(frame), _size), frame);
        } else {
-               video->give (shared_ptr<ImageProxy> (new J2KImageProxy (_stereo_reader->get_frame(frame), _size, dcp::EYE_LEFT)), frame);
-               video->give (shared_ptr<ImageProxy> (new J2KImageProxy (_stereo_reader->get_frame(frame), _size, dcp::EYE_RIGHT)), frame);
+               video->give (make_shared<J2KImageProxy> (_stereo_reader->get_frame(frame), _size, dcp::EYE_LEFT), frame);
+               video->give (make_shared<J2KImageProxy> (_stereo_reader->get_frame(frame), _size, dcp::EYE_RIGHT), frame);
        }
 
        _next += ContentTime::from_frames (1, vfr);
index 6b1d4d260dc3b044252ed5423502d3ca98541f2c..6c789632a2dff6e46c73f10fb91be54985dfe2b0 100644 (file)
@@ -72,6 +72,7 @@
 #endif
 #include <boost/filesystem.hpp>
 #include <boost/noncopyable.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 #include <fstream>
 #include <sstream>
@@ -93,6 +94,7 @@ using std::exception;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
 using boost::optional;
+using boost::make_shared;
 
 class FilmChangedDialog : public boost::noncopyable
 {
@@ -275,7 +277,7 @@ public:
 
        void new_film (boost::filesystem::path path)
        {
-               shared_ptr<Film> film (new Film (path));
+               shared_ptr<Film> film = make_shared<Film> (path);
                film->write_metadata ();
                film->set_name (path.filename().generic_string());
                set_film (film);
@@ -284,7 +286,7 @@ public:
        void load_film (boost::filesystem::path file)
        try
        {
-               shared_ptr<Film> film (new Film (file));
+               shared_ptr<Film> film = make_shared<Film> (file);
                list<string> const notes = film->read_metadata ();
 
                if (film->state_version() == 4) {
@@ -490,14 +492,14 @@ private:
                                        );
                        } else {
                                JobManager::instance()->add (
-                                       shared_ptr<Job> (new SendKDMEmailJob (
-                                                                _film->name(),
-                                                                _film->dcp_name(),
-                                                                d->from(),
-                                                                d->until(),
-                                                                CinemaKDMs::collect (screen_kdms),
-                                                                _film->log()
-                                                                ))
+                                       boost::make_shared<SendKDMEmailJob> (
+                                               _film->name(),
+                                               _film->dcp_name(),
+                                               d->from(),
+                                               d->until(),
+                                               CinemaKDMs::collect (screen_kdms),
+                                               _film->log()
+                                               )
                                        );
                        }
                } catch (dcp::NotEncryptedError& e) {
index a112e457a4af514463a69e2fc425f4c98a6c50b1..3570dda084a2dc0a257c43169db4bf03165b2281 100644 (file)
 #include <wx/cmdline.h>
 #include <wx/preferences.h>
 #include <wx/wx.h>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::exception;
 using std::string;
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::thread;
 using boost::scoped_array;
 
@@ -128,7 +130,7 @@ public:
        void start_job (boost::filesystem::path path)
        {
                try {
-                       shared_ptr<Film> film (new Film (path));
+                       shared_ptr<Film> film = make_shared<Film> (path);
                        film->read_metadata ();
                        film->make_dcp ();
                } catch (std::exception& e) {
index fd950807c3eed51480ed75ecdccea160c0e935a6..3697b4e8bb055adc13d156ceed6cf6dc94ba413f 100644 (file)
@@ -31,6 +31,7 @@
 #include "lib/video_content.h"
 #include <libxml++/libxml++.h>
 #include <boost/filesystem.hpp>
+#include <boost/make_shared.hpp>
 #include <getopt.h>
 #include <string>
 #include <iostream>
@@ -43,6 +44,7 @@ using std::cerr;
 using std::list;
 using std::exception;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::dynamic_pointer_cast;
 
 static void
@@ -206,7 +208,7 @@ main (int argc, char* argv[])
        }
 
        try {
-               shared_ptr<Film> film (new Film (output, false));
+               shared_ptr<Film> film = make_shared<Film> (output, false);
                film->set_name (name);
 
                film->set_container (container_ratio);
index c686a974de4d0746bc539b120cec56b7ad32677a..eb44b4997ff06982f23a0373f970564ca0879738 100644 (file)
@@ -51,6 +51,7 @@
 #endif
 #include <boost/bind.hpp>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 
 #ifdef check
 #undef check
@@ -61,6 +62,7 @@ using std::list;
 using std::string;
 using std::vector;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::bind;
 
 enum {
@@ -301,13 +303,13 @@ private:
                                if (film_name.empty ()) {
                                        film_name = decrypted.content_title_text ();
                                }
-                               shared_ptr<Job> job (new SendKDMEmailJob (
-                                                            film_name,
-                                                            decrypted.content_title_text(),
-                                                            _timing->from(), _timing->until(),
-                                                            CinemaKDMs::collect (screen_kdms),
-                                                            shared_ptr<Log> ()
-                                                            ));
+                               shared_ptr<Job> job = boost::make_shared<SendKDMEmailJob> (
+                                       film_name,
+                                       decrypted.content_title_text(),
+                                       _timing->from(), _timing->until(),
+                                       CinemaKDMs::collect (screen_kdms),
+                                       shared_ptr<Log> ()
+                                       );
 
                                JobManager::instance()->add (job);
                                if (_job_view) {
index 5e50df227ed703f87d229005e861d418df00c630..0de05c342e83e63a1e83119e1d6fa8a68d894180 100644 (file)
@@ -31,6 +31,7 @@
 #include "lib/player.h"
 #include "lib/player_video.h"
 #include "lib/encode_server_description.h"
+#include <boost/make_shared.hpp>
 #include <getopt.h>
 #include <iostream>
 #include <iomanip>
@@ -41,18 +42,19 @@ using std::cerr;
 using std::string;
 using std::pair;
 using boost::shared_ptr;
+using boost::make_shared;
 using dcp::Data;
 
 static shared_ptr<Film> film;
 static EncodeServerDescription* server;
-static shared_ptr<FileLog> log_ (new FileLog ("servomatictest.log"));
+static shared_ptr<FileLog> log_ = make_shared<FileLog> ("servomatictest.log");
 static int frame_count = 0;
 
 void
 process_video (shared_ptr<PlayerVideo> pvf)
 {
-       shared_ptr<DCPVideo> local  (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_));
-       shared_ptr<DCPVideo> remote (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_));
+       shared_ptr<DCPVideo> local = make_shared<DCPVideo> (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_);
+       shared_ptr<DCPVideo> remote = make_shared<DCPVideo> (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_);
 
        cout << "Frame " << frame_count << ": ";
        cout.flush ();
@@ -144,7 +146,7 @@ main (int argc, char* argv[])
                film.reset (new Film (film_dir));
                film->read_metadata ();
 
-               shared_ptr<Player> player (new Player (film, film->playlist ()));
+               shared_ptr<Player> player = make_shared<Player> (film, film->playlist ());
 
                DCPTime const frame = DCPTime::from_frames (1, film->video_frame_rate ());
                for (DCPTime t; t < film->length(); t += frame) {
index ab26329a4b878a564ecf9cd96e9eed8890f674db..8ffe8b7a4a9198a5986ccdce419591945b6db565 100644 (file)
@@ -33,6 +33,7 @@
 #include "lib/audio_content.h"
 #include <wx/spinctrl.h>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::vector;
@@ -42,6 +43,7 @@ using std::list;
 using std::pair;
 using boost::dynamic_pointer_cast;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::optional;
 
 AudioPanel::AudioPanel (ContentPanel* p)
@@ -312,10 +314,10 @@ AudioPanel::setup_peak ()
        if (sel.size() != 1) {
                _peak->SetLabel (wxT (""));
        } else {
-               shared_ptr<Playlist> playlist (new Playlist);
+               shared_ptr<Playlist> playlist = make_shared<Playlist> ();
                playlist->add (sel.front ());
                try {
-                       shared_ptr<AudioAnalysis> analysis (new AudioAnalysis (_parent->film()->audio_analysis_path (playlist)));
+                       shared_ptr<AudioAnalysis> analysis = make_shared<AudioAnalysis> (_parent->film()->audio_analysis_path (playlist));
                        if (analysis->sample_peak ()) {
                                float const peak_dB = 20 * log10 (analysis->sample_peak().get()) + analysis->gain_correction (playlist);
                                if (peak_dB > -3) {
index 01b1ca056c1ed4739229f52c97fad917314bfd31..19ebc90d5173b919af1948ba7b460c51f295d420 100644 (file)
 #include <dcp/modified_gamma_transfer_function.h>
 #include <wx/spinctrl.h>
 #include <wx/gbsizer.h>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::string;
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::dynamic_pointer_cast;
 
 ColourConversionEditor::ColourConversionEditor (wxWindow* parent, bool yuv)
@@ -308,19 +310,15 @@ ColourConversionEditor::get () const
 
        if (_input_gamma_linearised->GetValue ()) {
                conversion.set_in (
-                       shared_ptr<dcp::ModifiedGammaTransferFunction> (
-                               new dcp::ModifiedGammaTransferFunction (
-                                       _input_power->GetValue (),
-                                       raw_convert<double> (wx_to_std (_input_threshold->GetValue ())),
-                                       raw_convert<double> (wx_to_std (_input_A->GetValue ())),
-                                       raw_convert<double> (wx_to_std (_input_B->GetValue ()))
-                                       )
+                       make_shared<dcp::ModifiedGammaTransferFunction> (
+                               _input_power->GetValue (),
+                               raw_convert<double> (wx_to_std (_input_threshold->GetValue ())),
+                               raw_convert<double> (wx_to_std (_input_A->GetValue ())),
+                               raw_convert<double> (wx_to_std (_input_B->GetValue ()))
                                )
                        );
        } else {
-               conversion.set_in (
-                       shared_ptr<dcp::GammaTransferFunction> (new dcp::GammaTransferFunction (_input_gamma->GetValue ()))
-                       );
+               conversion.set_in (make_shared<dcp::GammaTransferFunction> (_input_gamma->GetValue ()));
        }
 
        conversion.set_yuv_to_rgb (static_cast<dcp::YUVToRGB> (_yuv_to_rgb->GetSelection ()));
@@ -349,7 +347,7 @@ ColourConversionEditor::get () const
                conversion.unset_adjusted_white ();
        }
 
-       conversion.set_out (shared_ptr<dcp::GammaTransferFunction> (new dcp::GammaTransferFunction (2.6)));
+       conversion.set_out (make_shared<dcp::GammaTransferFunction> (2.6));
 
        return conversion;
 }
index 3d5b002798ee72d6c8cce2d968f0733879a8b0c6..99b942174e0b508137f8e259d88eaca35131d61a 100644 (file)
 #include <wx/wx.h>
 #include <wx/dirdlg.h>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::cout;
 using std::vector;
 using std::exception;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::weak_ptr;
 using boost::dynamic_pointer_cast;
 
@@ -159,7 +161,7 @@ ContentMenu::join ()
        }
 
        try {
-               shared_ptr<FFmpegContent> joined (new FFmpegContent (film, fc));
+               shared_ptr<FFmpegContent> joined = boost::make_shared<FFmpegContent> (film, fc);
                BOOST_FOREACH (shared_ptr<Content> i, _content) {
                        film->remove_content (i);
                }
@@ -264,7 +266,7 @@ ContentMenu::find_missing ()
                return;
        }
 
-       shared_ptr<Job> j (new ExamineContentJob (film, content));
+       shared_ptr<Job> j = make_shared<ExamineContentJob> (film, content);
 
        _job_connection = j->Finished.connect (
                bind (
index 72ab0eef41f84e6e7fbac6772bf1eee7895768b0..2150d457626119affe1e78b58fb98beaff32ef77 100644 (file)
 #include <wx/richtext/richtextctrl.h>
 #include <boost/algorithm/string.hpp>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 
 using std::max;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::optional;
 using boost::dynamic_pointer_cast;
 
@@ -176,7 +178,7 @@ HintsDialog::film_changed ()
 
        boost::filesystem::path path = film->audio_analysis_path (film->playlist ());
        if (boost::filesystem::exists (path)) {
-               shared_ptr<AudioAnalysis> an (new AudioAnalysis (path));
+               shared_ptr<AudioAnalysis> an = make_shared<AudioAnalysis> (path);
                if (an->sample_peak() || an->true_peak()) {
                        float const peak = max (an->sample_peak().get_value_or(0), an->true_peak().get_value_or(0));
                        float const peak_dB = 20 * log10 (peak) + an->gain_correction (film->playlist ());
index cd6918b7268e730c7a93d4e8d1a796293c7cadf9..cba22178415473cbe9e9300c9452c10eb5800a50 100644 (file)
@@ -19,7 +19,7 @@
 */
 
 /** @file src/job_manager_view.cc
- *  @brief Class generating a GTK widget to show the progress of jobs.
+ *  @brief Class generating a widget to show the progress of jobs.
  */
 
 #include "job_manager_view.h"
@@ -30,6 +30,7 @@
 #include "lib/util.h"
 #include "lib/exceptions.h"
 #include "lib/compose.hpp"
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::string;
@@ -38,6 +39,7 @@ using std::map;
 using std::min;
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::weak_ptr;
 
 /** Must be called in the GUI thread */
@@ -68,7 +70,7 @@ JobManagerView::job_added (weak_ptr<Job> j)
 {
        shared_ptr<Job> job = j.lock ();
        if (job) {
-               _job_records.push_back (shared_ptr<JobView> (new JobView (job, this, _panel, _table)));
+               _job_records.push_back (make_shared<JobView> (job, this, _panel, _table));
        }
 }
 
index 68411ee917144f98a5f16879a9a5be360d95c81a..1a32e8fad3d0fe11ceee6b7e1a9850ac49a9437c 100644 (file)
 #include "lib/job_manager.h"
 #include "lib/send_problem_report_job.h"
 #include <wx/sizer.h>
+#include <boost/make_shared.hpp>
 
 using std::string;
 using boost::shared_ptr;
+using boost::make_shared;
 
 /** @param film Film that we are working on, or 0 */
 ReportProblemDialog::ReportProblemDialog (wxWindow* parent, shared_ptr<Film> film)
@@ -103,5 +105,5 @@ ReportProblemDialog::report ()
                return;
        }
 
-       JobManager::instance()->add (shared_ptr<Job> (new SendProblemReportJob (_film, wx_to_std (_email->GetValue ()), wx_to_std (_summary->GetValue ()))));
+       JobManager::instance()->add (boost::make_shared<SendProblemReportJob> (_film, wx_to_std (_email->GetValue ()), wx_to_std (_summary->GetValue ())));
 }
index 0638763fe364ce0743b05320d070819ad8674be4..df07a08c4fd4b523ebae17e5a5df656110cd1935 100644 (file)
@@ -26,6 +26,7 @@
 #include "cinema_dialog.h"
 #include "screen_dialog.h"
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 
 using std::list;
 using std::pair;
@@ -34,6 +35,7 @@ using std::map;
 using std::string;
 using std::make_pair;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::optional;
 
 ScreensPanel::ScreensPanel (wxWindow* parent)
@@ -149,7 +151,7 @@ ScreensPanel::add_cinema_clicked ()
 {
        CinemaDialog* d = new CinemaDialog (this, _("Add Cinema"));
        if (d->ShowModal () == wxID_OK) {
-               shared_ptr<Cinema> c (new Cinema (d->name(), d->emails(), d->notes(), d->utc_offset_hour(), d->utc_offset_minute()));
+               shared_ptr<Cinema> c = boost::make_shared<Cinema> (d->name(), d->emails(), d->notes(), d->utc_offset_hour(), d->utc_offset_minute());
                Config::instance()->add_cinema (c);
                add_cinema (c);
        }
@@ -208,7 +210,7 @@ ScreensPanel::add_screen_clicked ()
                return;
        }
 
-       shared_ptr<Screen> s (new Screen (d->name(), d->recipient(), d->trusted_devices()));
+       shared_ptr<Screen> s = boost::make_shared<Screen> (d->name(), d->recipient(), d->trusted_devices());
        c->add_screen (s);
        optional<wxTreeItemId> id = add_screen (c, s);
        if (id) {
index 6bb216df825bdd840fd021e4ddd1ee20cd6e8451..ef8549d4253795f6c6edebe6fcfa71fe358b2e03 100644 (file)
@@ -40,6 +40,7 @@
 #include <wx/graphics.h>
 #include <boost/weak_ptr.hpp>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <list>
 #include <iostream>
 
@@ -47,6 +48,7 @@ using std::list;
 using std::cout;
 using std::max;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::weak_ptr;
 using boost::dynamic_pointer_cast;
 using boost::bind;
@@ -150,19 +152,19 @@ Timeline::recreate_views ()
 
        BOOST_FOREACH (shared_ptr<Content> i, film->content ()) {
                if (i->video) {
-                       _views.push_back (shared_ptr<TimelineView> (new TimelineVideoContentView (*this, i)));
+                       _views.push_back (make_shared<TimelineVideoContentView> (*this, i));
                }
 
                if (i->audio && !i->audio->mapping().mapped_output_channels().empty ()) {
-                       _views.push_back (shared_ptr<TimelineView> (new TimelineAudioContentView (*this, i)));
+                       _views.push_back (make_shared<TimelineAudioContentView> (*this, i));
                }
 
                if (i->subtitle) {
-                       _views.push_back (shared_ptr<TimelineView> (new TimelineSubtitleContentView (*this, i)));
+                       _views.push_back (make_shared<TimelineSubtitleContentView> (*this, i));
                }
 
                if (dynamic_pointer_cast<AtmosMXFContent> (i)) {
-                       _views.push_back (shared_ptr<TimelineView> (new TimelineAtmosContentView (*this, i)));
+                       _views.push_back (make_shared<TimelineAtmosContentView> (*this, i));
                }
        }
 
index 033796ab23d2e65cc58c5461ec6316765a3eb95f..c5418e9dd5bd4ed85b395d6909db90f78b3a1996 100644 (file)
  *  The output is checked against test/data/4k_test.
  */
 
-#include <boost/test/unit_test.hpp>
 #include "lib/film.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/dcp_content_type.h"
 #include "lib/video_content.h"
 #include "lib/ratio.h"
 #include "test.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using boost::shared_ptr;
+using boost::make_shared;
 
 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"));
+       shared_ptr<FFmpegContent> c = make_shared<FFmpegContent> (film, "test/data/test.mp4");
        film->set_resolution (RESOLUTION_4K);
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
        film->set_container (Ratio::from_id ("185"));
index 5923e0698fba9a60fcd35232ab8eeb6c282c3f27..9fd9282813144a76e542c32670faa9c7b03ce988 100644 (file)
@@ -22,7 +22,6 @@
  *  @brief Check audio analysis code.
  */
 
-#include <boost/test/unit_test.hpp>
 #include "lib/audio_analysis.h"
 #include "lib/analyse_audio_job.h"
 #include "lib/film.h"
 #include "lib/job_manager.h"
 #include "lib/audio_content.h"
 #include "test.h"
+#include <boost/make_shared.hpp>
+#include <boost/test/unit_test.hpp>
 
 using boost::shared_ptr;
+using boost::make_shared;
 
 static float
 random_float ()
@@ -97,11 +99,11 @@ BOOST_AUTO_TEST_CASE (audio_analysis_test)
        film->set_name ("audio_analysis_test");
        boost::filesystem::path p = private_data / "betty_L.wav";
 
-       shared_ptr<FFmpegContent> c (new FFmpegContent (film, p));
+       shared_ptr<FFmpegContent> c = make_shared<FFmpegContent> (film, p);
        film->examine_and_add_content (c);
        wait_for_jobs ();
 
-       shared_ptr<AnalyseAudioJob> job (new AnalyseAudioJob (film, film->playlist ()));
+       shared_ptr<AnalyseAudioJob> job = make_shared<AnalyseAudioJob> (film, film->playlist ());
        job->Finished.connect (boost::bind (&finished));
        JobManager::instance()->add (job);
        wait_for_jobs ();
@@ -112,13 +114,13 @@ BOOST_AUTO_TEST_CASE (audio_analysis_negative_delay_test)
 {
        shared_ptr<Film> film = new_test_film ("audio_analysis_negative_delay_test");
        film->set_name ("audio_analysis_negative_delay_test");
-       shared_ptr<FFmpegContent> c (new FFmpegContent (film, private_data / "boon_telly.mkv"));
+       shared_ptr<FFmpegContent> c = make_shared<FFmpegContent> (film, private_data / "boon_telly.mkv");
        film->examine_and_add_content (c);
        wait_for_jobs ();
 
        c->audio->set_delay (-250);
 
-       shared_ptr<AnalyseAudioJob> job (new AnalyseAudioJob (film, film->playlist ()));
+       shared_ptr<AnalyseAudioJob> job = make_shared<AnalyseAudioJob> (film, film->playlist ());
        job->Finished.connect (boost::bind (&finished));
        JobManager::instance()->add (job);
        wait_for_jobs ();
@@ -129,11 +131,11 @@ BOOST_AUTO_TEST_CASE (audio_analysis_test2)
 {
        shared_ptr<Film> film = new_test_film ("audio_analysis_test2");
        film->set_name ("audio_analysis_test2");
-       shared_ptr<FFmpegContent> c (new FFmpegContent (film, private_data / "3d_thx_broadway_2010_lossless.m2ts"));
+       shared_ptr<FFmpegContent> c = make_shared<FFmpegContent> (film, private_data / "3d_thx_broadway_2010_lossless.m2ts");
        film->examine_and_add_content (c);
        wait_for_jobs ();
 
-       shared_ptr<AnalyseAudioJob> job (new AnalyseAudioJob (film, film->playlist ()));
+       shared_ptr<AnalyseAudioJob> job = make_shared<AnalyseAudioJob> (film, film->playlist ());
        job->Finished.connect (boost::bind (&finished));
        JobManager::instance()->add (job);
        wait_for_jobs ();
@@ -158,7 +160,7 @@ BOOST_AUTO_TEST_CASE (audio_analysis_test3)
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
 
-       shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/white.wav"));
+       shared_ptr<FFmpegContent> content = make_shared<FFmpegContent> (film, "test/data/white.wav");
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
index 945773d1203fc24cda5b45432da94df5073a7d88..92c99a378065389c800ba459682ecb6e785d8983 100644 (file)
@@ -28,6 +28,7 @@
 #include "lib/audio_content.h"
 #include "lib/film.h"
 #include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 #include <cassert>
 #include <iostream>
 
@@ -35,6 +36,7 @@ using std::string;
 using std::cout;
 using std::min;
 using boost::shared_ptr;
+using boost::make_shared;
 
 class TestAudioContent : public Content
 {
@@ -76,7 +78,7 @@ public:
                        _test_audio_content->audio_length() - _position
                        );
 
-               shared_ptr<AudioBuffers> buffers (new AudioBuffers (_test_audio_content->audio->stream()->channels(), N));
+               shared_ptr<AudioBuffers> buffers = make_shared<AudioBuffers> (_test_audio_content->audio->stream()->channels(), N);
                for (int i = 0; i < _test_audio_content->audio->stream()->channels(); ++i) {
                        for (int j = 0; j < N; ++j) {
                                buffers->data(i)[j] = j + _position;
index 1d2d171dbdf4c3669147bcd13b4ad296d6699b71..a87c3016e727d46ff47b40c03c046d1c621a8678 100644 (file)
  *  The output is checked algorithmically using knowledge of the input.
  */
 
-#include <boost/test/unit_test.hpp>
-#include <dcp/sound_frame.h>
-#include <dcp/cpl.h>
-#include <dcp/reel.h>
-#include <dcp/sound_asset.h>
-#include <dcp/sound_asset_reader.h>
-#include <dcp/reel_sound_asset.h>
 #include "lib/ffmpeg_content.h"
 #include "lib/dcp_content_type.h"
 #include "lib/ratio.h"
 #include "lib/film.h"
 #include "lib/audio_content.h"
 #include "test.h"
+#include <dcp/sound_frame.h>
+#include <dcp/cpl.h>
+#include <dcp/reel.h>
+#include <dcp/sound_asset.h>
+#include <dcp/sound_asset_reader.h>
+#include <dcp/reel_sound_asset.h>
+#include <boost/make_shared.hpp>
+#include <boost/test/unit_test.hpp>
 #include <iostream>
 
 using std::string;
 using std::cout;
 using boost::lexical_cast;
 using boost::shared_ptr;
+using boost::make_shared;
 
 static
 void test_audio_delay (int delay_in_ms)
@@ -55,7 +57,7 @@ void test_audio_delay (int delay_in_ms)
        film->set_container (Ratio::from_id ("185"));
        film->set_name (film_name);
 
-       shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/staircase.wav"));
+       shared_ptr<FFmpegContent> content = make_shared<FFmpegContent> (film, "test/data/staircase.wav");
        film->examine_and_add_content (content);
        wait_for_jobs ();
        content->audio->set_delay (delay_in_ms);
index b92d005a524eade90c33c7224136e85662cc30a3..0ad91dddeab9bf5ff28fe495f647561f197adbfe 100644 (file)
  *  @brief Basic tests of audio filters.
  */
 
-#include <boost/test/unit_test.hpp>
 #include "lib/audio_filter.h"
 #include "lib/audio_buffers.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using boost::shared_ptr;
+using boost::make_shared;
 
 static void
 audio_filter_impulse_test_one (AudioFilter& f, int block_size, int num_blocks)
@@ -35,7 +37,7 @@ audio_filter_impulse_test_one (AudioFilter& f, int block_size, int num_blocks)
 
        for (int i = 0; i < num_blocks; ++i) {
 
-               shared_ptr<AudioBuffers> in (new AudioBuffers (1, block_size));
+               shared_ptr<AudioBuffers> in = make_shared<AudioBuffers> (1, block_size);
                for (int j = 0; j < block_size; ++j) {
                        in->data()[0][j] = c + j;
                }
@@ -76,7 +78,7 @@ BOOST_AUTO_TEST_CASE (audio_filter_impulse_input_test)
 {
        LowPassAudioFilter lpf (0.02, 0.3);
 
-       shared_ptr<AudioBuffers> in (new AudioBuffers (1, 1751));
+       shared_ptr<AudioBuffers> in = make_shared<AudioBuffers> (1, 1751);
        in->make_silent ();
        in->data(0)[0] = 1;
 
index 78f8e689596272ae8551233a9a945f08d27b7232..9fc2d7242cb359d6b23b32a4de9c56cc54483291 100644 (file)
 #include "lib/audio_delay.h"
 #include "lib/audio_buffers.h"
 #include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 #include <cmath>
 #include <iostream>
 
 using std::cerr;
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 
 #define CHECK_SAMPLE(c,f,r) \
        if (fabs(out->data(c)[f] - (r)) > 0.1) {                        \
@@ -41,7 +43,7 @@ BOOST_AUTO_TEST_CASE (audio_processor_delay_test1)
 
        int const C = 2;
 
-       shared_ptr<AudioBuffers> in (new AudioBuffers (C, 256));
+       shared_ptr<AudioBuffers> in = make_shared<AudioBuffers> (C, 256);
        for (int i = 0; i < C; ++i) {
                for (int j = 0; j < 256; ++j) {
                        in->data(i)[j] = j;
@@ -91,7 +93,7 @@ BOOST_AUTO_TEST_CASE (audio_processor_delay_test2)
        /* Feeding 4 blocks of 64 should give silence each time */
 
        for (int i = 0; i < 4; ++i) {
-               shared_ptr<AudioBuffers> in (new AudioBuffers (C, 64));
+               shared_ptr<AudioBuffers> in = make_shared<AudioBuffers> (C, 64);
                for (int j = 0; j < C; ++j) {
                        for (int k = 0; k < 64; ++k) {
                                in->data(j)[k] = k + i * 64;
@@ -112,7 +114,7 @@ BOOST_AUTO_TEST_CASE (audio_processor_delay_test2)
        /* Now feed 4 blocks of silence and we should see the data */
        for (int i = 0; i < 4; ++i) {
                /* Feed some silence */
-               shared_ptr<AudioBuffers> in (new AudioBuffers (C, 64));
+               shared_ptr<AudioBuffers> in = make_shared<AudioBuffers> (C, 64);
                in->make_silent ();
                shared_ptr<AudioBuffers> out = delay.run (in);
 
index 8357cff78a367cd78736b9f001475edf9d29bf65..97d2cd759d3b4e77611dddf67bfa715530c47685 100644 (file)
 #include "lib/film.h"
 #include "test.h"
 #include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using boost::shared_ptr;
+using boost::make_shared;
 
 /** Test the mid-side decoder for analysis and DCP-making */
 BOOST_AUTO_TEST_CASE (audio_processor_test)
 {
        shared_ptr<Film> film = new_test_film ("audio_processor_test");
        film->set_name ("audio_processor_test");
-       shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/white.wav"));
+       shared_ptr<FFmpegContent> c = make_shared<FFmpegContent> (film, "test/data/white.wav");
        film->examine_and_add_content (c);
        wait_for_jobs ();
 
@@ -43,7 +45,7 @@ BOOST_AUTO_TEST_CASE (audio_processor_test)
        film->set_audio_processor (AudioProcessor::from_id ("mid-side-decoder"));
 
        /* Analyse the audio and check it doesn't crash */
-       shared_ptr<AnalyseAudioJob> job (new AnalyseAudioJob (film, film->playlist ()));
+       shared_ptr<AnalyseAudioJob> job = make_shared<AnalyseAudioJob> (film, film->playlist ());
        JobManager::instance()->add (job);
        wait_for_jobs ();
 
index 79b97ad77a557af765a4082839c21e4271136784..77ee908482fa5156721005ece0829e5de33485c2 100644 (file)
 
 */
 
-#include <boost/test/unit_test.hpp>
 #include "lib/image_content.h"
 #include "lib/dcp_content_type.h"
 #include "lib/film.h"
 #include "lib/ratio.h"
 #include "lib/video_content.h"
 #include "test.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 /** @file test/black_fill_test.cc
  *  @brief Test insertion of black frames between separate bits of video content.
  */
 
 using boost::shared_ptr;
+using boost::make_shared;
 
 BOOST_AUTO_TEST_CASE (black_fill_test)
 {
@@ -39,8 +41,8 @@ BOOST_AUTO_TEST_CASE (black_fill_test)
        film->set_name ("black_fill_test");
        film->set_container (Ratio::from_id ("185"));
        film->set_sequence (false);
-       shared_ptr<ImageContent> contentA (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
-       shared_ptr<ImageContent> contentB (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
+       shared_ptr<ImageContent> contentA = make_shared<ImageContent> (film, "test/data/simple_testcard_640x480.png");
+       shared_ptr<ImageContent> contentB = make_shared<ImageContent> (film, "test/data/simple_testcard_640x480.png");
 
        film->examine_and_add_content (contentA);
        film->examine_and_add_content (contentB);
index d7ccbc6590e3788362da8e620e14fbf364dc916f..71758e01251d60cfb4fead5e3ba8c25fb6b5f6fd 100644 (file)
@@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE (burnt_subtitle_test_subrip)
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
-       shared_ptr<TextSubtitleContent> content (new TextSubtitleContent (film, "test/data/subrip2.srt"));
+       shared_ptr<TextSubtitleContent> content = make_shared<TextSubtitleContent> (film, "test/data/subrip2.srt");
        content->set_use_subtitles (true);
        content->set_burn_subtitles (true);
        film->examine_and_add_content (content, true);
@@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE (burnt_subtitle_test_dcp)
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
        film->set_burn_subtitles (true);
-       shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent (film, "test/data/dcp_sub.xml"));
+       shared_ptr<DCPSubtitleContent> content = make_shared<DCPSubtitleContent> (film, "test/data/dcp_sub.xml");
        content->set_use_subtitles (true);
        film->examine_and_add_content (content, true);
        wait_for_jobs ();
index 1f77f7f907cc718a0bcf61dd32b41881c9dd34c3..68ef336a17a795ecf5925921fae5726bd4780017 100644 (file)
 #include "lib/file_log.h"
 #include <boost/test/unit_test.hpp>
 #include <boost/thread.hpp>
+#include <boost/make_shared.hpp>
 
 using std::list;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::thread;
 using boost::optional;
 using dcp::Data;
@@ -56,7 +58,7 @@ do_remote_encode (shared_ptr<DCPVideo> frame, EncodeServerDescription descriptio
 
 BOOST_AUTO_TEST_CASE (client_server_test_rgb)
 {
-       shared_ptr<Image> image (new Image (AV_PIX_FMT_RGB24, dcp::Size (1998, 1080), true));
+       shared_ptr<Image> image = make_shared<Image> (AV_PIX_FMT_RGB24, dcp::Size (1998, 1080), true);
        uint8_t* p = image->data()[0];
 
        for (int y = 0; y < 1080; ++y) {
@@ -69,7 +71,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb)
                p += image->stride()[0];
        }
 
-       shared_ptr<Image> sub_image (new Image (AV_PIX_FMT_RGBA, dcp::Size (100, 200), true));
+       shared_ptr<Image> sub_image = make_shared<Image> (AV_PIX_FMT_RGBA, dcp::Size (100, 200), true);
        p = sub_image->data()[0];
        for (int y = 0; y < 200; ++y) {
                uint8_t* q = p;
@@ -82,11 +84,11 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb)
                p += sub_image->stride()[0];
        }
 
-       shared_ptr<FileLog> log (new FileLog ("build/test/client_server_test_rgb.log"));
+       shared_ptr<FileLog> log = make_shared<FileLog> ("build/test/client_server_test_rgb.log");
 
        shared_ptr<PlayerVideo> pvf (
                new PlayerVideo (
-                       shared_ptr<ImageProxy> (new RawImageProxy (image)),
+                       make_shared<RawImageProxy> (image),
                        DCPTime (),
                        Crop (),
                        optional<double> (),
@@ -140,7 +142,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb)
 
 BOOST_AUTO_TEST_CASE (client_server_test_yuv)
 {
-       shared_ptr<Image> image (new Image (AV_PIX_FMT_YUV420P, dcp::Size (1998, 1080), true));
+       shared_ptr<Image> image = make_shared<Image> (AV_PIX_FMT_YUV420P, dcp::Size (1998, 1080), true);
 
        for (int i = 0; i < image->planes(); ++i) {
                uint8_t* p = image->data()[i];
@@ -149,7 +151,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv)
                }
        }
 
-       shared_ptr<Image> sub_image (new Image (AV_PIX_FMT_RGBA, dcp::Size (100, 200), true));
+       shared_ptr<Image> sub_image = make_shared<Image> (AV_PIX_FMT_RGBA, dcp::Size (100, 200), true);
        uint8_t* p = sub_image->data()[0];
        for (int y = 0; y < 200; ++y) {
                uint8_t* q = p;
@@ -162,11 +164,11 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv)
                p += sub_image->stride()[0];
        }
 
-       shared_ptr<FileLog> log (new FileLog ("build/test/client_server_test_yuv.log"));
+       shared_ptr<FileLog> log = make_shared<FileLog> ("build/test/client_server_test_yuv.log");
 
        shared_ptr<PlayerVideo> pvf (
                new PlayerVideo (
-                       shared_ptr<ImageProxy> (new RawImageProxy (image)),
+                       make_shared<RawImageProxy> (image),
                        DCPTime (),
                        Crop (),
                        optional<double> (),
@@ -220,7 +222,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv)
 
 BOOST_AUTO_TEST_CASE (client_server_test_j2k)
 {
-       shared_ptr<Image> image (new Image (AV_PIX_FMT_YUV420P, dcp::Size (1998, 1080), true));
+       shared_ptr<Image> image = make_shared<Image> (AV_PIX_FMT_YUV420P, dcp::Size (1998, 1080), true);
 
        for (int i = 0; i < image->planes(); ++i) {
                uint8_t* p = image->data()[i];
@@ -229,11 +231,11 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k)
                }
        }
 
-       shared_ptr<FileLog> log (new FileLog ("build/test/client_server_test_j2k.log"));
+       shared_ptr<FileLog> log = make_shared<FileLog> ("build/test/client_server_test_j2k.log");
 
        shared_ptr<PlayerVideo> raw_pvf (
                new PlayerVideo (
-                       shared_ptr<ImageProxy> (new RawImageProxy (image)),
+                       make_shared<RawImageProxy> (image),
                        DCPTime (),
                        Crop (),
                        optional<double> (),
@@ -260,7 +262,8 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k)
 
        shared_ptr<PlayerVideo> j2k_pvf (
                new PlayerVideo (
-                       shared_ptr<ImageProxy> (new J2KImageProxy (raw_locally_encoded, dcp::Size (1998, 1080))),
+                       /* This J2KImageProxy constructor is private, so no make_shared */
+                       shared_ptr<J2KImageProxy> (new J2KImageProxy (raw_locally_encoded, dcp::Size (1998, 1080))),
                        DCPTime (),
                        Crop (),
                        optional<double> (),
index 6c25e8ae31c5d018b281450b0e3f7ba074044e12..00e830dad7b118bdbe31a165145d13ffb944e276 100644 (file)
 #include <libxml++/libxml++.h>
 #include <boost/test/unit_test.hpp>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 
 BOOST_AUTO_TEST_CASE (colour_conversion_test1)
 {
@@ -109,7 +111,7 @@ BOOST_AUTO_TEST_CASE (colour_conversion_test4)
                xmlpp::Document out;
                xmlpp::Element* out_root = out.create_root_node ("Test");
                i.conversion.as_xml (out_root);
-               shared_ptr<cxml::Document> in (new cxml::Document ("Test"));
+               shared_ptr<cxml::Document> in = make_shared<cxml::Document> ("Test");
                in->read_string (out.write_to_string ("UTF-8"));
                BOOST_CHECK (ColourConversion::from_xml (in, Film::current_state_version).get () == i.conversion);
        }
index ef733d370d5bde31b15f0fa56c6e646a7171d024..85dea391fb2e48a6e8e929daebcb776e49f9cf9f 100644 (file)
@@ -22,7 +22,6 @@
  *  @brief Test DCP subtitle content in various ways.
  */
 
-#include <boost/test/unit_test.hpp>
 #include "lib/film.h"
 #include "lib/dcp_subtitle_content.h"
 #include "lib/dcp_content.h"
 #include "lib/content_subtitle.h"
 #include "lib/subtitle_decoder.h"
 #include "test.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::cout;
 using std::list;
 using boost::shared_ptr;
+using boost::make_shared;
 
 /** Test pass-through of a very simple DCP subtitle file */
 BOOST_AUTO_TEST_CASE (dcp_subtitle_test)
@@ -46,7 +48,7 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test)
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
-       shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent (film, "test/data/dcp_sub.xml"));
+       shared_ptr<DCPSubtitleContent> content = make_shared<DCPSubtitleContent> (film, "test/data/dcp_sub.xml");
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
@@ -67,11 +69,11 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_within_dcp_test)
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
-       shared_ptr<DCPContent> content (new DCPContent (film, private_data / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV"));
+       shared_ptr<DCPContent> content = make_shared<DCPContent> (film, private_data / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV");
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
-       shared_ptr<DCPDecoder> decoder (new DCPDecoder (content, film->log(), false));
+       shared_ptr<DCPDecoder> decoder = make_shared<DCPDecoder> (content, film->log(), false);
 
        list<ContentTimePeriod> ctp = decoder->text_subtitles_during (
                ContentTimePeriod (
index bad800e57823a21fd2874442ff2d61304a25ce82..2101e977485c1ed4543b5e77e6600258d3b1c428 100644 (file)
 #include "test.h"
 #include <sndfile.h>
 #include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using boost::shared_ptr;
+using boost::make_shared;
 
 /** Test the FFmpeg code with audio-only content */
 static void
@@ -37,7 +39,7 @@ test (boost::filesystem::path file)
        shared_ptr<Film> film = new_test_film ("ffmpeg_audio_only_test");
        film->set_name ("test_film");
        film->set_dcp_content_type (DCPContentType::from_pretty_name ("Test"));
-       shared_ptr<FFmpegContent> c (new FFmpegContent (film, file));
+       shared_ptr<FFmpegContent> c = make_shared<FFmpegContent> (film, file);
        film->examine_and_add_content (c);
        wait_for_jobs ();
        film->write_metadata ();
@@ -56,7 +58,7 @@ test (boost::filesystem::path file)
        BOOST_REQUIRE_EQUAL (info.samplerate, 48000);
        float* ref_buffer = new float[info.samplerate * info.channels];
 
-       shared_ptr<Player> player (new Player (film, film->playlist ()));
+       shared_ptr<Player> player = make_shared<Player> (film, film->playlist ());
 
        for (DCPTime t; t < film->length(); t += DCPTime::from_seconds (1)) {
                int const N = sf_readf_float (ref, ref_buffer, info.samplerate);
index cfbaf46c30aaa8d064458551ce1ea1d551b7ccfb..07e6e0310e91cd3979714043bbfc2bd422fc9e22 100644 (file)
 #include <dcp/sound_asset_reader.h>
 #include <dcp/reel.h>
 #include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using std::string;
 using boost::shared_ptr;
+using boost::make_shared;
 
 BOOST_AUTO_TEST_CASE (ffmpeg_audio_test)
 {
        shared_ptr<Film> film = new_test_film ("ffmpeg_audio_test");
        film->set_name ("ffmpeg_audio_test");
-       shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/staircase.mov"));
+       shared_ptr<FFmpegContent> c = make_shared<FFmpegContent> (film, "test/data/staircase.mov");
        film->examine_and_add_content (c);
 
        wait_for_jobs ();
index 18decee95a1e15a3441a5aa7bc0006ab64e18794..c69516b9f65714abedaec5fec6f625d2b4c0d07b 100644 (file)
  *  Also a quick test of Film::have_dcp ().
  */
 
-#include <boost/test/unit_test.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/algorithm/string.hpp>
 #include "lib/film.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/ratio.h"
 #include "lib/dcp_content_type.h"
 #include "lib/video_content.h"
 #include "test.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/algorithm/string.hpp>
+#include <boost/make_shared.hpp>
 
 using boost::shared_ptr;
+using boost::make_shared;
 
 BOOST_AUTO_TEST_CASE (ffmpeg_dcp_test)
 {
        shared_ptr<Film> film = new_test_film ("ffmpeg_dcp_test");
        film->set_name ("test_film2");
-       shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/test.mp4"));
+       shared_ptr<FFmpegContent> c = make_shared<FFmpegContent> (film, "test/data/test.mp4");
        film->examine_and_add_content (c);
 
        wait_for_jobs ();
@@ -59,7 +61,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_dcp_test)
 BOOST_AUTO_TEST_CASE (ffmpeg_have_dcp_test)
 {
        boost::filesystem::path p = test_film_dir ("ffmpeg_dcp_test");
-       shared_ptr<Film> film (new Film (p.string ()));
+       shared_ptr<Film> film = boost::make_shared<Film> (p.string ());
        film->read_metadata ();
        BOOST_CHECK (!film->cpls().empty());
 
index 8a854b01b7e0d8671d5e7ee3f7646730e1eceb99..5e310cd3c34ca75de5ea2c0555e0a3a272731c7f 100644 (file)
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 #include <boost/filesystem.hpp>
+#include <boost/make_shared.hpp>
 #include <vector>
 
 using std::cerr;
 using std::vector;
 using std::list;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::optional;
 
 static void
@@ -62,11 +64,11 @@ test (boost::filesystem::path file, vector<int> frames)
        }
 
        shared_ptr<Film> film = new_test_film ("ffmpeg_decoder_seek_test_" + file.string());
-       shared_ptr<FFmpegContent> content (new FFmpegContent (film, path));
+       shared_ptr<FFmpegContent> content = make_shared<FFmpegContent> (film, path);
        film->examine_and_add_content (content);
        wait_for_jobs ();
-       shared_ptr<Log> log (new NullLog);
-       shared_ptr<FFmpegDecoder> decoder (new FFmpegDecoder (content, log, false));
+       shared_ptr<Log> log = make_shared<NullLog> ();
+       shared_ptr<FFmpegDecoder> decoder = make_shared<FFmpegDecoder> (content, log, false);
 
        for (vector<int>::const_iterator i = frames.begin(); i != frames.end(); ++i) {
                check (decoder, *i);
index 6a27d698f5713997c0c0fd4d7e68caec77e8831c..9edca016049e390814a99b83e4e4bf925d8c9c71 100644 (file)
@@ -31,6 +31,7 @@
 #include "lib/film.h"
 #include "test.h"
 #include <boost/filesystem.hpp>
+#include <boost/make_shared.hpp>
 #include <boost/test/unit_test.hpp>
 #include <iostream>
 
@@ -38,6 +39,7 @@ using std::cout;
 using std::cerr;
 using std::list;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::optional;
 
 void
@@ -50,11 +52,11 @@ ffmpeg_decoder_sequential_test_one (boost::filesystem::path file, float fps, int
        }
 
        shared_ptr<Film> film = new_test_film ("ffmpeg_decoder_seek_test_" + file.string());
-       shared_ptr<FFmpegContent> content (new FFmpegContent (film, path));
+       shared_ptr<FFmpegContent> content = make_shared<FFmpegContent> (film, path);
        film->examine_and_add_content (content);
        wait_for_jobs ();
-       shared_ptr<Log> log (new NullLog);
-       shared_ptr<FFmpegDecoder> decoder (new FFmpegDecoder (content, log, false));
+       shared_ptr<Log> log = make_shared<NullLog> ();
+       shared_ptr<FFmpegDecoder> decoder = make_shared<FFmpegDecoder> (content, log, false);
 
        BOOST_REQUIRE (decoder->video->_content->video_frame_rate());
        BOOST_CHECK_CLOSE (decoder->video->_content->video_frame_rate().get(), fps, 0.01);
index 13846a8a16bff016609efa9a85357e8b7b5d8fb5..2900689e52a539d549acf780ee1d966abbe41f36 100644 (file)
  *  correctly from data/count300bd24.m2ts.
  */
 
-#include <boost/test/unit_test.hpp>
 #include "lib/ffmpeg_examiner.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/ffmpeg_audio_stream.h"
 #include "test.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using boost::shared_ptr;
+using boost::make_shared;
 
 BOOST_AUTO_TEST_CASE (ffmpeg_examiner_test)
 {
        shared_ptr<Film> film = new_test_film ("ffmpeg_examiner_test");
-       shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/count300bd24.m2ts"));
-       shared_ptr<FFmpegExaminer> examiner (new FFmpegExaminer (content));
+       shared_ptr<FFmpegContent> content = make_shared<FFmpegContent> (film, "test/data/count300bd24.m2ts");
+       shared_ptr<FFmpegExaminer> examiner = make_shared<FFmpegExaminer> (content);
 
        BOOST_CHECK_EQUAL (examiner->first_video().get(), ContentTime::from_seconds (600));
        BOOST_CHECK_EQUAL (examiner->audio_streams().size(), 1U);
index 02ea0233d8e1bb4caa3efd188201c86f19219a8c..ccc2a10f2301238d9076304d5ca2bac7f65c4de7 100644 (file)
  *  @brief Check the computation of _pts_offset in FFmpegDecoder.
  */
 
-#include <boost/test/unit_test.hpp>
 #include "lib/film.h"
 #include "lib/ffmpeg_decoder.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/ffmpeg_audio_stream.h"
 #include "lib/audio_content.h"
 #include "test.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using boost::shared_ptr;
+using boost::make_shared;
 
 BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test)
 {
        shared_ptr<Film> film = new_test_film ("ffmpeg_pts_offset_test");
-       shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/test.mp4"));
+       shared_ptr<FFmpegContent> content = make_shared<FFmpegContent> (film, "test/data/test.mp4");
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
        content->audio.reset (new AudioContent (content.get()));
+       /* Can't use make_shared here */
        content->audio->add_stream (shared_ptr<FFmpegAudioStream> (new FFmpegAudioStream));
        content->_video_frame_rate = 24;
 
index 970c6526d764ae3d609390e3ffca458e564a99a1..d61f5f0d186e86b2cd10dcaac951f95fc77097b4 100644 (file)
  *  @brief Test some basic reading/writing of film metadata.
  */
 
-#include <boost/test/unit_test.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/date_time.hpp>
 #include "lib/film.h"
 #include "lib/dcp_content_type.h"
 #include "lib/ratio.h"
 #include "test.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/date_time.hpp>
+#include <boost/make_shared.hpp>
 
 using std::string;
 using std::list;
 using boost::shared_ptr;
+using boost::make_shared;
 
 BOOST_AUTO_TEST_CASE (film_metadata_test)
 {
@@ -53,7 +55,7 @@ BOOST_AUTO_TEST_CASE (film_metadata_test)
        ignore.push_back ("Key");
        check_xml ("test/data/metadata.xml.ref", dir.string() + "/metadata.xml", ignore);
 
-       shared_ptr<Film> g (new Film (dir));
+       shared_ptr<Film> g = make_shared<Film> (dir);
        g->read_metadata ();
 
        BOOST_CHECK_EQUAL (g->name(), "fred");
index 592b7af8b5ca4ce17228fb3f4ec88f72b55cfc98..490836a465500cca08a7d5c8cf10e4e499f1ff2c 100644 (file)
@@ -23,7 +23,6 @@
  *  frame rate for the DCP.
  */
 
-#include <boost/test/unit_test.hpp>
 #include "lib/film.h"
 #include "lib/config.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/video_content.h"
 #include "lib/audio_content.h"
 #include "test.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using boost::shared_ptr;
+using boost::make_shared;
 
 /* Test Playlist::best_dcp_frame_rate and FrameRateChange
    with a single piece of content.
@@ -43,7 +45,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
 {
        shared_ptr<Film> film = new_test_film ("best_dcp_frame_rate_test_single");
        /* Get any piece of content, it doesn't matter what */
-       shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/test.mp4"));
+       shared_ptr<FFmpegContent> content = make_shared<FFmpegContent> (film, "test/data/test.mp4");
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
@@ -221,9 +223,9 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_double)
 {
        shared_ptr<Film> film = new_test_film ("best_dcp_frame_rate_test_double");
        /* Get any old content, it doesn't matter what */
-       shared_ptr<FFmpegContent> A (new FFmpegContent (film, "test/data/test.mp4"));
+       shared_ptr<FFmpegContent> A = make_shared<FFmpegContent> (film, "test/data/test.mp4");
        film->examine_and_add_content (A);
-       shared_ptr<FFmpegContent> B (new FFmpegContent (film, "test/data/test.mp4"));
+       shared_ptr<FFmpegContent> B = make_shared<FFmpegContent> (film, "test/data/test.mp4");
        film->examine_and_add_content (B);
        wait_for_jobs ();
 
@@ -252,7 +254,7 @@ BOOST_AUTO_TEST_CASE (audio_sampling_rate_test)
 {
        shared_ptr<Film> film = new_test_film ("audio_sampling_rate_test");
        /* Get any piece of content, it doesn't matter what */
-       shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/test.mp4"));
+       shared_ptr<FFmpegContent> content = make_shared<FFmpegContent> (film, "test/data/test.mp4");
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
@@ -262,7 +264,7 @@ BOOST_AUTO_TEST_CASE (audio_sampling_rate_test)
        afr.push_back (30);
        Config::instance()->set_allowed_dcp_frame_rates (afr);
 
-       shared_ptr<FFmpegAudioStream> stream (new FFmpegAudioStream ("foo", 0, 0, 0, 0));
+       shared_ptr<FFmpegAudioStream> stream = make_shared<FFmpegAudioStream> ("foo", 0, 0, 0, 0);
        content->audio.reset (new AudioContent (content.get()));
        content->audio->add_stream (stream);
        content->_video_frame_rate = 24;
index d002630356d6b402fe2fe1707e88f9c507594219..59b35a96bb876c54331da85589b9f12fa3a3ac1b 100644 (file)
  *  @see test/make_black_test.cc, test/pixel_formats_test.cc
  */
 
-#include <boost/test/unit_test.hpp>
 #include <Magick++.h>
 #include "lib/image.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::string;
 using std::list;
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 
 BOOST_AUTO_TEST_CASE (aligned_image_test)
 {
@@ -138,7 +140,7 @@ BOOST_AUTO_TEST_CASE (alpha_blend_test)
 {
        int const stride = 48 * 4;
 
-       shared_ptr<Image> A (new Image (AV_PIX_FMT_RGBA, dcp::Size (48, 48), false));
+       shared_ptr<Image> A = make_shared<Image> (AV_PIX_FMT_RGBA, dcp::Size (48, 48), false);
        A->make_black ();
        uint8_t* a = A->data()[0];
 
@@ -151,7 +153,7 @@ BOOST_AUTO_TEST_CASE (alpha_blend_test)
                }
        }
 
-       shared_ptr<Image> B (new Image (AV_PIX_FMT_RGBA, dcp::Size (48, 48), true));
+       shared_ptr<Image> B = make_shared<Image> (AV_PIX_FMT_RGBA, dcp::Size (48, 48), true);
        B->make_transparent ();
        uint8_t* b = B->data()[0];
 
@@ -192,7 +194,7 @@ BOOST_AUTO_TEST_CASE (merge_test1)
 {
        int const stride = 48 * 4;
 
-       shared_ptr<Image> A (new Image (AV_PIX_FMT_RGBA, dcp::Size (48, 48), false));
+       shared_ptr<Image> A = make_shared<Image> (AV_PIX_FMT_RGBA, dcp::Size (48, 48), false);
        A->make_transparent ();
        uint8_t* a = A->data()[0];
 
@@ -217,7 +219,7 @@ BOOST_AUTO_TEST_CASE (merge_test1)
 /** Test merge (list<PositionImage>) with two images */
 BOOST_AUTO_TEST_CASE (merge_test2)
 {
-       shared_ptr<Image> A (new Image (AV_PIX_FMT_RGBA, dcp::Size (48, 1), false));
+       shared_ptr<Image> A = make_shared<Image> (AV_PIX_FMT_RGBA, dcp::Size (48, 1), false);
        A->make_transparent ();
        uint8_t* a = A->data()[0];
        for (int x = 0; x < 16; ++x) {
@@ -227,7 +229,7 @@ BOOST_AUTO_TEST_CASE (merge_test2)
                a[x * 4 + 3] = 255;
        }
 
-       shared_ptr<Image> B (new Image (AV_PIX_FMT_RGBA, dcp::Size (48, 1), false));
+       shared_ptr<Image> B = make_shared<Image> (AV_PIX_FMT_RGBA, dcp::Size (48, 1), false);
        B->make_transparent ();
        uint8_t* b = B->data()[0];
        for (int x = 0; x < 16; ++x) {
index 69ffa9cc438181ffb8286391394fb5ffba419f55..3dc9333da0d617af18447be43ce2ec34bee23467 100644 (file)
 #include "lib/cross.h"
 #include <dcp/cpl.h>
 #include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using std::vector;
 using boost::shared_ptr;
+using boost::make_shared;
 
 /** Make an encrypted DCP, import it and make a new unencrypted DCP */
 BOOST_AUTO_TEST_CASE (import_dcp_test)
@@ -41,7 +43,7 @@ BOOST_AUTO_TEST_CASE (import_dcp_test)
        A->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        A->set_name ("frobozz");
 
-       shared_ptr<FFmpegContent> c (new FFmpegContent (A, "test/data/test.mp4"));
+       shared_ptr<FFmpegContent> c = make_shared<FFmpegContent> (A, "test/data/test.mp4");
        A->examine_and_add_content (c);
        A->set_encrypted (true);
        wait_for_jobs ();
@@ -52,7 +54,7 @@ BOOST_AUTO_TEST_CASE (import_dcp_test)
        dcp::DCP A_dcp ("build/test/import_dcp_test/" + A->dcp_name());
        A_dcp.read ();
 
-       Config::instance()->set_decryption_chain (shared_ptr<dcp::CertificateChain> (new dcp::CertificateChain (openssl_path ())));
+       Config::instance()->set_decryption_chain (make_shared<dcp::CertificateChain> (openssl_path ()));
 
        dcp::EncryptedKDM kdm = A->make_kdm (
                Config::instance()->decryption_chain()->leaf (),
@@ -68,7 +70,7 @@ BOOST_AUTO_TEST_CASE (import_dcp_test)
        B->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        B->set_name ("frobozz");
 
-       shared_ptr<DCPContent> d (new DCPContent (B, "build/test/import_dcp_test/" + A->dcp_name()));
+       shared_ptr<DCPContent> d = boost::make_shared<DCPContent> (B, "build/test/import_dcp_test/" + A->dcp_name());
        d->add_kdm (kdm);
        B->examine_and_add_content (d);
        wait_for_jobs ();
index 8883c2d6f43e97c781d6e388875502bcfa3daf27..4d5787997f40912441ecc6a633cbeb0aa42bafdb 100644 (file)
 #include "lib/cross.h"
 #include "test.h"
 #include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using boost::shared_ptr;
+using boost::make_shared;
 
 /** Interrupt a DCP encode when it is in progress, as this used to (still does?)
  *  sometimes give an error related to pthreads.
@@ -40,7 +42,7 @@ BOOST_AUTO_TEST_CASE (interrupt_encoder_test)
        film->set_container (Ratio::from_id ("185"));
        film->set_name ("interrupt_encoder_test");
 
-       shared_ptr<FFmpegContent> content (new FFmpegContent (film, private_data / "prophet_clip.mkv"));
+       shared_ptr<FFmpegContent> content = make_shared<FFmpegContent> (film, private_data / "prophet_clip.mkv");
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
index bb47fa9c0134e0e4061a0d5cc16871889b61a93a..e3023f9f5e891cb8712561cb5b5c1f4eb59e1752 100644 (file)
 #include "lib/ffmpeg_content.h"
 #include "lib/audio_content.h"
 #include "test.h"
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 
 BOOST_AUTO_TEST_CASE (isdcf_name_test)
 {
@@ -76,7 +78,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test)
 
        /* Test interior aspect ratio: shouldn't be shown with trailers */
 
-       shared_ptr<ImageContent> content (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
+       shared_ptr<ImageContent> content = make_shared<ImageContent> (film, "test/data/simple_testcard_640x480.png");
        film->examine_and_add_content (content);
        wait_for_jobs ();
        content->video->set_scale (VideoContentScale (Ratio::from_id ("133")));
@@ -128,7 +130,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test)
        /* Test audio channel markup */
 
        film->set_audio_channels (6);
-       shared_ptr<FFmpegContent> sound (new FFmpegContent (film, "test/data/sine_440.wav"));
+       shared_ptr<FFmpegContent> sound = make_shared<FFmpegContent> (film, "test/data/sine_440.wav");
        film->examine_and_add_content (sound);
        wait_for_jobs ();
        BOOST_CHECK_EQUAL (film->isdcf_name(false), "LikeShouting_XSN-2_F-133_DE-fr_US-R_10_4K_DI_20140704_PP_SMPTE_OV");
index 8728b7312137bbbdde15dcb56c2879303c0f93db..5212ec150dc4857f57252e7ff4861ceb35b69ef7 100644 (file)
  *  @brief Basic tests of Job and JobManager.
  */
 
-#include <boost/test/unit_test.hpp>
 #include "lib/job.h"
 #include "lib/job_manager.h"
 #include "lib/cross.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using std::string;
 using boost::shared_ptr;
+using boost::make_shared;
 
 class TestJob : public Job
 {
@@ -70,7 +72,7 @@ BOOST_AUTO_TEST_CASE (job_manager_test)
        shared_ptr<Film> film;
 
        /* Single job */
-       shared_ptr<TestJob> a (new TestJob (film));
+       shared_ptr<TestJob> a = make_shared<TestJob> (film);
 
        JobManager::instance()->add (a);
        dcpomatic_sleep (1);
index 405cc835fe974495db44b2bdc387157b12b9d01c..88bf4bb7a5e1100bd529102d650bb6fb069011e5 100644 (file)
  *  @see test/image_test.cc
  */
 
-#include <boost/test/unit_test.hpp>
 #include <dcp/util.h>
 extern "C" {
 #include <libavutil/pixfmt.h>
 }
 #include "lib/image.h"
+#include <boost/make_shared.hpp>
+#include <boost/test/unit_test.hpp>
 
 using std::list;
+using boost::make_shared;
 
 BOOST_AUTO_TEST_CASE (make_black_test)
 {
@@ -79,7 +81,7 @@ BOOST_AUTO_TEST_CASE (make_black_test)
 
        int N = 0;
        for (list<AVPixelFormat>::const_iterator i = pix_fmts.begin(); i != pix_fmts.end(); ++i) {
-               boost::shared_ptr<Image> foo (new Image (*i, in_size, true));
+               boost::shared_ptr<Image> foo = make_shared<Image> (*i, in_size, true);
                foo->make_black ();
                boost::shared_ptr<Image> bar = foo->scale (out_size, dcp::YUV_TO_RGB_REC601, AV_PIX_FMT_RGB24, true, false);
 
index 92c49a13442dd14400e41c66f299db40f93a1b4b..9b9e2c87bed21faf161d98682ec76c505c903915 100644 (file)
@@ -88,13 +88,13 @@ BOOST_AUTO_TEST_CASE (play_test)
        film->set_container (Ratio::from_id ("185"));
        film->set_name ("play_test");
 
-       shared_ptr<FFmpegContent> A (new FFmpegContent (film, "test/data/red_24.mp4"));
+       shared_ptr<FFmpegContent> A = make_shared<FFmpegContent> (film, "test/data/red_24.mp4");
        film->examine_and_add_content (A);
        wait_for_jobs ();
 
        BOOST_CHECK_EQUAL (A->video_length_after_3d_combine(), 16);
 
-       shared_ptr<FFmpegContent> B (new FFmpegContent (film, "test/data/red_30.mp4"));
+       shared_ptr<FFmpegContent> B = make_shared<FFmpegContent> (film, "test/data/red_30.mp4");
        film->examine_and_add_content (B);
        wait_for_jobs ();
 
@@ -107,7 +107,7 @@ BOOST_AUTO_TEST_CASE (play_test)
        /* A is 16 frames long at 25 fps */
        BOOST_CHECK_EQUAL (B->position(), 16 * TIME_HZ / 25);
 
-       shared_ptr<Player> player (new Player (film));
+       shared_ptr<Player> player = make_shared<Player> (film);
        PlayerWrapper wrap (player);
        /* Seek and audio don't get on at the moment */
        player->disable_audio ();
index 1b628f72a3034d051f7cfe02a71c28a3ee99d237..6ca0073d81ed39c037d6404977e578a5593a1d55 100644 (file)
@@ -22,8 +22,6 @@
  *  @brief Various tests of Player.
  */
 
-#include <iostream>
-#include <boost/test/unit_test.hpp>
 #include "lib/film.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/dcp_content_type.h"
 #include "lib/audio_buffers.h"
 #include "lib/player.h"
 #include "test.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
+#include <iostream>
 
 using std::cout;
 using std::list;
 using boost::shared_ptr;
+using boost::make_shared;
 
 static bool
 valid (Content const *)
@@ -49,9 +51,9 @@ BOOST_AUTO_TEST_CASE (player_overlaps_test)
        film->set_container (Ratio::from_id ("185"));
 
        /* This content is 3s long */
-       shared_ptr<FFmpegContent> A (new FFmpegContent (film, "test/data/test.mp4"));
-       shared_ptr<FFmpegContent> B (new FFmpegContent (film, "test/data/test.mp4"));
-       shared_ptr<FFmpegContent> C (new FFmpegContent (film, "test/data/test.mp4"));
+       shared_ptr<FFmpegContent> A = make_shared<FFmpegContent> (film, "test/data/test.mp4");
+       shared_ptr<FFmpegContent> B = make_shared<FFmpegContent> (film, "test/data/test.mp4");
+       shared_ptr<FFmpegContent> C = make_shared<FFmpegContent> (film, "test/data/test.mp4");
 
        film->examine_and_add_content (A);
        film->examine_and_add_content (B);
@@ -64,7 +66,7 @@ BOOST_AUTO_TEST_CASE (player_overlaps_test)
        B->set_position (DCPTime::from_seconds (10));
        C->set_position (DCPTime::from_seconds (20));
 
-       shared_ptr<Player> player (new Player (film, film->playlist ()));
+       shared_ptr<Player> player = make_shared<Player> (film, film->playlist ());
 
        list<shared_ptr<Piece> > o = player->overlaps (DCPTime::from_seconds (0), DCPTime::from_seconds (5), &valid);
        BOOST_CHECK_EQUAL (o.size(), 1U);
@@ -92,14 +94,14 @@ BOOST_AUTO_TEST_CASE (player_silence_padding_test)
 {
        shared_ptr<Film> film = new_test_film ("player_silence_padding_test");
        film->set_name ("player_silence_padding_test");
-       shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/test.mp4"));
+       shared_ptr<FFmpegContent> c = make_shared<FFmpegContent> (film, "test/data/test.mp4");
        film->set_container (Ratio::from_id ("185"));
        film->set_audio_channels (6);
 
        film->examine_and_add_content (c);
        wait_for_jobs ();
 
-       shared_ptr<Player> player (new Player (film, film->playlist ()));
+       shared_ptr<Player> player = make_shared<Player> (film, film->playlist ());
        shared_ptr<AudioBuffers> test = player->get_audio (DCPTime (0), DCPTime::from_seconds (1), true);
        BOOST_CHECK_EQUAL (test->frames(), 48000);
        BOOST_CHECK_EQUAL (test->channels(), film->audio_channels ());
index f9ef8793e8129fb6a1f0ee373fa3e016e83ac0ce..83e83d88d84b5fc0b690f7897ceabb4c5ce93904 100644 (file)
 #include <dcp/mono_picture_asset.h>
 #include <dcp/stereo_picture_asset.h>
 #include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::cout;
 using std::string;
 using boost::shared_ptr;
+using boost::make_shared;
 
 static void
 note (dcp::NoteType t, string n)
@@ -53,7 +55,7 @@ BOOST_AUTO_TEST_CASE (recover_test_2d)
        film->set_container (Ratio::from_id ("185"));
        film->set_name ("recover_test");
 
-       shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/count300bd24.m2ts"));
+       shared_ptr<FFmpegContent> content = make_shared<FFmpegContent> (film, "test/data/count300bd24.m2ts");
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
@@ -71,8 +73,8 @@ BOOST_AUTO_TEST_CASE (recover_test_2d)
        film->make_dcp ();
        wait_for_jobs ();
 
-       shared_ptr<dcp::MonoPictureAsset> A (new dcp::MonoPictureAsset ("build/test/recover_test_2d/original.mxf"));
-       shared_ptr<dcp::MonoPictureAsset> B (new dcp::MonoPictureAsset (video));
+       shared_ptr<dcp::MonoPictureAsset> A = make_shared<dcp::MonoPictureAsset> ("build/test/recover_test_2d/original.mxf");
+       shared_ptr<dcp::MonoPictureAsset> B = make_shared<dcp::MonoPictureAsset> (video);
 
        dcp::EqualityOptions eq;
        BOOST_CHECK (A->equals (B, eq, boost::bind (&note, _1, _2)));
@@ -86,7 +88,7 @@ BOOST_AUTO_TEST_CASE (recover_test_3d)
        film->set_name ("recover_test");
        film->set_three_d (true);
 
-       shared_ptr<ImageContent> content (new ImageContent (film, "test/data/3d_test"));
+       shared_ptr<ImageContent> content = make_shared<ImageContent> (film, "test/data/3d_test");
        content->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT_RIGHT);
        film->examine_and_add_content (content);
        wait_for_jobs ();
@@ -106,8 +108,8 @@ BOOST_AUTO_TEST_CASE (recover_test_3d)
        film->make_dcp ();
        wait_for_jobs ();
 
-       shared_ptr<dcp::StereoPictureAsset> A (new dcp::StereoPictureAsset ("build/test/recover_test_3d/original.mxf"));
-       shared_ptr<dcp::StereoPictureAsset> B (new dcp::StereoPictureAsset (video));
+       shared_ptr<dcp::StereoPictureAsset> A = make_shared<dcp::StereoPictureAsset> ("build/test/recover_test_3d/original.mxf");
+       shared_ptr<dcp::StereoPictureAsset> B = make_shared<dcp::StereoPictureAsset> (video);
 
        dcp::EqualityOptions eq;
        BOOST_CHECK (A->equals (B, eq, boost::bind (&note, _1, _2)));
index 6178c88ac71f2d2eccdb9b4082fe7ff1a17daeb2..f516fb2622a23d5c49dbc90d14a6a3f1b742028a 100644 (file)
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 
 using std::list;
 using boost::shared_ptr;
+using boost::make_shared;
 
 /** Test Film::reels() */
 BOOST_AUTO_TEST_CASE (reels_test1)
 {
        shared_ptr<Film> film = new_test_film ("reels_test1");
        film->set_container (Ratio::from_id ("185"));
-       shared_ptr<FFmpegContent> A (new FFmpegContent (film, "test/data/test.mp4"));
+       shared_ptr<FFmpegContent> A = make_shared<FFmpegContent> (film, "test/data/test.mp4");
        film->examine_and_add_content (A);
-       shared_ptr<FFmpegContent> B (new FFmpegContent (film, "test/data/test.mp4"));
+       shared_ptr<FFmpegContent> B = make_shared<FFmpegContent> (film, "test/data/test.mp4");
        film->examine_and_add_content (B);
        wait_for_jobs ();
        BOOST_CHECK_EQUAL (A->full_length(), DCPTime (288000));
@@ -87,21 +89,21 @@ BOOST_AUTO_TEST_CASE (reels_test2)
        film->set_dcp_content_type (DCPContentType::from_pretty_name ("Test"));
 
        {
-               shared_ptr<ImageContent> c (new ImageContent (film, "test/data/flat_red.png"));
+               shared_ptr<ImageContent> c = make_shared<ImageContent> (film, "test/data/flat_red.png");
                film->examine_and_add_content (c);
                wait_for_jobs ();
                c->video->set_length (24);
        }
 
        {
-               shared_ptr<ImageContent> c (new ImageContent (film, "test/data/flat_green.png"));
+               shared_ptr<ImageContent> c = make_shared<ImageContent> (film, "test/data/flat_green.png");
                film->examine_and_add_content (c);
                wait_for_jobs ();
                c->video->set_length (24);
        }
 
        {
-               shared_ptr<ImageContent> c (new ImageContent (film, "test/data/flat_blue.png"));
+               shared_ptr<ImageContent> c = make_shared<ImageContent> (film, "test/data/flat_blue.png");
                film->examine_and_add_content (c);
                wait_for_jobs ();
                c->video->set_length (24);
@@ -121,7 +123,7 @@ BOOST_AUTO_TEST_CASE (reels_test2)
        film2->set_dcp_content_type (DCPContentType::from_pretty_name ("Test"));
        film2->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
 
-       shared_ptr<DCPContent> c (new DCPContent (film2, film->dir (film->dcp_name ())));
+       shared_ptr<DCPContent> c = make_shared<DCPContent> (film2, film->dir (film->dcp_name ()));
        film2->examine_and_add_content (c);
        wait_for_jobs ();
 
@@ -155,9 +157,9 @@ BOOST_AUTO_TEST_CASE (reels_test3)
        film->set_dcp_content_type (DCPContentType::from_pretty_name ("Test"));
        film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
 
-       shared_ptr<Content> dcp (new DCPContent (film, "test/data/reels_test2"));
+       shared_ptr<Content> dcp = make_shared<DCPContent> (film, "test/data/reels_test2");
        film->examine_and_add_content (dcp);
-       shared_ptr<Content> sub (new TextSubtitleContent (film, "test/data/subrip.srt"));
+       shared_ptr<Content> sub = make_shared<TextSubtitleContent> (film, "test/data/subrip.srt");
        film->examine_and_add_content (sub);
        wait_for_jobs ();
 
@@ -197,7 +199,7 @@ BOOST_AUTO_TEST_CASE (reels_test4)
                content[i]->video->set_length (24);
        }
 
-       shared_ptr<TextSubtitleContent> subs (new TextSubtitleContent (film, "test/data/subrip3.srt"));
+       shared_ptr<TextSubtitleContent> subs = make_shared<TextSubtitleContent> (film, "test/data/subrip3.srt");
        film->examine_and_add_content (subs);
        wait_for_jobs ();
 
index d145ccb18f48591ba2242998b4dcd61a7578e449..be39242e7a29a20110f86084d1229fa5a9a18dad 100644 (file)
  *  @see test/skip_frame_test.cc
  */
 
-#include <boost/test/unit_test.hpp>
 #include "test.h"
 #include "lib/film.h"
 #include "lib/ratio.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/dcp_content_type.h"
 #include "lib/video_content.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using boost::shared_ptr;
+using boost::make_shared;
 
 BOOST_AUTO_TEST_CASE (repeat_frame_test)
 {
@@ -41,7 +43,7 @@ BOOST_AUTO_TEST_CASE (repeat_frame_test)
        film->set_name ("repeat_frame_test");
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_pretty_name ("Test"));
-       shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/red_24.mp4"));
+       shared_ptr<FFmpegContent> c = make_shared<FFmpegContent> (film, "test/data/red_24.mp4");
        film->examine_and_add_content (c);
 
        wait_for_jobs ();
index fb4b98861c18afc65a421b3a075c4d9571a4eda1..cb5cddc9e72a6600017148935234b7711942398f 100644 (file)
  *  to the number of samples it generates.
  */
 
-#include <boost/test/unit_test.hpp>
 #include "lib/audio_buffers.h"
 #include "lib/resampler.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::pair;
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 
 static void
 resampler_test_one (int from, int to)
@@ -42,7 +44,7 @@ resampler_test_one (int from, int to)
 
        /* XXX: no longer checks anything */
        for (int64_t i = 0; i < N; i += 1000) {
-               shared_ptr<AudioBuffers> a (new AudioBuffers (1, 1000));
+               shared_ptr<AudioBuffers> a = make_shared<AudioBuffers> (1, 1000);
                a->make_silent ();
                shared_ptr<const AudioBuffers> r = resamp.run (a);
        }
index 5ac5c7525cbb581704bd024439c00d6eea6a4172..4bb6551d39b1400dd17f14f1ee6404bdaaa50bb4 100644 (file)
  *  @brief Test scaling and black-padding of images from a still-image source.
  */
 
-#include <boost/test/unit_test.hpp>
 #include "lib/image_content.h"
 #include "lib/ratio.h"
 #include "lib/film.h"
 #include "lib/dcp_content_type.h"
 #include "lib/video_content.h"
 #include "test.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using std::string;
 using boost::shared_ptr;
+using boost::make_shared;
 
 static void scaling_test_for (shared_ptr<Film> film, shared_ptr<Content> content, string image, string container)
 {
@@ -60,7 +62,7 @@ BOOST_AUTO_TEST_CASE (scaling_test)
        shared_ptr<Film> film = new_test_film ("scaling_test");
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
        film->set_name ("scaling_test");
-       shared_ptr<ImageContent> imc (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
+       shared_ptr<ImageContent> imc = make_shared<ImageContent> (film, "test/data/simple_testcard_640x480.png");
 
        film->examine_and_add_content (imc);
 
index 05bf1b5bf4e519916cacb3bf263c45e1c7b72ebc..c22cadb96e8468f3e48f8fabdda97e7e70694095 100644 (file)
@@ -23,7 +23,6 @@
  *  confusing things as it might in ffmpeg_seek_test).
  */
 
-#include <boost/test/unit_test.hpp>
 #include "lib/film.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/ratio.h"
@@ -35,6 +34,8 @@
 #include "lib/video_content.h"
 #include "lib/video_decoder.h"
 #include "test.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::cout;
@@ -42,6 +43,7 @@ using std::list;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
 using boost::optional;
+using boost::make_shared;
 
 BOOST_AUTO_TEST_CASE (seek_zero_test)
 {
@@ -49,7 +51,7 @@ BOOST_AUTO_TEST_CASE (seek_zero_test)
        film->set_name ("seek_zero_test");
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_pretty_name ("Test"));
-       shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/count300bd48.m2ts"));
+       shared_ptr<FFmpegContent> content = make_shared<FFmpegContent> (film, "test/data/count300bd48.m2ts");
        film->examine_and_add_content (content);
        wait_for_jobs ();
        content->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
index 9791b71722e3bd92b430d27b13916780074330fe..5ece7d9cd180ec45e22d1b16f2c2c9af5d4a00ae 100644 (file)
 #include <dcp/reel_sound_asset.h>
 #include <dcp/sound_asset_reader.h>
 #include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using std::string;
 using boost::lexical_cast;
 using boost::shared_ptr;
+using boost::make_shared;
 
 static void
 test_silence_padding (int channels)
@@ -49,7 +51,7 @@ test_silence_padding (int channels)
        film->set_container (Ratio::from_id ("185"));
        film->set_name (film_name);
 
-       shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/staircase.wav"));
+       shared_ptr<FFmpegContent> content = make_shared<FFmpegContent> (film, "test/data/staircase.wav");
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
index 8ff43a4ca6d8cf8b22945403520168e92b8f34e1..b98b80334fa5e232b3060960c94ae37257b0d064 100644 (file)
  *  @see test/repeat_frame_test.cc
  */
 
-#include <boost/test/unit_test.hpp>
 #include "test.h"
 #include "lib/film.h"
 #include "lib/ratio.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/dcp_content_type.h"
 #include "lib/video_content.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using boost::shared_ptr;
+using boost::make_shared;
 
 BOOST_AUTO_TEST_CASE (skip_frame_test)
 {
@@ -41,7 +43,7 @@ BOOST_AUTO_TEST_CASE (skip_frame_test)
        film->set_name ("skip_frame_test");
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_pretty_name ("Test"));
-       shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/count300bd48.m2ts"));
+       shared_ptr<FFmpegContent> c = make_shared<FFmpegContent> (film, "test/data/count300bd48.m2ts");
        film->examine_and_add_content (c);
 
        wait_for_jobs ();
index 123d04d95778ed388b3c929be674500e56885973..2899d5064cd5dcb3dd2918c8e11074019c9c0a0b 100644 (file)
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 #include <boost/algorithm/string.hpp>
+#include <boost/make_shared.hpp>
 #include <list>
 
 using std::string;
 using std::list;
 using boost::shared_ptr;
+using boost::make_shared;
 
 /** Make a very short DCP with a single subtitle from .srt with no specified fonts */
 BOOST_AUTO_TEST_CASE (srt_subtitle_test)
@@ -44,7 +46,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test)
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
-       shared_ptr<TextSubtitleContent> content (new TextSubtitleContent (film, "test/data/subrip2.srt"));
+       shared_ptr<TextSubtitleContent> content = make_shared<TextSubtitleContent> (film, "test/data/subrip2.srt");
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
@@ -64,7 +66,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test2)
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
-       shared_ptr<TextSubtitleContent> content (new TextSubtitleContent (film, "test/data/subrip2.srt"));
+       shared_ptr<TextSubtitleContent> content = make_shared<TextSubtitleContent> (film, "test/data/subrip2.srt");
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
@@ -89,7 +91,7 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test3)
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
        film->set_interop (true);
-       shared_ptr<TextSubtitleContent> content (new TextSubtitleContent (film, private_data / "Ankoemmling.srt"));
+       shared_ptr<TextSubtitleContent> content = make_shared<TextSubtitleContent> (film, private_data / "Ankoemmling.srt");
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
@@ -130,11 +132,11 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test3)
 BOOST_AUTO_TEST_CASE (srt_subtitle_test4)
 {
        shared_ptr<Film> film = new_test_film ("subrip_render_test");
-       shared_ptr<TextSubtitleContent> content (new TextSubtitleContent (film, "test/data/subrip.srt"));
+       shared_ptr<TextSubtitleContent> content = make_shared<TextSubtitleContent> (film, "test/data/subrip.srt");
        content->examine (shared_ptr<Job> (), true);
        BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds ((3 * 60) + 56.471));
 
-       shared_ptr<SubRipDecoder> decoder (new SubRipDecoder (content));
+       shared_ptr<SubRipDecoder> decoder = make_shared<SubRipDecoder> (content);
        list<ContentTextSubtitle> cts = decoder->get_text_subtitles (
                ContentTimePeriod (
                        ContentTime::from_seconds (109), ContentTime::from_seconds (110)
index f6c65b1af67d34008744d868cc30b38bb4dfde40..0bfa39e747487416babc67c8f221335ff5d47468 100644 (file)
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 #include <boost/algorithm/string.hpp>
+#include <boost/make_shared.hpp>
 #include <list>
 
 using std::string;
 using std::list;
 using boost::shared_ptr;
+using boost::make_shared;
 
 /** Make a DCP with subs from a .ssa file */
 BOOST_AUTO_TEST_CASE (ssa_subtitle_test1)
@@ -42,7 +44,7 @@ BOOST_AUTO_TEST_CASE (ssa_subtitle_test1)
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
        film->set_interop (true);
-       shared_ptr<TextSubtitleContent> content (new TextSubtitleContent (film, private_data / "DKH_UT_EN20160601def.ssa"));
+       shared_ptr<TextSubtitleContent> content = make_shared<TextSubtitleContent> (film, private_data / "DKH_UT_EN20160601def.ssa");
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
index c7a9e95bfd6f8d6a78eda143c4020f4d4bf458ce..d3180434d082307896f4c0e201d3eaa9336fdd64 100644 (file)
@@ -40,6 +40,7 @@
 #define BOOST_TEST_DYN_LINK
 #define BOOST_TEST_MODULE dcpomatic_test
 #include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 #include <list>
 #include <vector>
 #include <iostream>
@@ -53,6 +54,7 @@ using std::list;
 using std::abs;
 using boost::shared_ptr;
 using boost::scoped_array;
+using boost::make_shared;
 
 boost::filesystem::path private_data = boost::filesystem::path ("..") / boost::filesystem::path ("dcpomatic-test-private");
 
@@ -112,7 +114,7 @@ new_test_film (string name)
                boost::filesystem::remove_all (p);
        }
 
-       shared_ptr<Film> film = shared_ptr<Film> (new Film (p.string()));
+       shared_ptr<Film> film = boost::make_shared<Film> (p.string());
        film->write_metadata ();
        return film;
 }
index ab94cf8e5b888a562b2612ce5a38006a17d0cfc8..23236fb31fa5e36c1eaf4e5b6de05880da4302d1 100644 (file)
 #include "lib/dcp_content_type.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/video_content.h"
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 
 BOOST_AUTO_TEST_CASE (threed_test)
 {
        shared_ptr<Film> film = new_test_film ("threed_test");
        film->set_name ("test_film2");
-       shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/test.mp4"));
+       shared_ptr<FFmpegContent> c = make_shared<FFmpegContent> (film, "test/data/test.mp4");
        film->examine_and_add_content (c);
        wait_for_jobs ();
 
index ddd685d0c33f2bb789ef1cce5567421c863958a8..bf21e5476d47e807c756e07ef4adc53f77eb4ab0 100644 (file)
 #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>"
@@ -123,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);
@@ -176,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 ());
@@ -381,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 ());
@@ -557,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 ());
index e0117c73417612486ebbe7c4b7f74fe571cd9d23..4c611c37ed80c9eb2d4f6a14d2b06d6560353e05 100644 (file)
@@ -18,8 +18,6 @@
 
 */
 
-#include <boost/test/unit_test.hpp>
-#include <sndfile.h>
 #include "lib/film.h"
 #include "lib/ratio.h"
 #include "lib/dcp_content_type.h"
 #include "lib/audio_buffers.h"
 #include "lib/upmixer_a.h"
 #include "test.h"
+#include <sndfile.h>
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using boost::shared_ptr;
+using boost::make_shared;
 
 BOOST_AUTO_TEST_CASE (upmixer_a_test)
 {
@@ -38,7 +40,7 @@ BOOST_AUTO_TEST_CASE (upmixer_a_test)
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
        film->set_audio_processor (AudioProcessor::from_id ("stereo-5.1-upmix-a"));
-       shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/white.wav"));
+       shared_ptr<FFmpegContent> content = make_shared<FFmpegContent> (film, "test/data/white.wav");
        film->examine_and_add_content (content);
 
        wait_for_jobs ();
@@ -54,7 +56,7 @@ BOOST_AUTO_TEST_CASE (upmixer_a_test)
        SNDFILE* Ls = sf_open ("build/test/upmixer_a_test/Ls.wav", SFM_WRITE, &info);
        SNDFILE* Rs = sf_open ("build/test/upmixer_a_test/Rs.wav", SFM_WRITE, &info);
 
-       shared_ptr<Player> player (new Player (film, film->playlist ()));
+       shared_ptr<Player> player = make_shared<Player> (film, film->playlist ());
        for (DCPTime t; t < film->length(); t += DCPTime::from_seconds (1)) {
                shared_ptr<AudioBuffers> b = player->get_audio (t, DCPTime::from_seconds (1), true);
                sf_write_float (L, b->data(0), b->frames());
index ae7c30be3063fb443242bcdc93817bb4b577e5fd..480df0bd738005b33d8c93a68b7ed828027ed13d 100644 (file)
 #include "test.h"
 #include <boost/test/unit_test.hpp>
 #include <boost/foreach.hpp>
+#include <boost/make_shared.hpp>
 
 using std::list;
 using std::string;
 using boost::shared_ptr;
+using boost::make_shared;
 
 /** Test the logic which decides whether a DCP can be referenced or not */
 BOOST_AUTO_TEST_CASE (vf_test1)
 {
        shared_ptr<Film> film = new_test_film ("vf_test1");
-       shared_ptr<DCPContent> dcp (new DCPContent (film, "test/data/reels_test2"));
+       shared_ptr<DCPContent> dcp = make_shared<DCPContent> (film, "test/data/reels_test2");
        film->examine_and_add_content (dcp);
        wait_for_jobs ();
 
@@ -51,7 +53,7 @@ BOOST_AUTO_TEST_CASE (vf_test1)
        /* (but reels_test2 has no subtitles to reference) */
        BOOST_CHECK (!dcp->can_reference_subtitle(why_not));
 
-       shared_ptr<FFmpegContent> other (new FFmpegContent (film, "test/data/test.mp4"));
+       shared_ptr<FFmpegContent> other = make_shared<FFmpegContent> (film, "test/data/test.mp4");
        film->examine_and_add_content (other);
        wait_for_jobs ();
 
index 6f5d85a11045d4b2c17b9666f1853af33c62e528..f1edce04150fb1997fe1fc622d8a535761d9e532 100644 (file)
 
 */
 
-#include <boost/test/unit_test.hpp>
 #include "lib/ffmpeg_content.h"
 #include "lib/ratio.h"
 #include "lib/video_content.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using std::list;
 using std::string;
 using std::cerr;
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::optional;
 
 static
@@ -86,11 +88,11 @@ test (dcp::Size content_size, dcp::Size display_size, dcp::Size film_size, Crop
                "<SubtitleYScale>0</SubtitleYScale>"
                "</Content>";
 
-       shared_ptr<cxml::Document> doc (new cxml::Document ());
+       shared_ptr<cxml::Document> doc = make_shared<cxml::Document> ();
        doc->read_string(s.str ());
 
        list<string> notes;
-       shared_ptr<FFmpegContent> vc (new FFmpegContent (film, doc, 10, notes));
+       shared_ptr<FFmpegContent> vc = boost::make_shared<FFmpegContent> (film, doc, 10, notes);
 
        optional<VideoContentScale> sc;
        if (ratio) {
index 2d783f52d72ae357d033ab70847902d98903333b..8aa5e830fd36ee5f21351642efedd17e990c5bbe 100644 (file)
 
 */
 
-#include <boost/test/unit_test.hpp>
 #include "lib/image_decoder.h"
 #include "lib/image_content.h"
 #include "lib/content_video.h"
 #include "lib/video_decoder.h"
 #include "lib/film.h"
 #include "test.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::list;
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 
 BOOST_AUTO_TEST_CASE (video_decoder_fill_test1)
 {
        shared_ptr<Film> film = new_test_film ("video_decoder_fill_test");
-       shared_ptr<ImageContent> c (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
+       shared_ptr<ImageContent> c = make_shared<ImageContent> (film, "test/data/simple_testcard_640x480.png");
        ImageDecoder decoder (c, film->log());
 
        decoder.video->fill_one_eye (0, 4, EYES_BOTH);
@@ -59,7 +61,7 @@ BOOST_AUTO_TEST_CASE (video_decoder_fill_test1)
 BOOST_AUTO_TEST_CASE (video_decoder_fill_test2)
 {
        shared_ptr<Film> film = new_test_film ("video_decoder_fill_test");
-       shared_ptr<ImageContent> c (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
+       shared_ptr<ImageContent> c = make_shared<ImageContent> (film, "test/data/simple_testcard_640x480.png");
        ImageDecoder decoder (c, film->log());
 
        decoder.video->fill_both_eyes (VideoFrame (0, EYES_LEFT), VideoFrame (4, EYES_LEFT));
index 953e9b7b705641b581c35c34de8b1048c86fd0b1..4759cb69ce5e2177745050b8f36fb25e5ee5796a 100644 (file)
 #include "test.h"
 #include <dcp/mono_picture_asset.h>
 #include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 
 using boost::shared_ptr;
+using boost::make_shared;
 using boost::dynamic_pointer_cast;
 
 static boost::filesystem::path ref_mxf = "test/data/scaling_test_185_185/j2c_a41afbff-e1ad-41c4-9a84-de315b95dd0f.mxf";
@@ -53,9 +55,9 @@ BOOST_AUTO_TEST_CASE (video_mxf_content_test)
        film->make_dcp ();
        wait_for_jobs ();
 
-       shared_ptr<dcp::MonoPictureAsset> ref (new dcp::MonoPictureAsset (ref_mxf));
+       shared_ptr<dcp::MonoPictureAsset> ref = make_shared<dcp::MonoPictureAsset> (ref_mxf);
        boost::filesystem::directory_iterator i ("build/test/video_mxf_content_test/video");
-       shared_ptr<dcp::MonoPictureAsset> comp (new dcp::MonoPictureAsset (*i));
+       shared_ptr<dcp::MonoPictureAsset> comp = make_shared<dcp::MonoPictureAsset> (*i);
        dcp::EqualityOptions op;
        BOOST_CHECK (ref->equals (comp, op, note));
 }
index 678f2b8d097cc08c5cb4688759521ae3c6621523..408d46b62c3b7269a7b56c35ef585c79108d5638 100644 (file)
  *  @brief Test creation of XML DCP subtitles.
  */
 
-#include <boost/test/unit_test.hpp>
 #include "lib/text_subtitle_content.h"
 #include "lib/film.h"
 #include "lib/ratio.h"
 #include "lib/dcp_content_type.h"
 #include "lib/subtitle_content.h"
 #include "test.h"
+#include <boost/test/unit_test.hpp>
+#include <boost/make_shared.hpp>
 #include <iostream>
 
 using std::cout;
 using boost::shared_ptr;
+using boost::make_shared;
 
 /** Build a small DCP with no picture and a single subtitle overlaid onto it */
 BOOST_AUTO_TEST_CASE (xml_subtitle_test)
@@ -41,7 +43,7 @@ BOOST_AUTO_TEST_CASE (xml_subtitle_test)
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
        film->set_name ("frobozz");
-       shared_ptr<TextSubtitleContent> content (new TextSubtitleContent (film, "test/data/subrip2.srt"));
+       shared_ptr<TextSubtitleContent> content = make_shared<TextSubtitleContent> (film, "test/data/subrip2.srt");
        content->subtitle->set_use (true);
        content->subtitle->set_burn (false);
        film->examine_and_add_content (content);
@@ -62,7 +64,7 @@ BOOST_AUTO_TEST_CASE (xml_subtitle_test2)
        film->set_name ("frobozz");
        film->set_interop (true);
        film->set_sequence (false);
-       shared_ptr<TextSubtitleContent> content (new TextSubtitleContent (film, "test/data/subrip2.srt"));
+       shared_ptr<TextSubtitleContent> content = make_shared<TextSubtitleContent> (film, "test/data/subrip2.srt");
        content->subtitle->set_use (true);
        content->subtitle->set_burn (false);
        film->examine_and_add_content (content);