Added vorbis functionality

This commit is contained in:
Oswald Auguste de Bruin 2013-07-15 16:24:43 +02:00 committed by Thulinma
parent ed7de50138
commit 37df1716de
3 changed files with 52 additions and 2 deletions

34
lib/vorbis.cpp Normal file
View file

@ -0,0 +1,34 @@
#include"vorbis.h"
#include<stdlib.h>
#include<string.h>
#include <arpa/inet.h>
namespace vorbis{
header::header(){
data = NULL;
datasize = 0;
}
bool header::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 header::read(char* newData, unsigned int length){
if (checkDataSize(length)){
memcpy(data, newData, length);
}else{
return false;
}
return true;
}
}