summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-09-30 10:51:31 +0100
committerCarl Hetherington <cth@carlh.net>2016-09-30 10:51:31 +0100
commit992a640cb1ceff2a57867f3167fec71ee67bf8a4 (patch)
tree3dab081db3d279306e19b3b2b2713f4dfe465820
parentcc9bfc4b9974b81e7a653e84c8a894bbaae726ec (diff)
Allow loading of multiple films from the batch converter command line.
-rw-r--r--src/lib/ffmpeg_decoder.cc4
-rw-r--r--src/tools/dcpomatic_batch.cc33
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 <wx/cmdline.h>
#include <wx/preferences.h>
#include <wx/wx.h>
+#include <boost/foreach.hpp>
#include <iostream>
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<boost::filesystem::path> film_to_load;
+static list<boost::filesystem::path> 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> 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;