X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fwriter.h;h=c0699ad4407158294a3c6d48eccdc8739efdca36;hb=7d93aa13507094e87bc9086986b36edd96a613b0;hp=db2c042faa3671e8407072afdd77cb891a9e282d;hpb=58bca31a6e1e20f20bf924af4cd27b54edd39be7;p=dcpomatic.git diff --git a/src/lib/writer.h b/src/lib/writer.h index db2c042fa..c0699ad44 100644 --- a/src/lib/writer.h +++ b/src/lib/writer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2014 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -70,7 +70,8 @@ bool operator== (QueueItem const & a, QueueItem const & b); class Writer : public ExceptionStore, public boost::noncopyable { public: - Writer (boost::shared_ptr, boost::shared_ptr); + Writer (boost::shared_ptr, boost::weak_ptr); + ~Writer (); bool can_fake_write (int) const; @@ -83,13 +84,14 @@ public: private: void thread (); + void terminate_thread (bool); void check_existing_picture_mxf (); bool check_existing_picture_mxf_frame (FILE *, int, Eyes); - bool have_sequenced_image_at_queue_head () const; + bool have_sequenced_image_at_queue_head (); /** our Film */ boost::shared_ptr _film; - boost::shared_ptr _job; + boost::weak_ptr _job; /** the first frame index that does not already exist in our MXF */ int _first_nonexistant_frame; @@ -103,8 +105,10 @@ private: int _queued_full_in_memory; /** mutex for thread state */ mutable boost::mutex _mutex; - /** condition to manage thread wakeups */ - boost::condition _condition; + /** condition to manage thread wakeups when we have nothing to do */ + boost::condition _empty_condition; + /** condition to manage thread wakeups when we have too much to do */ + boost::condition _full_condition; /** the data of the last written frame, or 0 if there isn't one */ boost::shared_ptr _last_written[EYES_COUNT]; /** the index of the last written frame */ @@ -128,10 +132,6 @@ private: boost::shared_ptr _picture_asset; boost::shared_ptr _picture_asset_writer; - boost::shared_ptr _mono_picture_asset; - boost::shared_ptr _mono_picture_asset_writer; - boost::shared_ptr _stereo_picture_asset; - boost::shared_ptr _stereo_picture_asset_writer; boost::shared_ptr _sound_asset; boost::shared_ptr _sound_asset_writer; };