X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fmatcher.h;h=61fd814362b41b2f0b61758752c6bd3fe28f834c;hb=5a57b5631518ce9711e6b44a65a0bb87aa434561;hp=b94c28446a4d7f3b69a8ebe8c70204ecf34e3b67;hpb=94b48aad7958be46e8294ed736baa53c86ce6b26;p=dcpomatic.git diff --git a/src/lib/matcher.h b/src/lib/matcher.h index b94c28446..61fd81436 100644 --- a/src/lib/matcher.h +++ b/src/lib/matcher.h @@ -19,22 +19,59 @@ #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; int64_t _audio_frames; boost::optional _pixel_format; - boost::optional _size; + 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; };