annotate loader/dshow/libwin32.h @ 2641:41b67e5e5d38

initial import from transcode
author arpi
date Fri, 02 Nov 2001 23:53:44 +0000
parents 8500ef44bf5c
children 004e3199fee0
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>
2072
4b3f3f850896 killed unneeded dependency on c++ headers
arpi
parents: 2069
diff changeset
36 //#include <string>
1558
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
37 #include <stdio.h>
2073
8500ef44bf5c stdlib.h added
arpi
parents: 2072
diff changeset
38 #include <stdlib.h>
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
39
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1558
diff changeset
40 typedef unsigned int uint_t; // use as generic type -
ce45cce7f7a5 sync with avifile
arpi
parents: 1558
diff changeset
41
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
42 typedef unsigned int fourcc_t;
1558
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
43
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
44 struct FatalError
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
45 {
1558
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
46 FatalError(const char* mod, const char* f, int l, const char* desc,...)
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
47 {
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
48 printf("FATAL: module: %s source: %s line %d ", mod, f, l);
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
49 va_list va;
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
50 va_start(va, desc);
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
51 vprintf(desc, va);
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
52 va_end(va);
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
53 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
54 void PrintAll() {}
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
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
57 struct CodecInfo
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
58 {
2072
4b3f3f850896 killed unneeded dependency on c++ headers
arpi
parents: 2069
diff changeset
59 // std::string dll;
4b3f3f850896 killed unneeded dependency on c++ headers
arpi
parents: 2069
diff changeset
60 char* dll;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
61 GUID guid;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
62 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
63
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
64 struct CImage { // public your_libvo_mem
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
65 char* ptr;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
66 char* Data() { return ptr; } // pointer to memory block
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
67 /* if you support such surface: */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
68 static bool Supported(fourcc_t csp, int bits) { return true; }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
69 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
70
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
71 // 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
72
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
73 #ifndef mmioFOURCC
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
74 #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
75 ( (long)(unsigned char)(ch0) | ( (long)(unsigned char)(ch1) << 8 ) | \
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
76 ( (long)(unsigned char)(ch2) << 16 ) | ( (long)(unsigned char)(ch3) << 24 ) )
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
77 #endif /* mmioFOURCC */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
78
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
79 /* OpenDivX */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
80 #define fccMP4S mmioFOURCC('M', 'P', '4', 'S')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
81 #define fccmp4s mmioFOURCC('m', 'p', '4', 's')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
82 #define fccDIVX mmioFOURCC('D', 'I', 'V', 'X')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
83 #define fccdivx mmioFOURCC('d', 'i', 'v', 'x')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
84 #define fccDIV1 mmioFOURCC('D', 'I', 'V', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
85 #define fccdiv1 mmioFOURCC('d', 'i', 'v', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
86
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
87 /* DivX codecs */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
88 #define fccDIV2 mmioFOURCC('D', 'I', 'V', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
89 #define fccdiv2 mmioFOURCC('d', 'i', 'v', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
90 #define fccDIV3 mmioFOURCC('D', 'I', 'V', '3')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
91 #define fccdiv3 mmioFOURCC('d', 'i', 'v', '3')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
92 #define fccDIV4 mmioFOURCC('D', 'I', 'V', '4')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
93 #define fccdiv4 mmioFOURCC('d', 'i', 'v', '4')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
94 #define fccDIV5 mmioFOURCC('D', 'I', 'V', '5')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
95 #define fccdiv5 mmioFOURCC('d', 'i', 'v', '5')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
96 #define fccDIV6 mmioFOURCC('D', 'I', 'V', '6')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
97 #define fccdiv6 mmioFOURCC('d', 'i', 'v', '6')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
98 #define fccMP41 mmioFOURCC('M', 'P', '4', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
99 #define fccmp41 mmioFOURCC('m', 'p', '4', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
100 #define fccMP43 mmioFOURCC('M', 'P', '4', '3')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
101 #define fccmp43 mmioFOURCC('m', 'p', '4', '3')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
102 /* old ms mpeg-4 codecs */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
103 #define fccMP42 mmioFOURCC('M', 'P', '4', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
104 #define fccmp42 mmioFOURCC('m', 'p', '4', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
105 #define fccMPG4 mmioFOURCC('M', 'P', 'G', '4')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
106 #define fccmpg4 mmioFOURCC('m', 'p', 'g', '4')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
107 /* Windows media codecs */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
108 #define fccWMV1 mmioFOURCC('W', 'M', 'V', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
109 #define fccwmv1 mmioFOURCC('w', 'm', 'v', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
110 #define fccWMV2 mmioFOURCC('W', 'M', 'V', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
111 #define fccwmv2 mmioFOURCC('w', 'm', 'v', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
112 #define fccMWV1 mmioFOURCC('M', 'W', 'V', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
113
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
114 /* Angel codecs */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
115 #define fccAP41 mmioFOURCC('A', 'P', '4', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
116 #define fccap41 mmioFOURCC('a', 'p', '4', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
117 #define fccAP42 mmioFOURCC('A', 'P', '4', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
118 #define fccap42 mmioFOURCC('a', 'p', '4', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
119
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
120 /* other codecs */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
121 #define fccIV31 mmioFOURCC('I', 'V', '3', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
122 #define fcciv31 mmioFOURCC('i', 'v', '3', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
123 #define fccIV32 mmioFOURCC('I', 'V', '3', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
124 #define fcciv32 mmioFOURCC('i', 'v', '3', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
125 #define fccIV41 mmioFOURCC('I', 'V', '4', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
126 #define fcciv41 mmioFOURCC('i', 'v', '4', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
127 #define fccIV50 mmioFOURCC('I', 'V', '5', '0')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
128 #define fcciv50 mmioFOURCC('i', 'v', '5', '0')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
129 #define fccI263 mmioFOURCC('I', '2', '6', '3')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
130 #define fcci263 mmioFOURCC('i', '2', '6', '3')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
131
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
132 #define fccMJPG mmioFOURCC('M', 'J', 'P', 'G')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
133 #define fccmjpg mmioFOURCC('m', 'j', 'p', 'g')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
134
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
135 #define fccHFYU mmioFOURCC('H', 'F', 'Y', 'U')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
136
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
137 #define fcccvid mmioFOURCC('c', 'v', 'i', 'd')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
138 #define fccdvsd mmioFOURCC('d', 'v', 's', 'd')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
139
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
140 /* Ati codecs */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
141 #define fccVCR2 mmioFOURCC('V', 'C', 'R', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
142 #define fccVCR1 mmioFOURCC('V', 'C', 'R', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
143 #define fccVYUY mmioFOURCC('V', 'Y', 'U', 'Y')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
144 #define fccYVU9 mmioFOURCC('I', 'Y', 'U', '9')
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 /* Asus codecs */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
147 #define fccASV1 mmioFOURCC('A', 'S', 'V', '1')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
148 #define fccASV2 mmioFOURCC('A', 'S', 'V', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
149
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
150 /* Microsoft video */
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
151 #define fcccram mmioFOURCC('c', 'r', 'a', 'm')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
152 #define fccCRAM mmioFOURCC('C', 'R', 'A', 'M')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
153 #define fccMSVC mmioFOURCC('M', 'S', 'V', 'C')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
154
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 fccMSZH mmioFOURCC('M', 'S', 'Z', 'H')
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 fccZLIB mmioFOURCC('Z', 'L', 'I', 'B')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
159
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
160 #define fccTM20 mmioFOURCC('T', 'M', '2', '0')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
161
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
162 #define fccYUV mmioFOURCC('Y', 'U', 'V', ' ')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
163 #define fccYUY2 mmioFOURCC('Y', 'U', 'Y', '2')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
164 #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
165 #define fccI420 mmioFOURCC('I', '4', '2', '0')
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
166 #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
167 #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
168 #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
169
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 struct BitmapInfo : public BITMAPINFOHEADER
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
172 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
173 int colors[3];
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
174
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
175 void SetBitFields16(){
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
176 biSize=sizeof(BITMAPINFOHEADER)+12;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
177 biCompression=3;//BI_BITFIELDS
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
178 biBitCount=16;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
179 biSizeImage=abs((int)(2*biWidth*biHeight));
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
180 colors[0]=0xF800;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
181 colors[1]=0x07E0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
182 colors[2]=0x001F;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
183 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
184 void SetBitFields15(){
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
185 biSize=sizeof(BITMAPINFOHEADER)+12;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
186 biCompression=3;//BI_BITFIELDS
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
187 biBitCount=16;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
188 biSizeImage=abs((int)(2*biWidth*biHeight));
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
189 colors[0]=0x7C00;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
190 colors[1]=0x03E0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
191 colors[2]=0x001F;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
192 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
193 void SetRGB(){
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
194 biSize = sizeof(BITMAPINFOHEADER);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
195 biCompression = 0; //BI_RGB
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
196 //biHeight = labs(biHeight);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
197 biSizeImage = labs(biWidth * biHeight) * ((biBitCount + 7) / 8);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
198 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
199 void SetBits(int bits) {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
200 switch (bits){
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
201 case 15: SetBitFields15();break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
202 case 16: SetBitFields16();break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
203 default: biBitCount = bits; SetRGB();break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
204 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
205 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
206 void SetSpace(int csp,int bits) {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
207 biSize = sizeof(BITMAPINFOHEADER);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
208 biCompression=csp;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
209 biBitCount=bits;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
210 biSizeImage=labs(biBitCount*biWidth*biHeight)>>3;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
211 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
212 void SetSpace(int csp) {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
213 int bits=0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
214 switch(csp){
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
215 case fccYUV:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
216 bits=24;break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
217 case fccYUY2:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
218 case fccUYVY:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
219 case fccYVYU:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
220 bits=16;break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
221 case fccYV12:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
222 case fccIYUV:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
223 case fccI420:
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
224 bits=12;break;
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 if (csp != 0 && csp != 3 && biHeight > 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
227 biHeight *= -1; // YUV formats uses should have height < 0
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
228 SetSpace(csp,bits);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
229 }
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 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
232
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
233 struct IAudioDecoder
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 WAVEFORMATEX in_fmt;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
236 const CodecInfo& record;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
237 IAudioDecoder(const CodecInfo& r, const WAVEFORMATEX* w) : record(r)
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 in_fmt = *w;
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 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
242
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
243 struct IAudioEncoder
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 IAudioEncoder(const CodecInfo&, WAVEFORMATEX*) {}
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
246 // you do not need this one...
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
247 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
248
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
249 struct IVideoDecoder
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
250 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
251 int VBUFSIZE;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
252 int QMARKHI;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
253 int QMARKLO;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
254 int DMARKHI;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
255 int DMARKLO;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
256
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
257 enum CAPS
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
258 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
259 CAP_NONE = 0,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
260 CAP_YUY2 = 1,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
261 CAP_YV12 = 2,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
262 CAP_IYUV = 4,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
263 CAP_UYVY = 8,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
264 CAP_YVYU = 16,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
265 CAP_I420 = 32,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
266 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
267 enum DecodingMode
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 DIRECT = 0,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
270 REALTIME,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
271 REALTIME_QUALITY_AUTO,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
272 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
273 enum DecodingState
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
274 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
275 STOP = 0,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
276 START,
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
277 };
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
278 IVideoDecoder(const CodecInfo& info, const BITMAPINFOHEADER& format) : record(info)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
279 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
280 // implement init part
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
281 unsigned bihs = (format.biSize < (int) sizeof(BITMAPINFOHEADER)) ?
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
282 sizeof(BITMAPINFOHEADER) : format.biSize;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
283 m_bh = (BITMAPINFOHEADER*) new char[bihs];
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
284 memcpy(m_bh, &format, bihs);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
285 m_State = STOP;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
286 //m_pFrame = 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
287 m_Mode = DIRECT;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
288 m_iDecpos = 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
289 m_iPlaypos = -1;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
290 m_fQuality = 0.0f;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
291 m_bCapable16b = true;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
292
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
293 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
294 virtual ~IVideoDecoder(){};
1558
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
295 // use this one
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
296 int Decode(void* src, size_t size, int is_keyframe, CImage* pImage)
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
297 { return DecodeInternal(src, size, is_keyframe, pImage); }
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
298 void Stop(){ StopInternal(); m_State = STOP;}
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
299 void Start(){StartInternal(); m_State = START;}
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
300 protected:
261f5fd2c909 error handling
arpi
parents: 1555
diff changeset
301 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
302 virtual void StartInternal()=0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
303 virtual void StopInternal()=0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
304
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
305 const CodecInfo& record;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
306 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
307 DecodingState m_State;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
308 int m_iDecpos;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
309 int m_iPlaypos;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
310 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
311 bool m_bCapable16b;
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 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
314 BitmapInfo m_decoder; // format of decoder output
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
315 BitmapInfo m_obh; // format of returned frames
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 struct IRtConfig
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 };
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
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
323
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
324 #endif
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
325
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
326 #endif