X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fmatcher.h;h=41aa373a412cd51808dc5d7967e3c04640cc7a80;hb=af671aa256ae0d2fa38a6740cea7fc0f6b45b5b8;hp=60bb8743226078628adfb7246fe2a3922c83a7b3;hpb=d1b20374b1bd02b2929c9c3080c006874b525ef5;p=dcpomatic.git diff --git a/src/lib/matcher.h b/src/lib/matcher.h index 60bb87432..41aa373a4 100644 --- a/src/lib/matcher.h +++ b/src/lib/matcher.h @@ -21,15 +21,19 @@ #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 (double); + void match (double); + void repeat_last_video (); + int _sample_rate; float _frames_per_second; int _video_frames; @@ -37,4 +41,23 @@ private: boost::optional _pixel_format; boost::optional _size; boost::optional _channels; + + struct AudioRecord { + AudioRecord (boost::shared_ptr a, double t) + : audio (a) + , time (t) + {} + + boost::shared_ptr audio; + double time; + }; + + 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; };