#include "atmos_content.h"
-#include "dcp_content.h"
-#include "video_content.h"
#include "audio_content.h"
-#include "dcp_examiner.h"
-#include "job.h"
-#include "film.h"
-#include "config.h"
-#include "overlaps.h"
#include "compose.hpp"
+#include "config.h"
+#include "dcp_content.h"
#include "dcp_decoder.h"
-#include "log.h"
+#include "dcp_examiner.h"
#include "dcpomatic_log.h"
+#include "film.h"
+#include "job.h"
+#include "log.h"
+#include "overlaps.h"
#include "text_content.h"
+#include "video_content.h"
#include <dcp/dcp.h>
#include <dcp/raw_convert.h>
#include <dcp/exceptions.h>
{
shared_ptr<DCPDecoder> decoder;
try {
- decoder.reset (new DCPDecoder (film, shared_from_this(), false, film->tolerant(), shared_ptr<DCPDecoder>()));
+ decoder = make_shared<DCPDecoder>(film, shared_from_this(), false, film->tolerant(), shared_ptr<DCPDecoder>());
} catch (dcp::ReadError &) {
/* We couldn't read the DCP, so it's probably missing */
return false;
{
shared_ptr<DCPDecoder> decoder;
try {
- decoder.reset (new DCPDecoder (film, shared_from_this(), false, film->tolerant(), shared_ptr<DCPDecoder>()));
+ decoder = make_shared<DCPDecoder>(film, shared_from_this(), false, film->tolerant(), shared_ptr<DCPDecoder>());
} catch (dcp::ReadError &) {
/* We couldn't read the DCP, so it's probably missing */
return false;
/*
- Copyright (C) 2016-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2016-2022 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "atmos_mxf_content.h"
#include "atmos_mxf_decoder.h"
-#include "ffmpeg_content.h"
-#include "ffmpeg_decoder.h"
#include "dcp_content.h"
#include "dcp_decoder.h"
+#include "dcp_subtitle_content.h"
+#include "dcp_subtitle_decoder.h"
+#include "ffmpeg_content.h"
+#include "ffmpeg_decoder.h"
#include "image_content.h"
#include "image_decoder.h"
#include "string_text_file_content.h"
#include "string_text_file_decoder.h"
-#include "dcp_subtitle_content.h"
-#include "dcp_subtitle_decoder.h"
+#include "timer.h"
#include "video_mxf_content.h"
#include "video_mxf_decoder.h"
-#include "timer.h"
+
+using std::dynamic_pointer_cast;
using std::list;
+using std::make_shared;
using std::shared_ptr;
-using std::dynamic_pointer_cast;
+
template <class T>
shared_ptr<T>
maybe_cast (shared_ptr<Decoder> d)
{
if (!d) {
- return shared_ptr<T> ();
+ return {};
}
return dynamic_pointer_cast<T> (d);
}
-/**
- @param tolerant true to proceed in the face of `survivable' errors, otherwise false.
- @param old_decoder A `used' decoder that has been previously made for this piece of content, or 0
+
+/** @param tolerant true to proceed in the face of `survivable' errors, otherwise false.
+ * @param old_decoder A `used' decoder that has been previously made for this piece of content, or 0
*/
shared_ptr<Decoder>
decoder_factory (shared_ptr<const Film> film, shared_ptr<const Content> content, bool fast, bool tolerant, shared_ptr<Decoder> old_decoder)
{
- shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (content);
+ auto fc = dynamic_pointer_cast<const FFmpegContent>(content);
if (fc) {
- return shared_ptr<Decoder> (new FFmpegDecoder(film, fc, fast));
+ return make_shared<FFmpegDecoder>(film, fc, fast);
}
- shared_ptr<const DCPContent> dc = dynamic_pointer_cast<const DCPContent> (content);
+ auto dc = dynamic_pointer_cast<const DCPContent>(content);
if (dc) {
try {
- return shared_ptr<Decoder> (new DCPDecoder(film, dc, fast, tolerant, maybe_cast<DCPDecoder>(old_decoder)));
+ return make_shared<DCPDecoder>(film, dc, fast, tolerant, maybe_cast<DCPDecoder>(old_decoder));
} catch (KDMError& e) {
/* This will be found and reported to the user when the content is examined */
- return shared_ptr<Decoder>();
+ return {};
}
}
- shared_ptr<const ImageContent> ic = dynamic_pointer_cast<const ImageContent> (content);
+ auto ic = dynamic_pointer_cast<const ImageContent>(content);
if (ic) {
- return shared_ptr<Decoder> (new ImageDecoder(film, ic));
+ return make_shared<ImageDecoder>(film, ic);
}
- shared_ptr<const StringTextFileContent> rc = dynamic_pointer_cast<const StringTextFileContent> (content);
+ auto rc = dynamic_pointer_cast<const StringTextFileContent>(content);
if (rc) {
- return shared_ptr<Decoder> (new StringTextFileDecoder(film, rc));
+ return make_shared<StringTextFileDecoder>(film, rc);
}
- shared_ptr<const DCPSubtitleContent> dsc = dynamic_pointer_cast<const DCPSubtitleContent> (content);
+ auto dsc = dynamic_pointer_cast<const DCPSubtitleContent> (content);
if (dsc) {
- return shared_ptr<Decoder> (new DCPSubtitleDecoder(film, dsc));
+ return make_shared<DCPSubtitleDecoder>(film, dsc);
}
- shared_ptr<const VideoMXFContent> vmc = dynamic_pointer_cast<const VideoMXFContent> (content);
+ auto vmc = dynamic_pointer_cast<const VideoMXFContent> (content);
if (vmc) {
- return shared_ptr<Decoder> (new VideoMXFDecoder(film, vmc));
+ return make_shared<VideoMXFDecoder>(film, vmc);
}
- shared_ptr<const AtmosMXFContent> amc = dynamic_pointer_cast<const AtmosMXFContent> (content);
+ auto amc = dynamic_pointer_cast<const AtmosMXFContent> (content);
if (amc) {
- return shared_ptr<Decoder> (new AtmosMXFDecoder(film, amc));
+ return make_shared<AtmosMXFDecoder>(film, amc);
}
- return shared_ptr<Decoder> ();
+ return {};
}
auto const f = full_length.frames_round (vfr);
auto v = video->position(film()).get_value_or(ContentTime()).frames_round(vfr) + 1;
while (v < f) {
- video->emit (film(), shared_ptr<const ImageProxy> (new RawImageProxy (_black_image)), v);
+ video->emit (film(), make_shared<const RawImageProxy>(_black_image), v);
++v;
}
}
int const r = d->ShowModal ();
if (r == wxID_OK && d->check_path() && maybe_save_film<FilmChangedDuplicatingDialog>()) {
- shared_ptr<Film> film (new Film (d->path()));
+ auto film = make_shared<Film>(d->path());
film->copy_from (_film);
film->set_name (d->path().filename().generic_string());
film->write_metadata ();
void new_playlist ()
{
- shared_ptr<SignalSPL> spl (new SignalSPL(wx_to_std(_("New Playlist"))));
+ auto spl = make_shared<SignalSPL>(wx_to_std(_("New Playlist")));
add_playlist_to_model (spl);
add_playlist_to_view (spl);
_list->SetItemState (_list->GetItemCount() - 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
/*
- Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2022 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
#include "static_text.h"
#include "check_box.h"
#include "dcpomatic_button.h"
-#include "lib/job.h"
-#include "lib/job_manager.h"
+#include "lib/analyse_audio_job.h"
#include "lib/compose.hpp"
#include "lib/config.h"
+#include "lib/job.h"
+#include "lib/job_manager.h"
#include "lib/send_notification_email_job.h"
#include "lib/transcode_job.h"
-#include "lib/analyse_audio_job.h"
#include <wx/wx.h>
#include <boost/algorithm/string.hpp>
-using std::string;
+using std::make_shared;
using std::min;
using std::shared_ptr;
+using std::string;
using boost::bind;
string body = Config::instance()->notification_email();
boost::algorithm::replace_all (body, "$JOB_NAME", _job->name());
boost::algorithm::replace_all (body, "$JOB_STATUS", _job->status());
- JobManager::instance()->add_after (_job, shared_ptr<Job> (new SendNotificationEmailJob (body)));
+ JobManager::instance()->add_after(_job, make_shared<SendNotificationEmailJob>(body));
}
}
}
/*
- Copyright (C) 2018-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2022 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
-#include "playlist_controls.h"
-#include "film_viewer.h"
-#include "wx_util.h"
+
#include "content_view.h"
#include "dcpomatic_button.h"
+#include "film_viewer.h"
+#include "playlist_controls.h"
#include "static_text.h"
-#include "lib/player_video.h"
-#include "lib/dcp_content.h"
+#include "wx_util.h"
+#include "lib/compose.hpp"
#include "lib/cross.h"
-#include "lib/scoped_temporary.h"
-#include "lib/internet.h"
+#include "lib/dcp_content.h"
#include "lib/ffmpeg_content.h"
-#include "lib/compose.hpp"
-#include <dcp/raw_convert.h>
+#include "lib/internet.h"
+#include "lib/player_video.h"
+#include "lib/scoped_temporary.h"
#include <dcp/exceptions.h>
+#include <dcp/raw_convert.h>
#include <wx/listctrl.h>
#include <wx/progdlg.h>
-using std::string;
+
using std::cout;
+using std::dynamic_pointer_cast;
using std::exception;
-using std::sort;
+using std::make_shared;
using std::shared_ptr;
-using std::dynamic_pointer_cast;
+using std::sort;
+using std::string;
using boost::optional;
using namespace dcpomatic;
+
PlaylistControls::PlaylistControls (wxWindow* parent, shared_ptr<FilmViewer> viewer)
: Controls (parent, viewer, false)
, _play_button (new Button(this, _("Play")))
_spl_view = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER);
_spl_view->AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 740);
- wxBoxSizer* left_sizer = new wxBoxSizer (wxVERTICAL);
- wxBoxSizer* e_sizer = new wxBoxSizer (wxHORIZONTAL);
+ auto left_sizer = new wxBoxSizer (wxVERTICAL);
+ auto e_sizer = new wxBoxSizer (wxHORIZONTAL);
wxFont subheading_font (*wxNORMAL_FONT);
subheading_font.SetWeight (wxFONTWEIGHT_BOLD);
- wxBoxSizer* spl_header = new wxBoxSizer (wxHORIZONTAL);
+ auto spl_header = new wxBoxSizer (wxHORIZONTAL);
{
wxStaticText* m = new StaticText (this, "Playlists");
m->SetFont (subheading_font);
_content_view = new ContentView (this);
- wxBoxSizer* content_header = new wxBoxSizer (wxHORIZONTAL);
+ auto content_header = new wxBoxSizer (wxHORIZONTAL);
{
wxStaticText* m = new StaticText (this, "Content");
m->SetFont (subheading_font);
_selected_playlist = boost::none;
_spl_view->SetItemState (selected, 0, wxLIST_STATE_SELECTED);
}
- ResetFilm (shared_ptr<Film>(new Film(optional<boost::filesystem::path>())));
+ ResetFilm (std::make_shared<Film>(optional<boost::filesystem::path>()));
}
void
PlaylistControls::get_kdm_from_directory (shared_ptr<DCPContent> dcp)
{
using namespace boost::filesystem;
- optional<path> kdm_dir = Config::instance()->player_kdm_directory();
+ auto kdm_dir = Config::instance()->player_kdm_directory();
if (!kdm_dir) {
- return optional<dcp::EncryptedKDM>();
+ return {};
}
for (directory_iterator i = directory_iterator(*kdm_dir); i != directory_iterator(); ++i) {
try {
for (auto const& i: _playlists[selected].get()) {
dialog.Pulse ();
- shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent> (i.content);
+ auto dcp = dynamic_pointer_cast<DCPContent> (i.content);
if (dcp && dcp->needs_kdm()) {
optional<dcp::EncryptedKDM> kdm;
kdm = get_kdm_from_directory (dcp);
PlaylistControls::reset_film ()
{
DCPOMATIC_ASSERT (_selected_playlist);
- shared_ptr<Film> film (new Film(optional<boost::filesystem::path>()));
+ auto film = std::make_shared<Film>(optional<boost::filesystem::path>());
film->add_content (_playlists[*_selected_playlist].get()[_selected_playlist_position].content);
ResetFilm (film);
}