Ogg fixed

This commit is contained in:
Oswald Auguste de Bruin 2013-08-29 13:10:22 +02:00 committed by Thulinma
parent 31bfc8223e
commit 632b3ff594
2 changed files with 30 additions and 12 deletions

View file

@ -188,6 +188,9 @@ namespace OGG{
temp = 0;
}
}
if (temp!=0){
segmentTableDeque.push_back(temp);
}
}
return segmentTableDeque;
}
@ -196,6 +199,7 @@ namespace OGG{
std::cerr << "Segments too big, create a continue page" << std::endl;
}
///\TODO MAKE FIX HERE
bool Page::setSegmentTable(std::vector<unsigned int> layout){
dataSum=0;
for (unsigned int i = 0; i < layout.size(); i++){
@ -205,7 +209,7 @@ namespace OGG{
char table[255];
for (unsigned int i = 0; i < layout.size(); i++){
while (layout[i]>=255){
if (place >= 255){
if (place > 255){
STerrMSG();
return false;
}
@ -213,13 +217,15 @@ namespace OGG{
layout[i] -= 255;
place++;
}
if (place >= 255){
if (place > 255){
STerrMSG();
return false;
}
if (layout[i] != 0){
table[place] = layout[i];
place++;
}
}
setPageSegments(place);
setSegmentTable(table,place);
return true;

View file

@ -66,7 +66,7 @@ namespace vorbis{
char header::getBlockSize0(){
if (getHeaderType() == 1){
return data[28]>>4;
return (data[28]>>4) & 0x0F;
}else{
return 0;
}
@ -106,12 +106,24 @@ namespace vorbis{
bool header::validate(){
switch(getHeaderType()){
case 1://ID header
if (datasize!=30) return false;
if (getVorbisVersion()!=0) return false;
if (getAudioChannels()<=0) return false;
if (getAudioSampleRate()<=0) return false;
if (getBlockSize0()>getBlockSize1()) return false;
if (getFramingFlag()!=1) return false;
if (datasize!=30){
return false;
}
if (getVorbisVersion()!=0){
return false;
}
if (getAudioChannels()<=0){
return false;
};
if (getAudioSampleRate()<=0) {
return false;
}
if (getBlockSize0()>getBlockSize1()){
return false;
};
if (getFramingFlag()!=1){
return false;
};
break;
case 3://comment header
break;
@ -140,7 +152,7 @@ namespace vorbis{
}else{
return false;
}
return validate();
return true;
}