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

View file

@ -1,5 +1,5 @@
lib_LTLIBRARIES=libmist-1.0.la lib_LTLIBRARIES=libmist-1.0.la
libmist_1_0_la_SOURCES=amf.h amf.cpp auth.h auth.cpp base64.h base64.cpp config.h config.cpp dtsc.h dtsc.cpp flv_tag.h flv_tag.cpp http_parser.h http_parser.cpp json.h json.cpp procs.h procs.cpp rtmpchunks.h rtmpchunks.cpp socket.h socket.cpp mp4.h mp4.cpp ftp.h ftp.cpp filesystem.h filesystem.cpp stream.h stream.cpp timing.h timing.cpp ts_packet.cpp ts_packet.h converter.cpp converter.h ogg.h ogg.cpp theora.cpp theora.h libmist_1_0_la_SOURCES=amf.h amf.cpp auth.h auth.cpp base64.h base64.cpp config.h config.cpp dtsc.h dtsc.cpp flv_tag.h flv_tag.cpp http_parser.h http_parser.cpp json.h json.cpp procs.h procs.cpp rtmpchunks.h rtmpchunks.cpp socket.h socket.cpp mp4.h mp4.cpp ftp.h ftp.cpp filesystem.h filesystem.cpp stream.h stream.cpp timing.h timing.cpp ts_packet.cpp ts_packet.h converter.cpp converter.h ogg.h ogg.cpp theora.cpp theora.h vorbis.cpp vorbis.h
libmist_1_0_la_LDFLAGS = -version-info 5:1:2 libmist_1_0_la_LDFLAGS = -version-info 5:1:2
libmist_1_0_la_CPPFLAGS=$(DEPS_CFLAGS) $(global_CFLAGS) libmist_1_0_la_CPPFLAGS=$(DEPS_CFLAGS) $(global_CFLAGS)
libmist_1_0_la_LIBADD=$(DEPS_LIBS) $(CLOCK_LIB) libmist_1_0_la_LIBADD=$(DEPS_LIBS) $(CLOCK_LIB)
@ -8,4 +8,4 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = mist-1.0.pc pkgconfig_DATA = mist-1.0.pc
library_includedir=$(includedir)/mist-1.0/mist library_includedir=$(includedir)/mist-1.0/mist
library_include_HEADERS = amf.h auth.h base64.h config.h dtsc.h flv_tag.h http_parser.h json.h procs.h rtmpchunks.h socket.h mp4.h ftp.h filesystem.h stream.h timing.h nal.h ts_packet.h converter.h ogg.h theora.h library_include_HEADERS = amf.h auth.h base64.h config.h dtsc.h flv_tag.h http_parser.h json.h procs.h rtmpchunks.h socket.h mp4.h ftp.h filesystem.h stream.h timing.h nal.h ts_packet.h converter.h ogg.h theora.h vorbis.h

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;
}
}

16
lib/vorbis.h Normal file
View file

@ -0,0 +1,16 @@
#pragma once
#include<sys/types.h>
#include<stdint.h>
#include<string>
namespace vorbis{
class header{
public:
header();
bool read(char* newData, unsigned int length);
private:
char* data;
unsigned int datasize;
bool checkDataSize(unsigned int size);
};
}