wip: black pieces; sad part is that Shuffler can't cope with content that doesn't...
[dcpomatic.git] / src / lib / black_decoder.cc
1 #include "black_content.h"
2 #include "black_decoder.h"
3 #include "image.h"
4 #include "raw_image_proxy.h"
5 #include "video_decoder.h"
6
7
8 using std::make_shared;
9 using std::shared_ptr;
10 using namespace dcpomatic;
11
12
13 BlackDecoder::BlackDecoder (shared_ptr<const Film> film, shared_ptr<const BlackContent> content)
14         : Decoder(film)
15         , _content(content)
16         , _video_frame_rate(film->video_frame_rate())
17 {
18         video = make_shared<VideoDecoder>(this, content);
19         _image = make_shared<Image>(AV_PIX_FMT_RGB24, dcp::Size(128, 128), Image::Alignment::PADDED);
20         _image->make_black ();
21         _proxy = make_shared<const RawImageProxy>(_image);
22 }
23
24
25 void
26 BlackDecoder::seek (ContentTime time, bool)
27 {
28         _position = DCPTime(time.get());
29 }
30
31
32 bool
33 BlackDecoder::pass ()
34 {
35         if (_position >= _content->end(film())) {
36                 return true;
37         }
38
39         video->emit(film(), _proxy, _position.frames_round(_video_frame_rate));
40         _position += DCPTime::from_frames(1, _video_frame_rate);
41         return false;
42 }
43