X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdecoder.h;h=85b256f5bbe592629b8dad0c2b9c12396816aa73;hb=6e8e4f7ae9a9ae243a1b7d9e17f6b6cacae277b3;hp=19ef25ede0836eea85926956131c6ce9db1e15fc;hpb=c55d8bcda8f4da74bbc9489127354211cea8f2ff;p=dcpomatic.git diff --git a/src/lib/decoder.h b/src/lib/decoder.h index 19ef25ede..85b256f5b 100644 --- a/src/lib/decoder.h +++ b/src/lib/decoder.h @@ -30,6 +30,7 @@ #include #include #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. @@ -66,6 +69,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,20 +80,27 @@ public: int last_video_frame () const { return _video_frame; } + + virtual std::vector audio_streams () const { + return std::vector (); + } - int decoding_frames () const; + virtual std::vector subtitle_streams () const { + return std::vector (); + } + virtual void set_audio_stream (Stream s) {} + virtual void set_subtitle_stream (Stream s) {} + /** 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, int> Video; + sigc::signal, int, boost::shared_ptr > 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 Audio; + /** Emitted when some audio data is ready */ + sigc::signal > Audio; protected: /** perform a single pass at our content */ @@ -102,6 +113,7 @@ protected: void process_video (AVFrame *); void process_audio (uint8_t *, int); + void process_subtitle (boost::shared_ptr); /** our FilmState */ boost::shared_ptr _fs; @@ -122,6 +134,8 @@ protected: private: void setup_video_filters (); + void emit_audio (uint8_t* data, int size); + int bytes_per_audio_sample () const; /** last video frame to be processed */ int _video_frame; @@ -137,6 +151,8 @@ private: (at the DCP sample rate). */ int64_t _audio_frames_processed; + + boost::shared_ptr _timed_subtitle; }; #endif