X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg_encoder.cc;h=5db3e31a69f97e90687e652afb2ce19902ef9f6e;hb=ca44e3542214050de6cb8bbb223138765ac4bdb7;hp=53ec0390b003b3980aca9d7e12d8f55254f5c80e;hpb=d0d2d6a0ca221341c59283167748193a416342a4;p=dcpomatic.git diff --git a/src/lib/ffmpeg_encoder.cc b/src/lib/ffmpeg_encoder.cc index 53ec0390b..5db3e31a6 100644 --- a/src/lib/ffmpeg_encoder.cc +++ b/src/lib/ffmpeg_encoder.cc @@ -18,26 +18,25 @@ */ + +#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 #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; @@ -48,6 +47,7 @@ using namespace dcpomatic; using namespace boost::placeholders; #endif + /** @param key Key to use to encrypt MP4 outputs */ FFmpegEncoder::FFmpegEncoder ( shared_ptr film, @@ -108,7 +108,7 @@ FFmpegEncoder::FFmpegEncoder ( } _butler = std::make_shared( - _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, _1, FFmpegFileEncoder::pixel_format(format)), VideoRange::VIDEO, Image::Alignment::PADDED, false, false ); } @@ -178,12 +178,15 @@ FFmpegEncoder::go () Butler::Error e; auto v = _butler->get_video (true, &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())); + } } } @@ -273,7 +276,7 @@ FFmpegEncoder::FileEncoderSet::get (Eyes eyes) const eyes = Eyes::BOTH; } else if (eyes == Eyes::RIGHT) { /* ...and ignore the right eye.*/ - return shared_ptr(); + return {}; } }