projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add a missing noncopyable.
[dcpomatic.git]
/
src
/
lib
/
writer.cc
diff --git
a/src/lib/writer.cc
b/src/lib/writer.cc
index 9a0f83a22a5c184d68c3b5c5bc07789fe9fe3bca..c1b66cd4c1b6ab96fa196cba6041764ae495f5db 100644
(file)
--- a/
src/lib/writer.cc
+++ b/
src/lib/writer.cc
@@
-68,7
+68,6
@@
using namespace dcpomatic;
Writer::Writer (shared_ptr<const Film> film, weak_ptr<Job> j)
: _film (film)
, _job (j)
Writer::Writer (shared_ptr<const Film> film, weak_ptr<Job> j)
: _film (film)
, _job (j)
- , _thread (0)
, _finish (false)
, _queued_full_in_memory (0)
/* These will be reset to sensible values when J2KEncoder is created */
, _finish (false)
, _queued_full_in_memory (0)
/* These will be reset to sensible values when J2KEncoder is created */
@@
-107,9
+106,9
@@
Writer::Writer (shared_ptr<const Film> film, weak_ptr<Job> j)
void
Writer::start ()
{
void
Writer::start ()
{
- _thread =
new boost::thread (boost::bind
(&Writer::thread, this));
+ _thread =
boost::thread (boost::bind
(&Writer::thread, this));
#ifdef DCPOMATIC_LINUX
#ifdef DCPOMATIC_LINUX
- pthread_setname_np (_thread
->
native_handle(), "writer");
+ pthread_setname_np (_thread
.
native_handle(), "writer");
#endif
}
#endif
}
@@
-269,8
+268,11
@@
Writer::write (shared_ptr<const AudioBuffers> audio, DCPTime const time)
/* Easy case: we can write all the audio to this reel */
_audio_reel->write (audio);
t = end;
/* Easy case: we can write all the audio to this reel */
_audio_reel->write (audio);
t = end;
+ } else if (_audio_reel->period().to <= t) {
+ /* This reel is entirely before the start of our audio; just skip the reel */
+ ++_audio_reel;
} else {
} else {
- /*
S
plit the audio into two and write the first part */
+ /*
This audio is over a reel boundary; s
plit the audio into two and write the first part */
DCPTime part_lengths[2] = {
_audio_reel->period().to - t,
end - _audio_reel->period().to
DCPTime part_lengths[2] = {
_audio_reel->period().to - t,
end - _audio_reel->period().to
@@
-282,15
+284,12
@@
Writer::write (shared_ptr<const AudioBuffers> audio, DCPTime const time)
};
if (part_frames[0]) {
};
if (part_frames[0]) {
- shared_ptr<AudioBuffers> part (new AudioBuffers (audio->channels(), part_frames[0]));
- part->copy_from (audio.get(), part_frames[0], 0, 0);
+ shared_ptr<AudioBuffers> part (new AudioBuffers(audio, part_frames[0], 0));
_audio_reel->write (part);
}
if (part_frames[1]) {
_audio_reel->write (part);
}
if (part_frames[1]) {
- shared_ptr<AudioBuffers> part (new AudioBuffers (audio->channels(), part_frames[1]));
- part->copy_from (audio.get(), part_frames[1], part_frames[0], 0);
- audio = part;
+ audio.reset (new AudioBuffers(audio, part_frames[1], part_frames[0]));
} else {
audio.reset ();
}
} else {
audio.reset ();
}
@@
-462,7
+461,7
@@
void
Writer::terminate_thread (bool can_throw)
{
boost::mutex::scoped_lock lock (_state_mutex);
Writer::terminate_thread (bool can_throw)
{
boost::mutex::scoped_lock lock (_state_mutex);
- if (
_thread == 0
) {
+ if (
!_thread.joinable()
) {
return;
}
return;
}
@@
-471,22
+470,17
@@
Writer::terminate_thread (bool can_throw)
_full_condition.notify_all ();
lock.unlock ();
_full_condition.notify_all ();
lock.unlock ();
- if (_thread->joinable ()) {
- _thread->join ();
- }
+ _thread.join ();
if (can_throw) {
rethrow ();
}
if (can_throw) {
rethrow ();
}
-
- delete _thread;
- _thread = 0;
}
void
Writer::finish ()
{
}
void
Writer::finish ()
{
- if (!_thread) {
+ if (!_thread
.joinable()
) {
return;
}
return;
}
@@
-558,6
+552,7
@@
Writer::finish ()
cpl->set_metadata (meta);
cpl->set_ratings (vector_to_list(_film->ratings()));
cpl->set_metadata (meta);
cpl->set_ratings (vector_to_list(_film->ratings()));
+ cpl->set_content_version_label_text (_film->content_version());
shared_ptr<const dcp::CertificateChain> signer;
if (_film->is_signed ()) {
shared_ptr<const dcp::CertificateChain> signer;
if (_film->is_signed ()) {
@@
-777,4
+772,7
@@
Writer::set_digest_progress (Job* job, float progress)
}
job->set_progress (min_progress);
}
job->set_progress (min_progress);
+
+ Waker waker;
+ waker.nudge ();
}
}