X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fmatcher.h;h=61fd814362b41b2f0b61758752c6bd3fe28f834c;hb=46cd0fe7b5b514f0d9456b25f670679cc584a218;hp=60bb8743226078628adfb7246fe2a3922c83a7b3;hpb=b3ff5b97d437086f07a1ae6c4460ab60b13defa1;p=dcpomatic.git diff --git a/src/lib/matcher.h b/src/lib/matcher.h index 60bb87432..61fd81436 100644 --- a/src/lib/matcher.h +++ b/src/lib/matcher.h @@ -19,17 +19,20 @@ #include #include "processor.h" -#include "ffmpeg_compatibility.h" -class Matcher : public AudioVideoProcessor +class Matcher : public Processor, public TimedAudioSink, public TimedVideoSink, public AudioSource, public VideoSource { public: - Matcher (Log* log, int sample_rate, float frames_per_second); - void process_video (boost::shared_ptr i, bool, boost::shared_ptr s); - void process_audio (boost::shared_ptr); + Matcher (boost::shared_ptr log, int sample_rate, float frames_per_second); + void process_video (boost::shared_ptr i, bool, boost::shared_ptr s, double); + void process_audio (boost::shared_ptr, double); void process_end (); private: + void fix_start (); + void match (double); + void repeat_last_video (); + int _sample_rate; float _frames_per_second; int _video_frames; @@ -37,4 +40,38 @@ private: boost::optional _pixel_format; boost::optional _size; boost::optional _channels; + + struct VideoRecord { + VideoRecord (boost::shared_ptr i, bool s, boost::shared_ptr u, double t) + : image (i) + , same (s) + , subtitle (u) + , time (t) + {} + + boost::shared_ptr image; + bool same; + boost::shared_ptr subtitle; + double time; + }; + + struct AudioRecord { + AudioRecord (boost::shared_ptr a, double t) + : audio (a) + , time (t) + {} + + boost::shared_ptr audio; + double time; + }; + + std::list _pending_video; + std::list _pending_audio; + + boost::optional _first_input; + boost::shared_ptr _last_image; + boost::shared_ptr _last_subtitle; + + bool _had_first_video; + bool _had_first_audio; };