diff --git a/lib/ogg.cpp b/lib/ogg.cpp index d15a7600..2a6bec50 100644 --- a/lib/ogg.cpp +++ b/lib/ogg.cpp @@ -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 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,12 +217,14 @@ namespace OGG{ layout[i] -= 255; place++; } - if (place >= 255){ + if (place > 255){ STerrMSG(); return false; } - table[place] = layout[i]; - place++; + if (layout[i] != 0){ + table[place] = layout[i]; + place++; + } } setPageSegments(place); setSegmentTable(table,place); diff --git a/lib/vorbis.cpp b/lib/vorbis.cpp index 28df5637..4eead952 100644 --- a/lib/vorbis.cpp +++ b/lib/vorbis.cpp @@ -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; }