#include "safe_stringstream.h"
#include "environment_info.h"
#include "raw_convert.h"
+#include "audio_processor.h"
#include <libcxml/cxml.h>
#include <dcp/cpl.h>
#include <dcp/signer.h>
, _sequence_video (true)
, _interop (false)
, _burn_subtitles (false)
+ , _audio_processor (0)
, _state_version (current_state_version)
, _dirty (false)
{
root->add_child("Signed")->add_child_text (_signed ? "1" : "0");
root->add_child("Encrypted")->add_child_text (_encrypted ? "1" : "0");
root->add_child("Key")->add_child_text (_key.hex ());
+ if (_audio_processor) {
+ root->add_child("AudioProcessor")->add_child_text (_audio_processor->id ());
+ }
_playlist->as_xml (root->add_child ("Playlist"));
return doc;
}
_key = dcp::Key (f.string_child ("Key"));
+ if (f.optional_string_child ("AudioProcessor")) {
+ _audio_processor = AudioProcessor::from_id (f.string_child ("AudioProcessor"));
+ } else {
+ _audio_processor = 0;
+ }
+
list<string> notes;
/* This method is the only one that can return notes (so far) */
_playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version, notes);
signal_changed (BURN_SUBTITLES);
}
+void
+Film::set_audio_processor (AudioProcessor const * processor)
+{
+ _audio_processor = processor;
+ signal_changed (AUDIO_PROCESSOR);
+}
+
void
Film::signal_changed (Property p)
{
class Playlist;
class AudioContent;
class Screen;
+class AudioProcessor;
struct isdcf_name_test;
/** @class Film
INTEROP,
/** The setting of _burn_subtitles has changed */
BURN_SUBTITLES,
+ AUDIO_PROCESSOR,
};
bool burn_subtitles () const {
return _burn_subtitles;
}
+
+ AudioProcessor const * audio_processor () const {
+ return _audio_processor;
+ }
/* SET */
void set_sequence_video (bool);
void set_interop (bool);
void set_burn_subtitles (bool);
+ void set_audio_processor (AudioProcessor const * processor);
/** Emitted when some property has of the Film has changed */
mutable boost::signals2::signal<void (Property)> Changed;
Resolution _resolution;
bool _signed;
bool _encrypted;
+ dcp::Key _key;
/** bandwidth for J2K files in bits per second */
int _j2k_bandwidth;
/** ISDCF naming stuff */
bool _sequence_video;
bool _interop;
bool _burn_subtitles;
- dcp::Key _key;
+ AudioProcessor const * _audio_processor;
int _state_version;
#include "dcp_decoder.h"
#include "dcp_subtitle_content.h"
#include "dcp_subtitle_decoder.h"
+#include "audio_processor.h"
#include <boost/foreach.hpp>
#include <stdint.h>
#include <algorithm>
_playlist_content_changed_connection = _playlist->ContentChanged.connect (bind (&Player::content_changed, this, _1, _2, _3));
_film_changed_connection = _film->Changed.connect (bind (&Player::film_changed, this, _1));
set_video_container_size (_film->frame_size ());
+
+ film_changed (Film::AUDIO_PROCESSOR);
}
void
if (p == Film::CONTAINER || p == Film::VIDEO_FRAME_RATE) {
Changed (false);
+ } else if (p == Film::AUDIO_PROCESSOR) {
+ if (_film->audio_processor ()) {
+ _audio_processor = _film->audio_processor()->clone (_film->audio_frame_rate ());
+ }
}
}
}
}
}
+
+ if (_audio_processor) {
+ dcp_mapped = _audio_processor->run (dcp_mapped);
+ }
all.audio = dcp_mapped;
/** true if the player should ignore all video; i.e. never produce any */
bool _ignore_video;
+ boost::shared_ptr<AudioProcessor> _audio_processor;
+
PlayerStatistics _statistics;
boost::signals2::scoped_connection _playlist_changed_connection;
#include "lib/util.h"
#include "lib/film.h"
#include "lib/ffmpeg_content.h"
+#include "lib/audio_processor.h"
#include <dcp/key.h>
#include <wx/wx.h>
#include <wx/notebook.h>
#include <wx/gbsizer.h>
#include <wx/spinctrl.h>
#include <boost/lexical_cast.hpp>
+#include <boost/foreach.hpp>
using std::cout;
using std::list;
_frame_rate_choice->Enable (s);
_frame_rate_spin->Enable (s);
_audio_channels->Enable (s);
+ _audio_processor->Enable (s);
_j2k_bandwidth->Enable (s);
_container->Enable (s);
_best_frame_rate->Enable (s && _film && _film->best_video_frame_rate () != _film->video_frame_rate ());
panel->SetSizer (sizer);
int r = 0;
+
add_label_to_grid_bag_sizer (grid, panel, _("Channels"), true, wxGBPosition (r, 0));
_audio_channels = new wxChoice (panel, wxID_ANY);
for (int i = 2; i <= 12; i += 2) {
_audio_channels->Append (wxString::Format ("%d", i));
}
grid->Add (_audio_channels, wxGBPosition (r, 1));
+
+ add_label_to_grid_bag_sizer (grid, panel, _("Processor"), true, wxGBPosition (r, 0));
+ _audio_processor = new wxChoice (panel, wxID_ANY);
+ _audio_processor->Append (_("None"), new wxStringClientData (N_("none")));
+ BOOST_FOREACH (AudioProcessor const * ap, AudioProcessor::all ()) {
+ _audio_processor->Append (std_to_wx (ap->name ()), new wxStringClientData (std_to_wx (ap->id ())));
+ }
+ grid->Add (_audio_processor, wxGBPosition (r, 1));
+
++r;
_audio_channels->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::audio_channels_changed, this));
+ _audio_processor->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::audio_processor_changed, this));
return panel;
}
_film->set_name (_film->isdcf_name (false));
_film->set_use_isdcf_name (false);
}
+
+void
+DCPPanel::audio_processor_changed ()
+{
+ if (!_film) {
+ return;
+ }
+
+ string const s = string_client_data (_audio_processor->GetClientObject (_audio_processor->GetSelection ()));
+ if (s != "none") {
+ _film->set_audio_processor (AudioProcessor::from_id (s));
+ }
+}
void burn_subtitles_toggled ();
void encrypted_toggled ();
void edit_key_clicked ();
-
+ void audio_processor_changed ();
+
void setup_frame_rate_widget ();
void setup_container ();
void setup_dcp_name ();
wxSpinCtrl* _frame_rate_spin;
wxSizer* _frame_rate_sizer;
wxChoice* _audio_channels;
+ wxChoice* _audio_processor;
wxButton* _best_frame_rate;
wxCheckBox* _three_d;
wxChoice* _resolution;
using boost::shared_ptr;
-#if 0
-/* XXX: no audio processors in content any more */
BOOST_AUTO_TEST_CASE (upmixer_a_test)
{
shared_ptr<Film> film = new_test_film ("upmixer_a_test");
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
+ film->set_audio_processor (AudioProcessor::from_id ("stereo-5.1-upmix-a"));
shared_ptr<SndfileContent> content (new SndfileContent (film, "test/data/white.wav"));
- content->set_audio_processor (AudioProcessor::from_id ("stereo-5.1-upmix-a"));
film->examine_and_add_content (content);
wait_for_jobs ();
check_audio_file ("test/data/upmixer_a_test/Ls.wav", "build/test/upmixer_a_test/Ls.wav");
check_audio_file ("test/data/upmixer_a_test/Rs.wav", "build/test/upmixer_a_test/Rs.wav");
}
-#endif