Various fixes to still-image mode.
[dcpomatic.git] / src / lib / ffmpeg_decoder.h
index 141b40da0da5e00a5de3289f3077d00c76c158a0..2011ef72f9f416661ce2394d15eb4e7bafb12c7c 100644 (file)
@@ -26,6 +26,7 @@
 #include <stdint.h>
 #include <boost/shared_ptr.hpp>
 #include <boost/optional.hpp>
+#include <boost/thread/mutex.hpp>
 extern "C" {
 #include <libavcodec/avcodec.h>
 #include <libpostproc/postprocess.h>
@@ -34,6 +35,7 @@ extern "C" {
 #include "decoder.h"
 #include "video_decoder.h"
 #include "audio_decoder.h"
+#include "film.h"
 
 struct AVFilterGraph;
 struct AVCodecContext;
@@ -84,7 +86,7 @@ private:
 class FFmpegDecoder : public VideoDecoder, public AudioDecoder
 {
 public:
-       FFmpegDecoder (boost::shared_ptr<Film>, boost::shared_ptr<const Options>, Job *);
+       FFmpegDecoder (boost::shared_ptr<Film>, boost::shared_ptr<const DecodeOptions>, Job *);
        ~FFmpegDecoder ();
 
        float frames_per_second () const;
@@ -98,6 +100,8 @@ public:
        void set_audio_stream (boost::shared_ptr<AudioStream>);
        void set_subtitle_stream (boost::shared_ptr<SubtitleStream>);
 
+       bool seek (SourceFrame);
+
 private:
 
        bool pass ();
@@ -105,8 +109,7 @@ private:
        AVSampleFormat audio_sample_format () const;
        int bytes_per_audio_sample () const;
 
-       void rough_video_output ();
-       void precise_video_output ();
+       void out_with_sync ();
        void filter_and_emit_video (AVFrame *);
 
        void setup_general ();
@@ -117,6 +120,8 @@ private:
        void maybe_add_subtitle ();
        boost::shared_ptr<AudioBuffers> deinterleave_audio (uint8_t* data, int size);
 
+       void film_changed (Film::Property);
+
        std::string stream_name (AVStream* s) const;
 
        AVFormatContext* _format_context;
@@ -135,7 +140,7 @@ private:
 
        boost::optional<double> _first_video;
        boost::optional<double> _first_audio;
-       boost::optional<double> _last_rough_output;
 
        std::list<boost::shared_ptr<FilterGraph> > _filter_graphs;
+       boost::mutex _filter_graphs_mutex;
 };