Mercurial > mplayer.hg
comparison loader/dshow/DS_VideoDec.c @ 173:fb67a2aa61fe
fixed DivX Quality setting (using registry)
author | arpi_esp |
---|---|
date | Tue, 20 Mar 2001 21:12:37 +0000 |
parents | 550ebe869cec |
children | 4b91c9120d6a |
comparison
equal
deleted
inserted
replaced
172:82a9977f7e04 | 173:fb67a2aa61fe |
---|---|
26 #include <strstream> | 26 #include <strstream> |
27 #include <dlfcn.h> | 27 #include <dlfcn.h> |
28 #include <sys/types.h> | 28 #include <sys/types.h> |
29 #include <sys/mman.h> | 29 #include <sys/mman.h> |
30 | 30 |
31 #include <registry.h> | |
32 #include <wine/winreg.h> | |
33 | |
31 #include "guids.h" | 34 #include "guids.h" |
32 #include "interfaces.h" | 35 #include "interfaces.h" |
33 #include "DS_Filter.h" | 36 #include "DS_Filter.h" |
34 | 37 |
35 #include "BitmapInfo.h" | 38 #include "BitmapInfo.h" |
36 | 39 |
37 #include <string> | 40 #include <string> |
38 #include <default.h> | 41 #include <default.h> |
39 | 42 |
40 #include "DS_VideoDec.h" | 43 #include "DS_VideoDec.h" |
44 | |
41 | 45 |
42 using namespace std; | 46 using namespace std; |
43 extern "C" char* def_path; | 47 extern "C" char* def_path; |
44 | 48 |
45 static char** m_destptr=0; | 49 static char** m_destptr=0; |
211 if(!size)return 0; | 215 if(!size)return 0; |
212 | 216 |
213 m_bh.biSizeImage=size; | 217 m_bh.biSizeImage=size; |
214 | 218 |
215 IMediaSample* sample=0; | 219 IMediaSample* sample=0; |
216 printf("GetBuffer... (m_pAll=%X) ",dsf->m_pAll);fflush(stdout); | 220 //printf("GetBuffer... (m_pAll=%X) ",dsf->m_pAll);fflush(stdout); |
217 dsf->m_pAll->vt->GetBuffer(dsf->m_pAll, &sample, 0, 0, 0); | 221 dsf->m_pAll->vt->GetBuffer(dsf->m_pAll, &sample, 0, 0, 0); |
218 printf("OK!\n"); | 222 //printf("OK!\n"); |
219 if(!sample) | 223 if(!sample) |
220 { | 224 { |
221 Debug cerr<<"ERROR: null sample"<<endl; | 225 Debug cerr<<"ERROR: null sample"<<endl; |
222 return -1; | 226 return -1; |
223 } | 227 } |
224 char* ptr; | 228 char* ptr; |
225 printf("GetPtr...");fflush(stdout); | 229 //printf("GetPtr...");fflush(stdout); |
226 sample->vt->GetPointer(sample, (BYTE **)&ptr); | 230 sample->vt->GetPointer(sample, (BYTE **)&ptr); |
227 printf("OK!\n"); | 231 //printf("OK!\n"); |
228 memcpy(ptr, src, size); | 232 memcpy(ptr, src, size); |
229 printf("memcpy OK!\n"); | 233 //printf("memcpy OK!\n"); |
230 sample->vt->SetActualDataLength(sample, size); | 234 sample->vt->SetActualDataLength(sample, size); |
231 printf("SetActualDataLength OK!\n"); | 235 //printf("SetActualDataLength OK!\n"); |
232 sample->vt->SetSyncPoint(sample, is_keyframe); | 236 sample->vt->SetSyncPoint(sample, is_keyframe); |
233 printf("SetSyncPoint OK!\n"); | 237 //printf("SetSyncPoint OK!\n"); |
234 sample->vt->SetPreroll(sample, !render); | 238 sample->vt->SetPreroll(sample, !render); |
235 // sample->vt->SetMediaType(sample, &m_sOurType); | 239 // sample->vt->SetMediaType(sample, &m_sOurType); |
236 int result=dsf->m_pImp->vt->Receive(dsf->m_pImp, sample); | 240 int result=dsf->m_pImp->vt->Receive(dsf->m_pImp, sample); |
237 if(result) | 241 if(result) |
238 Debug printf("Error putting data into input pin %x\n", result); | 242 printf("Error putting data into input pin %x\n", result); |
239 | 243 |
240 sample->vt->Release((IUnknown*)sample); | 244 sample->vt->Release((IUnknown*)sample); |
241 | 245 |
242 return 0; | 246 return 0; |
243 } | 247 } |
380 | 384 |
381 printf("Invalid setting!\n"); | 385 printf("Invalid setting!\n"); |
382 return -200; | 386 return -200; |
383 } | 387 } |
384 | 388 |
385 | 389 extern "C" int DS_SetAttr_DivX(char* attribute, int value){ |
390 int result, status, newkey, count; | |
391 if(strcmp(attribute, "Quality")==0){ | |
392 char* keyname="SOFTWARE\\Microsoft\\Scrunch"; | |
393 result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status); | |
394 if(result!=0) | |
395 { | |
396 printf("VideoDecoder::SetExtAttr: registry failure\n"); | |
397 return -1; | |
398 } | |
399 result=RegSetValueExA(newkey, "Current Post Process Mode", 0, REG_DWORD, &value, 4); | |
400 if(result!=0) | |
401 { | |
402 printf("VideoDecoder::SetExtAttr: error writing value\n"); | |
403 return -1; | |
404 } | |
405 value=-1; | |
406 result=RegSetValueExA(newkey, "Force Post Process Mode", 0, REG_DWORD, &value, 4); | |
407 if(result!=0) | |
408 { | |
409 printf("VideoDecoder::SetExtAttr: error writing value\n"); | |
410 return -1; | |
411 } | |
412 RegCloseKey(newkey); | |
413 return 0; | |
414 } | |
415 | |
416 if( | |
417 (strcmp(attribute, "Saturation")==0) || | |
418 (strcmp(attribute, "Hue")==0) || | |
419 (strcmp(attribute, "Contrast")==0) || | |
420 (strcmp(attribute, "Brightness")==0) | |
421 ) | |
422 { | |
423 char* keyname="SOFTWARE\\Microsoft\\Scrunch\\Video"; | |
424 result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status); | |
425 if(result!=0) | |
426 { | |
427 printf("VideoDecoder::SetExtAttr: registry failure\n"); | |
428 return -1; | |
429 } | |
430 result=RegSetValueExA(newkey, attribute, 0, REG_DWORD, &value, 4); | |
431 if(result!=0) | |
432 { | |
433 printf("VideoDecoder::SetExtAttr: error writing value\n"); | |
434 return -1; | |
435 } | |
436 RegCloseKey(newkey); | |
437 return 0; | |
438 } | |
439 | |
440 printf("Unknown attribute!\n"); | |
441 return -200; | |
442 } | |
443 |