summaryrefslogtreecommitdiff
path: root/encoders/vorbis_encoder.h
blob: 5206ace7481682337913b874e43ad3d947d3186e (plain)
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
#ifndef VORBIS_ENCODER_H
#define VORBIS_ENCODER_H

#include "encoder.h"

#include <vorbis/vorbisenc.h>
#include <ogg/ogg.h>

class VorbisEncoder : public Encoder {
	private:
		vorbis_info vi;
		vorbis_dsp_state dsp;
		vorbis_block vb;
		ogg_stream_state os;
		ogg_page og;
		RawAudioSource::p source;
		//! Set to true when ogg stream headers are written.
		bool headers_written;

	protected:
		std::size_t write_pages(char *buf, std::size_t buf_size);
		std::size_t encode(char *buf, std::size_t buf_size);

	public:
		VorbisEncoder(RawAudioSource::p source_);
		virtual ~VorbisEncoder ();

		virtual std::size_t read(char* buf, std::size_t buf_size);
		virtual std::string get_mime_type();
};

#endif