tagparser/flac/flacstream.h

76 lines
1.6 KiB
C
Raw Normal View History

#ifndef TAG_PARSER_FLACSTREAM_H
#define TAG_PARSER_FLACSTREAM_H
2016-05-16 20:56:53 +02:00
#include "../abstracttrack.h"
#include <iosfwd>
2017-02-05 21:02:40 +01:00
#include <memory>
2016-05-16 20:56:53 +02:00
namespace TagParser {
2016-05-16 20:56:53 +02:00
class MediaFileInfo;
class VorbisComment;
2018-03-07 01:17:50 +01: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;
2018-07-10 17:07:34 +02:00
std::streamoff 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()
2018-03-07 01:17:50 +01:00
{
}
2016-05-16 20:56:53 +02:00
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;
}
2018-03-07 01:17:50 +01:00
} // namespace TagParser
2016-05-16 20:56:53 +02:00
#endif // TAG_PARSER_FLACSTREAM_H