diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-07-08 23:23:07 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-07-08 23:23:07 +0100 |
| commit | f1fab174c7db85a1641bca2830ea75829982723f (patch) | |
| tree | 80f64c7f5daf22f129b5e286487a704c6c069e14 /src/lib/encoder.cc | |
| parent | 2b4110534a7e3b2a2905c9f25226ba5c1ba4a167 (diff) | |
| parent | 50e6acde52c7eaa3afa239bc14f08eced3787bd9 (diff) | |
Merge branch 'staging'
Diffstat (limited to 'src/lib/encoder.cc')
| -rw-r--r-- | src/lib/encoder.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc index 2c989452d..0ac32d3bf 100644 --- a/src/lib/encoder.cc +++ b/src/lib/encoder.cc @@ -47,6 +47,7 @@ using std::stringstream; using std::vector; using std::list; using std::cout; +using std::min; using std::make_pair; using namespace boost; @@ -149,6 +150,20 @@ Encoder::process_end () } #endif + if (_film->audio_channels() == 0 && _film->minimum_audio_channels() > 0) { + /* Put audio in where there is none at all */ + int64_t af = video_frames_to_audio_frames (_video_frames_out, 48000, _film->dcp_frame_rate ()); + while (af) { + int64_t const this_time = min (af, static_cast<int64_t> (24000)); + shared_ptr<AudioBuffers> out (new AudioBuffers (_film->minimum_audio_channels(), this_time)); + out->make_silent (); + out->set_frames (this_time); + write_audio (out); + + af -= this_time; + } + } + boost::mutex::scoped_lock lock (_mutex); _film->log()->log (String::compose (N_("Clearing queue of %1"), _queue.size ())); @@ -433,10 +448,10 @@ Encoder::encoder_thread (ServerDescription* server) void Encoder::write_audio (shared_ptr<const AudioBuffers> data) { - AudioMapping m (_film->audio_channels ()); + AudioMapping m (_film); if (m.dcp_channels() != _film->audio_channels()) { - /* Remap (currently just for mono -> 5.1) */ + /* Remap and pad with silence */ shared_ptr<AudioBuffers> b (new AudioBuffers (m.dcp_channels(), data->frames ())); for (int i = 0; i < m.dcp_channels(); ++i) { |
