Allow loading of multiple films from the batch converter command line.
authorCarl Hetherington <cth@carlh.net>
Fri, 30 Sep 2016 09:51:31 +0000 (10:51 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 30 Sep 2016 09:51:31 +0000 (10:51 +0100)
src/lib/ffmpeg_decoder.cc
src/tools/dcpomatic_batch.cc

index a0965dcfb81a917eef2e0ba46b1223d536f35cc6..f0500a6296965bec6a43816de589a49f999e0ed4 100644 (file)
@@ -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);
index 64eb46af2c2813de29acc96a04e534fe147e3e70..ca9ec3a6be3fdd8b00a1473c57307558f7e2e133 100644 (file)
 #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;