DTSC2OGG page in lib now, not yet header making
This commit is contained in:
parent
6c4d9d96aa
commit
b85ceb9fc5
2 changed files with 29 additions and 2 deletions
28
lib/ogg.cpp
28
lib/ogg.cpp
|
@ -456,5 +456,31 @@ namespace OGG{
|
||||||
}
|
}
|
||||||
memcpy(data + 27 + getPageSegments(), newData, length);
|
memcpy(data + 27 + getPageSegments(), newData, length);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Page::readDTSCVector(std::vector <JSON::Value> DTSCVec, unsigned int serial, unsigned int sequence){
|
||||||
|
clear();
|
||||||
|
setVersion();
|
||||||
|
if (DTSCVec[0]["OggCont"]){
|
||||||
|
setHeaderType(1);//headertype 1 = Continue Page
|
||||||
|
}else if (DTSCVec[0]["OggEOS"]){
|
||||||
|
setHeaderType(4);//headertype 4 = end of stream
|
||||||
|
}else{
|
||||||
|
setHeaderType(0);//headertype 0 = normal
|
||||||
|
}
|
||||||
|
setGranulePosition(DTSCVec[0]["granule"].asInt());
|
||||||
|
setBitstreamSerialNumber(serial);
|
||||||
|
setPageSequenceNumber(sequence);
|
||||||
|
|
||||||
|
std::vector<unsigned int> curSegTable;
|
||||||
|
std::string pageBuffer;
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < DTSCVec.size(); i++){
|
||||||
|
curSegTable.push_back(DTSCVec[i]["data"].asString().size());
|
||||||
|
pageBuffer += DTSCVec[i]["data"].asString();
|
||||||
|
}
|
||||||
|
setSegmentTable(curSegTable);
|
||||||
|
setPayload((char*)pageBuffer.c_str(), pageBuffer.size());
|
||||||
|
setCRCChecksum(calcChecksum());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include"dtsc.h"
|
#include"dtsc.h"
|
||||||
#include "theora.h"
|
#include "theora.h"
|
||||||
#include "vorbis.h"
|
#include "vorbis.h"
|
||||||
|
#include "json.h"
|
||||||
|
|
||||||
namespace OGG{
|
namespace OGG{
|
||||||
class Page{
|
class Page{
|
||||||
|
@ -31,7 +32,6 @@ namespace OGG{
|
||||||
std::deque<unsigned int> & getSegmentTableDeque();
|
std::deque<unsigned int> & getSegmentTableDeque();
|
||||||
bool setSegmentTable(std::vector<unsigned int> layout);
|
bool setSegmentTable(std::vector<unsigned int> layout);
|
||||||
void setSegmentTable(char* newVal, unsigned int length);
|
void setSegmentTable(char* newVal, unsigned int length);
|
||||||
|
|
||||||
char* getPage();//returns complete page with header
|
char* getPage();//returns complete page with header
|
||||||
unsigned long int getPageSize();
|
unsigned long int getPageSize();
|
||||||
char* getFullPayload();//returns all segments in the page
|
char* getFullPayload();//returns all segments in the page
|
||||||
|
@ -45,6 +45,7 @@ namespace OGG{
|
||||||
long unsigned int calcChecksum();
|
long unsigned int calcChecksum();
|
||||||
bool clear();
|
bool clear();
|
||||||
bool setPayload(char* newData, unsigned int length);
|
bool setPayload(char* newData, unsigned int length);
|
||||||
|
void readDTSCVector(std::vector <JSON::Value> DTSCVec, unsigned int serial, unsigned int sequence);
|
||||||
private:
|
private:
|
||||||
std::deque<unsigned int> segmentTableDeque;
|
std::deque<unsigned int> segmentTableDeque;
|
||||||
char* data;//pointer to the beginning of the Page data
|
char* data;//pointer to the beginning of the Page data
|
||||||
|
|
Loading…
Add table
Reference in a new issue