string directory,
string mxf_name,
boost::signals2::signal<void (float)>* progress,
- int fps, int intrinsic_duration, int start_frame
+ int fps, int intrinsic_duration
)
: MXFAsset (directory, mxf_name, progress, fps, intrinsic_duration)
, _channels (files.size ())
, _sampling_rate (0)
- , _start_frame (start_frame)
{
assert (_channels);
string directory,
string mxf_name,
boost::signals2::signal<void (float)>* progress,
- int fps, int intrinsic_duration, int start_frame, int channels
+ int fps, int intrinsic_duration, int channels
)
: MXFAsset (directory, mxf_name, progress, fps, intrinsic_duration)
, _channels (channels)
, _sampling_rate (0)
- , _start_frame (start_frame)
{
assert (_channels);
SoundAsset::SoundAsset (string directory, string mxf_name)
: MXFAsset (directory, mxf_name)
, _channels (0)
- , _start_frame (0)
{
ASDCP::PCM::MXFReader reader;
if (ASDCP_FAILURE (reader.OpenRead (path().string().c_str()))) {
- throw MXFFileError ("could not open MXF file for reading", path().string());
+ boost::throw_exception (MXFFileError ("could not open MXF file for reading", path().string()));
}
ASDCP::PCM::AudioDescriptor desc;
if (ASDCP_FAILURE (reader.FillAudioDescriptor (desc))) {
- throw DCPReadError ("could not read audio MXF information");
+ boost::throw_exception (DCPReadError ("could not read audio MXF information"));
}
_sampling_rate = desc.AudioSamplingRate.Numerator / desc.AudioSamplingRate.Denominator;
: MXFAsset (directory, mxf_name, 0, fps, 0)
, _channels (channels)
, _sampling_rate (sampling_rate)
- , _start_frame (0)
{
}
ASDCP::PCM::WAVParser pcm_parser_channel[_channels];
if (pcm_parser_channel[0].OpenRead (get_path(LEFT).c_str(), asdcp_edit_rate)) {
- throw FileError ("could not open WAV file for reading", get_path(LEFT));
+ boost::throw_exception (FileError ("could not open WAV file for reading", get_path(LEFT)));
}
ASDCP::PCM::AudioDescriptor audio_desc;
string const path = get_path (channels[i]);
if (ASDCP_FAILURE (pcm_parser_channel[i].OpenRead (path.c_str(), asdcp_edit_rate))) {
- throw FileError ("could not open WAV file for reading", path);
+ boost::throw_exception (FileError ("could not open WAV file for reading", path));
}
pcm_parser_channel[i].FillAudioDescriptor (audio_desc_channel[i]);
ASDCP::PCM::MXFWriter mxf_writer;
if (ASDCP_FAILURE (mxf_writer.OpenWrite (path().string().c_str(), writer_info, audio_desc))) {
- throw FileError ("could not open audio MXF for writing", path().string());
- }
-
- /* Skip through up to our _start_frame; this is pretty inefficient... */
- for (int i = 0; i < _start_frame; ++i) {
- for (int j = 0; j < _channels; ++j) {
- if (ASDCP_FAILURE (pcm_parser_channel[j].ReadFrame (frame_buffer_channel[j]))) {
- throw MiscError ("could not read audio frame");
- }
- }
+ boost::throw_exception (FileError ("could not open audio MXF for writing", path().string()));
}
for (int i = 0; i < _intrinsic_duration; ++i) {
for (int j = 0; j < _channels; ++j) {
memset (frame_buffer_channel[j].Data(), 0, frame_buffer_channel[j].Capacity());
if (ASDCP_FAILURE (pcm_parser_channel[j].ReadFrame (frame_buffer_channel[j]))) {
- throw MiscError ("could not read audio frame");
+ boost::throw_exception (MiscError ("could not read audio frame"));
}
}
}
if (ASDCP_FAILURE (mxf_writer.WriteFrame (frame_buffer, 0, 0))) {
- throw MiscError ("could not write audio MXF frame");
+ boost::throw_exception (MiscError ("could not write audio MXF frame"));
}
if (_progress) {
}
if (ASDCP_FAILURE (mxf_writer.Finalize())) {
- throw MiscError ("could not finalise audio MXF");
+ boost::throw_exception (MiscError ("could not finalise audio MXF"));
}
}
ASDCP::PCM::MXFReader reader_A;
if (ASDCP_FAILURE (reader_A.OpenRead (path().string().c_str()))) {
- throw MXFFileError ("could not open MXF file for reading", path().string());
+ boost::throw_exception (MXFFileError ("could not open MXF file for reading", path().string()));
}
ASDCP::PCM::MXFReader reader_B;
if (ASDCP_FAILURE (reader_B.OpenRead (other->path().string().c_str()))) {
- throw MXFFileError ("could not open MXF file for reading", path().string());
+ boost::throw_exception (MXFFileError ("could not open MXF file for reading", path().string()));
}
ASDCP::PCM::AudioDescriptor desc_A;
if (ASDCP_FAILURE (reader_A.FillAudioDescriptor (desc_A))) {
- throw DCPReadError ("could not read audio MXF information");
+ boost::throw_exception (DCPReadError ("could not read audio MXF information"));
}
ASDCP::PCM::AudioDescriptor desc_B;
if (ASDCP_FAILURE (reader_B.FillAudioDescriptor (desc_B))) {
- throw DCPReadError ("could not read audio MXF information");
+ boost::throw_exception (DCPReadError ("could not read audio MXF information"));
}
if (
for (int i = 0; i < _intrinsic_duration; ++i) {
if (ASDCP_FAILURE (reader_A.ReadFrame (i, buffer_A))) {
- throw DCPReadError ("could not read audio frame");
+ boost::throw_exception (DCPReadError ("could not read audio frame"));
}
if (ASDCP_FAILURE (reader_B.ReadFrame (i, buffer_B))) {
- throw DCPReadError ("could not read audio frame");
+ boost::throw_exception (DCPReadError ("could not read audio frame"));
}
if (buffer_A.Size() != buffer_B.Size()) {
shared_ptr<const SoundFrame>
SoundAsset::get_frame (int n) const
{
- return shared_ptr<const SoundFrame> (new SoundFrame (path().string(), n + _entry_point));
+ /* XXX: should add on entry point here? */
+ return shared_ptr<const SoundFrame> (new SoundFrame (path().string(), n));
}
shared_ptr<SoundAssetWriter>
MXFAsset::fill_writer_info (&_state->writer_info, _asset->uuid ());
- if (ASDCP_FAILURE (_state->mxf_writer.OpenWrite (_asset->path().c_str(), _state->writer_info, _state->audio_desc))) {
- throw FileError ("could not open audio MXF for writing", _asset->path().string());
+ if (ASDCP_FAILURE (_state->mxf_writer.OpenWrite (_asset->path().string().c_str(), _state->writer_info, _state->audio_desc))) {
+ boost::throw_exception (FileError ("could not open audio MXF for writing", _asset->path().string()));
}
}
SoundAssetWriter::write_current_frame ()
{
if (ASDCP_FAILURE (_state->mxf_writer.WriteFrame (_state->frame_buffer, 0, 0))) {
- throw MiscError ("could not write audio MXF frame");
+ boost::throw_exception (MiscError ("could not write audio MXF frame"));
}
++_frames_written;
}
if (ASDCP_FAILURE (_state->mxf_writer.Finalize())) {
- throw MiscError ("could not finalise audio MXF");
+ boost::throw_exception (MiscError ("could not finalise audio MXF"));
}
_finalized = true;