Untested external audio support; AB transcodes still broken.
[dcpomatic.git] / src / lib / video_decoder.h
1 #ifndef DVDOMATIC_VIDEO_DECODER_H
2 #define DVDOMATIC_VIDEO_DECODER_H
3
4 #include "video_source.h"
5 #include "stream.h"
6 #include "decoder.h"
7
8 class VideoDecoder : public VideoSource, public virtual Decoder
9 {
10 public:
11         VideoDecoder (boost::shared_ptr<Film>, boost::shared_ptr<const Options>, Job *);
12
13         /** @return video frames per second, or 0 if unknown */
14         virtual float frames_per_second () const = 0;
15         /** @return native size in pixels */
16         virtual Size native_size () const = 0;
17
18         virtual int time_base_numerator () const = 0;
19         virtual int time_base_denominator () const = 0;
20         virtual int sample_aspect_ratio_numerator () const = 0;
21         virtual int sample_aspect_ratio_denominator () const = 0;
22
23         virtual void set_subtitle_stream (boost::optional<SubtitleStream>);
24
25         SourceFrame video_frame () const {
26                 return _video_frame;
27         }
28
29         boost::optional<SubtitleStream> subtitle_stream () const {
30                 return _subtitle_stream;
31         }
32
33         std::vector<SubtitleStream> subtitle_streams () const {
34                 return _subtitle_streams;
35         }
36
37 protected:
38         
39         virtual PixelFormat pixel_format () const = 0;
40         void set_progress () const;
41
42         void emit_video (boost::shared_ptr<Image>);
43         void emit_subtitle (boost::shared_ptr<TimedSubtitle>);
44         void repeat_last_video ();
45
46         boost::optional<SubtitleStream> _subtitle_stream;
47         std::vector<SubtitleStream> _subtitle_streams;
48
49 private:
50         void signal_video (boost::shared_ptr<Image>, boost::shared_ptr<Subtitle>);
51
52         SourceFrame _video_frame;
53
54         boost::shared_ptr<TimedSubtitle> _timed_subtitle;
55
56         boost::shared_ptr<Image> _last_image;
57         boost::shared_ptr<Subtitle> _last_subtitle;
58 };
59
60 #endif