Theora headers 1 and 2 working in analyser
This commit is contained in:
parent
4ea8fe0327
commit
a2f088ad80
4 changed files with 324 additions and 107 deletions
48
lib/ogg.cpp
48
lib/ogg.cpp
|
@ -252,12 +252,16 @@ namespace OGG{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Page::toPrettyString(){
|
void Page::setInternalCodec(std::string myCodec){
|
||||||
|
codec = myCodec;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Page::toPrettyString(size_t indent){
|
||||||
std::stringstream r;
|
std::stringstream r;
|
||||||
r << "Size(" << getPageSize() << ")(" << dataSum << ")" << std::endl;
|
r << std::string(indent,' ') << "OGG Page (" << getPageSize() << ")" << std::endl;
|
||||||
r << "Magic_Number: " << std::string(data, 4) << std::endl;
|
r << std::string(indent + 2,' ') << "Magic Number: " << std::string(data, 4) << std::endl;
|
||||||
r << "Version: " << (int)getVersion() << std::endl;
|
r << std::string(indent + 2,' ') << "Version: " << (int)getVersion() << std::endl;
|
||||||
r << "Header_type: " << std::hex << (int)getHeaderType() << std::dec;
|
r << std::string(indent + 2,' ') << "Headertype: " << std::hex << (int)getHeaderType() << std::dec;
|
||||||
if (typeContinue()){
|
if (typeContinue()){
|
||||||
r << " continued";
|
r << " continued";
|
||||||
}
|
}
|
||||||
|
@ -268,19 +272,33 @@ namespace OGG{
|
||||||
r << " eos";
|
r << " eos";
|
||||||
}
|
}
|
||||||
r << std::endl;
|
r << std::endl;
|
||||||
r << "Granule_position: " <<std::hex<< getGranulePosition() <<std::dec<< std::endl;
|
r << std::string(indent + 2,' ') << "Granule Position: " <<std::hex<< getGranulePosition() <<std::dec<< std::endl;
|
||||||
r << "Bitstream_SN: " << getBitstreamSerialNumber() << std::endl;
|
r << std::string(indent + 2,' ') << "Bitstream Number: " << getBitstreamSerialNumber() << std::endl;
|
||||||
r << "Page_sequence_number: " << getPageSequenceNumber() << std::endl;
|
r << std::string(indent + 2,' ') << "Sequence Number: " << getPageSequenceNumber() << std::endl;
|
||||||
r << "CRC_checksum: " << std::hex << getCRCChecksum()<< std::dec << std::endl;
|
r << std::string(indent + 2,' ') << "Checksum: " << std::hex << getCRCChecksum()<< std::dec << std::endl;
|
||||||
//r << " Calced Checksum: " << std::hex << calcChecksum() << std::dec << std::endl;
|
//r << " Calced Checksum: " << std::hex << calcChecksum() << std::dec << std::endl;
|
||||||
//r << "CRC_checksum write: " << std::hex << getCRCChecksum()<< std::dec << std::endl;
|
//r << "CRC_checksum write: " << std::hex << getCRCChecksum()<< std::dec << std::endl;
|
||||||
r << "Page_segments: " << (int)getPageSegments() << std::endl;
|
r << std::string(indent + 2,' ') << "Segments: " << (int)getPageSegments() << std::endl;
|
||||||
r << "SegmentTable: ";
|
|
||||||
std::deque<unsigned int> temp = getSegmentTableDeque();
|
std::deque<unsigned int> temp = getSegmentTableDeque();
|
||||||
for (std::deque<unsigned int>::iterator i = temp.begin(); i != temp.end(); i++){
|
for (std::deque<unsigned int>::iterator i = temp.begin(); i != temp.end(); i++){
|
||||||
r << (*i) << " ";
|
r << std::string(indent + 4,' ') << (*i) << std::endl;
|
||||||
|
}
|
||||||
|
r << std::string(indent + 2,' ') << "Payloadsize: " << dataSum << std::endl;
|
||||||
|
if (codec == "theora"){
|
||||||
|
int offset = 0;
|
||||||
|
for (int i = 0; i < getSegmentTableDeque().size(); i++){
|
||||||
|
theora::header tmpHeader;
|
||||||
|
int len = getSegmentTableDeque()[i];
|
||||||
|
if (tmpHeader.read(getFullPayload()+offset,len)){
|
||||||
|
r << tmpHeader.toPrettyString(indent + 4);
|
||||||
|
}
|
||||||
|
theora::frame tmpFrame;
|
||||||
|
if (tmpFrame.read(getFullPayload()+offset,len)){
|
||||||
|
r << tmpFrame.toPrettyString(indent + 4);
|
||||||
|
}
|
||||||
|
offset += len;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
r << std::endl;
|
|
||||||
return r.str();
|
return r.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,4 +402,8 @@ namespace OGG{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Page::getPayloadSize(){
|
||||||
|
return dataSum;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
#pragma once
|
||||||
#include<string>
|
#include<string>
|
||||||
#include<vector>
|
#include<vector>
|
||||||
#include<deque>
|
#include<deque>
|
||||||
#include"dtsc.h"
|
#include"dtsc.h"
|
||||||
|
#include "theora.h"
|
||||||
|
|
||||||
namespace OGG{
|
namespace OGG{
|
||||||
class Page{
|
class Page{
|
||||||
|
@ -30,17 +32,19 @@ namespace OGG{
|
||||||
void setSegmentTable(char* newVal, unsigned int length);
|
void setSegmentTable(char* newVal, unsigned int length);
|
||||||
unsigned long int getPageSize();
|
unsigned long int getPageSize();
|
||||||
char* getFullPayload();
|
char* getFullPayload();
|
||||||
char* getSegment(long unsigned int);
|
int getPayloadSize();
|
||||||
bool typeBOS();
|
bool typeBOS();
|
||||||
bool typeEOS();
|
bool typeEOS();
|
||||||
bool typeContinue();
|
bool typeContinue();
|
||||||
bool typeNone();
|
bool typeNone();
|
||||||
std::string toPrettyString();
|
std::string toPrettyString(size_t indent = 0);
|
||||||
|
void setInternalCodec(std::string myCodec);
|
||||||
private:
|
private:
|
||||||
long unsigned int calcChecksum();
|
long unsigned int calcChecksum();
|
||||||
char* data;
|
char* data;
|
||||||
unsigned int datasize;
|
unsigned int datasize;
|
||||||
unsigned int dataSum;
|
unsigned int dataSum;
|
||||||
bool checkDataSize(unsigned int size);
|
bool checkDataSize(unsigned int size);
|
||||||
|
std::string codec;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
322
lib/theora.cpp
322
lib/theora.cpp
|
@ -2,6 +2,7 @@
|
||||||
#include<stdlib.h>
|
#include<stdlib.h>
|
||||||
#include<string.h>
|
#include<string.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
namespace theora{
|
namespace theora{
|
||||||
bool header::checkDataSize(unsigned int size){
|
bool header::checkDataSize(unsigned int size){
|
||||||
|
@ -19,73 +20,261 @@ namespace theora{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the 32 bits integer at the given index.
|
|
||||||
/// Attempts to resize the data pointer if the index is out of range.
|
|
||||||
/// Returns zero if resizing failed.
|
|
||||||
uint32_t header::getInt32(size_t index){
|
uint32_t header::getInt32(size_t index){
|
||||||
/*if (index + 3 >= datasize){
|
if (datasize >= (index + 3)){
|
||||||
if ( !reserve(index, 0, 4)){
|
return (data[index] << 24) + (data[index + 1] << 16) + (data[index + 2] << 8) + data[index + 3];
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
setInt32(0, index);
|
return 0;
|
||||||
}*/
|
|
||||||
uint32_t result;
|
|
||||||
memcpy((char*) &result, data + index, 4);
|
|
||||||
return ntohl(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t header::getInt24(size_t index){
|
uint32_t header::getInt24(size_t index){
|
||||||
/*if (index + 3 >= datasize){
|
if (datasize >= (index + 2)){
|
||||||
if ( !reserve(index, 0, 4)){
|
return 0 + (data[index] << 16) + (data[index + 1] << 8) + data[index + 2];
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
setInt32(0, index);
|
return 0;
|
||||||
}*/
|
|
||||||
uint32_t result = 0;
|
|
||||||
//memcpy(((char*) &result)+1, data + index, 3);
|
|
||||||
result += data[index] << 16;
|
|
||||||
result += data[index+1] << 8;
|
|
||||||
result += data[index+2];
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t header::getInt16(size_t index){
|
uint16_t header::getInt16(size_t index){
|
||||||
/*if (index + 3 >= datasize){
|
if (datasize >= (index + 1)){
|
||||||
if ( !reserve(index, 0, 4)){
|
return 0 + (data[index] << 8) + data[index + 1];
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
setInt32(0, index);
|
|
||||||
}*/
|
|
||||||
uint16_t result;
|
|
||||||
memcpy((char*) &result, data + index, 2);
|
|
||||||
return ntohs(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
uint32_t header::commentLen(size_t index){
|
||||||
|
if (datasize >= index + 3){
|
||||||
|
return data[index] + (data[index + 1] << 8) + (data[index + 2] << 16) + (data[index + 3] << 24);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
header::header(){
|
header::header(){
|
||||||
data = NULL;
|
data = NULL;
|
||||||
datasize = 0;
|
datasize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool header::validateIdentificationHeader(){
|
||||||
|
if (datasize != 42){return false;}
|
||||||
|
if (getHeaderType() != 0){return false;}
|
||||||
|
if (getVMAJ() != 3){return false;}
|
||||||
|
if (getVMIN() != 2){return false;}
|
||||||
|
if (getFMBW() == 0){return false;}
|
||||||
|
if (getFMBH() == 0){return false;}
|
||||||
|
if (getPICW() > getFMBW() * 16){return false;}
|
||||||
|
if (getPICH() > getFMBH() * 16){return false;}
|
||||||
|
if (getPICX() > (getFMBW() * 16) - getPICW()){return false;}
|
||||||
|
if (getPICY() > (getFMBH() * 16) - getPICH()){return false;}
|
||||||
|
if (getFRN() == 0){return false;}
|
||||||
|
if (getFRD() == 0){return false;}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool header::read(char* newData, unsigned int length){
|
bool header::read(char* newData, unsigned int length){
|
||||||
if (length < 7){
|
if (length < 7){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (! (newData[0] & 0x80)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if(memcmp(newData+1, "theora", 6)!=0){
|
if(memcmp(newData+1, "theora", 6)!=0){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch(newData[0]){
|
if (checkDataSize(length)){
|
||||||
case 0x80:
|
memcpy(data, newData, length);
|
||||||
//if (length != 42) return false;
|
}else{
|
||||||
break;
|
|
||||||
case 0x81:
|
|
||||||
break;
|
|
||||||
case 0x82:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
switch(getHeaderType()){
|
||||||
|
case 0:
|
||||||
|
return validateIdentificationHeader();
|
||||||
break;
|
break;
|
||||||
};
|
case 1:
|
||||||
|
///\todo Read Comment header
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
///\todo Read Setup Header
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int header::getHeaderType(){
|
||||||
|
return (data[0] & 0x7F);
|
||||||
|
}
|
||||||
|
|
||||||
|
char header::getVMAJ(){
|
||||||
|
if (getHeaderType() == 0){return data[7];}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char header::getVMIN(){
|
||||||
|
if (getHeaderType() == 0){return data[8];}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char header::getVREV(){
|
||||||
|
if (getHeaderType() == 0){return data[9];}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
short header::getFMBW(){
|
||||||
|
if (getHeaderType() == 0){return getInt16(10);}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
short header::getFMBH(){
|
||||||
|
if (getHeaderType() == 0){return getInt16(12);}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char header::getPICX(){
|
||||||
|
if (getHeaderType() == 0){return data[20];}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char header::getPICY(){
|
||||||
|
if (getHeaderType() == 0){return data[21];}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char header::getKFGShift(){
|
||||||
|
if (getHeaderType() == 0){return (getInt16(40) >> 5) & 0x1F;}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
long unsigned int header::getFRN(){
|
||||||
|
if (getHeaderType() == 0){return getInt32(22);}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
long unsigned int header::getPICH(){
|
||||||
|
if (getHeaderType() == 0){return getInt24(17);}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
long unsigned int header::getPICW(){
|
||||||
|
if (getHeaderType() == 0){return getInt24(14);}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
long unsigned int header::getFRD(){
|
||||||
|
if (getHeaderType() == 0){return getInt32(26);}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
long unsigned int header::getPARN(){
|
||||||
|
if (getHeaderType() == 0){return getInt24(30);}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
long unsigned int header::getPARD(){
|
||||||
|
if (getHeaderType() == 0){return getInt24(33);}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char header::getCS(){
|
||||||
|
if (getHeaderType() == 0){return data[36];}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
long unsigned int header::getNOMBR(){
|
||||||
|
if (getHeaderType() == 0){return getInt24(37);}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char header::getQUAL(){
|
||||||
|
if (getHeaderType() == 0){return (data[40] >> 3) & 0x1F;}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char header::getPF(){
|
||||||
|
if (getHeaderType() == 0){return (data[41] >> 3) & 0x03;}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string header::getVendor(){
|
||||||
|
if (getHeaderType() != 1){return "";}
|
||||||
|
return std::string(data + 11, commentLen(7));
|
||||||
|
}
|
||||||
|
|
||||||
|
long unsigned int header::getNComments(){
|
||||||
|
if (getHeaderType() != 1){return 0;}
|
||||||
|
int offset = 11 + commentLen(7);
|
||||||
|
return commentLen(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string header::getUserComment(size_t index){
|
||||||
|
if (index >= getNComments()){return "";}
|
||||||
|
int len;
|
||||||
|
int offset = 11 + commentLen(7) + 4;
|
||||||
|
for (int i = 0; i < index; i++){
|
||||||
|
offset += 4 + commentLen(offset);
|
||||||
|
}
|
||||||
|
return std::string(data + offset + 4,commentLen(offset));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string header::toPrettyString(size_t indent){
|
||||||
|
std::stringstream result;
|
||||||
|
result << std::string(indent,' ') << "Theora header" << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "HeaderType: " << getHeaderType() << std::endl;
|
||||||
|
switch (getHeaderType()){
|
||||||
|
case 0:
|
||||||
|
result << std::string(indent+2,' ') << "VMAJ: " << (int)getVMAJ() << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "VMIN: " << (int)getVMIN() << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "VREV: " << (int)getVREV() << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "FMBW: " << getFMBW() << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "FMBH: " << getFMBH() << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "PICH: " << getPICH() << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "PICW: " << getPICW() << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "PICX: " << (int)getPICX() << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "PICY: " << (int)getPICY() << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "FRN: " << getFRN() << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "FRD: " << getFRD() << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "PARN: " << getPARN() << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "PARD: " << getPARD() << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "CS: " << (int)getCS() << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "NOMBR: " << getNOMBR() << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "QUAL: " << (int)getQUAL() << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "KFGShift: " << (int)getKFGShift() << std::endl;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
result << std::string(indent+2,' ') << "Vendor: " << getVendor() << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "User Comments (" << getNComments() << "):" << std::endl;
|
||||||
|
for (int i = 0; i < getNComments(); i++){
|
||||||
|
result << std::string(indent+4,' ') << "[" << i << "] " << getUserComment(i) << std::endl;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return result.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
frame::frame(){
|
||||||
|
data = NULL;
|
||||||
|
datasize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool frame::checkDataSize(unsigned int size){
|
||||||
|
if (size > datasize){
|
||||||
|
void* tmp = realloc(data,size);
|
||||||
|
if (tmp){
|
||||||
|
data = (char*)tmp;
|
||||||
|
datasize = size;
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool frame::read(char* newData, unsigned int length){
|
||||||
|
if (length < 7){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((newData[0] & 0x80)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (checkDataSize(length)){
|
if (checkDataSize(length)){
|
||||||
memcpy(data, newData, length);
|
memcpy(data, newData, length);
|
||||||
}else{
|
}else{
|
||||||
|
@ -94,56 +283,23 @@ namespace theora{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int header::getHeaderType(){
|
char frame::getFTYPE(){
|
||||||
switch(data[0]){
|
return (data[0] >> 6) & 0x01;
|
||||||
case 0x80:
|
|
||||||
return 0;
|
|
||||||
break;
|
|
||||||
case 0x81:
|
|
||||||
return 1;
|
|
||||||
break;
|
|
||||||
case 0x82:
|
|
||||||
return 2;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -1;
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char header::getKFGShift(){
|
char frame::getNQIS(){
|
||||||
if (getHeaderType() == 0){
|
|
||||||
return (getInt16(40) >> 5) & 0x1F;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long unsigned int header::getFRN(){
|
char frame::getQIS(size_t index){
|
||||||
if (getHeaderType() == 0){
|
if (index >= 3){return 0;}
|
||||||
return getInt32(22);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long unsigned int header::getPICH(){
|
std::string frame::toPrettyString(size_t indent){
|
||||||
if (getHeaderType() == 0){
|
std::stringstream result;
|
||||||
return getInt24(17);
|
result << std::string(indent,' ') << "Theora Frame" << std::endl;
|
||||||
|
result << std::string(indent+2,' ') << "FType: " << (int)getFTYPE() << std::endl;
|
||||||
|
return result.str();
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
long unsigned int header::getPICW(){
|
|
||||||
if (getHeaderType() == 0){
|
|
||||||
return getInt24(14);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
long unsigned int header::getFRD(){
|
|
||||||
if (getHeaderType() == 0){
|
|
||||||
return getInt32(26);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
39
lib/theora.h
39
lib/theora.h
|
@ -1,5 +1,7 @@
|
||||||
|
#pragma once
|
||||||
#include<sys/types.h>
|
#include<sys/types.h>
|
||||||
#include<stdint.h>
|
#include<stdint.h>
|
||||||
|
#include<string>
|
||||||
|
|
||||||
namespace theora{
|
namespace theora{
|
||||||
class header{
|
class header{
|
||||||
|
@ -7,18 +9,51 @@ namespace theora{
|
||||||
header();
|
header();
|
||||||
bool read(char* newData, unsigned int length);
|
bool read(char* newData, unsigned int length);
|
||||||
int getHeaderType();
|
int getHeaderType();
|
||||||
char getKFGShift();
|
char getVMAJ();
|
||||||
long unsigned int getPICH();//movie height
|
char getVMIN();
|
||||||
|
char getVREV();
|
||||||
|
short getFMBW();
|
||||||
|
short getFMBH();
|
||||||
long unsigned int getPICW();//movie width
|
long unsigned int getPICW();//movie width
|
||||||
|
long unsigned int getPICH();//movie height
|
||||||
|
char getPICX();
|
||||||
|
char getPICY();
|
||||||
long unsigned int getFRN();//frame rate numerator
|
long unsigned int getFRN();//frame rate numerator
|
||||||
long unsigned int getFRD();//frame rate denominator
|
long unsigned int getFRD();//frame rate denominator
|
||||||
|
long unsigned int getPARN();
|
||||||
|
long unsigned int getPARD();
|
||||||
|
char getCS();
|
||||||
|
long unsigned int getNOMBR();
|
||||||
|
char getQUAL();
|
||||||
|
char getPF();
|
||||||
|
char getKFGShift();
|
||||||
|
std::string getVendor();
|
||||||
|
long unsigned int getNComments();
|
||||||
|
std::string getUserComment(size_t index);
|
||||||
|
std::string toPrettyString(size_t indent = 0);
|
||||||
protected:
|
protected:
|
||||||
uint32_t getInt32(size_t index);
|
uint32_t getInt32(size_t index);
|
||||||
uint32_t getInt24(size_t index);
|
uint32_t getInt24(size_t index);
|
||||||
uint16_t getInt16(size_t index);
|
uint16_t getInt16(size_t index);
|
||||||
|
uint32_t commentLen(size_t index);
|
||||||
private:
|
private:
|
||||||
char* data;
|
char* data;
|
||||||
unsigned int datasize;
|
unsigned int datasize;
|
||||||
bool checkDataSize(unsigned int size);
|
bool checkDataSize(unsigned int size);
|
||||||
|
bool validateIdentificationHeader();
|
||||||
|
};
|
||||||
|
|
||||||
|
class frame{
|
||||||
|
public:
|
||||||
|
frame();
|
||||||
|
bool read(char* newData, unsigned int length);
|
||||||
|
char getFTYPE();
|
||||||
|
char getNQIS();
|
||||||
|
char getQIS(size_t index);
|
||||||
|
std::string toPrettyString(size_t indent = 0);
|
||||||
|
private:
|
||||||
|
char * data;
|
||||||
|
unsigned int datasize;
|
||||||
|
bool checkDataSize(unsigned int size);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue