annotate loader/dshow/libwin32.h @ 1558:261f5fd2c909

error handling
author arpi
date Thu, 16 Aug 2001 18:27:03 +0000
parents 076c27342828
children ce45cce7f7a5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
1 #ifndef __LIBWIN32_H
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
2 #define __LIBWIN32_H
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
3
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
4 #define VFW_E_INVALIDMEDIATYPE 0x80040200
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
5 #define VFW_E_INVALIDSUBTYPE 0x80040201
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
6 #define VFW_E_ALREADY_CONNECTED 0x80040204
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
7 #define VFW_E_FILTER_ACTIVE 0x80040205
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
8 #define VFW_E_NO_ACCEPTABLE_TYPES 0x80040207
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
9 #define VFW_E_NOT_CONNECTED 0x80040209
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
10 #define VFW_E_NO_ALLOCATOR 0x8004020A
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
11 #define VFW_E_NOT_RUNNING 0x80040226
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
12 #define VFW_E_TYPE_NOT_ACCEPTED 0x8004022A
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
13 #define VFW_E_SAMPLE_REJECTED 0x8004022B
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
14
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
15 #include <sys/types.h>
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
16 #include <inttypes.h>
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
17
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
18 #ifndef NOAVIFILE_HEADERS
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
19 #include <audiodecoder.h>
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
20 #include <audioencoder.h>
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
21 #include <videodecoder.h>
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
22 #include <videoencoder.h>
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
23 #include <except.h>
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
24 #include <fourcc.h>
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
25
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
26 #else
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
27 // code for mplayer team
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
28
1558
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
29 //#define FATAL(a) // you don't need exception - if you want - just fill more code
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
30 #define FATAL(X...) FatalError(__MODULE__,__FILE__,__LINE__,X)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
31 #include <wine/mmreg.h>
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
32 #include <wine/winreg.h>
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
33 #include <wine/vfw.h>
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
34 #include <com.h>
1558
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
35 #include <stdarg.h>
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
36 #include <string>
1558
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
37 #include <stdio.h>
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
38
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
39 typedef unsigned int fourcc_t;
1558
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
40
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
41 struct FatalError
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
42 {
1558
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
43 FatalError(const char* mod, const char* f, int l, const char* desc,...)
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
44 {
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
45 printf("FATAL: module: %s source: %s line %d ", mod, f, l);
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
46 va_list va;
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
47 va_start(va, desc);
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
48 vprintf(desc, va);
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
49 va_end(va);
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
50 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
51 void PrintAll() {}
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
52 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
53
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
54 struct CodecInfo
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
55 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
56 std::string dll;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
57 GUID guid;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
58 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
59
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
60 struct CImage { // public your_libvo_mem
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
61 char* ptr;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
62 char* Data() { return ptr; } // pointer to memory block
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
63 /* if you support such surface: */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
64 static bool Supported(fourcc_t csp, int bits) { return true; }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
65 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
66
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
67 // might be minimalized to contain just those which are needed by DS_VideoDecoder
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
68
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
69 #ifndef mmioFOURCC
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
70 #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
71 ( (long)(unsigned char)(ch0) | ( (long)(unsigned char)(ch1) << 8 ) | \
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
72 ( (long)(unsigned char)(ch2) << 16 ) | ( (long)(unsigned char)(ch3) << 24 ) )
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
73 #endif /* mmioFOURCC */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
74
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
75 /* OpenDivX */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
76 #define fccMP4S mmioFOURCC('M', 'P', '4', 'S')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
77 #define fccmp4s mmioFOURCC('m', 'p', '4', 's')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
78 #define fccDIVX mmioFOURCC('D', 'I', 'V', 'X')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
79 #define fccdivx mmioFOURCC('d', 'i', 'v', 'x')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
80 #define fccDIV1 mmioFOURCC('D', 'I', 'V', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
81 #define fccdiv1 mmioFOURCC('d', 'i', 'v', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
82
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
83 /* DivX codecs */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
84 #define fccDIV2 mmioFOURCC('D', 'I', 'V', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
85 #define fccdiv2 mmioFOURCC('d', 'i', 'v', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
86 #define fccDIV3 mmioFOURCC('D', 'I', 'V', '3')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
87 #define fccdiv3 mmioFOURCC('d', 'i', 'v', '3')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
88 #define fccDIV4 mmioFOURCC('D', 'I', 'V', '4')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
89 #define fccdiv4 mmioFOURCC('d', 'i', 'v', '4')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
90 #define fccDIV5 mmioFOURCC('D', 'I', 'V', '5')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
91 #define fccdiv5 mmioFOURCC('d', 'i', 'v', '5')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
92 #define fccDIV6 mmioFOURCC('D', 'I', 'V', '6')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
93 #define fccdiv6 mmioFOURCC('d', 'i', 'v', '6')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
94 #define fccMP41 mmioFOURCC('M', 'P', '4', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
95 #define fccmp41 mmioFOURCC('m', 'p', '4', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
96 #define fccMP43 mmioFOURCC('M', 'P', '4', '3')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
97 #define fccmp43 mmioFOURCC('m', 'p', '4', '3')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
98 /* old ms mpeg-4 codecs */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
99 #define fccMP42 mmioFOURCC('M', 'P', '4', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
100 #define fccmp42 mmioFOURCC('m', 'p', '4', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
101 #define fccMPG4 mmioFOURCC('M', 'P', 'G', '4')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
102 #define fccmpg4 mmioFOURCC('m', 'p', 'g', '4')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
103 /* Windows media codecs */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
104 #define fccWMV1 mmioFOURCC('W', 'M', 'V', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
105 #define fccwmv1 mmioFOURCC('w', 'm', 'v', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
106 #define fccWMV2 mmioFOURCC('W', 'M', 'V', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
107 #define fccwmv2 mmioFOURCC('w', 'm', 'v', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
108 #define fccMWV1 mmioFOURCC('M', 'W', 'V', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
109
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
110 /* Angel codecs */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
111 #define fccAP41 mmioFOURCC('A', 'P', '4', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
112 #define fccap41 mmioFOURCC('a', 'p', '4', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
113 #define fccAP42 mmioFOURCC('A', 'P', '4', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
114 #define fccap42 mmioFOURCC('a', 'p', '4', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
115
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
116 /* other codecs */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
117 #define fccIV31 mmioFOURCC('I', 'V', '3', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
118 #define fcciv31 mmioFOURCC('i', 'v', '3', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
119 #define fccIV32 mmioFOURCC('I', 'V', '3', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
120 #define fcciv32 mmioFOURCC('i', 'v', '3', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
121 #define fccIV41 mmioFOURCC('I', 'V', '4', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
122 #define fcciv41 mmioFOURCC('i', 'v', '4', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
123 #define fccIV50 mmioFOURCC('I', 'V', '5', '0')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
124 #define fcciv50 mmioFOURCC('i', 'v', '5', '0')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
125 #define fccI263 mmioFOURCC('I', '2', '6', '3')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
126 #define fcci263 mmioFOURCC('i', '2', '6', '3')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
127
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
128 #define fccMJPG mmioFOURCC('M', 'J', 'P', 'G')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
129 #define fccmjpg mmioFOURCC('m', 'j', 'p', 'g')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
130
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
131 #define fccHFYU mmioFOURCC('H', 'F', 'Y', 'U')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
132
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
133 #define fcccvid mmioFOURCC('c', 'v', 'i', 'd')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
134 #define fccdvsd mmioFOURCC('d', 'v', 's', 'd')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
135
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
136 /* Ati codecs */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
137 #define fccVCR2 mmioFOURCC('V', 'C', 'R', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
138 #define fccVCR1 mmioFOURCC('V', 'C', 'R', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
139 #define fccVYUY mmioFOURCC('V', 'Y', 'U', 'Y')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
140 #define fccYVU9 mmioFOURCC('I', 'Y', 'U', '9')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
141
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
142 /* Asus codecs */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
143 #define fccASV1 mmioFOURCC('A', 'S', 'V', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
144 #define fccASV2 mmioFOURCC('A', 'S', 'V', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
145
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
146 /* Microsoft video */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
147 #define fcccram mmioFOURCC('c', 'r', 'a', 'm')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
148 #define fccCRAM mmioFOURCC('C', 'R', 'A', 'M')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
149 #define fccMSVC mmioFOURCC('M', 'S', 'V', 'C')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
150
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
151
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
152 #define fccMSZH mmioFOURCC('M', 'S', 'Z', 'H')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
153
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
154 #define fccZLIB mmioFOURCC('Z', 'L', 'I', 'B')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
155
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
156 #define fccTM20 mmioFOURCC('T', 'M', '2', '0')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
157
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
158 #define fccYUV mmioFOURCC('Y', 'U', 'V', ' ')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
159 #define fccYUY2 mmioFOURCC('Y', 'U', 'Y', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
160 #define fccYV12 mmioFOURCC('Y', 'V', '1', '2')/* Planar mode: Y + V + U (3 planes) */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
161 #define fccI420 mmioFOURCC('I', '4', '2', '0')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
162 #define fccIYUV mmioFOURCC('I', 'Y', 'U', 'V')/* Planar mode: Y + U + V (3 planes) */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
163 #define fccUYVY mmioFOURCC('U', 'Y', 'V', 'Y')/* Packed mode: U0+Y0+V0+Y1 (1 plane) */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
164 #define fccYVYU mmioFOURCC('Y', 'V', 'Y', 'U')/* Packed mode: Y0+V0+Y1+U0 (1 plane) */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
165
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
166
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
167 struct BitmapInfo : public BITMAPINFOHEADER
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
168 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
169 int colors[3];
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
170
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
171 void SetBitFields16(){
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
172 biSize=sizeof(BITMAPINFOHEADER)+12;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
173 biCompression=3;//BI_BITFIELDS
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
174 biBitCount=16;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
175 biSizeImage=abs((int)(2*biWidth*biHeight));
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
176 colors[0]=0xF800;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
177 colors[1]=0x07E0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
178 colors[2]=0x001F;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
179 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
180 void SetBitFields15(){
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
181 biSize=sizeof(BITMAPINFOHEADER)+12;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
182 biCompression=3;//BI_BITFIELDS
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
183 biBitCount=16;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
184 biSizeImage=abs((int)(2*biWidth*biHeight));
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
185 colors[0]=0x7C00;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
186 colors[1]=0x03E0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
187 colors[2]=0x001F;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
188 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
189 void SetRGB(){
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
190 biSize = sizeof(BITMAPINFOHEADER);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
191 biCompression = 0; //BI_RGB
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
192 //biHeight = labs(biHeight);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
193 biSizeImage = labs(biWidth * biHeight) * ((biBitCount + 7) / 8);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
194 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
195 void SetBits(int bits) {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
196 switch (bits){
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
197 case 15: SetBitFields15();break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
198 case 16: SetBitFields16();break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
199 default: biBitCount = bits; SetRGB();break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
200 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
201 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
202 void SetSpace(int csp,int bits) {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
203 biSize = sizeof(BITMAPINFOHEADER);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
204 biCompression=csp;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
205 biBitCount=bits;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
206 biSizeImage=labs(biBitCount*biWidth*biHeight)>>3;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
207 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
208 void SetSpace(int csp) {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
209 int bits=0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
210 switch(csp){
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
211 case fccYUV:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
212 bits=24;break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
213 case fccYUY2:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
214 case fccUYVY:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
215 case fccYVYU:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
216 bits=16;break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
217 case fccYV12:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
218 case fccIYUV:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
219 case fccI420:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
220 bits=12;break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
221 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
222 if (csp != 0 && csp != 3 && biHeight > 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
223 biHeight *= -1; // YUV formats uses should have height < 0
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
224 SetSpace(csp,bits);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
225 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
226
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
227 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
228
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
229 struct IAudioDecoder
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
230 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
231 WAVEFORMATEX in_fmt;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
232 const CodecInfo& record;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
233 IAudioDecoder(const CodecInfo& r, const WAVEFORMATEX* w) : record(r)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
234 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
235 in_fmt = *w;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
236 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
237 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
238
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
239 struct IAudioEncoder
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
240 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
241 IAudioEncoder(const CodecInfo&, WAVEFORMATEX*) {}
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
242 // you do not need this one...
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
243 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
244
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
245 struct IVideoDecoder
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
246 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
247 int VBUFSIZE;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
248 int QMARKHI;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
249 int QMARKLO;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
250 int DMARKHI;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
251 int DMARKLO;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
252
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
253 enum CAPS
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
254 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
255 CAP_NONE = 0,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
256 CAP_YUY2 = 1,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
257 CAP_YV12 = 2,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
258 CAP_IYUV = 4,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
259 CAP_UYVY = 8,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
260 CAP_YVYU = 16,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
261 CAP_I420 = 32,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
262 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
263 enum DecodingMode
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
264 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
265 DIRECT = 0,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
266 REALTIME,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
267 REALTIME_QUALITY_AUTO,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
268 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
269 enum DecodingState
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
270 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
271 STOP = 0,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
272 START,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
273 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
274 IVideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& format) : record(info)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
275 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
276 // implement init part
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
277 unsigned bihs = (format.biSize < (int) sizeof(BITMAPINFOHEADER)) ?
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
278 sizeof(BITMAPINFOHEADER) : format.biSize;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
279 m_bh = (BITMAPINFOHEADER*) new char[bihs];
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
280 memcpy(m_bh, &format, bihs);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
281 m_State = STOP;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
282 //m_pFrame = 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
283 m_Mode = DIRECT;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
284 m_iDecpos = 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
285 m_iPlaypos = -1;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
286 m_fQuality = 0.0f;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
287 m_bCapable16b = true;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
288
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
289 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
290 virtual ~IVideoDecoder(){};
1558
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
291 // use this one
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
292 int Decode(void* src, size_t size, int is_keyframe, CImage* pImage)
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
293 { return DecodeInternal(src, size, is_keyframe, pImage); }
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
294 void Stop(){ StopInternal(); m_State = STOP;}
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
295 void Start(){StartInternal(); m_State = START;}
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
296 protected:
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
297 virtual int DecodeInternal(void* src, size_t size, int is_keyframe, CImage* pImage) = 0;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
298 virtual void StartInternal()=0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
299 virtual void StopInternal()=0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
300
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
301 const CodecInfo& record;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
302 DecodingMode m_Mode; // should we do precaching (or even change Quality on the fly)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
303 DecodingState m_State;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
304 int m_iDecpos;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
305 int m_iPlaypos;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
306 float m_fQuality; // quality for the progress bar 0..1(best)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
307 bool m_bCapable16b;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
308
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
309 BITMAPINFOHEADER* m_bh; // format of input data (might be larger - e.g. huffyuv)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
310 BitmapInfo m_decoder; // format of decoder output
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
311 BitmapInfo m_obh; // format of returned frames
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
312 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
313
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
314 struct IRtConfig
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
315 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
316 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
317
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
318
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
319
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
320 #endif
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
321
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
322 #endif