summaryrefslogtreecommitdiff
path: root/src/lib/encoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-07-04 22:38:43 +0100
committerCarl Hetherington <cth@carlh.net>2013-07-04 22:38:43 +0100
commita43aa6de965cb95fd85425cf5a7dfbdb6f878e22 (patch)
treeb604e6dfe2dff2b020d84891b3406b89d116ddb5 /src/lib/encoder.cc
parentaabf54736d7401437af7f066c51fee91be64e809 (diff)
Put in silence where there was none.
Diffstat (limited to 'src/lib/encoder.cc')
-rw-r--r--src/lib/encoder.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc
index 6a99132fd..ebe72b6cd 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, 24000L);
+ 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 ()));