Lib ogg added new function
This commit is contained in:
parent
8cae5f1fc6
commit
04500e4694
2 changed files with 24 additions and 2 deletions
|
@ -33,6 +33,19 @@ namespace theora{
|
|||
memcpy((char*) &result, data + index, 4);
|
||||
return ntohl(result);
|
||||
}
|
||||
|
||||
uint16_t header::getInt16(size_t index){
|
||||
/*if (index + 3 >= datasize){
|
||||
if ( !reserve(index, 0, 4)){
|
||||
return 0;
|
||||
}
|
||||
setInt32(0, index);
|
||||
}*/
|
||||
uint16_t result;
|
||||
memcpy((char*) &result, data + index, 2);
|
||||
return ntohs(result);
|
||||
}
|
||||
|
||||
|
||||
header::header(){
|
||||
data = NULL;
|
||||
|
@ -83,6 +96,13 @@ namespace theora{
|
|||
};
|
||||
}
|
||||
|
||||
char header::getKFGShift(){
|
||||
if (getHeaderType() == 0){
|
||||
return (getInt16(40) >> 5) & 0x1F;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
long unsigned int header::getFRN(){
|
||||
if (getHeaderType() == 0){
|
||||
return getInt32(22);
|
||||
|
|
|
@ -7,10 +7,12 @@ namespace theora{
|
|||
header();
|
||||
bool read(char* newData, unsigned int length);
|
||||
int getHeaderType();
|
||||
long unsigned int getFRN();
|
||||
long unsigned int getFRD();
|
||||
char getKFGShift();
|
||||
long unsigned int getFRN();//frame rate numerator
|
||||
long unsigned int getFRD();//frame rate denominator
|
||||
protected:
|
||||
uint32_t getInt32(size_t index);
|
||||
uint16_t getInt16(size_t index);
|
||||
private:
|
||||
char* data;
|
||||
unsigned int datasize;
|
||||
|
|
Loading…
Add table
Reference in a new issue