std::shared_ptr
[dcpomatic.git] / src / lib / decoder.h
index f70eca8b3fb55a41ca8d627b9e141f3728abf0d5..da5be4af679ccbda8b7c2100e2af3e5ce52b82e6 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 #define DCPOMATIC_DECODER_H
 
 #include "types.h"
+#include "film.h"
+#include "font_data.h"
 #include "dcpomatic_time.h"
+#include "weak_film.h"
 #include <boost/utility.hpp>
 
 class Decoded;
 class VideoDecoder;
 class AudioDecoder;
-class SubtitleDecoder;
+class TextDecoder;
+class AtmosDecoder;
 class DecoderPart;
 
 /** @class Decoder.
  *  @brief Parent class for decoders of content.
  */
-class Decoder : public boost::noncopyable
+class Decoder : public boost::noncopyable, public WeakConstFilm
 {
 public:
+       Decoder (std::weak_ptr<const Film> film);
        virtual ~Decoder () {}
 
-       boost::shared_ptr<VideoDecoder> video;
-       boost::shared_ptr<AudioDecoder> audio;
-       boost::shared_ptr<SubtitleDecoder> subtitle;
+       std::shared_ptr<VideoDecoder> video;
+       std::shared_ptr<AudioDecoder> audio;
+       std::list<std::shared_ptr<TextDecoder> > text;
+       std::shared_ptr<AtmosDecoder> atmos;
 
-       virtual void pass () = 0;
-       virtual void seek (ContentTime time, bool accurate) = 0;
+       std::shared_ptr<TextDecoder> only_text () const;
 
-       ContentTime position () const;
+       /** Do some decoding and perhaps emit video, audio or subtitle data.
+        *  @return true if this decoder will emit no more data unless a seek() happens.
+        */
+       virtual bool pass () = 0;
+       virtual void seek (dcpomatic::ContentTime time, bool accurate);
+
+       virtual dcpomatic::ContentTime position () const;
+
+       virtual std::vector<dcpomatic::FontData> fonts () const {
+               return std::vector<dcpomatic::FontData>();
+       }
 };
 
 #endif