tagparser/flac/flacstream.h

76 lines
1.6 KiB
C
Raw Normal View History

2016-05-16 20:56:53 +02:00
#ifndef FLACSTREAM_H
#define FLACSTREAM_H
#include "../abstracttrack.h"
#include <iosfwd>
2017-02-05 21:02:40 +01:00
#include <memory>
2016-05-16 20:56:53 +02:00
namespace Media {
class MediaFileInfo;
class VorbisComment;
2016-08-29 15:43:05 +02:00
class TAG_PARSER_EXPORT FlacStream : public AbstractTrack
2016-05-16 20:56:53 +02:00
{
public:
FlacStream(MediaFileInfo &mediaFileInfo, uint64 startOffset);
~FlacStream() override;
2016-05-16 20:56:53 +02:00
TrackType type() const override;
2016-05-16 20:56:53 +02:00
VorbisComment *vorbisComment() const;
VorbisComment *createVorbisComment();
2016-05-21 22:11:08 +02:00
bool removeVorbisComment();
2016-05-16 20:56:53 +02:00
uint32 paddingSize() const;
uint32 streamOffset() const;
uint32 makeHeader(std::ostream &stream, Diagnostics &diag);
static void makePadding(std::ostream &stream, uint32 size, bool isLast, Diagnostics &diag);
2016-05-16 20:56:53 +02:00
protected:
void internalParseHeader(Diagnostics &diag) override;
2016-05-16 20:56:53 +02:00
private:
MediaFileInfo &m_mediaFileInfo;
std::unique_ptr<VorbisComment> m_vorbisComment;
uint32 m_paddingSize;
uint32 m_streamOffset;
};
inline FlacStream::~FlacStream()
{}
inline TrackType FlacStream::type() const
{
return TrackType::FlacStream;
}
/*!
* \brief Returns the Vorbis comment if one is present in the stream.
*/
inline VorbisComment *FlacStream::vorbisComment() const
{
return m_vorbisComment.get();
}
/*!
* \brief Returns the padding size.
*/
inline uint32 FlacStream::paddingSize() const
{
return m_paddingSize;
}
/*!
* \brief Returns the start offset of the actual FLAC frames.
* \remarks This equals the size of the metadata header blocks.
*/
inline uint32 FlacStream::streamOffset() const
{
return m_streamOffset;
}
}
#endif // FLACSTREAM_H