Improvements to FLAC library and analyser
This commit is contained in:
parent
a7183aedc5
commit
dc0ec77f26
4 changed files with 442 additions and 180 deletions
64
lib/flac.h
64
lib/flac.h
|
|
@ -1,5 +1,4 @@
|
|||
#pragma once
|
||||
#include <mist/defines.h>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
|
@ -11,9 +10,6 @@ namespace FLAC{
|
|||
size_t utfBytes(char p); // UTF encoding byte size
|
||||
uint32_t utfVal(char *p); // UTF encoding value
|
||||
|
||||
size_t rate();
|
||||
uint8_t channels();
|
||||
|
||||
class Frame{
|
||||
public:
|
||||
Frame(char *pkt);
|
||||
|
|
@ -29,4 +25,64 @@ namespace FLAC{
|
|||
char *data;
|
||||
};
|
||||
|
||||
class MetaBlock{
|
||||
public:
|
||||
MetaBlock();
|
||||
MetaBlock(const char *_ptr, size_t _len);
|
||||
std::string getType();
|
||||
size_t getSize();
|
||||
bool getLast();
|
||||
std::string toPrettyString();
|
||||
virtual void toPrettyString(std::ostream &out);
|
||||
|
||||
protected:
|
||||
const char *ptr;
|
||||
size_t len;
|
||||
};
|
||||
|
||||
class StreamInfo : public MetaBlock{
|
||||
public:
|
||||
StreamInfo() : MetaBlock(){};
|
||||
StreamInfo(const char *_ptr, size_t _len) : MetaBlock(_ptr, _len){};
|
||||
uint16_t getMinBlockSize();
|
||||
uint16_t getMaxBlockSize();
|
||||
uint32_t getMinFrameSize();
|
||||
uint32_t getMaxFrameSize();
|
||||
uint32_t getSampleRate();
|
||||
uint8_t getChannels();
|
||||
uint8_t getBits();
|
||||
uint64_t getSamples();
|
||||
std::string getMD5();
|
||||
void toPrettyString(std::ostream &out);
|
||||
};
|
||||
|
||||
class Picture : public MetaBlock{
|
||||
public:
|
||||
Picture() : MetaBlock(){};
|
||||
Picture(const char *_ptr, size_t _len) : MetaBlock(_ptr, _len){};
|
||||
std::string getPicType();
|
||||
std::string getMime();
|
||||
uint32_t getMimeLen();
|
||||
std::string getDesc();
|
||||
uint32_t getDescLen();
|
||||
uint32_t getWidth();
|
||||
uint32_t getHeight();
|
||||
uint32_t getDepth();
|
||||
uint32_t getColors();
|
||||
uint32_t getDataLen();
|
||||
const char *getData();
|
||||
void toPrettyString(std::ostream &out);
|
||||
};
|
||||
|
||||
class VorbisComment : public MetaBlock{
|
||||
public:
|
||||
VorbisComment() : MetaBlock(){};
|
||||
VorbisComment(const char *_ptr, size_t _len) : MetaBlock(_ptr, _len){};
|
||||
uint32_t getVendorSize();
|
||||
std::string getVendor();
|
||||
std::string getComment(uint32_t _num);
|
||||
uint32_t getCommentCount();
|
||||
void toPrettyString(std::ostream &out);
|
||||
};
|
||||
|
||||
}// namespace FLAC
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue