/*
- Copyright (C) 2012-2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
files in the program, then also delete it here.
*/
+
+/** @file src/sound_frame.cc
+ * @brief SoundFrame class
+ */
+
+
#include "sound_frame.h"
#include <asdcp/AS_DCP.h>
#include <iostream>
+
using std::cout;
using namespace dcp;
-SoundFrame::SoundFrame (ASDCP::PCM::MXFReader* reader, int n, boost::shared_ptr<const DecryptionContext> c)
- : Frame<ASDCP::PCM::MXFReader, ASDCP::PCM::FrameBuffer> (reader, n, c)
+
+SoundFrame::SoundFrame (ASDCP::PCM::MXFReader* reader, int n, std::shared_ptr<const DecryptionContext> c, bool check_hmac)
+ : Frame<ASDCP::PCM::MXFReader, ASDCP::PCM::FrameBuffer> (reader, n, c, check_hmac)
{
ASDCP::PCM::AudioDescriptor desc;
reader->FillAudioDescriptor (desc);
_channels = desc.ChannelCount;
}
+
int32_t
SoundFrame::get (int channel, int frame) const
{
uint8_t const * d = data() + (frame * _channels * 3) + (channel * 3);
- return d[0] | (d[1] << 8) | (d[2] << 16);
+ /* This is slightly dubious I think */
+ return (d[0] << 8 | (d[1] << 16) | (d[2] << 24)) >> 8;
}
+
+int
+SoundFrame::channels () const
+{
+ return _channels;
+}
+
+
int
SoundFrame::samples () const
{