2 * Unit tests for video playback
4 * Copyright 2008,2010 Jörg Höhle
5 * Copyright 2008 Austin English
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define WIN32_LEAN_AND_MEAN
26 #include "wine/test.h"
28 static void test_OpenCase(void)
31 /* Open a compressor with combinations of lowercase
32 * and uppercase compressortype and handler.
34 h
= ICOpen(mmioFOURCC('v','i','d','c'),mmioFOURCC('m','s','v','c'),ICMODE_DECOMPRESS
);
35 ok(0!=h
,"ICOpen(vidc.msvc) failed\n");
37 ok(ICClose(h
)==ICERR_OK
,"ICClose failed\n");
39 h
= ICOpen(mmioFOURCC('v','i','d','c'),mmioFOURCC('M','S','V','C'),ICMODE_DECOMPRESS
);
40 ok(0!=h
,"ICOpen(vidc.MSVC) failed\n");
42 ok(ICClose(h
)==ICERR_OK
,"ICClose failed\n");
44 h
= ICOpen(mmioFOURCC('V','I','D','C'),mmioFOURCC('m','s','v','c'),ICMODE_DECOMPRESS
);
45 ok(0!=h
,"ICOpen(VIDC.msvc) failed\n");
47 ok(ICClose(h
)==ICERR_OK
,"ICClose failed\n");
49 h
= ICOpen(mmioFOURCC('V','I','D','C'),mmioFOURCC('M','S','V','C'),ICMODE_DECOMPRESS
);
50 ok(0!=h
,"ICOpen(VIDC.MSVC) failed\n");
52 ok(ICClose(h
)==ICERR_OK
,"ICClose failed\n");
54 h
= ICOpen(mmioFOURCC('v','i','d','c'),mmioFOURCC('m','S','v','C'),ICMODE_DECOMPRESS
);
55 ok(0!=h
,"ICOpen(vidc.mSvC) failed\n");
57 ok(ICClose(h
)==ICERR_OK
,"ICClose failed\n");
59 h
= ICOpen(mmioFOURCC('v','I','d','C'),mmioFOURCC('m','s','v','c'),ICMODE_DECOMPRESS
);
60 ok(0!=h
,"ICOpen(vIdC.msvc) failed\n");
62 ok(ICClose(h
)==ICERR_OK
,"ICClose failed\n");
66 static void test_Locate(void)
68 static BITMAPINFOHEADER bi
= {sizeof(BITMAPINFOHEADER
),32,8, 1,8, BI_RLE8
, 0,100000,100000, 0,0};
69 static BITMAPINFOHEADER bo
= {sizeof(BITMAPINFOHEADER
),32,8, 1,8, BI_RGB
, 0,100000,100000, 0,0};
73 /* Oddly, MSDN documents that ICLocate takes BITMAPINFOHEADER
74 * pointers, while ICDecompressQuery takes the larger
75 * BITMAPINFO. Probably it's all the same as long as the
76 * variable length color quads are present when they are
79 h
= ICLocate(ICTYPE_VIDEO
, 0, &bi
, &bo
, ICMODE_DECOMPRESS
);
80 ok(h
!= 0, "RLE8->RGB failed\n");
81 if (h
) ok(ICClose(h
) == ICERR_OK
,"ICClose failed\n");
83 bo
.biHeight
= - bo
.biHeight
;
84 h
= ICLocate(ICTYPE_VIDEO
, 0, &bi
, &bo
, ICMODE_DECOMPRESS
);
85 ok(h
== 0, "RLE8->RGB height<0 succeeded\n");
86 if (h
) ok(ICClose(h
) == ICERR_OK
,"ICClose failed\n");
87 bo
.biHeight
= - bo
.biHeight
;
89 bi
.biCompression
= mmioFOURCC('c','v','i','d'); /* Cinepak */
90 h
= ICOpen(ICTYPE_VIDEO
, mmioFOURCC('c','v','i','d'), ICMODE_DECOMPRESS
);
91 if (h
== 0) win_skip("Cinepak/ICCVID codec not found\n");
93 bo
.biBitCount
= bi
.biBitCount
= 32;
94 err
= ICDecompressQuery(h
, &bi
, &bo
);
95 ok(err
== ICERR_OK
, "Query cvid->RGB32: %d\n", err
);
97 err
= ICDecompressQuery(h
, &bi
, NULL
);
98 ok(err
== ICERR_OK
, "Query cvid 32: %d\n", err
);
100 bo
.biHeight
= -bo
.biHeight
;
101 err
= ICDecompressQuery(h
, &bi
, &bo
);
102 todo_wine
ok(err
== ICERR_OK
, "Query cvid->RGB32 height<0: %d\n", err
);
103 bo
.biHeight
= -bo
.biHeight
;
105 ok(ICClose(h
) == ICERR_OK
,"ICClose failed\n");
107 bo
.biBitCount
= bi
.biBitCount
= 8;
108 h
= ICLocate(ICTYPE_VIDEO
, 0, &bi
, &bo
, ICMODE_DECOMPRESS
);
109 todo_wine
ok(h
!= 0, "cvid->RGB8 failed\n");
110 if (h
) ok(ICClose(h
) == ICERR_OK
,"ICClose failed\n");
111 bo
.biHeight
= - bo
.biHeight
;
112 h
= ICLocate(ICTYPE_VIDEO
, 0, &bi
, &bo
, ICMODE_DECOMPRESS
);
113 todo_wine
ok(h
!= 0, "cvid->RGB8 height<0 failed\n");
114 if (h
) ok(ICClose(h
) == ICERR_OK
,"ICClose failed\n");
115 bo
.biHeight
= - bo
.biHeight
;
117 bo
.biBitCount
= bi
.biBitCount
= 16;
118 h
= ICLocate(ICTYPE_VIDEO
, 0, &bi
, &bo
, ICMODE_DECOMPRESS
);
119 ok(h
!= 0, "cvid->RGB16 failed\n");
120 if (h
) ok(ICClose(h
) == ICERR_OK
,"ICClose failed\n");
121 bo
.biHeight
= - bo
.biHeight
;
122 h
= ICLocate(ICTYPE_VIDEO
, 0, &bi
, &bo
, ICMODE_DECOMPRESS
);
123 todo_wine
ok(h
!= 0, "cvid->RGB16 height<0 failed\n");
124 if (h
) ok(ICClose(h
) == ICERR_OK
,"ICClose failed\n");
125 bo
.biHeight
= - bo
.biHeight
;
127 bo
.biBitCount
= bi
.biBitCount
= 32;
128 h
= ICLocate(ICTYPE_VIDEO
, 0, &bi
, &bo
, ICMODE_DECOMPRESS
);
129 ok(h
!= 0, "cvid->RGB32 failed\n");
130 if (h
) ok(ICClose(h
) == ICERR_OK
,"ICClose failed\n");
131 bo
.biHeight
= - bo
.biHeight
;
132 h
= ICLocate(ICTYPE_VIDEO
, 0, &bi
, &bo
, ICMODE_DECOMPRESS
);
133 todo_wine
ok(h
!= 0, "cvid->RGB32 height<0 failed\n");
134 if (h
) ok(ICClose(h
) == ICERR_OK
,"ICClose failed\n");
135 bo
.biHeight
= - bo
.biHeight
;
137 bi
.biCompression
= mmioFOURCC('C','V','I','D');
138 /* Unlike ICOpen, upper case fails with ICLocate. */
139 h
= ICLocate(ICTYPE_VIDEO
, 0, &bi
, &bo
, ICMODE_DECOMPRESS
);
140 ok(h
== 0, "CVID->RGB32 upper case succeeded\n");
141 if (h
) ok(ICClose(h
) == ICERR_OK
,"ICClose failed\n");
144 bi
.biCompression
= mmioFOURCC('M','S','V','C'); /* MS Video 1 */
146 bo
.biBitCount
= bi
.biBitCount
= 16;
147 h
= ICLocate(ICTYPE_VIDEO
, 0, &bi
, &bo
, ICMODE_DECOMPRESS
);
148 ok(h
!= 0, "MSVC->RGB16 failed\n");
149 if (h
) ok(ICClose(h
) == ICERR_OK
,"ICClose failed\n");
151 bo
.biHeight
= - bo
.biHeight
;
152 h
= ICLocate(ICTYPE_VIDEO
, 0, &bi
, &bo
, ICMODE_DECOMPRESS
);
153 todo_wine
ok(h
!= 0, "MSVC->RGB16 height<0 failed\n");
154 if (h
) ok(ICClose(h
) == ICERR_OK
,"ICClose failed\n");
155 bo
.biHeight
= - bo
.biHeight
;
158 h
= ICLocate(ICTYPE_VIDEO
, 0, &bi
, &bo
, ICMODE_DECOMPRESS
);
159 ok(h
== 0, "MSVC->RGB16 height too small succeeded\n");
160 if (h
) ok(ICClose(h
) == ICERR_OK
,"ICClose failed\n");
163 /* ICLocate wants upper case MSVC */
164 bi
.biCompression
= mmioFOURCC('m','s','v','c');
165 h
= ICLocate(ICTYPE_VIDEO
, 0, &bi
, &bo
, ICMODE_DECOMPRESS
);
166 ok(h
== 0, "msvc->RGB16 succeeded\n");
167 if (h
) ok(ICClose(h
) == ICERR_OK
,"ICClose failed\n");
169 bi
.biCompression
= mmioFOURCC('M','S','V','C');
170 h
= ICOpen(ICTYPE_VIDEO
, mmioFOURCC('M','S','V','C'), ICMODE_DECOMPRESS
);
171 ok(h
!= 0, "No MSVC codec installed!?\n");
173 err
= ICDecompressQuery(h
, &bi
, &bo
);
174 ok(err
== ICERR_OK
, "Query MSVC->RGB16: %d\n", err
);
176 err
= ICDecompressQuery(h
, &bi
, NULL
);
177 ok(err
== ICERR_OK
, "Query MSVC 16: %d\n", err
);
179 bo
.biHeight
= -bo
.biHeight
;
180 err
= ICDecompressQuery(h
, &bi
, &bo
);
181 todo_wine
ok(err
== ICERR_OK
, "Query MSVC->RGB16 height<0: %d\n", err
);
182 bo
.biHeight
= -bo
.biHeight
;
184 bi
.biCompression
= mmioFOURCC('m','s','v','c');
185 err
= ICDecompressQuery(h
, &bi
, &bo
);
186 ok(err
== ICERR_BADFORMAT
, "Query msvc->RGB16: %d\n", err
);
188 ok(ICClose(h
) == ICERR_OK
,"ICClose failed\n");
191 bi
.biCompression
= BI_RGB
;
192 bo
.biBitCount
= bi
.biBitCount
= 8;
193 h
= ICLocate(ICTYPE_VIDEO
, 0, &bi
, &bo
, ICMODE_DECOMPRESS
);
194 todo_wine
ok(h
!= 0, "RGB8->RGB identity failed\n");
195 if (h
) ok(ICClose(h
) == ICERR_OK
,"ICClose failed\n");
197 bi
.biCompression
= BI_RLE8
;
198 h
= ICLocate(ICTYPE_VIDEO
, 0, &bi
, &bo
, ICMODE_DECOMPRESS
);
199 ok(h
!= 0, "RLE8->RGB again failed\n");
200 if (h
) ok(ICClose(h
) == ICERR_OK
,"ICClose failed\n");