Merge master.
authorCarl Hetherington <cth@carlh.net>
Sat, 10 May 2014 13:13:10 +0000 (14:13 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 10 May 2014 13:13:10 +0000 (14:13 +0100)
15 files changed:
ChangeLog
debian/changelog
src/lib/audio_mapping.cc
src/lib/film.cc
src/lib/resampler.cc
src/lib/util.cc
src/lib/util.h
src/wx/audio_dialog.cc
src/wx/audio_dialog.h
src/wx/audio_mapping_view.cc
src/wx/audio_plot.cc
src/wx/audio_plot.h
src/wx/film_editor.cc
test/audio_mapping_test.cc
test/silence_padding_test.cc

index b7e9ad74fd3c52fb23dc3f46727e1d9c542b61d8..662983a74a4598610f8752a66c8dc5d800c8c61c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,24 @@
 
        * Add subtitle view.
 
+2014-05-10  Carl Hetherington  <cth@carlh.net>
+
+       * Version 1.69.2 released.
+
+2014-05-10  Carl Hetherington  <cth@carlh.net>
+
+       * Fix setup of the libswresample context to work with high channel counts.
+
+2014-05-09  Carl Hetherington  <cth@carlh.net>
+
+       * Version 1.69.1 released.
+
+2014-05-09  Carl Hetherington  <cth@carlh.net>
+
+       * Fix crash on using content with more than 12 audio channels.
+
+       * Re-introduce ffprobe call when adding content.
+
 2014-05-05  Carl Hetherington  <cth@carlh.net>
 
        * Version 1.69.0 released.
 
        * Another attempt to fix colour conversion dialog strange behaviour
        on OS X.
->>>>>>> master
 
 2014-03-18  Carl Hetherington  <cth@carlh.net>
 
index 0f31a27167dae0e469b4194e2c0fcaedb5f193e0..418ef9fa4966fe1009e5733c90db27ea441bd7dc 100644 (file)
@@ -1,4 +1,4 @@
-dcpomatic (1.69.0-1) UNRELEASED; urgency=low
+dcpomatic (1.69.2-1) UNRELEASED; urgency=low
 
   * New upstream release.
   * New upstream release.
@@ -124,8 +124,10 @@ dcpomatic (1.69.0-1) UNRELEASED; urgency=low
   * New upstream release.
   * New upstream release.
   * New upstream release.
+  * New upstream release.
+  * New upstream release.
 
- -- Carl Hetherington <carl@d1stkfactory>  Mon, 05 May 2014 16:41:46 +0100
+ -- Carl Hetherington <carl@d1stkfactory>  Sat, 10 May 2014 13:40:32 +0100
 
 dcpomatic (0.87-1) UNRELEASED; urgency=low
 
index f6d747b9b49e6add9027c23360e9307818ffd386..969397b0bdf9a1a43f696cfc9d4b22ac04e125ef 100644 (file)
@@ -28,6 +28,7 @@ using std::cout;
 using std::make_pair;
 using std::pair;
 using std::string;
+using std::min;
 using boost::shared_ptr;
 using boost::lexical_cast;
 using boost::dynamic_pointer_cast;
@@ -53,7 +54,7 @@ AudioMapping::setup (int c)
        
        _gain.resize (_content_channels);
        for (int i = 0; i < _content_channels; ++i) {
-               _gain[i].resize (MAX_AUDIO_CHANNELS);
+               _gain[i].resize (MAX_DCP_AUDIO_CHANNELS);
        }
 }
 
