ogg edits
This commit is contained in:
parent
9073fe7cfb
commit
29a24a5453
2 changed files with 37 additions and 6 deletions
36
lib/ogg.cpp
36
lib/ogg.cpp
|
@ -14,11 +14,11 @@ namespace OGG{
|
|||
}
|
||||
|
||||
bool Page::read(std::string & newData){
|
||||
dataSum = 0;
|
||||
//datasize = 0;
|
||||
if (newData.size()<27){
|
||||
return false;
|
||||
}
|
||||
dataSum = 0;
|
||||
if (!checkDataSize(27)){
|
||||
return false;
|
||||
}
|
||||
|
@ -175,19 +175,47 @@ namespace OGG{
|
|||
return data + 27 + getPageSegments();
|
||||
}
|
||||
|
||||
bool Page::typeBOS(){
|
||||
if (getHeaderType() & 0x02){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Page::typeEOS(){
|
||||
if (getHeaderType() & 0x04){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Page::typeContinue(){
|
||||
if (getHeaderType() & 0x01){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Page::typeNone(){
|
||||
if (getHeaderType() & 0x07 == 0x00){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string Page::toPrettyString(){
|
||||
std::stringstream r;
|
||||
r << "Size(" << getPageSize() << ")(" << dataSum << ")" << std::endl;
|
||||
r << "Magic_Number: " << std::string(data, 4) << std::endl;
|
||||
r << "Version: " << (int)getVersion() << std::endl;
|
||||
r << "Header_type: " << std::hex << (int)getHeaderType() << std::dec;
|
||||
if (getHeaderType() & 0x01){
|
||||
if (typeContinue()){
|
||||
r << " continued";
|
||||
}
|
||||
if (getHeaderType() & 0x02){
|
||||
if (typeBOS()){
|
||||
r << " bos";
|
||||
}
|
||||
if (getHeaderType() & 0x04){
|
||||
if (typeEOS()){
|
||||
r << " eos";
|
||||
}
|
||||
r << std::endl;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include<string>
|
||||
#include<vector>
|
||||
#include<deque>
|
||||
#include<mist/
|
||||
#include"dtsc.h"
|
||||
|
||||
namespace OGG{
|
||||
class Page{
|
||||
|
@ -31,7 +31,10 @@ namespace OGG{
|
|||
unsigned long int getPageSize();
|
||||
char* getFullPayload();
|
||||
char* getSegment(long unsigned int);
|
||||
|
||||
bool typeBOS();
|
||||
bool typeEOS();
|
||||
bool typeContinue();
|
||||
bool typeNone();
|
||||
std::string toPrettyString();
|
||||
private:
|
||||
long unsigned int calcChecksum();
|
||||
|
|
Loading…
Add table
Reference in a new issue