projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Runs.
[dcpomatic.git]
/
src
/
lib
/
writer.cc
diff --git
a/src/lib/writer.cc
b/src/lib/writer.cc
index d480d502afdd6ef7899f6c51da2b739427998ba8..5f5dae98f31c24a3181718fdf880d88ad843208e 100644
(file)
--- a/
src/lib/writer.cc
+++ b/
src/lib/writer.cc
@@
-28,6
+28,7
@@
#include "format.h"
#include "log.h"
#include "dcp_video_frame.h"
#include "format.h"
#include "log.h"
#include "dcp_video_frame.h"
+#include "playlist.h"
#include "i18n.h"
#include "i18n.h"
@@
-41,8
+42,9
@@
using boost::shared_ptr;
int const Writer::_maximum_frames_in_memory = 8;
int const Writer::_maximum_frames_in_memory = 8;
-Writer::Writer (shared_ptr<Film> f)
+Writer::Writer (shared_ptr<Film> f
, shared_ptr<Playlist> p
)
: _film (f)
: _film (f)
+ , _playlist (p)
, _first_nonexistant_frame (0)
, _thread (0)
, _finish (false)
, _first_nonexistant_frame (0)
, _thread (0)
, _finish (false)
@@
-67,21
+69,23
@@
Writer::Writer (shared_ptr<Film> f)
new libdcp::MonoPictureAsset (
_film->video_mxf_dir (),
_film->video_mxf_filename (),
new libdcp::MonoPictureAsset (
_film->video_mxf_dir (),
_film->video_mxf_filename (),
-
DCPFrameRate (_film->frames_per_second()).frames_per_second
,
- _film->format()->dcp_size()
+
_film->dcp_frame_rate ()
,
+ _film->format()->dcp_size
()
)
);
_picture_asset_writer = _picture_asset->start_write (_first_nonexistant_frame > 0);
)
);
_picture_asset_writer = _picture_asset->start_write (_first_nonexistant_frame > 0);
- if (dcp_audio_channels (_film->audio_channels()) > 0) {
+ AudioMapping m (_playlist->audio_channels ());
+
+ if (m.dcp_channels() > 0) {
_sound_asset.reset (
new libdcp::SoundAsset (
_film->dir (_film->dcp_name()),
N_("audio.mxf"),
_sound_asset.reset (
new libdcp::SoundAsset (
_film->dir (_film->dcp_name()),
N_("audio.mxf"),
-
DCPFrameRate (_film->frames_per_second()).frames_per_second
,
-
dcp_audio_channels (_film->audio_channels()
),
- dcp_audio_sample_rate (_
film->audio_stream()->sampl
e_rate())
+
_film->dcp_frame_rate ()
,
+
m.dcp_channels (
),
+ dcp_audio_sample_rate (_
playlist->audio_fram
e_rate())
)
);
)
);
@@
-259,8
+263,6
@@
Writer::finish ()
int const frames = _last_written_frame + 1;
int const duration = frames - _film->trim_start() - _film->trim_end();
int const frames = _last_written_frame + 1;
int const duration = frames - _film->trim_start() - _film->trim_end();
- _film->set_dcp_intrinsic_duration (frames);
-
_picture_asset->set_entry_point (_film->trim_start ());
_picture_asset->set_duration (duration);
_picture_asset->set_entry_point (_film->trim_start ());
_picture_asset->set_duration (duration);
@@
-273,8
+275,14
@@
Writer::finish ()
boost::filesystem::path to;
to /= _film->dir (_film->dcp_name());
to /= N_("video.mxf");
boost::filesystem::path to;
to /= _film->dir (_film->dcp_name());
to /= N_("video.mxf");
-
- boost::filesystem::create_hard_link (from, to);
+
+ boost::system::error_code ec;
+ boost::filesystem::create_hard_link (from, to, ec);
+ if (ec) {
+ /* hard link failed; copy instead */
+ boost::filesystem::copy_file (from, to);
+ _film->log()->log ("Hard-link failed; fell back to copying");
+ }
/* And update the asset */
/* And update the asset */
@@
-287,10
+295,15
@@
Writer::finish ()
}
libdcp::DCP dcp (_film->dir (_film->dcp_name()));
}
libdcp::DCP dcp (_film->dir (_film->dcp_name()));
- DCPFrameRate dfr (_film->frames_per_second ());
shared_ptr<libdcp::CPL> cpl (
shared_ptr<libdcp::CPL> cpl (
- new libdcp::CPL (_film->dir (_film->dcp_name()), _film->dcp_name(), _film->dcp_content_type()->libdcp_kind (), frames, dfr.frames_per_second)
+ new libdcp::CPL (
+ _film->dir (_film->dcp_name()),
+ _film->dcp_name(),
+ _film->dcp_content_type()->libdcp_kind (),
+ frames,
+ _film->dcp_frame_rate ()
+ )
);
dcp.add_cpl (cpl);
);
dcp.add_cpl (cpl);