summaryrefslogtreecommitdiff
path: root/engine/voice_codecs/frame_encoder/iframeencoder.h
blob: 8bf5594c568370cc69b2908f9a9c073f2f3e7568 (plain) (blame)
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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

#ifndef IFRAMEENCODER_H
#define IFRAMEENCODER_H
#pragma once


// A frame encoder is a codec that encodes and decodes data in fixed-size frames.
// VoiceCodec_Frame handles queuing of data and the IVoiceCodec interface.
abstract_class IFrameEncoder
{
public:
	virtual			~IFrameEncoder() {}

	// This is called by VoiceCodec_Frame to see if it can initialize..
	// Fills in the uncompressed and encoded frame size (both are in BYTES).
	virtual bool	Init(int quality, int &rawFrameSize, int &encodedFrameSize) = 0;

	virtual void	Release() = 0;
	
	// pUncompressed is 8-bit signed mono sound data with 'rawFrameSize' bytes.
	// pCompressed is the size of encodedFrameSize.
	virtual void	EncodeFrame(const char *pUncompressed, char *pCompressed) = 0;
	
	// pCompressed is encodedFrameSize.
	// pDecompressed is where the 8-bit signed mono samples are stored and has space for 'rawFrameSize' bytes.
	virtual void	DecodeFrame(const char *pCompressed, char *pDecompressed) = 0;

	// Some codecs maintain state between Compress and Decompress calls. This should clear that state.
	virtual bool	ResetState() = 0;
};


#endif // IFRAMEENCODER_H