Various DCI naming tweaks and a subtitle bug fix.
[dcpomatic.git] / src / lib / decoder.h
index d8551047043f08af5c84b01259a45035bad8d790..8a04ec9f2d77d4a553c80cf8f830d391bd383ec5 100644 (file)
@@ -37,6 +37,8 @@ class Options;
 class Image;
 class Log;
 class DelayLine;
+class TimedSubtitle;
+class Subtitle;
 
 /** @class Decoder.
  *  @brief Parent class for decoders of content.
@@ -65,6 +67,8 @@ public:
        virtual int audio_sample_rate () const = 0;
        /** @return format of audio samples */
        virtual AVSampleFormat audio_sample_format () const = 0;
+       virtual int64_t audio_channel_layout () const = 0;
+       virtual bool has_subtitles () const = 0;
 
        void process_begin ();
        bool pass ();
@@ -76,13 +80,12 @@ public:
                return _video_frame;
        }
        
-       int decoding_frames () const;
-
        /** Emitted when a video frame is ready.
         *  First parameter is the frame.
         *  Second parameter is its index within the content.
+        *  Third parameter is either 0 or a subtitle that should be on this frame.
         */
-       sigc::signal<void, boost::shared_ptr<Image>, int> Video;
+       sigc::signal<void, boost::shared_ptr<Image>, int, boost::shared_ptr<Subtitle> > Video;
 
        /** Emitted when some audio data is ready.
         *  First parameter is the interleaved sample data, format is given in the FilmState.
@@ -100,7 +103,8 @@ protected:
        virtual int sample_aspect_ratio_denominator () const = 0;
        
        void process_video (AVFrame *);
-       void process_audio (uint8_t *, int, int);
+       void process_audio (uint8_t *, int);
+       void process_subtitle (boost::shared_ptr<TimedSubtitle>);
 
        /** our FilmState */
        boost::shared_ptr<const FilmState> _fs;
@@ -132,7 +136,12 @@ private:
        DelayLine* _delay_line;
        int _delay_in_bytes;
 
-       int _audio_frames_processed;
+       /* Number of audio frames that we have pushed to the encoder
+          (at the DCP sample rate).
+       */
+       int64_t _audio_frames_processed;
+
+       boost::shared_ptr<TimedSubtitle> _timed_subtitle;
 };
 
 #endif