Mercurial > mplayer.hg
annotate loader/dshow/DS_VideoDecoder.c @ 23046:82216ef041e0
updated vidix files headers whenever it's possible to have a clear GPL statement
author | ben |
---|---|
date | Sun, 22 Apr 2007 14:05:41 +0000 |
parents | 49f01f8fbd60 |
children | 450bb2a75cba |
rev | line source |
---|---|
1545 | 1 /******************************************************** |
2 | |
3 DirectShow Video decoder implementation | |
4 Copyright 2000 Eugene Kuznetsov (divx@euro.ru) | |
5 | |
6 *********************************************************/ | |
9967
b0d1b415320c
cygwin support patch by Sascha Sommer and some fixes by me
alex
parents:
9581
diff
changeset
|
7 #include "config.h" |
1545 | 8 #include "guids.h" |
9 #include "interfaces.h" | |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7316
diff
changeset
|
10 #include "registry.h" |
1545 | 11 |
3946 | 12 #ifndef NOAVIFILE_HEADERS |
13 #include "videodecoder.h" | |
14 #else | |
15 #include "libwin32.h" | |
16 #endif | |
17 #include "DS_Filter.h" | |
18 | |
19 struct _DS_VideoDecoder | |
20 { | |
21 IVideoDecoder iv; | |
22 | |
23 DS_Filter* m_pDS_Filter; | |
24 AM_MEDIA_TYPE m_sOurType, m_sDestType; | |
25 VIDEOINFOHEADER* m_sVhdr; | |
26 VIDEOINFOHEADER* m_sVhdr2; | |
27 int m_Caps;//CAPS m_Caps; // capabilities of DirectShow decoder | |
28 int m_iLastQuality; // remember last quality as integer | |
29 int m_iMinBuffers; | |
30 int m_iMaxAuto; | |
31 int m_bIsDivX; // for speed | |
32 int m_bIsDivX4; // for speed | |
33 }; | |
22398
49f01f8fbd60
Rework of copying samples from directshow codecs.
voroshil
parents:
22307
diff
changeset
|
34 static SampleProcUserData sampleProcData; |
3946 | 35 |
1545 | 36 #include "DS_VideoDecoder.h" |
3946 | 37 |
3059 | 38 #include "../wine/winerror.h" |
9967
b0d1b415320c
cygwin support patch by Sascha Sommer and some fixes by me
alex
parents:
9581
diff
changeset
|
39 #ifdef WIN32_LOADER |
8451 | 40 #include "../ldt_keeper.h" |
9967
b0d1b415320c
cygwin support patch by Sascha Sommer and some fixes by me
alex
parents:
9581
diff
changeset
|
41 #endif |
3059 | 42 |
43 #ifndef NOAVIFILE_HEADERS | |
44 #define VFW_E_NOT_RUNNING 0x80040226 | |
45 #include "fourcc.h" | |
46 #include "except.h" | |
47 #endif | |
1545 | 48 |
49 #include <unistd.h> | |
50 #include <fcntl.h> | |
51 #include <errno.h> | |
52 #include <sys/types.h> | |
9978 | 53 #ifndef __MINGW32__ |
1545 | 54 #include <sys/mman.h> |
9978 | 55 #endif |
3059 | 56 #include <stdio.h> |
57 #include <stdlib.h> // labs | |
2072 | 58 |
3059 | 59 // strcmp((const char*)info.dll,...) is used instead of (... == ...) |
60 // so Arpi could use char* pointer in his simplified DS_VideoDecoder class | |
1545 | 61 |
3059 | 62 #define false 0 |
63 #define true 1 | |
64 | |
65 int DS_VideoDecoder_GetCapabilities(DS_VideoDecoder *this) | |
66 {return this->m_Caps;} | |
67 | |
68 typedef struct _ct ct; | |
1545 | 69 |
3059 | 70 struct _ct { |
71 unsigned int bits; | |
72 fourcc_t fcc; | |
8451 | 73 const GUID *subtype; |
3059 | 74 int cap; |
75 }; | |
76 | |
77 static ct check[] = { | |
78 {16, fccYUY2, &MEDIASUBTYPE_YUY2, CAP_YUY2}, | |
79 {12, fccIYUV, &MEDIASUBTYPE_IYUV, CAP_IYUV}, | |
80 {16, fccUYVY, &MEDIASUBTYPE_UYVY, CAP_UYVY}, | |
81 {12, fccYV12, &MEDIASUBTYPE_YV12, CAP_YV12}, | |
6527 | 82 //{16, fccYV12, &MEDIASUBTYPE_YV12, CAP_YV12}, |
3059 | 83 {16, fccYVYU, &MEDIASUBTYPE_YVYU, CAP_YVYU}, |
6527 | 84 {12, fccI420, &MEDIASUBTYPE_I420, CAP_I420}, |
85 {9, fccYVU9, &MEDIASUBTYPE_YVU9, CAP_YVU9}, | |
9581 | 86 {0, 0, 0, 0}, |
3059 | 87 }; |
88 | |
89 | |
3444 | 90 DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER * format, int flip, int maxauto) |
1545 | 91 { |
3059 | 92 DS_VideoDecoder *this; |
93 HRESULT result; | |
94 ct* c; | |
95 | |
96 this = malloc(sizeof(DS_VideoDecoder)); | |
97 memset( this, 0, sizeof(DS_VideoDecoder)); | |
98 | |
99 this->m_sVhdr2 = 0; | |
100 this->m_iLastQuality = -1; | |
101 this->m_iMaxAuto = maxauto; | |
102 | |
9967
b0d1b415320c
cygwin support patch by Sascha Sommer and some fixes by me
alex
parents:
9581
diff
changeset
|
103 #ifdef WIN32_LOADER |
3063 | 104 Setup_LDT_Keeper(); |
9967
b0d1b415320c
cygwin support patch by Sascha Sommer and some fixes by me
alex
parents:
9581
diff
changeset
|
105 #endif |
3063 | 106 |
1545 | 107 //memset(&m_obh, 0, sizeof(m_obh)); |
108 //m_obh.biSize = sizeof(m_obh); | |
3059 | 109 /*try*/ |
1545 | 110 { |
3059 | 111 unsigned int bihs; |
112 | |
113 bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ? | |
114 sizeof(BITMAPINFOHEADER) : format->biSize; | |
115 | |
18878 | 116 this->iv.m_bh = malloc(bihs); |
3059 | 117 memcpy(this->iv.m_bh, format, bihs); |
22187
88b36fd17976
Precent overflow of this->m_sVhdr->bmiHeader buffer, may have been
rtogni
parents:
22001
diff
changeset
|
118 this->iv.m_bh->biSize = bihs; |
4205
c42ab0e5bbbc
possible sig11 fixed - noticed by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3978
diff
changeset
|
119 |
3059 | 120 this->iv.m_State = STOP; |
121 //this->iv.m_pFrame = 0; | |
122 this->iv.m_Mode = DIRECT; | |
123 this->iv.m_iDecpos = 0; | |
124 this->iv.m_iPlaypos = -1; | |
125 this->iv.m_fQuality = 0.0f; | |
126 this->iv.m_bCapable16b = true; | |
127 | |
4205
c42ab0e5bbbc
possible sig11 fixed - noticed by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3978
diff
changeset
|
128 bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER); |
18878 | 129 this->m_sVhdr = malloc(bihs); |
3059 | 130 memset(this->m_sVhdr, 0, bihs); |
131 memcpy(&this->m_sVhdr->bmiHeader, this->iv.m_bh, this->iv.m_bh->biSize); | |
132 this->m_sVhdr->rcSource.left = this->m_sVhdr->rcSource.top = 0; | |
133 this->m_sVhdr->rcSource.right = this->m_sVhdr->bmiHeader.biWidth; | |
134 this->m_sVhdr->rcSource.bottom = this->m_sVhdr->bmiHeader.biHeight; | |
135 //this->m_sVhdr->rcSource.right = 0; | |
136 //this->m_sVhdr->rcSource.bottom = 0; | |
137 this->m_sVhdr->rcTarget = this->m_sVhdr->rcSource; | |
1545 | 138 |
3059 | 139 this->m_sOurType.majortype = MEDIATYPE_Video; |
140 this->m_sOurType.subtype = MEDIATYPE_Video; | |
141 this->m_sOurType.subtype.f1 = this->m_sVhdr->bmiHeader.biCompression; | |
142 this->m_sOurType.formattype = FORMAT_VideoInfo; | |
143 this->m_sOurType.bFixedSizeSamples = false; | |
144 this->m_sOurType.bTemporalCompression = true; | |
145 this->m_sOurType.pUnk = 0; | |
146 this->m_sOurType.cbFormat = bihs; | |
147 this->m_sOurType.pbFormat = (char*)this->m_sVhdr; | |
148 | |
149 this->m_sVhdr2 = (VIDEOINFOHEADER*)(malloc(sizeof(VIDEOINFOHEADER)+12)); | |
150 memcpy(this->m_sVhdr2, this->m_sVhdr, sizeof(VIDEOINFOHEADER)); | |
151 memset((char*)this->m_sVhdr2 + sizeof(VIDEOINFOHEADER), 0, 12); | |
152 this->m_sVhdr2->bmiHeader.biCompression = 0; | |
153 this->m_sVhdr2->bmiHeader.biBitCount = 24; | |
1545 | 154 |
3059 | 155 memset(&this->m_sDestType, 0, sizeof(this->m_sDestType)); |
156 this->m_sDestType.majortype = MEDIATYPE_Video; | |
157 this->m_sDestType.subtype = MEDIASUBTYPE_RGB24; | |
158 this->m_sDestType.formattype = FORMAT_VideoInfo; | |
159 this->m_sDestType.bFixedSizeSamples = true; | |
160 this->m_sDestType.bTemporalCompression = false; | |
161 this->m_sDestType.lSampleSize = labs(this->m_sVhdr2->bmiHeader.biWidth*this->m_sVhdr2->bmiHeader.biHeight | |
162 * ((this->m_sVhdr2->bmiHeader.biBitCount + 7) / 8)); | |
163 this->m_sVhdr2->bmiHeader.biSizeImage = this->m_sDestType.lSampleSize; | |
164 this->m_sDestType.pUnk = 0; | |
165 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); | |
166 this->m_sDestType.pbFormat = (char*)this->m_sVhdr2; | |
167 | |
168 memset(&this->iv.m_obh, 0, sizeof(this->iv.m_obh)); | |
169 memcpy(&this->iv.m_obh, this->iv.m_bh, sizeof(this->iv.m_obh) < (unsigned) this->iv.m_bh->biSize | |
170 ? sizeof(this->iv.m_obh) : (unsigned) this->iv.m_bh->biSize); | |
171 this->iv.m_obh.biBitCount=24; | |
172 this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER); | |
173 this->iv.m_obh.biCompression = 0; //BI_RGB | |
174 //this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight); | |
175 this->iv.m_obh.biSizeImage = labs(this->iv.m_obh.biWidth * this->iv.m_obh.biHeight) | |
176 * ((this->iv.m_obh.biBitCount + 7) / 8); | |
1545 | 177 |
178 | |
22398
49f01f8fbd60
Rework of copying samples from directshow codecs.
voroshil
parents:
22307
diff
changeset
|
179 this->m_pDS_Filter = DS_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType,&sampleProcData); |
3456 | 180 |
181 if (!this->m_pDS_Filter) | |
182 { | |
183 printf("Failed to create DirectShow filter\n"); | |
184 return 0; | |
185 } | |
1545 | 186 |
187 if (!flip) | |
188 { | |
3059 | 189 this->iv.m_obh.biHeight *= -1; |
3466 | 190 this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight; |
3059 | 191 result = this->m_pDS_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDS_Filter->m_pOutputPin, &this->m_sDestType); |
1545 | 192 if (result) |
193 { | |
3466 | 194 printf("Decoder does not support upside-down RGB frames\n"); |
3059 | 195 this->iv.m_obh.biHeight *= -1; |
3466 | 196 this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight; |
1545 | 197 } |
198 } | |
199 | |
3059 | 200 memcpy( &this->iv.m_decoder, &this->iv.m_obh, sizeof(this->iv.m_obh) ); |
1545 | 201 |
3059 | 202 switch (this->iv.m_bh->biCompression) |
1545 | 203 { |
6527 | 204 #if 0 |
1545 | 205 case fccDIV3: |
206 case fccDIV4: | |
207 case fccDIV5: | |
3059 | 208 case fccDIV6: |
1545 | 209 case fccMP42: |
210 case fccWMV2: | |
211 //YV12 seems to be broken for DivX :-) codec | |
3060 | 212 // case fccIV50: |
1545 | 213 //produces incorrect picture |
214 //m_Caps = (CAPS) (m_Caps & ~CAP_YV12); | |
3059 | 215 //m_Caps = CAP_UYVY;//CAP_YUY2; // | CAP_I420; |
216 //m_Caps = CAP_I420; | |
217 this->m_Caps = (CAP_YUY2 | CAP_UYVY); | |
1545 | 218 break; |
6527 | 219 #endif |
1545 | 220 default: |
3059 | 221 |
222 this->m_Caps = CAP_NONE; | |
1545 | 223 |
6527 | 224 printf("Decoder supports the following YUV formats: "); |
3059 | 225 for (c = check; c->bits; c++) |
1545 | 226 { |
3059 | 227 this->m_sVhdr2->bmiHeader.biBitCount = c->bits; |
228 this->m_sVhdr2->bmiHeader.biCompression = c->fcc; | |
229 this->m_sDestType.subtype = *c->subtype; | |
230 result = this->m_pDS_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDS_Filter->m_pOutputPin, &this->m_sDestType); | |
1545 | 231 if (!result) |
6527 | 232 { |
3059 | 233 this->m_Caps = (this->m_Caps | c->cap); |
8451 | 234 printf("%.4s ", (char *)&c->fcc); |
6527 | 235 } |
1545 | 236 } |
6527 | 237 printf("\n"); |
1545 | 238 } |
239 | |
3059 | 240 if (this->m_Caps != CAP_NONE) |
6527 | 241 printf("Decoder is capable of YUV output (flags 0x%x)\n", (int)this->m_Caps); |
1545 | 242 |
3059 | 243 this->m_sVhdr2->bmiHeader.biBitCount = 24; |
244 this->m_sVhdr2->bmiHeader.biCompression = 0; | |
245 this->m_sDestType.subtype = MEDIASUBTYPE_RGB24; | |
1545 | 246 |
3059 | 247 this->m_iMinBuffers = this->iv.VBUFSIZE; |
3444 | 248 this->m_bIsDivX = (strcmp(dllname, "divxcvki.ax") == 0 |
249 || strcmp(dllname, "divx_c32.ax") == 0 | |
250 || strcmp(dllname, "wmvds32.ax") == 0 | |
251 || strcmp(dllname, "wmv8ds32.ax") == 0); | |
252 this->m_bIsDivX4 = (strcmp(dllname, "divxdec.ax") == 0); | |
3059 | 253 if (this->m_bIsDivX) |
254 this->iv.VBUFSIZE += 7; | |
255 else if (this->m_bIsDivX4) | |
256 this->iv.VBUFSIZE += 9; | |
1545 | 257 } |
3059 | 258 /*catch (FatalError& error) |
1545 | 259 { |
3059 | 260 delete[] m_sVhdr; |
1545 | 261 delete[] m_sVhdr2; |
262 delete m_pDS_Filter; | |
263 throw; | |
3059 | 264 }*/ |
265 return this; | |
1545 | 266 } |
267 | |
3059 | 268 void DS_VideoDecoder_Destroy(DS_VideoDecoder *this) |
1545 | 269 { |
3059 | 270 DS_VideoDecoder_StopInternal(this); |
271 this->iv.m_State = STOP; | |
272 free(this->m_sVhdr); | |
273 free(this->m_sVhdr2); | |
274 DS_Filter_Destroy(this->m_pDS_Filter); | |
1545 | 275 } |
276 | |
3059 | 277 void DS_VideoDecoder_StartInternal(DS_VideoDecoder *this) |
1545 | 278 { |
3059 | 279 ALLOCATOR_PROPERTIES props, props1; |
280 Debug printf("DS_VideoDecoder_StartInternal\n"); | |
1545 | 281 //cout << "DSSTART" << endl; |
22304
254733f57707
Fixed loading of VoxWare and wma9sp binary audio codecs using dshow engine.
voroshil
parents:
22187
diff
changeset
|
282 this->m_pDS_Filter->m_pAll->vt->Commit(this->m_pDS_Filter->m_pAll); |
3063 | 283 this->m_pDS_Filter->Start(this->m_pDS_Filter); |
3059 | 284 |
3957
49290522ab06
SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents:
3946
diff
changeset
|
285 this->iv.m_State = START; |
1545 | 286 } |
287 | |
3059 | 288 void DS_VideoDecoder_StopInternal(DS_VideoDecoder *this) |
1545 | 289 { |
3063 | 290 this->m_pDS_Filter->Stop(this->m_pDS_Filter); |
1545 | 291 //??? why was this here ??? m_pOurOutput->SetFramePointer(0); |
292 } | |
293 | |
3063 | 294 int DS_VideoDecoder_DecodeInternal(DS_VideoDecoder *this, const void* src, int size, int is_keyframe, char* pImage) |
1545 | 295 { |
296 IMediaSample* sample = 0; | |
3059 | 297 char* ptr; |
298 int result; | |
299 | |
3063 | 300 Debug printf("DS_VideoDecoder_DecodeInternal(%p,%p,%d,%d,%p)\n",this,src,size,is_keyframe,pImage); |
3059 | 301 |
302 this->m_pDS_Filter->m_pAll->vt->GetBuffer(this->m_pDS_Filter->m_pAll, &sample, 0, 0, 0); | |
303 | |
1545 | 304 if (!sample) |
305 { | |
3059 | 306 Debug printf("ERROR: null sample\n"); |
1545 | 307 return -1; |
308 } | |
3059 | 309 |
1545 | 310 //cout << "DECODE " << (void*) pImage << " d: " << (void*) pImage->Data() << endl; |
311 | |
3059 | 312 |
3466 | 313 sample->vt->SetActualDataLength(sample, size); |
1545 | 314 sample->vt->GetPointer(sample, (BYTE **)&ptr); |
315 memcpy(ptr, src, size); | |
316 sample->vt->SetSyncPoint(sample, is_keyframe); | |
317 sample->vt->SetPreroll(sample, pImage ? 0 : 1); | |
318 // sample->vt->SetMediaType(sample, &m_sOurType); | |
319 | |
320 // FIXME: - crashing with YV12 at this place decoder will crash | |
321 // while doing this call | |
322 // %FS register was not setup for calling into win32 dll. Are all | |
323 // crashes inside ...->Receive() fixed now? | |
324 // | |
325 // nope - but this is surely helpfull - I'll try some more experiments | |
9967
b0d1b415320c
cygwin support patch by Sascha Sommer and some fixes by me
alex
parents:
9581
diff
changeset
|
326 #ifdef WIN32_LOADER |
3060 | 327 Setup_FS_Segment(); |
9967
b0d1b415320c
cygwin support patch by Sascha Sommer and some fixes by me
alex
parents:
9581
diff
changeset
|
328 #endif |
1545 | 329 #if 0 |
3059 | 330 if (!this->m_pDS_Filter || !this->m_pDS_Filter->m_pImp |
331 || !this->m_pDS_Filter->m_pImp->vt | |
332 || !this->m_pDS_Filter->m_pImp->vt->Receive) | |
1545 | 333 printf("DecodeInternal ERROR???\n"); |
334 #endif | |
3059 | 335 result = this->m_pDS_Filter->m_pImp->vt->Receive(this->m_pDS_Filter->m_pImp, sample); |
1545 | 336 if (result) |
337 { | |
338 Debug printf("DS_VideoDecoder::DecodeInternal() error putting data into input pin %x\n", result); | |
339 } | |
22398
49f01f8fbd60
Rework of copying samples from directshow codecs.
voroshil
parents:
22307
diff
changeset
|
340 if (pImage) |
49f01f8fbd60
Rework of copying samples from directshow codecs.
voroshil
parents:
22307
diff
changeset
|
341 { |
49f01f8fbd60
Rework of copying samples from directshow codecs.
voroshil
parents:
22307
diff
changeset
|
342 memcpy(pImage, sampleProcData.frame_pointer, sampleProcData.frame_size); |
49f01f8fbd60
Rework of copying samples from directshow codecs.
voroshil
parents:
22307
diff
changeset
|
343 } |
1545 | 344 sample->vt->Release((IUnknown*)sample); |
345 | |
3059 | 346 #if 0 |
347 if (this->m_bIsDivX) | |
1545 | 348 { |
349 int q; | |
3059 | 350 IHidden* hidden=(IHidden*)((int)this->m_pDS_Filter->m_pFilter + 0xb8); |
1545 | 351 // always check for actual value |
352 // this seems to be the only way to know the actual value | |
3059 | 353 hidden->vt->GetSmth2(hidden, &this->m_iLastQuality); |
354 if (this->m_iLastQuality > 9) | |
355 this->m_iLastQuality -= 10; | |
356 | |
357 if (this->m_iLastQuality < 0) | |
358 this->m_iLastQuality = 0; | |
359 else if (this->m_iLastQuality > this->m_iMaxAuto) | |
360 this->m_iLastQuality = this->m_iMaxAuto; | |
1545 | 361 |
3059 | 362 //cout << " Qual: " << this->m_iLastQuality << endl; |
363 this->iv.m_fQuality = this->m_iLastQuality / 4.0; | |
364 } | |
365 else if (this->m_bIsDivX4) | |
366 { | |
367 | |
368 // maybe access methods directly to safe some cpu cycles... | |
369 DS_VideoDecoder_GetValue(this, "Postprocessing", this->m_iLastQuality); | |
370 if (this->m_iLastQuality < 0) | |
371 this->m_iLastQuality = 0; | |
372 else if (this->m_iLastQuality > this->m_iMaxAuto) | |
373 this->m_iLastQuality = this->m_iMaxAuto; | |
1545 | 374 |
375 //cout << " Qual: " << m_iLastQuality << endl; | |
3059 | 376 this->iv.m_fQuality = this->m_iLastQuality / 6.0; |
1545 | 377 } |
378 | |
3059 | 379 if (this->iv.m_Mode == -1 ) // ???BUFFERED_QUALITY_AUTO) |
1545 | 380 { |
381 // adjust Quality - depends on how many cached frames we have | |
3059 | 382 int buffered = this->iv.m_iDecpos - this->iv.m_iPlaypos; |
1545 | 383 |
3059 | 384 if (this->m_bIsDivX || this->m_bIsDivX4) |
385 { | |
386 int to = buffered - this->m_iMinBuffers; | |
387 if (to < 0) | |
388 to = 0; | |
389 if (to != this->m_iLastQuality) | |
390 { | |
391 if (to > this->m_iMaxAuto) | |
392 to = this->m_iMaxAuto; | |
393 if (this->m_iLastQuality != to) | |
1545 | 394 { |
3059 | 395 if (this->m_bIsDivX) |
396 { | |
397 IHidden* hidden=(IHidden*)((int)this->m_pDS_Filter->m_pFilter + 0xb8); | |
398 hidden->vt->SetSmth(hidden, to, 0); | |
399 } | |
400 else | |
401 DS_VideoDecoder_SetValue(this, "Postprocessing", to); | |
1545 | 402 #ifndef QUIET |
3059 | 403 //printf("Switching quality %d -> %d b:%d\n",m_iLastQuality, to, buffered); |
1545 | 404 #endif |
405 } | |
406 } | |
407 } | |
408 } | |
3059 | 409 #endif |
1545 | 410 |
411 return 0; | |
412 } | |
413 | |
414 /* | |
415 * bits == 0 - leave unchanged | |
416 */ | |
3059 | 417 //int SetDestFmt(DS_VideoDecoder * this, int bits = 24, fourcc_t csp = 0); |
3946 | 418 int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, unsigned int csp) |
1545 | 419 { |
3059 | 420 HRESULT result; |
22307
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
421 ALLOCATOR_PROPERTIES props,props1; |
3059 | 422 int should_test=1; |
423 int stoped = 0; | |
424 | |
425 Debug printf("DS_VideoDecoder_SetDestFmt (%p, %d, %d)\n",this,bits,(int)csp); | |
426 | |
427 /* if (!CImage::Supported(csp, bits)) | |
1545 | 428 return -1; |
3059 | 429 */ |
1545 | 430 // BitmapInfo temp = m_obh; |
3059 | 431 |
3063 | 432 if (!csp) // RGB |
1545 | 433 { |
3059 | 434 int ok = true; |
1545 | 435 |
436 switch (bits) | |
437 { | |
438 case 15: | |
3059 | 439 this->m_sDestType.subtype = MEDIASUBTYPE_RGB555; |
1545 | 440 break; |
441 case 16: | |
3059 | 442 this->m_sDestType.subtype = MEDIASUBTYPE_RGB565; |
1545 | 443 break; |
444 case 24: | |
3059 | 445 this->m_sDestType.subtype = MEDIASUBTYPE_RGB24; |
1545 | 446 break; |
447 case 32: | |
3059 | 448 this->m_sDestType.subtype = MEDIASUBTYPE_RGB32; |
1545 | 449 break; |
450 default: | |
451 ok = false; | |
452 break; | |
453 } | |
454 | |
3059 | 455 if (ok) { |
9581 | 456 if (bits == 15) |
457 this->iv.m_obh.biBitCount=16; | |
458 else | |
459 this->iv.m_obh.biBitCount=bits; | |
3059 | 460 if( bits == 15 || bits == 16 ) { |
461 this->iv.m_obh.biSize=sizeof(BITMAPINFOHEADER)+12; | |
462 this->iv.m_obh.biCompression=3;//BI_BITFIELDS | |
463 this->iv.m_obh.biSizeImage=abs((int)(2*this->iv.m_obh.biWidth*this->iv.m_obh.biHeight)); | |
464 } | |
465 | |
466 if( bits == 16 ) { | |
467 this->iv.m_obh.colors[0]=0xF800; | |
468 this->iv.m_obh.colors[1]=0x07E0; | |
469 this->iv.m_obh.colors[2]=0x001F; | |
470 } else if ( bits == 15 ) { | |
471 this->iv.m_obh.colors[0]=0x7C00; | |
472 this->iv.m_obh.colors[1]=0x03E0; | |
473 this->iv.m_obh.colors[2]=0x001F; | |
474 } else { | |
475 this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER); | |
476 this->iv.m_obh.biCompression = 0; //BI_RGB | |
477 //this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight); | |
478 this->iv.m_obh.biSizeImage = labs(this->iv.m_obh.biWidth * this->iv.m_obh.biHeight) | |
479 * ((this->iv.m_obh.biBitCount + 7) / 8); | |
480 } | |
481 } | |
1545 | 482 //.biSizeImage=abs(temp.biWidth*temp.biHeight*((temp.biBitCount+7)/8)); |
3063 | 483 } else |
484 { // YUV | |
3059 | 485 int ok = true; |
1545 | 486 switch (csp) |
487 { | |
488 case fccYUY2: | |
3059 | 489 this->m_sDestType.subtype = MEDIASUBTYPE_YUY2; |
1545 | 490 break; |
491 case fccYV12: | |
3059 | 492 this->m_sDestType.subtype = MEDIASUBTYPE_YV12; |
1545 | 493 break; |
494 case fccIYUV: | |
3059 | 495 this->m_sDestType.subtype = MEDIASUBTYPE_IYUV; |
1545 | 496 break; |
6527 | 497 case fccI420: |
498 this->m_sDestType.subtype = MEDIASUBTYPE_I420; | |
499 break; | |
1545 | 500 case fccUYVY: |
3059 | 501 this->m_sDestType.subtype = MEDIASUBTYPE_UYVY; |
1545 | 502 break; |
503 case fccYVYU: | |
3059 | 504 this->m_sDestType.subtype = MEDIASUBTYPE_YVYU; |
1545 | 505 break; |
6527 | 506 case fccYVU9: |
507 this->m_sDestType.subtype = MEDIASUBTYPE_YVU9; | |
1545 | 508 default: |
509 ok = false; | |
510 break; | |
511 } | |
512 | |
3059 | 513 if (ok) { |
514 if (csp != 0 && csp != 3 && this->iv.m_obh.biHeight > 0) | |
515 this->iv.m_obh.biHeight *= -1; // YUV formats uses should have height < 0 | |
516 this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER); | |
517 this->iv.m_obh.biCompression=csp; | |
518 this->iv.m_obh.biBitCount=bits; | |
519 this->iv.m_obh.biSizeImage=labs(this->iv.m_obh.biBitCount* | |
520 this->iv.m_obh.biWidth*this->iv.m_obh.biHeight)>>3; | |
521 } | |
1545 | 522 } |
3059 | 523 this->m_sDestType.lSampleSize = this->iv.m_obh.biSizeImage; |
524 memcpy(&(this->m_sVhdr2->bmiHeader), &this->iv.m_obh, sizeof(this->iv.m_obh)); | |
525 this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); | |
526 if (this->m_sVhdr2->bmiHeader.biCompression == 3) | |
527 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12; | |
1545 | 528 else |
3059 | 529 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); |
1545 | 530 |
3059 | 531 |
1545 | 532 switch(csp) |
533 { | |
534 case fccYUY2: | |
3059 | 535 if(!(this->m_Caps & CAP_YUY2)) |
1545 | 536 should_test=false; |
537 break; | |
538 case fccYV12: | |
3059 | 539 if(!(this->m_Caps & CAP_YV12)) |
1545 | 540 should_test=false; |
541 break; | |
542 case fccIYUV: | |
3059 | 543 if(!(this->m_Caps & CAP_IYUV)) |
1545 | 544 should_test=false; |
545 break; | |
6527 | 546 case fccI420: |
547 if(!(this->m_Caps & CAP_I420)) | |
548 should_test=false; | |
549 break; | |
1545 | 550 case fccUYVY: |
3059 | 551 if(!(this->m_Caps & CAP_UYVY)) |
1545 | 552 should_test=false; |
553 break; | |
554 case fccYVYU: | |
3059 | 555 if(!(this->m_Caps & CAP_YVYU)) |
1545 | 556 should_test=false; |
557 break; | |
6527 | 558 case fccYVU9: |
559 if(!(this->m_Caps & CAP_YVU9)) | |
560 should_test=false; | |
561 break; | |
1545 | 562 } |
563 if(should_test) | |
3059 | 564 result = this->m_pDS_Filter->m_pOutputPin->vt->QueryAccept(this->m_pDS_Filter->m_pOutputPin, &this->m_sDestType); |
1545 | 565 else |
566 result = -1; | |
567 | |
568 if (result != 0) | |
569 { | |
570 if (csp) | |
3059 | 571 printf("Warning: unsupported color space\n"); |
1545 | 572 else |
3059 | 573 printf("Warning: unsupported bit depth\n"); |
1545 | 574 |
3059 | 575 this->m_sDestType.lSampleSize = this->iv.m_decoder.biSizeImage; |
576 memcpy(&(this->m_sVhdr2->bmiHeader), &this->iv.m_decoder, sizeof(this->iv.m_decoder)); | |
577 this->m_sVhdr2->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); | |
578 if (this->m_sVhdr2->bmiHeader.biCompression == 3) | |
579 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER) + 12; | |
1545 | 580 else |
3059 | 581 this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); |
1545 | 582 |
3059 | 583 return -1; |
1545 | 584 } |
585 | |
3059 | 586 memcpy( &this->iv.m_decoder, &this->iv.m_obh, sizeof(this->iv.m_obh)); |
1545 | 587 |
588 // m_obh=temp; | |
589 // if(csp) | |
590 // m_obh.biBitCount=BitmapInfo::BitCount(csp); | |
3059 | 591 this->iv.m_bh->biBitCount = bits; |
592 | |
593 //DS_VideoDecoder_Restart(this); | |
1545 | 594 |
3059 | 595 if (this->iv.m_State == START) |
1545 | 596 { |
3059 | 597 DS_VideoDecoder_StopInternal(this); |
598 this->iv.m_State = STOP; | |
1545 | 599 stoped = true; |
600 } | |
601 | |
3059 | 602 this->m_pDS_Filter->m_pInputPin->vt->Disconnect(this->m_pDS_Filter->m_pInputPin); |
603 this->m_pDS_Filter->m_pOutputPin->vt->Disconnect(this->m_pDS_Filter->m_pOutputPin); | |
3063 | 604 this->m_pDS_Filter->m_pOurOutput->SetNewFormat(this->m_pDS_Filter->m_pOurOutput,&this->m_sDestType); |
3059 | 605 result = this->m_pDS_Filter->m_pInputPin->vt->ReceiveConnection(this->m_pDS_Filter->m_pInputPin, |
606 this->m_pDS_Filter->m_pOurInput, | |
607 &this->m_sOurType); | |
1545 | 608 if (result) |
609 { | |
3059 | 610 printf("Error reconnecting input pin 0x%x\n", (int)result); |
1545 | 611 return -1; |
612 } | |
22307
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
613 |
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
614 if(this->m_pDS_Filter->m_pAll) |
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
615 this->m_pDS_Filter->m_pAll->vt->Release(this->m_pDS_Filter->m_pAll); |
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
616 this->m_pDS_Filter->m_pAll=MemAllocatorCreate(); |
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
617 if (!this->m_pDS_Filter->m_pAll) |
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
618 { |
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
619 printf("Call to MemAllocatorCreate failed\n"); |
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
620 return -1; |
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
621 } |
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
622 //Seting allocator property according to our media type |
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
623 props.cBuffers=1; |
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
624 props.cbBuffer=this->m_sDestType.lSampleSize; |
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
625 props.cbAlign=1; |
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
626 props.cbPrefix=0; |
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
627 this->m_pDS_Filter->m_pAll->vt->SetProperties(this->m_pDS_Filter->m_pAll, &props, &props1); |
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
628 //Notify remote pin about choosed allocator |
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
629 this->m_pDS_Filter->m_pImp->vt->NotifyAllocator(this->m_pDS_Filter->m_pImp, this->m_pDS_Filter->m_pAll, 0); |
68125c62b6eb
Fix loading of mpeg4ds direct show video codec under win32, broken in r22322
voroshil
parents:
22304
diff
changeset
|
630 |
3059 | 631 result = this->m_pDS_Filter->m_pOutputPin->vt->ReceiveConnection(this->m_pDS_Filter->m_pOutputPin, |
632 (IPin *)this->m_pDS_Filter->m_pOurOutput, | |
633 &this->m_sDestType); | |
1545 | 634 if (result) |
635 { | |
3059 | 636 printf("Error reconnecting output pin 0x%x\n", (int)result); |
1545 | 637 return -1; |
638 } | |
639 | |
640 if (stoped) | |
3059 | 641 { |
642 DS_VideoDecoder_StartInternal(this); | |
643 this->iv.m_State = START; | |
644 } | |
1545 | 645 |
646 return 0; | |
647 } | |
648 | |
3059 | 649 |
650 int DS_VideoDecoder_SetDirection(DS_VideoDecoder *this, int d) | |
651 { | |
652 this->iv.m_obh.biHeight = (d) ? this->iv.m_bh->biHeight : -this->iv.m_bh->biHeight; | |
653 this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight; | |
654 return 0; | |
655 } | |
656 | |
3946 | 657 int DS_VideoDecoder_GetValue(DS_VideoDecoder *this, const char* name, int* value) |
1545 | 658 { |
3059 | 659 /* |
660 if (m_bIsDivX4) | |
661 { | |
662 IDivxFilterInterface* pIDivx; | |
663 if (m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)m_pDS_Filter->m_pFilter, &IID_IDivxFilterInterface, (void**)&pIDivx)) | |
664 { | |
665 Debug printf("No such interface\n"); | |
666 return -1; | |
667 } | |
668 if (strcmp(name, "Postprocessing") == 0) | |
669 { | |
670 pIDivx->vt->get_PPLevel(pIDivx, &value); | |
671 value /= 10; | |
672 } | |
673 else if (strcmp(name, "Brightness") == 0) | |
674 pIDivx->vt->get_Brightness(pIDivx, &value); | |
675 else if (strcmp(name, "Contrast") == 0) | |
676 pIDivx->vt->get_Contrast(pIDivx, &value); | |
677 else if (strcmp(name, "Saturation") == 0) | |
678 pIDivx->vt->get_Saturation(pIDivx, &value); | |
679 else if (strcmp(name, "MaxAuto") == 0) | |
680 value = m_iMaxAuto; | |
681 pIDivx->vt->Release((IUnknown*)pIDivx); | |
682 return 0; | |
683 } | |
684 else if (m_bIsDivX) | |
1545 | 685 { |
686 if (m_State != START) | |
687 return VFW_E_NOT_RUNNING; | |
688 // brightness 87 | |
689 // contrast 74 | |
690 // hue 23 | |
691 // saturation 20 | |
692 // post process mode 0 | |
693 // get1 0x01 | |
694 // get2 10 | |
695 // get3=set2 86 | |
696 // get4=set3 73 | |
697 // get5=set4 19 | |
698 // get6=set5 23 | |
699 IHidden* hidden=(IHidden*)((int)m_pDS_Filter->m_pFilter+0xb8); | |
3059 | 700 if (strcmp(name, "Quality") == 0) |
701 { | |
702 #warning NOT SURE | |
703 int r = hidden->vt->GetSmth2(hidden, &value); | |
704 if (value >= 10) | |
705 value -= 10; | |
706 return 0; | |
707 } | |
1545 | 708 if (strcmp(name, "Brightness") == 0) |
709 return hidden->vt->GetSmth3(hidden, &value); | |
710 if (strcmp(name, "Contrast") == 0) | |
711 return hidden->vt->GetSmth4(hidden, &value); | |
712 if (strcmp(name, "Hue") == 0) | |
713 return hidden->vt->GetSmth6(hidden, &value); | |
714 if (strcmp(name, "Saturation") == 0) | |
715 return hidden->vt->GetSmth5(hidden, &value); | |
3059 | 716 if (strcmp(name, "MaxAuto") == 0) |
1545 | 717 { |
3059 | 718 value = m_iMaxAuto; |
719 return 0; | |
1545 | 720 } |
721 } | |
3059 | 722 else if (strcmp((const char*)record.dll, "ir50_32.dll") == 0) |
1545 | 723 { |
724 IHidden2* hidden = 0; | |
725 if (m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)m_pDS_Filter->m_pFilter, &IID_Iv50Hidden, (void**)&hidden)) | |
726 { | |
3059 | 727 Debug printf("No such interface\n"); |
1545 | 728 return -1; |
729 } | |
730 #warning FIXME | |
731 int recordpar[30]; | |
732 recordpar[0]=0x7c; | |
733 recordpar[1]=fccIV50; | |
734 recordpar[2]=0x10005; | |
735 recordpar[3]=2; | |
736 recordpar[4]=1; | |
737 recordpar[5]=0x80000000; | |
738 | |
739 if (strcmp(name, "Brightness") == 0) | |
740 recordpar[5]|=0x20; | |
741 else if (strcmp(name, "Saturation") == 0) | |
742 recordpar[5]|=0x40; | |
743 else if (strcmp(name, "Contrast") == 0) | |
744 recordpar[5]|=0x80; | |
745 if (!recordpar[5]) | |
746 { | |
747 hidden->vt->Release((IUnknown*)hidden); | |
748 return -1; | |
749 } | |
750 if (hidden->vt->DecodeSet(hidden, recordpar)) | |
751 return -1; | |
752 | |
753 if (strcmp(name, "Brightness") == 0) | |
754 value = recordpar[18]; | |
755 else if (strcmp(name, "Saturation") == 0) | |
756 value = recordpar[19]; | |
757 else if (strcmp(name, "Contrast") == 0) | |
758 value = recordpar[20]; | |
759 | |
760 hidden->vt->Release((IUnknown*)hidden); | |
761 } | |
3059 | 762 */ |
1545 | 763 return 0; |
764 } | |
765 | |
3946 | 766 int DS_VideoDecoder_SetValue(DS_VideoDecoder *this, const char* name, int value) |
1545 | 767 { |
3957
49290522ab06
SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents:
3946
diff
changeset
|
768 if (this->m_bIsDivX4) { |
49290522ab06
SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents:
3946
diff
changeset
|
769 IDivxFilterInterface* pIDivx=NULL; |
3978 | 770 // printf("DS_SetValue for DIVX4, name=%s value=%d\n",name,value); |
3957
49290522ab06
SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents:
3946
diff
changeset
|
771 if (this->m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)this->m_pDS_Filter->m_pFilter, &IID_IDivxFilterInterface, (void**)&pIDivx)) |
3059 | 772 { |
3957
49290522ab06
SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents:
3946
diff
changeset
|
773 printf("No such interface\n"); |
3059 | 774 return -1; |
775 } | |
6801 | 776 if (strcasecmp(name, "Postprocessing") == 0) |
3059 | 777 pIDivx->vt->put_PPLevel(pIDivx, value * 10); |
6801 | 778 else if (strcasecmp(name, "Brightness") == 0) |
3059 | 779 pIDivx->vt->put_Brightness(pIDivx, value); |
6801 | 780 else if (strcasecmp(name, "Contrast") == 0) |
3059 | 781 pIDivx->vt->put_Contrast(pIDivx, value); |
6801 | 782 else if (strcasecmp(name, "Saturation") == 0) |
3059 | 783 pIDivx->vt->put_Saturation(pIDivx, value); |
6801 | 784 else if (strcasecmp(name, "MaxAuto") == 0) |
3957
49290522ab06
SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents:
3946
diff
changeset
|
785 this->m_iMaxAuto = value; |
3059 | 786 pIDivx->vt->Release((IUnknown*)pIDivx); |
787 //printf("Set %s %d\n", name, value); | |
788 return 0; | |
789 } | |
3957
49290522ab06
SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents:
3946
diff
changeset
|
790 |
49290522ab06
SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents:
3946
diff
changeset
|
791 if (this->m_bIsDivX) { |
49290522ab06
SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents:
3946
diff
changeset
|
792 IHidden* hidden; |
49290522ab06
SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents:
3946
diff
changeset
|
793 if (this->iv.m_State != START) |
1545 | 794 return VFW_E_NOT_RUNNING; |
795 | |
796 //cout << "set value " << name << " " << value << endl; | |
797 // brightness 87 | |
798 // contrast 74 | |
799 // hue 23 | |
800 // saturation 20 | |
801 // post process mode 0 | |
802 // get1 0x01 | |
803 // get2 10 | |
804 // get3=set2 86 | |
805 // get4=set3 73 | |
806 // get5=set4 19 | |
3059 | 807 // get6=set5 23 |
3957
49290522ab06
SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents:
3946
diff
changeset
|
808 hidden = (IHidden*)((int)this->m_pDS_Filter->m_pFilter + 0xb8); |
7316 | 809 //printf("DS_SetValue for DIVX, name=%s value=%d\n",name,value); |
6801 | 810 if (strcasecmp(name, "Quality") == 0) |
1545 | 811 { |
3957
49290522ab06
SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents:
3946
diff
changeset
|
812 this->m_iLastQuality = value; |
1545 | 813 return hidden->vt->SetSmth(hidden, value, 0); |
814 } | |
6801 | 815 if (strcasecmp(name, "Brightness") == 0) |
1545 | 816 return hidden->vt->SetSmth2(hidden, value, 0); |
6801 | 817 if (strcasecmp(name, "Contrast") == 0) |
1545 | 818 return hidden->vt->SetSmth3(hidden, value, 0); |
6801 | 819 if (strcasecmp(name, "Saturation") == 0) |
1545 | 820 return hidden->vt->SetSmth4(hidden, value, 0); |
6801 | 821 if (strcasecmp(name, "Hue") == 0) |
1545 | 822 return hidden->vt->SetSmth5(hidden, value, 0); |
6801 | 823 if (strcasecmp(name, "MaxAuto") == 0) |
3059 | 824 { |
3957
49290522ab06
SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents:
3946
diff
changeset
|
825 this->m_iMaxAuto = value; |
3059 | 826 } |
3957
49290522ab06
SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents:
3946
diff
changeset
|
827 return 0; |
1545 | 828 } |
3957
49290522ab06
SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents:
3946
diff
changeset
|
829 #if 0 |
49290522ab06
SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents:
3946
diff
changeset
|
830 if (strcmp((const char*)record.dll, "ir50_32.dll") == 0) |
1545 | 831 { |
832 IHidden2* hidden = 0; | |
833 if (m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)m_pDS_Filter->m_pFilter, &IID_Iv50Hidden, (void**)&hidden)) | |
834 { | |
3059 | 835 Debug printf("No such interface\n"); |
1545 | 836 return -1; |
837 } | |
838 int recordpar[30]; | |
839 recordpar[0]=0x7c; | |
840 recordpar[1]=fccIV50; | |
841 recordpar[2]=0x10005; | |
842 recordpar[3]=2; | |
843 recordpar[4]=1; | |
844 recordpar[5]=0x80000000; | |
845 if (strcmp(name, "Brightness") == 0) | |
846 { | |
847 recordpar[5]|=0x20; | |
848 recordpar[18]=value; | |
849 } | |
850 else if (strcmp(name, "Saturation") == 0) | |
851 { | |
852 recordpar[5]|=0x40; | |
853 recordpar[19]=value; | |
854 } | |
855 else if (strcmp(name, "Contrast") == 0) | |
856 { | |
857 recordpar[5]|=0x80; | |
858 recordpar[20]=value; | |
859 } | |
860 if(!recordpar[5]) | |
861 { | |
862 hidden->vt->Release((IUnknown*)hidden); | |
863 return -1; | |
864 } | |
865 HRESULT result = hidden->vt->DecodeSet(hidden, recordpar); | |
866 hidden->vt->Release((IUnknown*)hidden); | |
867 | |
868 return result; | |
869 } | |
3957
49290522ab06
SetValue fixed, iv_State=START enabled (silly xine developers disabled for unknown reason)
arpi
parents:
3946
diff
changeset
|
870 #endif |
3978 | 871 // printf("DS_SetValue for ????, name=%s value=%d\n",name,value); |
1545 | 872 return 0; |
873 } | |
874 /* | |
3063 | 875 vim: vi* sux. |
1545 | 876 */ |
3063 | 877 |
878 int DS_SetAttr_DivX(char* attribute, int value){ | |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7316
diff
changeset
|
879 int result, status, newkey; |
6801 | 880 if(strcasecmp(attribute, "Quality")==0){ |
3063 | 881 char* keyname="SOFTWARE\\Microsoft\\Scrunch"; |
882 result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status); | |
883 if(result!=0) | |
884 { | |
885 printf("VideoDecoder::SetExtAttr: registry failure\n"); | |
886 return -1; | |
887 } | |
888 result=RegSetValueExA(newkey, "Current Post Process Mode", 0, REG_DWORD, &value, 4); | |
889 if(result!=0) | |
890 { | |
891 printf("VideoDecoder::SetExtAttr: error writing value\n"); | |
892 return -1; | |
893 } | |
894 value=-1; | |
895 result=RegSetValueExA(newkey, "Force Post Process Mode", 0, REG_DWORD, &value, 4); | |
896 if(result!=0) | |
897 { | |
898 printf("VideoDecoder::SetExtAttr: error writing value\n"); | |
899 return -1; | |
900 } | |
901 RegCloseKey(newkey); | |
902 return 0; | |
903 } | |
904 | |
905 if( | |
6801 | 906 (strcasecmp(attribute, "Saturation")==0) || |
907 (strcasecmp(attribute, "Hue")==0) || | |
908 (strcasecmp(attribute, "Contrast")==0) || | |
909 (strcasecmp(attribute, "Brightness")==0) | |
3063 | 910 ) |
911 { | |
912 char* keyname="SOFTWARE\\Microsoft\\Scrunch\\Video"; | |
913 result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status); | |
914 if(result!=0) | |
915 { | |
916 printf("VideoDecoder::SetExtAttr: registry failure\n"); | |
917 return -1; | |
918 } | |
919 result=RegSetValueExA(newkey, attribute, 0, REG_DWORD, &value, 4); | |
920 if(result!=0) | |
921 { | |
922 printf("VideoDecoder::SetExtAttr: error writing value\n"); | |
923 return -1; | |
924 } | |
925 RegCloseKey(newkey); | |
926 return 0; | |
927 } | |
928 | |
929 printf("Unknown attribute!\n"); | |
930 return -200; | |
931 } | |
932 | |
933 | |
934 | |
935 |