+
+FFmpegEncoder::FileEncoderSet::FileEncoderSet (
+ dcp::Size video_frame_size,
+ int video_frame_rate,
+ int audio_frame_rate,
+ int channels,
+ ExportFormat format,
+ bool audio_stream_per_channel,
+ int x264_crf,
+ bool three_d,
+ boost::filesystem::path output,
+ string extension
+ )
+{
+ if (three_d) {
+ /// TRANSLATORS: L here is an abbreviation for "left", to indicate the left-eye part of a 3D export
+ _encoders[Eyes::LEFT] = make_shared<FFmpegFileEncoder>(
+ video_frame_size, video_frame_rate, audio_frame_rate, channels, format,
+ audio_stream_per_channel, x264_crf, String::compose("%1_%2%3", output.string(), _("L"), extension)
+ );
+ /// TRANSLATORS: R here is an abbreviation for "right", to indicate the right-eye part of a 3D export
+ _encoders[Eyes::RIGHT] = make_shared<FFmpegFileEncoder>(
+ video_frame_size, video_frame_rate, audio_frame_rate, channels, format,
+ audio_stream_per_channel, x264_crf, String::compose("%1_%2%3", output.string(), _("R"), extension)
+ );
+ } else {
+ _encoders[Eyes::BOTH] = make_shared<FFmpegFileEncoder>(
+ video_frame_size, video_frame_rate, audio_frame_rate, channels, format,
+ audio_stream_per_channel, x264_crf, String::compose("%1%2", output.string(), extension)
+ );
+ }
+}
+
+shared_ptr<FFmpegFileEncoder>
+FFmpegEncoder::FileEncoderSet::get (Eyes eyes) const
+{
+ if (_encoders.size() == 1) {
+ /* We are doing a 2D export... */
+ if (eyes == Eyes::LEFT) {
+ /* ...but we got some 3D data; put the left eye into the output... */
+ eyes = Eyes::BOTH;
+ } else if (eyes == Eyes::RIGHT) {
+ /* ...and ignore the right eye.*/
+ return shared_ptr<FFmpegFileEncoder>();
+ }
+ }
+
+ map<Eyes, std::shared_ptr<FFmpegFileEncoder> >::const_iterator i = _encoders.find (eyes);
+ DCPOMATIC_ASSERT (i != _encoders.end());
+ return i->second;
+}
+
+void
+FFmpegEncoder::FileEncoderSet::flush ()
+{
+ for (auto& i: _encoders) {
+ i.second->flush ();
+ }
+}
+
+void
+FFmpegEncoder::FileEncoderSet::audio (shared_ptr<AudioBuffers> a)
+{
+ for (auto& i: _encoders) {
+ i.second->audio (a);
+ }
+}