aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Input/in_flv/svc_flvdecoder.h
blob: 1093d18aac1685ebe20d83d395891fd2f4c59822 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once

#include <bfc/dispatch.h>
#include <api/service/services.h>

class ifc_flvaudiodecoder;
class ifc_flvvideodecoder;
class svc_flvdecoder : public Dispatchable
{
protected:
	svc_flvdecoder() {}
	~svc_flvdecoder() {}
public:
	static FOURCC getServiceType() { return WaSvc::FLVDECODER; } 
	enum
	{
		CREATEDECODER_SUCCESS = 0,
		CREATEDECODER_NOT_MINE = -1, // graceful failure
		CREATEDECODER_FAILURE = 1, // generic failure - format_type is ours but we weren't able to create the decoder
	};
	int CreateAudioDecoder(int stereo, int bits, int sample_rate, int format, ifc_flvaudiodecoder **decoder);
	int CreateVideoDecoder(int format_type, int width, int height, ifc_flvvideodecoder **decoder);
	int HandlesAudio(int format_type);
	int HandlesVideo(int format_type);
	DISPATCH_CODES
	{
		CREATE_AUDIO_DECODER = 0,
			CREATE_VIDEO_DECODER = 1,
			HANDLES_AUDIO=2,
			HANDLES_VIDEO=3,
	};
};

inline int svc_flvdecoder::CreateAudioDecoder(int stereo, int bits, int sample_rate, int format, ifc_flvaudiodecoder **decoder)
{
	return _call(CREATE_AUDIO_DECODER, (int)CREATEDECODER_NOT_MINE, stereo, bits, sample_rate, format, decoder);
}

inline int svc_flvdecoder::CreateVideoDecoder(int format_type, int width, int height, ifc_flvvideodecoder **decoder)
{
	return _call(CREATE_VIDEO_DECODER, (int)CREATEDECODER_NOT_MINE, format_type,width, height, decoder);
}

inline int svc_flvdecoder::HandlesAudio(int format_type)
{
	return _call(HANDLES_AUDIO, (int)CREATEDECODER_NOT_MINE, format_type);
}

inline int svc_flvdecoder::HandlesVideo(int format_type)
{
	return _call(HANDLES_VIDEO, (int)CREATEDECODER_NOT_MINE, format_type);
}