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){
|
bool Page::read(std::string & newData){
|
||||||
dataSum = 0;
|
|
||||||
//datasize = 0;
|
//datasize = 0;
|
||||||
if (newData.size()<27){
|
if (newData.size()<27){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
dataSum = 0;
|
||||||
if (!checkDataSize(27)){
|
if (!checkDataSize(27)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -175,19 +175,47 @@ namespace OGG{
|
||||||
return data + 27 + getPageSegments();
|
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::string Page::toPrettyString(){
|
||||||
std::stringstream r;
|
std::stringstream r;
|
||||||
r << "Size(" << getPageSize() << ")(" << dataSum << ")" << std::endl;
|
r << "Size(" << getPageSize() << ")(" << dataSum << ")" << std::endl;
|
||||||
r << "Magic_Number: " << std::string(data, 4) << std::endl;
|
r << "Magic_Number: " << std::string(data, 4) << std::endl;
|
||||||
r << "Version: " << (int)getVersion() << std::endl;
|
r << "Version: " << (int)getVersion() << std::endl;
|
||||||
r << "Header_type: " << std::hex << (int)getHeaderType() << std::dec;
|
r << "Header_type: " << std::hex << (int)getHeaderType() << std::dec;
|
||||||
if (getHeaderType() & 0x01){
|
if (typeContinue()){
|
||||||
r << " continued";
|
r << " continued";
|
||||||
}
|
}
|
||||||
if (getHeaderType() & 0x02){
|
if (typeBOS()){
|
||||||
r << " bos";
|
r << " bos";
|
||||||
}
|
}
|
||||||
if (getHeaderType() & 0x04){
|
if (typeEOS()){
|
||||||
r << " eos";
|
r << " eos";
|
||||||
}
|
}
|
||||||
r << std::endl;
|
r << std::endl;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include<string>
|
#include<string>
|
||||||
#include<vector>
|
#include<vector>
|
||||||
#include<deque>
|
#include<deque>
|
||||||
#include<mist/
|
#include"dtsc.h"
|
||||||
|
|
||||||
namespace OGG{
|
namespace OGG{
|
||||||
class Page{
|
class Page{
|
||||||
|
@ -31,7 +31,10 @@ namespace OGG{
|
||||||
unsigned long int getPageSize();
|
unsigned long int getPageSize();
|
||||||
char* getFullPayload();
|
char* getFullPayload();
|
||||||
char* getSegment(long unsigned int);
|
char* getSegment(long unsigned int);
|
||||||
|
bool typeBOS();
|
||||||
|
bool typeEOS();
|
||||||
|
bool typeContinue();
|
||||||
|
bool typeNone();
|
||||||
std::string toPrettyString();
|
std::string toPrettyString();
|
||||||
private:
|
private:
|
||||||
long unsigned int calcChecksum();
|
long unsigned int calcChecksum();
|
||||||
|
|
Loading…
Add table
Reference in a new issue