tagparser/wav/waveaudiostream.h

51 lines
1.1 KiB
C
Raw Normal View History

#ifndef TAG_PARSER_WAVEAUDIOSTREAM_H
#define TAG_PARSER_WAVEAUDIOSTREAM_H
2015-04-22 19:22:01 +02:00
2015-09-06 19:57:33 +02:00
#include "../abstracttrack.h"
2015-04-22 19:22:01 +02:00
2018-03-07 01:17:50 +01:00
namespace TagParser {
2015-04-22 19:22:01 +02:00
2018-03-07 01:17:50 +01: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;
}
2018-03-07 01:17:50 +01:00
class TAG_PARSER_EXPORT WaveAudioStream : public AbstractTrack {
2015-04-22 19:22:01 +02:00
public:
WaveAudioStream(std::iostream &stream, uint64 startOffset);
~WaveAudioStream() override;
2015-04-22 19:22:01 +02:00
TrackType type() const override;
2015-04-22 19:22:01 +02:00
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:
void internalParseHeader(Diagnostics &diag) override;
2015-04-22 19:22:01 +02:00
private:
uint64 m_dataOffset;
};
2018-03-07 01:17:50 +01:00
} // namespace TagParser
2015-04-22 19:22:01 +02:00
#endif // TAG_PARSER_WAVEAUDIOSTREAM_H