-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOGGencoder.h
40 lines (30 loc) · 1.18 KB
/
OGGencoder.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <fstream>
#include <vorbis/vorbisenc.h>
#include "params.h"
using namespace std;
#pragma once
class OGGencoder{
private:
PARAMS params; //Audio parameters
ofstream myFile; //File where the data will be written
ogg_stream_state os; /* take physical pages, weld into a logical
stream of packets */
ogg_page og; /* one Ogg bitstream page. Vorbis packets are inside */
ogg_packet op; /* one raw packet of data for decode */
vorbis_info vi; /* struct that stores all the static vorbis bitstream
settings */
vorbis_comment vc; /* struct that stores all the user comments */
vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
vorbis_block vb; /* local working space for packet->PCM decode */
public:
OGGencoder(pPARAMS,char* szOutputFilename);
~OGGencoder();
/*initializing encoder setup*/
bool initLibvorbisenc();
/*Here the bitstream is initialized. And the header of the file is written*/
bool initBitstream();
/*Encodes a chunk of PCM data and appends it to a file*/
bool encodeChunk(signed char *readbuffer);
/*Cleans up stuff*/
bool cleanup();
};