21 #ifndef SH_AUDIODATA_H 22 #define SH_AUDIODATA_H 50 template<AUDIOSAMPLETYPE Type,
class ValueType,
class SampleValueType = AudioSampleValue<Type,ValueType> >
64 std::vector<ValueType>
Data ;
67 ValueType readValue (
BinaryIO* io)
const ;
68 void writeValue (
BinaryIO* io, ValueType v)
const ;
73 template<AUDIOSAMPLETYPE Type,
class ValueType,
class SampleValueType>
80 Data.push_back (readValue(io)) ;
85 for (
UWORD32 i = 0 ; i < n ; i++) {
86 Data[i] = readValue(io) ;
94 throw SteghideError (
_(
"an error occured while reading the audio data from the file \"%s\"."), io->
getName().c_str()) ;
100 throw SteghideError (
_(
"premature end of file \"%s\" while reading audio data."), io->
getName().c_str()) ;
106 throw SteghideError (
_(
"an error occured while reading the audio data from standard input.")) ;
112 throw SteghideError (
_(
"premature end of data from standard input while reading audio data.")) ;
119 template<AUDIOSAMPLETYPE Type,
class ValueType,
class SampleValueType>
126 for (
UWORD32 i = 0 ; i < n ; i++) {
127 writeValue (io, Data[i]) ;
134 throw SteghideError (
_(
"an error occured while writing the audio data to the file \"%s\"."), io->
getName().c_str()) ;
140 throw SteghideError (
_(
"an error occured while writing the audio data to standard output.")) ;
147 template<AUDIOSAMPLETYPE Type,
class ValueType,
class SampleValueType>
153 template<AUDIOSAMPLETYPE Type,
class ValueType,
class SampleValueType>
157 return ((
SampleValue*)
new SampleValueType (Data[pos])) ;
160 template<AUDIOSAMPLETYPE Type,
class ValueType,
class SampleValueType>
163 const SampleValueType* sample =
dynamic_cast<const SampleValueType*
> (s) ;
166 Data[pos] = sample->getValue() ;
169 #endif // ndef SH_AUDIODATA_H Definition: SteghideError.h:28
#define _(S)
Definition: common.h:78
bool eof(void) const
Definition: BinaryIO.cc:123
a cover-/stego-file
Definition: CvrStgFile.h:46
an object that can hold embedded data
Definition: CvrStgObject.h:40
UWORD32 SamplePos
Definition: common.h:67
std::vector< ValueType > Data
Definition: AudioData.h:64
SampleValue * getSampleValue(const SamplePos pos) const
Definition: AudioData.h:154
virtual SampleValue * getSampleValue(const SamplePos pos) const =0
the value of a sample in a CvrStgFile
Definition: SampleValue.h:61
#define myassert(expr)
Definition: common.h:89
implementation of the AudioData-Interface
Definition: AudioData.h:51
CvrStgFile * TheCvrStgFile
Definition: AudioData.h:65
unsigned long UWORD32
Definition: common.h:45
virtual ~AudioDataImpl(void)
Definition: AudioData.h:54
interface definition for AudioData objects.
Definition: AudioData.h:37
provides methods for file i/o as needed by the rest of steghide
Definition: BinaryIO.h:33
void read(BinaryIO *io, UWORD32 n=AudioData::NoLimit)
Definition: AudioData.h:74
TYPE getType(void)
Definition: error.cc:102
virtual unsigned long getNumSamples(void) const =0
virtual void write(BinaryIO *io, UWORD32 n=NoLimit)=0
const std::string & getName(void) const
Definition: BinaryIO.h:53
void write(BinaryIO *io, UWORD32 n=AudioData::NoLimit)
Definition: AudioData.h:120
unsigned long getNumSamples(void) const
Definition: AudioData.h:148
virtual void read(BinaryIO *io, UWORD32 n=NoLimit)=0
void replaceSample(const SamplePos pos, const SampleValue *s)
Definition: AudioData.h:161
static const UWORD32 NoLimit
constant that can be used as parameter to read and write to indicate that there is no limit ...
Definition: AudioData.h:40
virtual void replaceSample(const SamplePos pos, const SampleValue *s)=0
AudioDataImpl(CvrStgFile *f)
Definition: AudioData.h:53