Mercurial > mplayer.hg
annotate loader/dshow/DS_VideoDec.c @ 1555:076c27342828
Start/Stop state flag fixed - requires for brightness/contrast/etc stuff...
author | arpi |
---|---|
date | Thu, 16 Aug 2001 15:41:03 +0000 |
parents | da26060c81ef |
children | 241ea640d1c3 |
rev | line source |
---|---|
1545 | 1 #include "guids.h" |
2 #include "interfaces.h" | |
169 | 3 |
1545 | 4 #include "DS_VideoDecoder.h" |
5 #include <wine/winerror.h> | |
6 #include <libwin32.h> | |
7 //#include <cpuinfo.h> | |
1063 | 8 |
169 | 9 #include <unistd.h> |
10 #include <fcntl.h> | |
1545 | 11 #include <errno.h> |
169 | 12 #include <sys/types.h> |
13 #include <sys/mman.h> | |
1545 | 14 #include <cstdio> |
15 #include <iostream> | |
16 #include <strstream> | |
169 | 17 |
173 | 18 #include <registry.h> |
1545 | 19 //#include <wine/winreg.h> |
169 | 20 |
21 #include "DS_VideoDec.h" | |
22 | |
1545 | 23 static void* _handle; // will be parameter later... |
24 static char** _d_ptr; // will be parameter later... | |
169 | 25 |
1545 | 26 extern "C" void Setup_LDT_Keeper(); |
27 extern "C" void setup_FS_Segment(); | |
169 | 28 |
1545 | 29 extern "C" int DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER* format, int flip,char** d_ptr){ |
169 | 30 |
1545 | 31 Setup_LDT_Keeper(); |
169 | 32 |
1545 | 33 CodecInfo ci; |
34 ci.dll=dllname; | |
35 ci.guid=*guid; | |
36 | |
37 DS_VideoDecoder* dec=new DS_VideoDecoder(ci, *format, flip); | |
38 | |
39 _d_ptr=d_ptr; | |
40 _handle=(void*)dec; | |
169 | 41 |
42 return 0; | |
43 } | |
44 | |
45 extern "C" void DS_VideoDecoder_Start(){ | |
1545 | 46 DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle; |
1555
076c27342828
Start/Stop state flag fixed - requires for brightness/contrast/etc stuff...
arpi
parents:
1545
diff
changeset
|
47 dec->Start(); |
169 | 48 } |
49 | |
50 extern "C" void DS_VideoDecoder_Stop(){ | |
1545 | 51 DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle; |
1555
076c27342828
Start/Stop state flag fixed - requires for brightness/contrast/etc stuff...
arpi
parents:
1545
diff
changeset
|
52 dec->Stop(); |
169 | 53 } |
54 | |
55 extern "C" void DS_VideoDecoder_Restart(){ | |
56 } | |
57 | |
58 extern "C" void DS_VideoDecoder_Close(){ | |
59 } | |
60 | |
61 extern "C" int DS_VideoDecoder_DecodeFrame(char* src, int size, int is_keyframe, int render){ | |
1545 | 62 DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle; |
63 CImage image; | |
64 image.ptr=*_d_ptr; | |
65 return dec->DecodeInternal((void*)src,(size_t)size,is_keyframe,&image); | |
169 | 66 } |
67 | |
68 extern "C" int DS_VideoDecoder_SetDestFmt(int bits, int csp){ | |
1545 | 69 DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle; |
70 return dec->SetDestFmt(bits,(fourcc_t)csp); | |
169 | 71 } |
72 | |
73 extern "C" int DS_SetValue_DivX(char* name, int value){ | |
1545 | 74 DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle; |
1555
076c27342828
Start/Stop state flag fixed - requires for brightness/contrast/etc stuff...
arpi
parents:
1545
diff
changeset
|
75 printf("DS_SetValue_DivX(%s),%d)\n",name,value); |
1545 | 76 return (int) dec->SetValue(name,value); |
169 | 77 } |
78 | |
173 | 79 extern "C" int DS_SetAttr_DivX(char* attribute, int value){ |
80 int result, status, newkey, count; | |
81 if(strcmp(attribute, "Quality")==0){ | |
82 char* keyname="SOFTWARE\\Microsoft\\Scrunch"; | |
83 result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status); | |
84 if(result!=0) | |
85 { | |
86 printf("VideoDecoder::SetExtAttr: registry failure\n"); | |
87 return -1; | |
88 } | |
89 result=RegSetValueExA(newkey, "Current Post Process Mode", 0, REG_DWORD, &value, 4); | |
90 if(result!=0) | |
91 { | |
92 printf("VideoDecoder::SetExtAttr: error writing value\n"); | |
93 return -1; | |
94 } | |
95 value=-1; | |
96 result=RegSetValueExA(newkey, "Force Post Process Mode", 0, REG_DWORD, &value, 4); | |
97 if(result!=0) | |
98 { | |
99 printf("VideoDecoder::SetExtAttr: error writing value\n"); | |
100 return -1; | |
101 } | |
102 RegCloseKey(newkey); | |
103 return 0; | |
104 } | |
169 | 105 |
173 | 106 if( |
107 (strcmp(attribute, "Saturation")==0) || | |
108 (strcmp(attribute, "Hue")==0) || | |
109 (strcmp(attribute, "Contrast")==0) || | |
110 (strcmp(attribute, "Brightness")==0) | |
111 ) | |
112 { | |
113 char* keyname="SOFTWARE\\Microsoft\\Scrunch\\Video"; | |
114 result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status); | |
115 if(result!=0) | |
116 { | |
117 printf("VideoDecoder::SetExtAttr: registry failure\n"); | |
118 return -1; | |
119 } | |
120 result=RegSetValueExA(newkey, attribute, 0, REG_DWORD, &value, 4); | |
121 if(result!=0) | |
122 { | |
123 printf("VideoDecoder::SetExtAttr: error writing value\n"); | |
124 return -1; | |
125 } | |
126 RegCloseKey(newkey); | |
127 return 0; | |
128 } | |
129 | |
130 printf("Unknown attribute!\n"); | |
131 return -200; | |
132 } | |
133 |