Added vorbis functionality
This commit is contained in:
parent
ed7de50138
commit
37df1716de
3 changed files with 52 additions and 2 deletions
34
lib/vorbis.cpp
Normal file
34
lib/vorbis.cpp
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue