Mercurial > mplayer.hg
annotate loader/dshow/DS_VideoDec.c @ 1559:241ea640d1c3
fixes
author | arpi |
---|---|
date | Thu, 16 Aug 2001 18:39:49 +0000 |
parents | 076c27342828 |
children | a3d84360aa81 |
rev | line source |
---|---|
1545 | 1 #include "guids.h" |
2 #include "interfaces.h" | |
1559 | 3 #include "libwin32.h" |
169 | 4 |
1545 | 5 #include "DS_VideoDecoder.h" |
6 #include <wine/winerror.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; | |
1559 | 36 |
37 // try { | |
38 DS_VideoDecoder* dec=new DS_VideoDecoder(ci, *format, flip); | |
39 // } catch (FatalError &e) { | |
40 // _handle=NULL; | |
41 // return -1; | |
42 // } | |
1545 | 43 |
44 _d_ptr=d_ptr; | |
45 _handle=(void*)dec; | |
169 | 46 |
47 return 0; | |
48 } | |
49 | |
50 extern "C" void DS_VideoDecoder_Start(){ | |
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->Start(); |
169 | 53 } |
54 | |
55 extern "C" void DS_VideoDecoder_Stop(){ | |
1545 | 56 DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle; |
1555
076c27342828
Start/Stop state flag fixed - requires for brightness/contrast/etc stuff...
arpi
parents:
1545
diff
changeset
|
57 dec->Stop(); |
169 | 58 } |
59 | |
60 extern "C" void DS_VideoDecoder_Restart(){ | |
61 } | |
62 | |
63 extern "C" void DS_VideoDecoder_Close(){ | |
1559 | 64 DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle; |
65 delete dec; | |
169 | 66 } |
67 | |
68 extern "C" int DS_VideoDecoder_DecodeFrame(char* src, int size, int is_keyframe, int render){ | |
1545 | 69 DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle; |
70 CImage image; | |
71 image.ptr=*_d_ptr; | |
1559 | 72 return dec->Decode((void*)src,(size_t)size,is_keyframe,&image); |
169 | 73 } |
74 | |
75 extern "C" int DS_VideoDecoder_SetDestFmt(int bits, int csp){ | |
1545 | 76 DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle; |
77 return dec->SetDestFmt(bits,(fourcc_t)csp); | |
169 | 78 } |
79 | |
80 extern "C" int DS_SetValue_DivX(char* name, int value){ | |
1545 | 81 DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle; |
1555
076c27342828
Start/Stop state flag fixed - requires for brightness/contrast/etc stuff...
arpi
parents:
1545
diff
changeset
|
82 printf("DS_SetValue_DivX(%s),%d)\n",name,value); |
1545 | 83 return (int) dec->SetValue(name,value); |
169 | 84 } |
85 | |
173 | 86 extern "C" int DS_SetAttr_DivX(char* attribute, int value){ |
87 int result, status, newkey, count; | |
88 if(strcmp(attribute, "Quality")==0){ | |
89 char* keyname="SOFTWARE\\Microsoft\\Scrunch"; | |
90 result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status); | |
91 if(result!=0) | |
92 { | |
93 printf("VideoDecoder::SetExtAttr: registry failure\n"); | |
94 return -1; | |
95 } | |
96 result=RegSetValueExA(newkey, "Current 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 value=-1; | |
103 result=RegSetValueExA(newkey, "Force Post Process Mode", 0, REG_DWORD, &value, 4); | |
104 if(result!=0) | |
105 { | |
106 printf("VideoDecoder::SetExtAttr: error writing value\n"); | |
107 return -1; | |
108 } | |
109 RegCloseKey(newkey); | |
110 return 0; | |
111 } | |
169 | 112 |
173 | 113 if( |
114 (strcmp(attribute, "Saturation")==0) || | |
115 (strcmp(attribute, "Hue")==0) || | |
116 (strcmp(attribute, "Contrast")==0) || | |
117 (strcmp(attribute, "Brightness")==0) | |
118 ) | |
119 { | |
120 char* keyname="SOFTWARE\\Microsoft\\Scrunch\\Video"; | |
121 result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status); | |
122 if(result!=0) | |
123 { | |
124 printf("VideoDecoder::SetExtAttr: registry failure\n"); | |
125 return -1; | |
126 } | |
127 result=RegSetValueExA(newkey, attribute, 0, REG_DWORD, &value, 4); | |
128 if(result!=0) | |
129 { | |
130 printf("VideoDecoder::SetExtAttr: error writing value\n"); | |
131 return -1; | |
132 } | |
133 RegCloseKey(newkey); | |
134 return 0; | |
135 } | |
136 | |
137 printf("Unknown attribute!\n"); | |
138 return -200; | |
139 } | |
140 |