/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
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
*/
-#include "AS_DCP.h"
-#include "KM_fileio.h"
+/** @file src/sound_frame.cc
+ * @brief SoundFrame class.
+ */
+
#include "sound_frame.h"
#include "exceptions.h"
+#include "AS_DCP.h"
+#include "KM_fileio.h"
using namespace std;
-using namespace libdcp;
+using namespace dcp;
-SoundFrame::SoundFrame (string mxf_path, int n)
+SoundFrame::SoundFrame (boost::filesystem::path mxf_path, int n, ASDCP::AESDecContext* c)
{
ASDCP::PCM::MXFReader reader;
- if (ASDCP_FAILURE (reader.OpenRead (mxf_path.c_str()))) {
- boost::throw_exception (FileError ("could not open MXF file for reading", mxf_path));
+ Kumu::Result_t r = reader.OpenRead (mxf_path.file().c_str());
+ if (ASDCP_FAILURE (r)) {
+ boost::throw_exception (FileError ("could not open MXF file for reading", mxf_path, r));
}
/* XXX: unfortunate guesswork on this buffer size */
_buffer = new ASDCP::PCM::FrameBuffer (1 * Kumu::Megabyte);
- if (ASDCP_FAILURE (reader.ReadFrame (n, *_buffer))) {
+ if (ASDCP_FAILURE (reader.ReadFrame (n, *_buffer, c))) {
boost::throw_exception (DCPReadError ("could not read audio frame"));
}
}