1 |
|
/***************************************************************************** |
2 |
|
* |
3 |
|
* XVID MPEG-4 VIDEO CODEC |
4 |
|
* - XviD Decoder part of the DShow Filter - |
5 |
|
* |
6 |
|
* Copyright(C) 2002-2003 Peter Ross <pross@xvid.org> |
7 |
|
* |
8 |
|
* This program is free software ; you can redistribute it and/or modify |
9 |
|
* it under the terms of the GNU General Public License as published by |
10 |
|
* the Free Software Foundation ; either version 2 of the License, or |
11 |
|
* (at your option) any later version. |
12 |
|
* |
13 |
|
* This program is distributed in the hope that it will be useful, |
14 |
|
* but WITHOUT ANY WARRANTY ; without even the implied warranty of |
15 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
* GNU General Public License for more details. |
17 |
|
* |
18 |
|
* You should have received a copy of the GNU General Public License |
19 |
|
* along with this program ; if not, write to the Free Software |
20 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
|
* |
22 |
|
* $Id$ |
23 |
|
* |
24 |
|
****************************************************************************/ |
25 |
|
|
26 |
|
#ifndef _FILTER_H_ |
27 |
|
#define _FILTER_H_ |
28 |
|
|
29 |
|
#include <xvid.h> |
30 |
|
#include "IXvidDecoder.h" |
31 |
|
|
32 |
|
#ifdef _DEBUG |
33 |
|
#include <stdio.h> /* vsprintf */ |
34 |
|
#define DPRINTF_BUF_SZ 1024 |
35 |
|
static __inline void |
36 |
|
DPRINTF(char *fmt, ...) |
37 |
|
{ |
38 |
|
va_list args; |
39 |
|
char buf[DPRINTF_BUF_SZ]; |
40 |
|
|
41 |
|
va_start(args, fmt); |
42 |
|
vsprintf(buf, fmt, args); |
43 |
|
OutputDebugString(buf); |
44 |
|
} |
45 |
|
#else |
46 |
|
static __inline void |
47 |
|
DPRINTF(char *fmt, ...) { } |
48 |
|
#endif |
49 |
|
|
50 |
|
/* registry stuff */ |
51 |
|
#define XVID_REG_KEY HKEY_CURRENT_USER |
52 |
|
#define XVID_REG_SUBKEY "Software\\GNU\\XviD" |
53 |
|
#define XVID_REG_CLASS "config" |
54 |
|
|
55 |
|
#define REG_GET_N(X, Y, Z) size=sizeof(int);if(RegQueryValueEx(hKey, X, 0, 0, (LPBYTE)&Y, &size) != ERROR_SUCCESS) {Y=Z;} |
56 |
|
#define REG_GET_S(X, Y, Z) size=MAX_PATH;if(RegQueryValueEx(hKey, X, 0, 0, Y, &size) != ERROR_SUCCESS) {lstrcpy(Y, Z);} |
57 |
|
#define REG_SET_N(X, Y) RegSetValueEx(hKey, X, 0, REG_DWORD, (LPBYTE)&Y, sizeof(int)) |
58 |
|
#define REG_SET_S(X, Y) RegSetValueEx(hKey, X, 0, REG_SZ, Y, lstrlen(Y)+1) |
59 |
|
|
60 |
|
#define XVID_NAME_L L"XviD MPEG-4 Video Decoder" |
61 |
|
|
62 |
|
/* --- fourcc --- */ |
63 |
|
|
64 |
|
#define FOURCC_XVID mmioFOURCC('X','V','I','D') |
65 |
|
#define FOURCC_DIVX mmioFOURCC('D','I','V','X') |
66 |
|
#define FOURCC_DX50 mmioFOURCC('D','X','5','0') |
67 |
|
|
68 |
|
/* --- media uids --- */ |
69 |
|
|
70 |
|
DEFINE_GUID(CLSID_XVID, mmioFOURCC('x','v','i','d'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); |
71 |
|
DEFINE_GUID(CLSID_XVID_UC, mmioFOURCC('X','V','I','D'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); |
72 |
|
DEFINE_GUID(CLSID_DIVX, mmioFOURCC('d','i','v','x'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); |
73 |
|
DEFINE_GUID(CLSID_DIVX_UC, mmioFOURCC('D','I','V','X'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); |
74 |
|
DEFINE_GUID(CLSID_DX50, mmioFOURCC('d','x','5','0'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); |
75 |
|
DEFINE_GUID(CLSID_DX50_UC, mmioFOURCC('D','X','5','0'), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); |
76 |
|
|
77 |
|
|
78 |
|
/* MEDIATYPE_IYUV is not always defined in the directx headers */ |
79 |
|
DEFINE_GUID(CLSID_MEDIASUBTYPE_IYUV, 0x56555949, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); |
80 |
|
|
81 |
|
|
82 |
|
class CXvidDecoder : public CVideoTransformFilter, public IXvidDecoder, public ISpecifyPropertyPages |
83 |
|
{ |
84 |
|
|
85 |
|
public : |
86 |
|
|
87 |
|
static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr); |
88 |
|
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv); |
89 |
|
DECLARE_IUNKNOWN; |
90 |
|
|
91 |
|
CXvidDecoder(LPUNKNOWN punk, HRESULT *phr); |
92 |
|
~CXvidDecoder(); |
93 |
|
|
94 |
|
HRESULT CheckInputType(const CMediaType * mtIn); |
95 |
|
HRESULT GetMediaType(int iPos, CMediaType * pmt); |
96 |
|
HRESULT SetMediaType(PIN_DIRECTION direction, const CMediaType *pmt); |
97 |
|
|
98 |
|
HRESULT CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut); |
99 |
|
HRESULT DecideBufferSize(IMemAllocator * pima, ALLOCATOR_PROPERTIES * pProperties); |
100 |
|
|
101 |
|
HRESULT Transform(IMediaSample *pIn, IMediaSample *pOut); |
102 |
|
|
103 |
|
STDMETHODIMP GetPages(CAUUID * pPages); |
104 |
|
STDMETHODIMP FreePages(CAUUID * pPages); |
105 |
|
|
106 |
|
private : |
107 |
|
|
108 |
|
HRESULT ChangeColorspace(GUID subtype, GUID formattype, void * format); |
109 |
|
|
110 |
|
xvid_dec_create_t m_create; |
111 |
|
xvid_dec_frame_t m_frame; |
112 |
|
}; |
113 |
|
|
114 |
|
|
115 |
|
#endif /* _FILTER_H_ */ |