Remove old unused stuff.
[dcpomatic.git] / src / lib / decoder.h
index 04ff512eb4fe520291754866fbf564b6c470efa9..f530de0ebaeb89adff237391624b337afdc7531a 100644 (file)
@@ -30,6 +30,7 @@
 #include <boost/shared_ptr.hpp>
 #include <sigc++/sigc++.h>
 #include "util.h"
+#include "stream.h"
 
 class Job;
 class FilmState;
@@ -37,6 +38,8 @@ class Options;
 class Image;
 class Log;
 class DelayLine;
+class TimedSubtitle;
+class Subtitle;
 
 /** @class Decoder.
  *  @brief Parent class for decoders of content.
@@ -53,8 +56,6 @@ public:
 
        /* Methods to query our input video */
 
-       /** @return length in video frames */
-       virtual int length_in_frames () const = 0;
        /** @return video frames per second, or 0 if unknown */
        virtual float frames_per_second () const = 0;
        /** @return native size in pixels */
@@ -66,6 +67,7 @@ public:
        /** @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,18 +78,24 @@ public:
        int last_video_frame () const {
                return _video_frame;
        }
+
+       virtual std::vector<AudioStream> audio_streams () const {
+               return std::vector<AudioStream> ();
+       }
        
+       virtual std::vector<SubtitleStream> subtitle_streams () const {
+               return std::vector<SubtitleStream> ();
+       }
+
        /** 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.
-        *  Second parameter is the size of the data.
-        */
-       sigc::signal<void, uint8_t *, int> Audio;
+       /** Emitted when some audio data is ready */
+       sigc::signal<void, boost::shared_ptr<AudioBuffers> > Audio;
        
 protected:
        /** perform a single pass at our content */
@@ -100,7 +108,10 @@ protected:
        
        void process_video (AVFrame *);
        void process_audio (uint8_t *, int);
+       void process_subtitle (boost::shared_ptr<TimedSubtitle>);
 
+       int bytes_per_audio_sample () const;
+       
        /** our FilmState */
        boost::shared_ptr<const FilmState> _fs;
        /** our options */
@@ -120,6 +131,7 @@ protected:
 
 private:
        void setup_video_filters ();
+       void emit_audio (uint8_t* data, int size);
        
        /** last video frame to be processed */
        int _video_frame;
@@ -135,6 +147,8 @@ private:
           (at the DCP sample rate).
        */
        int64_t _audio_frames_processed;
+
+       boost::shared_ptr<TimedSubtitle> _timed_subtitle;
 };
 
 #endif