2 Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include <boost/shared_ptr.hpp>
22 #include <boost/thread.hpp>
23 #include <boost/thread/condition.hpp>
30 class MonoPictureAsset;
31 class MonoPictureAssetWriter;
33 class SoundAssetWriter;
45 /** encoded data for FULL */
46 boost::shared_ptr<const EncodedData> encoded;
47 /** size of data for FAKE */
53 bool operator< (QueueItem const & a, QueueItem const & b);
54 bool operator== (QueueItem const & a, QueueItem const & b);
59 Writer (boost::shared_ptr<Film>);
61 bool can_fake_write (int) const;
63 void write (boost::shared_ptr<const EncodedData>, int);
64 void fake_write (int);
65 void write (boost::shared_ptr<const AudioBuffers>);
72 void check_existing_picture_mxf ();
74 boost::shared_ptr<Film> _film;
75 int _first_nonexistant_frame;
77 boost::thread* _thread;
79 std::list<QueueItem> _queue;
80 mutable boost::mutex _mutex;
81 boost::condition _condition;
82 boost::shared_ptr<const EncodedData> _last_written;
83 std::list<QueueItem> _pending;
84 int _last_written_frame;
85 static const unsigned int _maximum_frames_in_memory;
87 boost::shared_ptr<libdcp::MonoPictureAsset> _picture_asset;
88 boost::shared_ptr<libdcp::MonoPictureAssetWriter> _picture_asset_writer;
89 boost::shared_ptr<libdcp::SoundAsset> _sound_asset;
90 boost::shared_ptr<libdcp::SoundAssetWriter> _sound_asset_writer;