@@ -61,7 +62,7 @@ void
 AudioMapping::make_default ()
 {
        for (int i = 0; i < _content_channels; ++i) {
-               for (int j = 0; j < MAX_AUDIO_CHANNELS; ++j) {
+               for (int j = 0; j < MAX_DCP_AUDIO_CHANNELS; ++j) {
                        _gain[i][j] = 0;
                }
        }
@@ -71,7 +72,7 @@ AudioMapping::make_default ()
                set (0, dcp::CENTRE, 1);
        } else {
                /* 1:1 mapping */
-               for (int i = 0; i < _content_channels; ++i) {
+               for (int i = 0; i < min (_content_channels, MAX_DCP_AUDIO_CHANNELS); ++i) {
                        set (i, static_cast<dcp::Channel> (i), 1);
                }
        }
@@ -117,7 +118,7 @@ AudioMapping::as_xml (xmlpp::Node* node) const
        node->add_child ("ContentChannels")->add_child_text (lexical_cast<string> (_content_channels));
 
        for (int c = 0; c < _content_channels; ++c) {
-               for (int d = 0; d < MAX_AUDIO_CHANNELS; ++d) {
+               for (int d = 0; d < MAX_DCP_AUDIO_CHANNELS; ++d) {
                        xmlpp::Element* t = node->add_child ("Gain");
                        t->set_attribute ("Content", lexical_cast<string> (c));
                        t->set_attribute ("DCP", lexical_cast<string> (d));
index 267138ce63b74d51054d695b52777bd405a6ebc9..33cb304600cda8146deb44a6d1ada1e214925729 100644 (file)
@@ -826,6 +826,10 @@ Film::content () const
 void
 Film::examine_and_add_content (shared_ptr<Content> c)
 {
+       if (dynamic_pointer_cast<FFmpegContent> (c)) {
+               run_ffprobe (c->path(0), file ("ffprobe.log"), _log);
+       }
+                       
        shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c));
        j->Finished.connect (bind (&Film::maybe_add_content, this, boost::weak_ptr<Job> (j), boost::weak_ptr<Content> (c)));
        JobManager::instance()->add (j);
index 00121384dce7617ab59f0ee85ea0373a7ab0c440..9a81df4993e5da7132938afd25db6dbf29c6d392 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
 
 extern "C" {
 #include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
 }      
 #include "resampler.h"
 #include "audio_buffers.h"
@@ -37,24 +38,19 @@ Resampler::Resampler (int in, int out, int channels)
        , _out_rate (out)
        , _channels (channels)
 {
-       /* We will be using planar float data when we call the
-          resampler.  As far as I can see, the audio channel
-          layout is not necessary for our purposes; it seems
-          only to be used get the number of channels and
-          decide if rematrixing is needed.  It won't be, since
-          input and output layouts are the same.
-       */
-
-       _swr_context = swr_alloc_set_opts (
-               0,
-               av_get_default_channel_layout (_channels),
-               AV_SAMPLE_FMT_FLTP,
-               _out_rate,
-               av_get_default_channel_layout (_channels),
-               AV_SAMPLE_FMT_FLTP,
-               _in_rate,
-               0, 0
-               );
+       _swr_context = swr_alloc ();
+
+       /* Sample formats */
+       av_opt_set_int (_swr_context, "isf", AV_SAMPLE_FMT_FLTP, 0);
+       av_opt_set_int (_swr_context, "osf", AV_SAMPLE_FMT_FLTP, 0);
+
+       /* Channel counts */
+       av_opt_set_int (_swr_context, "ich", _channels, 0);
+       av_opt_set_int (_swr_context, "och", _channels, 0);
+
+       /* Sample rates */
+       av_opt_set_int (_swr_context, "isr", _in_rate, 0);
+       av_opt_set_int (_swr_context, "osr", _out_rate, 0);
        
        swr_init (_swr_context);
 }
index 45d5a757cc2783a0c40cdefda99c9c5fd52b2528..0eb14845d7da6dba601412a34c72544cd590db4b 100644 (file)
@@ -737,7 +737,7 @@ ensure_ui_thread ()
 string
 audio_channel_name (int c)
 {
-       assert (MAX_AUDIO_CHANNELS == 12);
+       assert (MAX_DCP_AUDIO_CHANNELS == 12);
 
        /* TRANSLATORS: these are the names of audio channels; Lfe (sub) is the low-frequency
           enhancement channel (sub-woofer).  HI is the hearing-impaired audio track and
index a13d7ff734faca494ee0a53c68e923790b4af1f4..8e65bbb5415cc236e496e56a83b92dbd45503082 100644 (file)
@@ -49,8 +49,8 @@ extern "C" {
 
 #undef check
 
-/** The maximum number of audio channels that we can cope with */
-#define MAX_AUDIO_CHANNELS 12
+/** The maximum number of audio channels that we can have in a DCP */
+#define MAX_DCP_AUDIO_CHANNELS 12
 
 #define DCPOMATIC_HELLO "Boys, you gotta learn not to talk to nuns that way"
 
index 1bce22811c6b7c48e6543445e1ad53414da6509e..0e1316cf31979f21d3ec4790f1a3ba5bb7154461 100644 (file)
@@ -45,7 +45,7 @@ AudioDialog::AudioDialog (wxWindow* parent)
                side->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 16);
        }
 
-       for (int i = 0; i < MAX_AUDIO_CHANNELS; ++i) {
+       for (int i = 0; i < MAX_DCP_AUDIO_CHANNELS; ++i) {
                _channel_checkbox[i] = new wxCheckBox (this, wxID_ANY, std_to_wx (audio_channel_name (i)));
                side->Add (_channel_checkbox[i], 1, wxEXPAND | wxALL, 3);
                _channel_checkbox[i]->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AudioDialog::channel_clicked, this, _1));
@@ -144,11 +144,11 @@ void
 AudioDialog::channel_clicked (wxCommandEvent& ev)
 {
        int c = 0;
-       while (c < MAX_AUDIO_CHANNELS && ev.GetEventObject() != _channel_checkbox[c]) {
+       while (c < MAX_DCP_AUDIO_CHANNELS && ev.GetEventObject() != _channel_checkbox[c]) {
                ++c;
        }
 
-       assert (c < MAX_AUDIO_CHANNELS);
+       assert (c < MAX_DCP_AUDIO_CHANNELS);
 
        _plot->set_channel_visible (c, _channel_checkbox[c]->GetValue ());
 }
index b4257057dd6c4a2741301510fa478ddd85911992..b277852928d19f53e3849464a0541d24c65288c3 100644 (file)
@@ -43,7 +43,7 @@ private:
 
        boost::shared_ptr<AudioContent> _content;
        AudioPlot* _plot;
-       wxCheckBox* _channel_checkbox[MAX_AUDIO_CHANNELS];
+       wxCheckBox* _channel_checkbox[MAX_DCP_AUDIO_CHANNELS];
        wxCheckBox* _type_checkbox[AudioPoint::COUNT];
        wxSlider* _smoothing;
        boost::signals2::scoped_connection _content_changed_connection;
index be1bd67b9cd4d0a388f85e5030363352cf0d7cb3..9375010865dbc0cc2a9c0dd34834edd97d53934f 100644 (file)
@@ -118,7 +118,7 @@ AudioMappingView::AudioMappingView (wxWindow* parent)
 {
        _grid = new wxGrid (this, wxID_ANY);
 
-       _grid->CreateGrid (0, MAX_AUDIO_CHANNELS + 1);
+       _grid->CreateGrid (0, MAX_DCP_AUDIO_CHANNELS + 1);
        _grid->HideRowLabels ();
        _grid->DisableDragRowSize ();
        _grid->DisableDragColSize ();
@@ -240,7 +240,7 @@ AudioMappingView::update_cells ()
        _grid->InsertRows (0, _map.content_channels ());
 
        for (int i = 0; i < _map.content_channels(); ++i) {
-               for (int j = 0; j < MAX_AUDIO_CHANNELS; ++j) {
+               for (int j = 0; j < MAX_DCP_AUDIO_CHANNELS; ++j) {
                        _grid->SetCellRenderer (i, j + 1, new ValueRenderer);
                }
        }
@@ -279,8 +279,8 @@ AudioMappingView::set_column_labels ()
        
        _grid->SetColLabelValue (0, _("Content"));
 
-#if MAX_AUDIO_CHANNELS != 12
-#warning AudioMappingView::set_column_labels() is expecting the wrong MAX_AUDIO_CHANNELS
+#if MAX_DCP_AUDIO_CHANNELS != 12
+#warning AudioMappingView::set_column_labels() is expecting the wrong MAX_DCP_AUDIO_CHANNELS
 #endif 
        
        if (c > 0) {
index 124b927367da0a69773a3e2d05171e176fa186ee..69faf127e2db0404fa5192cf9f12d8a74510ec5b 100644 (file)
@@ -46,7 +46,7 @@ AudioPlot::AudioPlot (wxWindow* parent)
        SetDoubleBuffered (true);
 #endif 
 
-       for (int i = 0; i < MAX_AUDIO_CHANNELS; ++i) {
+       for (int i = 0; i < MAX_DCP_AUDIO_CHANNELS; ++i) {
                _channel_visible[i] = false;
        }
 
@@ -67,8 +67,8 @@ AudioPlot::AudioPlot (wxWindow* parent)
        _colours.push_back (wxColour (255,   0, 139));
        _colours.push_back (wxColour (139,   0, 255));
 
-#if MAX_AUDIO_CHANNELS != 12
-#warning AudioPlot::AudioPlot is expecting the wrong MAX_AUDIO_CHANNELS
+#if MAX_DCP_AUDIO_CHANNELS != 12
+#warning AudioPlot::AudioPlot is expecting the wrong MAX_DCP_AUDIO_CHANNELS
 #endif 
        
        Bind (wxEVT_PAINT, boost::bind (&AudioPlot::paint, this));
@@ -81,7 +81,7 @@ AudioPlot::set_analysis (shared_ptr<AudioAnalysis> a)
 {
        _analysis = a;
 
-       for (int i = 0; i < MAX_AUDIO_CHANNELS; ++i) {
+       for (int i = 0; i < MAX_DCP_AUDIO_CHANNELS; ++i) {
                _channel_visible[i] = false;
        }
 
@@ -168,7 +168,7 @@ AudioPlot::paint ()
        gc->DrawText (_("Time"), data_width, metrics.height - metrics.y_origin + db_label_height / 2);
        
        if (_type_visible[AudioPoint::PEAK]) {
-               for (int c = 0; c < MAX_AUDIO_CHANNELS; ++c) {
+               for (int c = 0; c < MAX_DCP_AUDIO_CHANNELS; ++c) {
                        wxGraphicsPath p = gc->CreatePath ();
                        if (_channel_visible[c] && c < _analysis->channels()) {
                                plot_peak (p, c, metrics);
@@ -180,7 +180,7 @@ AudioPlot::paint ()
        }
 
        if (_type_visible[AudioPoint::RMS]) {
-               for (int c = 0; c < MAX_AUDIO_CHANNELS; ++c) {
+               for (int c = 0; c < MAX_DCP_AUDIO_CHANNELS; ++c) {
                        wxGraphicsPath p = gc->CreatePath ();
                        if (_channel_visible[c] && c < _analysis->channels()) {
                                plot_rms (p, c, metrics);
index 4a1a40aa138ad709d54bfca4cf9ac8c4600ef480..adf11e633030262a62dfa4802f3c3cc5e7bcaf6d 100644 (file)
@@ -46,7 +46,7 @@ private:
        float y_for_linear (float, Metrics const &) const;
 
        boost::shared_ptr<AudioAnalysis> _analysis;
-       bool _channel_visible[MAX_AUDIO_CHANNELS];
+       bool _channel_visible[MAX_DCP_AUDIO_CHANNELS];
        bool _type_visible[AudioPoint::COUNT];
        /** gain to apply in dB */
        float _gain;
index 2cf6a0b6ccc6847a627bfeb63a848a8e407d6ab8..3fd63e9224c6e363e74027f5371f17840bb2d41c 100644 (file)
@@ -214,7 +214,7 @@ FilmEditor::make_dcp_panel ()
                _frame_rate->Append (std_to_wx (boost::lexical_cast<string> (*i)));
        }
 
-       _audio_channels->SetRange (0, MAX_AUDIO_CHANNELS);
+       _audio_channels->SetRange (0, MAX_DCP_AUDIO_CHANNELS);
        _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
 
        _resolution->Append (_("2K"));
index f8467f3de9b144f70e2f620e1510eb2ee05191ab..fc597b91df10e4ca9dadaf8303a4b7cb844de983 100644 (file)
@@ -35,7 +35,7 @@ BOOST_AUTO_TEST_CASE (audio_mapping_test)
        four.make_default ();
 
        for (int i = 0; i < 4; ++i) {
-               for (int j = 0; j < MAX_AUDIO_CHANNELS; ++j) {
+               for (int j = 0; j < MAX_DCP_AUDIO_CHANNELS; ++j) {
                        BOOST_CHECK_EQUAL (four.get (i, static_cast<dcp::Channel> (j)), i == j ? 1 : 0);
                }
        }
index ff369062662b6807fe45a56e57d5d4631c033d48..82b9def0e12f3ccbfa471f7e977d1272576b0eca 100644 (file)
@@ -121,7 +121,7 @@ test_silence_padding (int channels)
 
 BOOST_AUTO_TEST_CASE (silence_padding_test)
 {
-       for (int i = 1; i < MAX_AUDIO_CHANNELS; ++i) {
+       for (int i = 1; i < MAX_DCP_AUDIO_CHANNELS; ++i) {
                test_silence_padding (i);
        }
 }