From a68b877d96a9e9f366f27752e071bc0e895e9dc7 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 1 Jun 2016 23:53:06 +0100 Subject: Add Reader classes to permit much more efficient DCP reading. --- src/sound_frame.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/sound_frame.cc') diff --git a/src/sound_frame.cc b/src/sound_frame.cc index 2d31291b..540c3dfd 100644 --- a/src/sound_frame.cc +++ b/src/sound_frame.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington + Copyright (C) 2012-2016 Carl Hetherington This file is part of libdcp. @@ -30,18 +30,12 @@ using namespace std; using namespace dcp; -SoundFrame::SoundFrame (boost::filesystem::path path, int n, ASDCP::AESDecContext* c) +SoundFrame::SoundFrame (ASDCP::PCM::MXFReader* reader, int n, ASDCP::AESDecContext* c) { - ASDCP::PCM::MXFReader reader; - Kumu::Result_t r = reader.OpenRead (path.string().c_str()); - if (ASDCP_FAILURE (r)) { - boost::throw_exception (FileError ("could not open MXF file for reading", path, r)); - } - /* XXX: unfortunate guesswork on this buffer size */ _buffer = new ASDCP::PCM::FrameBuffer (1 * Kumu::Megabyte); - if (ASDCP_FAILURE (reader.ReadFrame (n, *_buffer, c))) { + if (ASDCP_FAILURE (reader->ReadFrame (n, *_buffer, c))) { boost::throw_exception (DCPReadError ("could not read audio frame")); } } -- cgit v1.2.3