aboutsummaryrefslogtreecommitdiff
path: root/Src/bmp/avi_decoder.cpp
blob: b133d8fd9f38c1e73d3182ff5076bb6740e57f7a (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
53
54
#include "avi_decoder.h"
#include "avi_tscc_decoder.h"
#include "avi_rle_decoder.h"
#include "avi_yuv_decoder.h"
#include "avi_rgb_decoder.h"

int AVIDecoderCreator::CreateVideoDecoder(const nsavi::AVIH *avi_header, const nsavi::STRH *stream_header, const nsavi::STRF *stream_format, const nsavi::STRD *stream_data, ifc_avivideodecoder **decoder)
{
	nsavi::video_format *format = (nsavi::video_format *)stream_format;
	if (format)
	{
		if (format->compression == 'ccst') // tscc
		{
			*decoder = AVITSCC::CreateDecoder(format);
			if (*decoder)
				return CREATEDECODER_SUCCESS;
			else
				return CREATEDECODER_FAILURE;
		}
		else if (format->compression == nsavi::video_format_rle8) // 8bit RLE
		{
			*decoder = AVIRLE::CreateDecoder(format);
			if (*decoder)
				return CREATEDECODER_SUCCESS;
			else
				return CREATEDECODER_FAILURE;
		}
		else if (format->compression == 'YVYU') // YUV
		{
			*decoder = AVIYUV::CreateDecoder(format);
			if (*decoder)
				return CREATEDECODER_SUCCESS;
			else
				return CREATEDECODER_FAILURE;
		}
		else if (format->compression == nsavi::video_format_rgb)
		{
			*decoder = AVIRGB::CreateDecoder(format);
			if (*decoder)
				return CREATEDECODER_SUCCESS;
			else
				return CREATEDECODER_FAILURE;
		}
	}

	return CREATEDECODER_NOT_MINE;
}


#define CBCLASS AVIDecoderCreator
START_DISPATCH;
CB(CREATE_VIDEO_DECODER, CreateVideoDecoder)
END_DISPATCH;
#undef CBCLASS