*/
+
+#include "butler.h"
+#include "cross.h"
#include "ffmpeg_encoder.h"
#include "film.h"
+#include "image.h"
#include "job.h"
+#include "log.h"
#include "player.h"
#include "player_video.h"
-#include "log.h"
-#include "image.h"
-#include "cross.h"
-#include "butler.h"
#include "compose.hpp"
#include <iostream>
#include "i18n.h"
+
using std::cout;
using std::list;
using std::make_shared;
-using std::map;
-using std::pair;
-using std::runtime_error;
using std::shared_ptr;
using std::string;
using std::weak_ptr;
using namespace boost::placeholders;
#endif
+
/** @param key Key to use to encrypt MP4 outputs */
FFmpegEncoder::FFmpegEncoder (
shared_ptr<const Film> film,
}
_butler = std::make_shared<Butler>(
- _film, _player, map, _output_audio_channels, bind(&PlayerVideo::force, _1, FFmpegFileEncoder::pixel_format(format)), VideoRange::VIDEO, true, false
+ _film, _player, map, _output_audio_channels, bind(&PlayerVideo::force, FFmpegFileEncoder::pixel_format(format)), VideoRange::VIDEO, Image::Alignment::PADDED, false, false
);
}
for (int j = 0; j < gets_per_frame; ++j) {
Butler::Error e;
- auto v = _butler->get_video (true, &e);
+ auto v = _butler->get_video (Butler::Behaviour::BLOCKING, &e);
_butler->rethrow ();
- if (!v.first) {
- throw DecodeError(String::compose("Error during decoding: %1", e.summary()));
- }
- auto fe = encoder->get (v.first->eyes());
- if (fe) {
- fe->video(v.first, v.second);
+ if (v.first) {
+ auto fe = encoder->get (v.first->eyes());
+ if (fe) {
+ fe->video(v.first, v.second - reel->from);
+ }
+ } else {
+ if (e.code != Butler::Error::Code::FINISHED) {
+ throw DecodeError(String::compose("Error during decoding: %1", e.summary()));
+ }
}
}
waker.nudge ();
- _butler->get_audio (interleaved, audio_frames);
+ _butler->get_audio (Butler::Behaviour::BLOCKING, interleaved, audio_frames);
/* XXX: inefficient; butler interleaves and we deinterleave again */
float* p = interleaved;
for (int j = 0; j < audio_frames; ++j) {
eyes = Eyes::BOTH;
} else if (eyes == Eyes::RIGHT) {
/* ...and ignore the right eye.*/
- return shared_ptr<FFmpegFileEncoder>();
+ return {};
}
}
- map<Eyes, std::shared_ptr<FFmpegFileEncoder> >::const_iterator i = _encoders.find (eyes);
+ auto i = _encoders.find (eyes);
DCPOMATIC_ASSERT (i != _encoders.end());
return i->second;
}