tagparser/wav/waveaudiostream.h

56 lines
1.0 KiB
C
Raw Normal View History

2015-04-22 19:22:01 +02:00
#ifndef WAVEAUDIOSTREAM_H
#define WAVEAUDIOSTREAM_H
2015-09-06 19:57:33 +02:00
#include "../abstracttrack.h"
2015-04-22 19:22:01 +02:00
#include <fstream>
namespace Media
{
2016-08-29 15:43:05 +02:00
class TAG_PARSER_EXPORT WaveFormatHeader
2015-06-12 02:35:50 +02:00
{
public:
WaveFormatHeader();
void parse(IoUtilities::BinaryReader &reader);
MediaFormat format() const;
uint32 bitrate() const;
uint16 formatTag;
uint16 channelCount;
uint16 sampleRate;
uint16 bytesPerSecond;
uint16 chunkSize;
uint16 bitsPerSample;
};
/*!
* \brief Calculates the bitrate from the header data.
*/
inline uint32 WaveFormatHeader::bitrate() const
{
return bitsPerSample * sampleRate * channelCount;
}
2016-08-29 15:43:05 +02:00
class TAG_PARSER_EXPORT WaveAudioStream : public AbstractTrack
2015-04-22 19:22:01 +02:00
{
public:
WaveAudioStream(std::iostream &stream, uint64 startOffset);
virtual ~WaveAudioStream();
virtual TrackType type() const;
2015-06-12 02:35:50 +02:00
static void addInfo(const WaveFormatHeader &waveHeader, AbstractTrack &track);
2015-04-22 19:22:01 +02:00
protected:
virtual void internalParseHeader();
private:
uint64 m_dataOffset;
};
}
#endif // WAVEAUDIOSTREAM_H