From 992a640cb1ceff2a57867f3167fec71ee67bf8a4 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 30 Sep 2016 10:51:31 +0100 Subject: [PATCH] Allow loading of multiple films from the batch converter command line. --- src/lib/ffmpeg_decoder.cc | 4 ++++ src/tools/dcpomatic_batch.cc | 33 +++++++++++++++++++++------------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index a0965dcfb..f0500a629 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -421,6 +421,10 @@ FFmpegDecoder::decode_audio_packet () ct += ContentTime::from_frames (remove, (*stream)->frame_rate ()); } + if (ct < ContentTime()) { + LOG_WARNING ("Crazy timestamp %s", to_string (ct)); + } + /* Give this data provided there is some, and its time is sane */ if (ct >= ContentTime() && data->frames() > 0) { audio->give (*stream, data, ct); diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc index 64eb46af2..ca9ec3a6b 100644 --- a/src/tools/dcpomatic_batch.cc +++ b/src/tools/dcpomatic_batch.cc @@ -36,16 +36,18 @@ #include #include #include +#include #include using std::exception; using std::string; using std::cout; +using std::list; using boost::shared_ptr; using boost::thread; using boost::scoped_array; -static boost::optional film_to_load; +static list films_to_load; enum { ID_file_add_film = 1, @@ -318,15 +320,22 @@ class App : public wxApp this->Bind (wxEVT_IDLE, boost::bind (&App::idle, this)); shared_ptr film; - if (film_to_load && boost::filesystem::is_directory (film_to_load.get())) { - try { - film.reset (new Film (film_to_load.get())); - film->read_metadata (); - film->make_dcp (); - } catch (exception& e) { - error_dialog ( - 0, std_to_wx (String::compose (wx_to_std (_("Could not load film %1 (%2)")), film_to_load->string(), e.what())) - ); + BOOST_FOREACH (boost::filesystem::path i, films_to_load) { + if (boost::filesystem::is_directory (i)) { + try { + film.reset (new Film (i)); + film->read_metadata (); + film->make_dcp (); + } catch (exception& e) { + error_dialog ( + 0, std_to_wx ( + String::compose ( + wx_to_std (_("Could not load film %1 (%2)")), i.string(), + e.what() + ) + ) + ); + } } } @@ -346,8 +355,8 @@ class App : public wxApp bool OnCmdLineParsed (wxCmdLineParser& parser) { - if (parser.GetParamCount() > 0) { - film_to_load = wx_to_std (parser.GetParam(0)); + for (size_t i = 0; i < parser.GetParamCount(); ++i) { + films_to_load.push_back (wx_to_std (parser.GetParam(i))); } return true; -- 2.30.2