#include "image.h"
#include "image_proxy.h"
#include "raw_image_proxy.h"
-#include "content_video.h"
+#include "raw_image_proxy.h"
+#include "film.h"
+#include "log.h"
#include "i18n.h"
#else
: _video_content (c)
#endif
- , _same (false)
, _last_seek_accurate (true)
+ , _ignore_video (false)
{
_black_image.reset (new Image (PIX_FMT_RGB24, _video_content->video_size(), true));
_black_image->make_black ();
break;
}
- if (pass ()) {
+ if (pass (PASS_REASON_VIDEO)) {
/* The decoder has nothing more for us */
break;
}
dec = decoded_video (frame);
} else {
/* Any frame will do: use the first one that comes out of pass() */
- while (_decoded_video.empty() && !pass ()) {}
+ while (_decoded_video.empty() && !pass (PASS_REASON_VIDEO)) {}
if (!_decoded_video.empty ()) {
dec.push_back (_decoded_video.front ());
}
void
VideoDecoder::video (shared_ptr<const ImageProxy> image, VideoFrame frame)
{
+ if (_ignore_video) {
+ return;
+ }
+
/* We may receive the same frame index twice for 3D, and we need to know
when that happens.
*/
- _same = (!_decoded_video.empty() && frame == _decoded_video.back().frame);
+ bool const same = (!_decoded_video.empty() && frame == _decoded_video.back().frame);
/* Work out what we are going to push into _decoded_video next */
list<ContentVideo> to_push;
to_push.push_back (ContentVideo (image, EYES_BOTH, PART_WHOLE, frame));
break;
case VIDEO_FRAME_TYPE_3D_ALTERNATE:
- to_push.push_back (ContentVideo (image, _same ? EYES_RIGHT : EYES_LEFT, PART_WHOLE, frame));
+ to_push.push_back (ContentVideo (image, same ? EYES_RIGHT : EYES_LEFT, PART_WHOLE, frame));
break;
case VIDEO_FRAME_TYPE_3D_LEFT_RIGHT:
to_push.push_back (ContentVideo (image, EYES_LEFT, PART_LEFT_HALF, frame));
to = to_push.front().frame;
}
+ /* It has been known that this method receives frames out of order; at this
+ point I'm not sure why, but we'll just ignore them.
+ */
+
+ if (from && to && from.get() > to.get()) {
+ _video_content->film()->log()->log (
+ String::compose ("Ignoring out-of-order decoded frame %1 after %2", to.get(), from.get()), Log::TYPE_WARNING
+ );
+ return;
+ }
+
if (from) {
if (_video_content->video_frame_type() == VIDEO_FRAME_TYPE_2D) {
fill_2d (from.get(), to.get ());
copy (to_push.begin(), to_push.end(), back_inserter (_decoded_video));
- /* We can't let this build up too much or we will run out of memory */
- DCPOMATIC_ASSERT (_decoded_video.size() < 32);
+ /* We can't let this build up too much or we will run out of memory. We need to allow
+ the most frames that can exist between blocks of sound in a multiplexed file.
+ */
+ DCPOMATIC_ASSERT (_decoded_video.size() <= 96);
}
void
_last_seek_time = s;
_last_seek_accurate = accurate;
}
+
+/** Set this player never to produce any video data */
+void
+VideoDecoder::set_ignore_video ()
+{
+ _ignore_video = true;
+}