summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-03-12 22:29:20 +0000
committerCarl Hetherington <cth@carlh.net>2013-03-12 22:29:20 +0000
commit2f7180555f2d8b727bde21613fc2474bb4f7664c (patch)
tree791291da76fbcf31ce62f72d1a540b67ca20b4f3
parent1895cfd9642f53dd4ea83e53a655f93c8a65b37e (diff)
parent7d262f9be3a4c5d8da07dce42f7e2da708f6c7f4 (diff)
Merge branch 'master' of /home/carl/git/dvdomatic
-rw-r--r--ChangeLog5
-rw-r--r--src/lib/ab_transcoder.cc17
-rw-r--r--src/lib/analyse_audio_job.cc3
-rw-r--r--src/lib/combiner.cc2
-rw-r--r--src/lib/combiner.h2
-rw-r--r--src/lib/dcp_video_frame.cc4
-rw-r--r--src/lib/dcp_video_frame.h4
-rw-r--r--src/lib/delay_line.cc2
-rw-r--r--src/lib/delay_line.h2
-rw-r--r--src/lib/film.cc51
-rw-r--r--src/lib/film.h15
-rw-r--r--src/lib/gain.cc2
-rw-r--r--src/lib/gain.h2
-rw-r--r--src/lib/matcher.cc2
-rw-r--r--src/lib/matcher.h2
-rw-r--r--src/lib/processor.h10
-rw-r--r--src/lib/server.cc2
-rw-r--r--src/lib/server.h4
-rw-r--r--src/lib/transcode_job.cc3
-rw-r--r--src/lib/transcoder.cc1
-rw-r--r--src/lib/writer.cc12
-rw-r--r--src/tools/dvdomatic.cc10
-rw-r--r--src/tools/servomatic_cli.cc9
-rw-r--r--src/tools/servomatic_gui.cc13
-rw-r--r--src/tools/servomatictest.cc6
-rw-r--r--src/wx/audio_dialog.cc4
-rw-r--r--src/wx/audio_dialog.h2
-rw-r--r--src/wx/film_editor.cc18
-rw-r--r--src/wx/film_editor.h1
-rw-r--r--test/test.cc14
30 files changed, 129 insertions, 95 deletions
diff --git a/ChangeLog b/ChangeLog
index 8e0dd277e..6120113be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-08 Carl Hetherington <cth@carlh.net>
+
+ * Disable show audio button and use content audio selector
+ as appropriate for the audio in the content (#41 and #73).
+
2013-03-05 Carl Hetherington <cth@carlh.net>
* Version 0.76 released.
diff --git a/src/lib/ab_transcoder.cc b/src/lib/ab_transcoder.cc
index 4ed5d02ca..3a1cd83d7 100644
--- a/src/lib/ab_transcoder.cc
+++ b/src/lib/ab_transcoder.cc
@@ -40,6 +40,7 @@
using std::string;
using boost::shared_ptr;
+using boost::dynamic_pointer_cast;
/** @param a Film to use for the left half of the screen.
* @param b Film to use for the right half of the screen.
@@ -54,6 +55,7 @@ ABTranscoder::ABTranscoder (
, _film_b (b)
, _job (j)
, _encoder (e)
+ , _combiner (new Combiner (a->log()))
{
_da = decoder_factory (_film_a, o);
_db = decoder_factory (_film_b, o);
@@ -92,17 +94,24 @@ void
ABTranscoder::go ()
{
_encoder->process_begin ();
+
+ bool done[3] = { false, false, false };
while (1) {
- bool const va = _da.video->pass ();
- bool const vb = _db.video->pass ();
- bool const a = _da.audio->pass ();
+ done[0] = _da.video->pass ();
+ done[1] = _db.video->pass ();
+
+ if (!done[2] && _da.audio && dynamic_pointer_cast<Decoder> (_da.audio) != dynamic_pointer_cast<Decoder> (_da.video)) {
+ done[2] = _da.audio->pass ();
+ } else {
+ done[2] = true;
+ }
if (_job) {
_da.video->set_progress (_job);
}
- if (va && vb && a) {
+ if (done[0] && done[1] && done[2]) {
break;
}
}
diff --git a/src/lib/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc
index 41f918f34..92c3cdd4e 100644
--- a/src/lib/analyse_audio_job.cc
+++ b/src/lib/analyse_audio_job.cc
@@ -29,6 +29,7 @@
using std::string;
using std::max;
+using std::min;
using std::cout;
using boost::shared_ptr;
@@ -67,7 +68,7 @@ AnalyseAudioJob::run ()
decoders.audio->Audio.connect (bind (&AnalyseAudioJob::audio, this, _1));
int64_t total_audio_frames = video_frames_to_audio_frames (_film->length().get(), _film->audio_stream()->sample_rate(), _film->source_frame_rate());
- _samples_per_point = total_audio_frames / _num_points;
+ _samples_per_point = max (1L, total_audio_frames / _num_points);
_current.resize (_film->audio_stream()->channels ());
_analysis.reset (new AudioAnalysis (_film->audio_stream()->channels()));
diff --git a/src/lib/combiner.cc b/src/lib/combiner.cc
index 68aafd2a2..12ce4a96e 100644
--- a/src/lib/combiner.cc
+++ b/src/lib/combiner.cc
@@ -22,7 +22,7 @@
using boost::shared_ptr;
-Combiner::Combiner (Log* log)
+Combiner::Combiner (shared_ptr<Log> log)
: VideoProcessor (log)
{
diff --git a/src/lib/combiner.h b/src/lib/combiner.h
index 7fad1aeae..68026eaff 100644
--- a/src/lib/combiner.h
+++ b/src/lib/combiner.h
@@ -31,7 +31,7 @@
class Combiner : public VideoProcessor
{
public:
- Combiner (Log* log);
+ Combiner (boost::shared_ptr<Log> log);
void process_video (boost::shared_ptr<Image> i, bool, boost::shared_ptr<Subtitle> s);
void process_video_b (boost::shared_ptr<Image> i, bool, boost::shared_ptr<Subtitle> s);
diff --git a/src/lib/dcp_video_frame.cc b/src/lib/dcp_video_frame.cc
index 67617c63c..d674393a9 100644
--- a/src/lib/dcp_video_frame.cc
+++ b/src/lib/dcp_video_frame.cc
@@ -70,7 +70,7 @@ using libdcp::Size;
* @param out Required size of output, in pixels (including any padding).
* @param s Scaler to use.
* @param p Number of pixels of padding either side of the image.
- * @param f Index of the frame within the DCP's intrinsic duration.
+ * @param f Index of the frame within the DCP.
* @param fps Frames per second of the Film's source.
* @param pp FFmpeg post-processing string to use.
* @param clut Colour look-up table to use (see Config::colour_lut_index ())
@@ -80,7 +80,7 @@ using libdcp::Size;
DCPVideoFrame::DCPVideoFrame (
shared_ptr<const Image> yuv, shared_ptr<Subtitle> sub,
Size out, int p, int subtitle_offset, float subtitle_scale,
- Scaler const * s, int f, int dcp_fps, string pp, int clut, int bw, Log* l
+ Scaler const * s, int f, int dcp_fps, string pp, int clut, int bw, shared_ptr<Log> l
)
: _input (yuv)
, _subtitle (sub)
diff --git a/src/lib/dcp_video_frame.h b/src/lib/dcp_video_frame.h
index 6794765ac..4ceb07d26 100644
--- a/src/lib/dcp_video_frame.h
+++ b/src/lib/dcp_video_frame.h
@@ -107,7 +107,7 @@ class DCPVideoFrame
public:
DCPVideoFrame (
boost::shared_ptr<const Image>, boost::shared_ptr<Subtitle>, libdcp::Size,
- int, int, float, Scaler const *, int, int, std::string, int, int, Log *
+ int, int, float, Scaler const *, int, int, std::string, int, int, boost::shared_ptr<Log>
);
virtual ~DCPVideoFrame ();
@@ -135,7 +135,7 @@ private:
int _colour_lut; ///< Colour look-up table to use
int _j2k_bandwidth; ///< J2K bandwidth to use
- Log* _log; ///< log
+ boost::shared_ptr<Log> _log; ///< log
opj_image_cmptparm_t _cmptparm[3]; ///< libopenjpeg's opj_image_cmptparm_t
opj_image* _image; ///< libopenjpeg's image container
diff --git a/src/lib/delay_line.cc b/src/lib/delay_line.cc
index 4ad172781..53da9a412 100644
--- a/src/lib/delay_line.cc
+++ b/src/lib/delay_line.cc
@@ -30,7 +30,7 @@ using boost::shared_ptr;
/** @param channels Number of channels of audio.
* @param frames Delay in frames, +ve to move audio later.
*/
-DelayLine::DelayLine (Log* log, int channels, int frames)
+DelayLine::DelayLine (shared_ptr<Log> log, int channels, int frames)
: AudioProcessor (log)
, _negative_delay_remaining (0)
, _frames (frames)
diff --git a/src/lib/delay_line.h b/src/lib/delay_line.h
index 4d6f1313b..c51784f35 100644
--- a/src/lib/delay_line.h
+++ b/src/lib/delay_line.h
@@ -26,7 +26,7 @@ class AudioBuffers;
class DelayLine : public AudioProcessor
{
public:
- DelayLine (Log* log, int channels, int frames);
+ DelayLine (boost::shared_ptr<Log> log, int channels, int frames);
void process_audio (boost::shared_ptr<AudioBuffers>);
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 8f545952b..77f9828cd 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -144,12 +144,13 @@ Film::Film (string d, bool must_exist)
read_metadata ();
}
- _log = new FileLog (file ("log"));
+ _log.reset (new FileLog (file ("log")));
}
Film::Film (Film const & o)
: boost::enable_shared_from_this<Film> (o)
- , _log (0)
+ /* note: the copied film shares the original's log */
+ , _log (o._log)
, _directory (o._directory)
, _name (o._name)
, _use_dci_name (o._use_dci_name)
@@ -180,7 +181,6 @@ Film::Film (Film const & o)
, _dcp_frame_rate (o._dcp_frame_rate)
, _size (o._size)
, _length (o._length)
- , _dcp_intrinsic_duration (o._dcp_intrinsic_duration)
, _content_digest (o._content_digest)
, _content_audio_streams (o._content_audio_streams)
, _external_audio_stream (o._external_audio_stream)
@@ -188,12 +188,12 @@ Film::Film (Film const & o)
, _source_frame_rate (o._source_frame_rate)
, _dirty (o._dirty)
{
-
+
}
Film::~Film ()
{
- delete _log;
+
}
string
@@ -350,9 +350,12 @@ void
Film::analyse_audio_finished ()
{
ensure_ui_thread ();
- _analyse_audio_job.reset ();
- AudioAnalysisFinished ();
+ if (_analyse_audio_job->finished_ok ()) {
+ AudioAnalysisSucceeded ();
+ }
+
+ _analyse_audio_job.reset ();
}
void
@@ -450,7 +453,6 @@ Film::write_metadata () const
f << "width " << _size.width << endl;
f << "height " << _size.height << endl;
f << "length " << _length.get_value_or(0) << endl;
- f << "dcp_intrinsic_duration " << _dcp_intrinsic_duration.get_value_or(0) << endl;
f << "content_digest " << _content_digest << endl;
for (vector<shared_ptr<AudioStream> >::const_iterator i = _content_audio_streams.begin(); i != _content_audio_streams.end(); ++i) {
@@ -591,11 +593,6 @@ Film::read_metadata ()
if (vv) {
_length = vv;
}
- } else if (k == "dcp_intrinsic_duration") {
- int const vv = atoi (v.c_str ());
- if (vv) {
- _dcp_intrinsic_duration = vv;
- }
} else if (k == "content_digest") {
_content_digest = v;
} else if (k == "content_audio_stream" || (!version && k == "audio_stream")) {
@@ -1291,16 +1288,6 @@ Film::unset_length ()
}
void
-Film::set_dcp_intrinsic_duration (int d)
-{
- {
- boost::mutex::scoped_lock lm (_state_mutex);
- _dcp_intrinsic_duration = d;
- }
- signal_changed (DCP_INTRINSIC_DURATION);
-}
-
-void
Film::set_content_digest (string d)
{
{
@@ -1434,3 +1421,21 @@ Film::have_dcp () const
return true;
}
+
+bool
+Film::has_audio () const
+{
+ if (use_content_audio()) {
+ return audio_stream();
+ }
+
+ vector<string> const e = external_audio ();
+ for (vector<string>::const_iterator i = e.begin(); i != e.end(); ++i) {
+ if (!i->empty ()) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
diff --git a/src/lib/film.h b/src/lib/film.h
index 9921acbb4..698e7ef46 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -77,7 +77,7 @@ public:
/** @return Logger.
* It is safe to call this from any thread.
*/
- Log* log () const {
+ boost::shared_ptr<Log> log () const {
return _log;
}
@@ -98,10 +98,6 @@ public:
std::string dci_name (bool if_created_now) const;
std::string dcp_name (bool if_created_now = false) const;
- boost::optional<int> dcp_intrinsic_duration () const {
- return _dcp_intrinsic_duration;
- }
-
/** @return true if our state has changed since we last saved it */
bool dirty () const {
return _dirty;
@@ -145,7 +141,6 @@ public:
DCI_METADATA,
SIZE,
LENGTH,
- DCP_INTRINSIC_DURATION,
CONTENT_AUDIO_STREAMS,
SUBTITLE_STREAMS,
SOURCE_FRAME_RATE,
@@ -327,7 +322,7 @@ public:
}
boost::shared_ptr<AudioStream> audio_stream () const;
-
+ bool has_audio () const;
/* SET */
@@ -365,7 +360,6 @@ public:
void set_size (libdcp::Size);
void set_length (SourceFrame);
void unset_length ();
- void set_dcp_intrinsic_duration (int);
void set_content_digest (std::string);
void set_content_audio_streams (std::vector<boost::shared_ptr<AudioStream> >);
void set_subtitle_streams (std::vector<boost::shared_ptr<SubtitleStream> >);
@@ -374,7 +368,7 @@ public:
/** Emitted when some property has changed */
mutable boost::signals2::signal<void (Property)> Changed;
- boost::signals2::signal<void ()> AudioAnalysisFinished;
+ boost::signals2::signal<void ()> AudioAnalysisSucceeded;
/** Current version number of the state file */
static int const state_version;
@@ -382,7 +376,7 @@ public:
private:
/** Log to write to */
- Log* _log;
+ boost::shared_ptr<Log> _log;
/** Any running ExamineContentJob, or 0 */
boost::shared_ptr<ExamineContentJob> _examine_content_job;
@@ -477,7 +471,6 @@ private:
libdcp::Size _size;
/** The length of the source, in video frames (as far as we know) */
boost::optional<SourceFrame> _length;
- boost::optional<int> _dcp_intrinsic_duration;
/** MD5 digest of our content file */
std::string _content_digest;
/** The audio streams in our content */
diff --git a/src/lib/gain.cc b/src/lib/gain.cc
index cec3b3c62..df7011d2e 100644
--- a/src/lib/gain.cc
+++ b/src/lib/gain.cc
@@ -22,7 +22,7 @@
using boost::shared_ptr;
/** @param gain gain in dB */
-Gain::Gain (Log* log, float gain)
+Gain::Gain (shared_ptr<Log> log, float gain)
: AudioProcessor (log)
, _gain (gain)
{
diff --git a/src/lib/gain.h b/src/lib/gain.h
index 716ee9b51..d462e5aee 100644
--- a/src/lib/gain.h
+++ b/src/lib/gain.h
@@ -22,7 +22,7 @@
class Gain : public AudioProcessor
{
public:
- Gain (Log* log, float gain);
+ Gain (boost::shared_ptr<Log> log, float gain);
void process_audio (boost::shared_ptr<AudioBuffers>);
diff --git a/src/lib/matcher.cc b/src/lib/matcher.cc
index 4cd264338..48f6ed912 100644
--- a/src/lib/matcher.cc
+++ b/src/lib/matcher.cc
@@ -26,7 +26,7 @@
using std::min;
using boost::shared_ptr;
-Matcher::Matcher (Log* log, int sample_rate, float frames_per_second)
+Matcher::Matcher (shared_ptr<Log> log, int sample_rate, float frames_per_second)
: AudioVideoProcessor (log)
, _sample_rate (sample_rate)
, _frames_per_second (frames_per_second)
diff --git a/src/lib/matcher.h b/src/lib/matcher.h
index 60bb87432..b1680e131 100644
--- a/src/lib/matcher.h
+++ b/src/lib/matcher.h
@@ -24,7 +24,7 @@
class Matcher : public AudioVideoProcessor
{
public:
- Matcher (Log* log, int sample_rate, float frames_per_second);
+ Matcher (boost::shared_ptr<Log> log, int sample_rate, float frames_per_second);
void process_video (boost::shared_ptr<Image> i, bool, boost::shared_ptr<Subtitle> s);
void process_audio (boost::shared_ptr<AudioBuffers>);
void process_end ();
diff --git a/src/lib/processor.h b/src/lib/processor.h
index 19d7c4b0c..1ba396f2f 100644
--- a/src/lib/processor.h
+++ b/src/lib/processor.h
@@ -40,7 +40,7 @@ public:
/** Construct a Processor.
* @param log Log to use.
*/
- Processor (Log* log)
+ Processor (boost::shared_ptr<Log> log)
: _log (log)
{}
@@ -50,7 +50,7 @@ public:
virtual void process_end () {}
protected:
- Log* _log; ///< log to write to
+ boost::shared_ptr<Log> _log; ///< log to write to
};
/** @class AudioVideoProcessor
@@ -62,7 +62,7 @@ public:
/** Construct an AudioVideoProcessor.
* @param log Log to write to.
*/
- AudioVideoProcessor (Log* log)
+ AudioVideoProcessor (boost::shared_ptr<Log> log)
: Processor (log)
{}
};
@@ -76,7 +76,7 @@ public:
/** Construct an AudioProcessor.
* @param log Log to write to.
*/
- AudioProcessor (Log* log)
+ AudioProcessor (boost::shared_ptr<Log> log)
: Processor (log)
{}
};
@@ -90,7 +90,7 @@ public:
/** Construct an VideoProcessor.
* @param log Log to write to.
*/
- VideoProcessor (Log* log)
+ VideoProcessor (boost::shared_ptr<Log> log)
: Processor (log)
{}
};
diff --git a/src/lib/server.cc b/src/lib/server.cc
index 76a25bfbb..9c5a77f68 100644
--- a/src/lib/server.cc
+++ b/src/lib/server.cc
@@ -77,7 +77,7 @@ ServerDescription::as_metadata () const
return s.str ();
}
-Server::Server (Log* log)
+Server::Server (shared_ptr<Log> log)
: _log (log)
{
diff --git a/src/lib/server.h b/src/lib/server.h
index 32ba8dc4b..89aeca626 100644
--- a/src/lib/server.h
+++ b/src/lib/server.h
@@ -76,7 +76,7 @@ private:
class Server
{
public:
- Server (Log* log);
+ Server (boost::shared_ptr<Log> log);
void run (int num_threads);
@@ -88,5 +88,5 @@ private:
std::list<boost::shared_ptr<Socket> > _queue;
boost::mutex _worker_mutex;
boost::condition _worker_condition;
- Log* _log;
+ boost::shared_ptr<Log> _log;
};
diff --git a/src/lib/transcode_job.cc b/src/lib/transcode_job.cc
index f7cc500fe..234ebe051 100644
--- a/src/lib/transcode_job.cc
+++ b/src/lib/transcode_job.cc
@@ -68,10 +68,7 @@ TranscodeJob::run ()
set_progress (1);
set_state (FINISHED_OK);
- _film->set_dcp_intrinsic_duration (_encoder->video_frames_out ());
-
_film->log()->log (N_("Transcode job completed successfully"));
- _film->log()->log (String::compose (N_("DCP intrinsic duration is %1"), _encoder->video_frames_out()));
} catch (std::exception& e) {
diff --git a/src/lib/transcoder.cc b/src/lib/transcoder.cc
index 9720ca56a..e0f3a03a2 100644
--- a/src/lib/transcoder.cc
+++ b/src/lib/transcoder.cc
@@ -38,7 +38,6 @@
#include "audio_decoder.h"
using std::string;
-using std::cout;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
diff --git a/src/lib/writer.cc b/src/lib/writer.cc
index 5a2f7c9a9..2d7ee9ba3 100644
--- a/src/lib/writer.cc
+++ b/src/lib/writer.cc
@@ -261,8 +261,6 @@ Writer::finish ()
int const frames = _last_written_frame + 1;
int const duration = frames - _film->trim_start() - _film->trim_end();
- _film->set_dcp_intrinsic_duration (frames);
-
_picture_asset->set_entry_point (_film->trim_start ());
_picture_asset->set_duration (duration);
@@ -275,8 +273,14 @@ Writer::finish ()
boost::filesystem::path to;
to /= _film->dir (_film->dcp_name());
to /= N_("video.mxf");
-
- boost::filesystem::create_hard_link (from, to);
+
+ boost::system::error_code ec;
+ boost::filesystem::create_hard_link (from, to, ec);
+ if (ec) {
+ /* hard link failed; copy instead */
+ boost::filesystem::copy_file (from, to);
+ _film->log()->log ("Hard-link failed; fell back to copying");
+ }
/* And update the asset */
diff --git a/src/tools/dvdomatic.cc b/src/tools/dvdomatic.cc
index d08975061..084e0fff7 100644
--- a/src/tools/dvdomatic.cc
+++ b/src/tools/dvdomatic.cc
@@ -479,12 +479,16 @@ class App : public wxApp
#ifdef DVDOMATIC_POSIX
unsetenv ("UBUNTU_MENUPROXY");
#endif
-
+
+ /* This needs to be before setup_i18n, as setup_i18n() will
+ create a Config object, which needs Scalers to have
+ been created.
+ */
+ dvdomatic_setup ();
+
wxInitAllImageHandlers ();
setup_i18n ();
- dvdomatic_setup ();
-
if (!film_to_load.empty() && boost::filesystem::is_directory (film_to_load)) {
try {
film.reset (new Film (film_to_load));
diff --git a/src/tools/servomatic_cli.cc b/src/tools/servomatic_cli.cc
index f8e713193..6626d45b9 100644
--- a/src/tools/servomatic_cli.cc
+++ b/src/tools/servomatic_cli.cc
@@ -42,7 +42,10 @@
#include "log.h"
#include "version.h"
-using namespace std;
+using std::cerr;
+using std::string;
+using std::cout;
+using boost::shared_ptr;
static void
help (string n)
@@ -87,8 +90,8 @@ main (int argc, char* argv[])
}
Scaler::setup_scalers ();
- FileLog log ("servomatic.log");
- Server server (&log);
+ shared_ptr<FileLog> log (new FileLog ("servomatic.log"));
+ Server server (log);
server.run (num_threads);
return 0;
}
diff --git a/src/tools/servomatic_gui.cc b/src/tools/servomatic_gui.cc
index 610ba8005..dd169725f 100644
--- a/src/tools/servomatic_gui.cc
+++ b/src/tools/servomatic_gui.cc
@@ -25,8 +25,11 @@
#include "lib/server.h"
#include "lib/config.h"
-using namespace std;
-using namespace boost;
+using std::cout;
+using std::string;
+using boost::shared_ptr;
+using boost::thread;
+using boost::bind;
enum {
ID_status = 1,
@@ -52,7 +55,7 @@ private:
string _log;
};
-static MemoryLog memory_log;
+static shared_ptr<MemoryLog> memory_log (new MemoryLog);
class StatusDialog : public wxDialog
{
@@ -77,7 +80,7 @@ public:
private:
void update (wxTimerEvent &)
{
- _text->ChangeValue (std_to_wx (memory_log.get ()));
+ _text->ChangeValue (std_to_wx (memory_log->get ()));
_sizer->Layout ();
}
@@ -141,7 +144,7 @@ private:
void main_thread ()
{
- Server server (&memory_log);
+ Server server (memory_log);
server.run (Config::instance()->num_local_encoding_threads ());
}
diff --git a/src/tools/servomatictest.cc b/src/tools/servomatictest.cc
index 91ad02120..f5756c693 100644
--- a/src/tools/servomatictest.cc
+++ b/src/tools/servomatictest.cc
@@ -43,7 +43,7 @@ using std::pair;
using boost::shared_ptr;
static ServerDescription* server;
-static FileLog log_ ("servomatictest.log");
+static shared_ptr<FileLog> log_ (new FileLog ("servomatictest.log"));
static int frame = 0;
void
@@ -53,14 +53,14 @@ process_video (shared_ptr<Image> image, bool, shared_ptr<Subtitle> sub)
new DCPVideoFrame (
image, sub,
libdcp::Size (1024, 1024), 0, 0, 0,
- Scaler::from_id ("bicubic"), frame, 24, "", 0, 250000000, &log_)
+ Scaler::from_id ("bicubic"), frame, 24, "", 0, 250000000, log_)
);
shared_ptr<DCPVideoFrame> remote (
new DCPVideoFrame (
image, sub,
libdcp::Size (1024, 1024), 0, 0, 0,
- Scaler::from_id ("bicubic"), frame, 24, "", 0, 250000000, &log_)
+ Scaler::from_id ("bicubic"), frame, 24, "", 0, 250000000, log_)
);
cout << "Frame " << frame << ": ";
diff --git a/src/wx/audio_dialog.cc b/src/wx/audio_dialog.cc
index 5bac8eabe..ba7ddd8f7 100644
--- a/src/wx/audio_dialog.cc
+++ b/src/wx/audio_dialog.cc
@@ -87,7 +87,7 @@ void
AudioDialog::set_film (boost::shared_ptr<Film> f)
{
_film_changed_connection.disconnect ();
- _film_audio_analysis_finished_connection.disconnect ();
+ _film_audio_analysis_succeeded_connection.disconnect ();
_film = f;
@@ -96,7 +96,7 @@ AudioDialog::set_film (boost::shared_ptr<Film> f)
_plot->set_gain (_film->audio_gain ());
_film_changed_connection = _film->Changed.connect (bind (&AudioDialog::film_changed, this, _1));
- _film_audio_analysis_finished_connection = _film->AudioAnalysisFinished.connect (bind (&AudioDialog::try_to_load_analysis, this));
+ _film_audio_analysis_succeeded_connection = _film->AudioAnalysisSucceeded.connect (bind (&AudioDialog::try_to_load_analysis, this));
SetTitle (std_to_wx (String::compose (wx_to_std (_("DVD-o-matic audio - %1")), _film->name())));
}
diff --git a/src/wx/audio_dialog.h b/src/wx/audio_dialog.h
index 16cb356fe..514faeea0 100644
--- a/src/wx/audio_dialog.h
+++ b/src/wx/audio_dialog.h
@@ -47,5 +47,5 @@ private:
wxCheckBox* _type_checkbox[AudioPoint::COUNT];
wxSlider* _smoothing;
boost::signals2::scoped_connection _film_changed_connection;
- boost::signals2::scoped_connection _film_audio_analysis_finished_connection;
+ boost::signals2::scoped_connection _film_audio_analysis_succeeded_connection;
};
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index b9a4012e3..20dbc88ef 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -617,6 +617,7 @@ FilmEditor::film_changed (Film::Property p)
setup_formats ();
setup_subtitle_control_sensitivity ();
setup_streams ();
+ setup_show_audio_sensitivity ();
break;
case Film::TRUST_CONTENT_HEADER:
checked_set (_trust_content_header, _film->trust_content_header ());
@@ -627,6 +628,7 @@ FilmEditor::film_changed (Film::Property p)
break;
case Film::CONTENT_AUDIO_STREAMS:
setup_streams ();
+ setup_show_audio_sensitivity ();
break;
case Film::FORMAT:
{
@@ -696,8 +698,6 @@ FilmEditor::film_changed (Film::Property p)
_trim_end->SetRange (0, _film->length().get());
}
break;
- case Film::DCP_INTRINSIC_DURATION:
- break;
case Film::DCP_CONTENT_TYPE:
checked_set (_dcp_content_type, DCPContentType::as_index (_film->dcp_content_type ()));
setup_dcp_name ();
@@ -754,6 +754,7 @@ FilmEditor::film_changed (Film::Property p)
setup_dcp_name ();
setup_audio_details ();
setup_audio_control_sensitivity ();
+ setup_show_audio_sensitivity ();
break;
case Film::USE_CONTENT_AUDIO:
checked_set (_use_content_audio, _film->use_content_audio());
@@ -761,6 +762,7 @@ FilmEditor::film_changed (Film::Property p)
setup_dcp_name ();
setup_audio_details ();
setup_audio_control_sensitivity ();
+ setup_show_audio_sensitivity ();
break;
case Film::SUBTITLE_STREAM:
if (_film->subtitle_stream()) {
@@ -774,6 +776,7 @@ FilmEditor::film_changed (Film::Property p)
checked_set (_external_audio[i], a[i]);
}
setup_audio_details ();
+ setup_show_audio_sensitivity ();
break;
}
case Film::DCP_FRAME_RATE:
@@ -915,6 +918,7 @@ FilmEditor::set_things_sensitive (bool s)
setup_subtitle_control_sensitivity ();
setup_audio_control_sensitivity ();
+ setup_show_audio_sensitivity ();
}
/** Called when the `Edit filters' button has been clicked */
@@ -1123,7 +1127,7 @@ FilmEditor::setup_subtitle_control_sensitivity ()
void
FilmEditor::setup_audio_control_sensitivity ()
{
- _use_content_audio->Enable (_generally_sensitive);
+ _use_content_audio->Enable (_generally_sensitive && _film && !_film->content_audio_streams().empty());
_use_external_audio->Enable (_generally_sensitive);
bool const source = _generally_sensitive && _use_content_audio->GetValue();
@@ -1218,7 +1222,7 @@ FilmEditor::subtitle_stream_changed (wxCommandEvent &)
void
FilmEditor::setup_audio_details ()
{
- if (!_film->audio_stream()) {
+ if (!_film->content_audio_stream()) {
_audio->SetLabel (wxT (""));
} else {
stringstream s;
@@ -1289,3 +1293,9 @@ FilmEditor::best_dcp_frame_rate_clicked (wxCommandEvent &)
_film->set_dcp_frame_rate (best_dcp_frame_rate (_film->source_frame_rate ()));
}
+
+void
+FilmEditor::setup_show_audio_sensitivity ()
+{
+ _show_audio->Enable (_film && _film->has_audio ());
+}
diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h
index 29b453b8b..e5b619886 100644
--- a/src/wx/film_editor.h
+++ b/src/wx/film_editor.h
@@ -98,6 +98,7 @@ private:
void setup_streams ();
void setup_audio_details ();
void setup_dcp_name ();
+ void setup_show_audio_sensitivity ();
wxControl* video_control (wxControl *);
wxControl* still_control (wxControl *);
diff --git a/test/test.cc b/test/test.cc
index 15c34ca78..448168f24 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -254,9 +254,9 @@ public:
void
do_positive_delay_line_test (int delay_length, int data_length)
{
- NullLog log;
+ shared_ptr<NullLog> log (new NullLog);
- DelayLine d (&log, 6, delay_length);
+ DelayLine d (log, 6, delay_length);
shared_ptr<AudioBuffers> data (new AudioBuffers (6, data_length));
int in = 0;
@@ -297,9 +297,9 @@ do_positive_delay_line_test (int delay_length, int data_length)
void
do_negative_delay_line_test (int delay_length, int data_length)
{
- NullLog log;
+ shared_ptr<NullLog> log (new NullLog);
- DelayLine d (&log, 6, delay_length);
+ DelayLine d (log, 6, delay_length);
shared_ptr<AudioBuffers> data (new AudioBuffers (6, data_length));
int in = 0;
@@ -406,7 +406,7 @@ BOOST_AUTO_TEST_CASE (client_server_test)
shared_ptr<Subtitle> subtitle (new Subtitle (Position (50, 60), sub_image));
- FileLog log ("build/test/client_server_test.log");
+ shared_ptr<FileLog> log (new FileLog ("build/test/client_server_test.log"));
shared_ptr<DCPVideoFrame> frame (
new DCPVideoFrame (
@@ -422,14 +422,14 @@ BOOST_AUTO_TEST_CASE (client_server_test)
"",
0,
200000000,
- &log
+ log
)
);
shared_ptr<EncodedData> locally_encoded = frame->encode_locally ();
BOOST_ASSERT (locally_encoded);
- Server* server = new Server (&log);
+ Server* server = new Server (log);
new thread (boost::bind (&Server::run, server, 2));