1/*
2 * XvidDecoder.h - XviD plugin for the Haiku Operating System
3 *
4 * Copyright (C) 2007 Stephan A��mus <superstippi@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 *
19 */
20#ifndef XVID_DECODER_H
21#define XVID_DECODER_H
22
23
24#include <DataIO.h>
25#include <MediaFormats.h>
26
27#include "DecoderPlugin.h"
28#include "xvid.h"
29
30
31class XvidDecoder : public Decoder {
32 public:
33								XvidDecoder();
34
35	virtual						~XvidDecoder();
36
37	virtual	void				GetCodecInfo(media_codec_info *mci);
38
39	virtual	status_t			Setup(media_format* inputFormat,
40									const void* inInfo, size_t inSize);
41
42	virtual	status_t			NegotiateOutputFormat(
43									media_format *outputFormat);
44
45	virtual	status_t			Decode(void* outBuffer, int64* outFrameCount,
46									media_header* mh, media_decode_info* info);
47
48	virtual	status_t			SeekedTo(int64 frame, bigtime_t time);
49
50 private:
51			int					_XvidInit();
52			int					_XvidUninit();
53
54			int					_XvidDecode(uchar *istream, uchar *ostream,
55									int inStreamSize,
56									xvid_dec_stats_t* xvidDecoderStats,
57									bool hurryUp);
58
59	media_format				fInputFormat;
60	media_raw_video_format		fOutputVideoFormat;
61
62	void*						fXvidDecoderHandle;
63	int							fXvidColorspace;
64
65	int64						fFrame;
66	int32						fIndexInCodecTable;
67
68	const void*					fChunkBuffer;
69	uint8*						fWrappedChunkBuffer;
70	const char*					fChunkBufferHandle;
71	size_t						fChunkBufferSize;
72	int32						fLeftInChunkBuffer;
73
74	bool						fDiscontinuity;
75};
76
77
78class XvidPlugin : public DecoderPlugin {
79 public:
80			Decoder*			NewDecoder(uint index);
81			status_t			GetSupportedFormats(
82									media_format** formats, size_t* count);
83};
84
85
86#endif // XVID_DECODER_H
87