Mercurial > mplayer.hg
annotate loader/dshow/DS_VideoDec.c @ 1850:62b8e85865a2
Some changes to compile the GUI on solaris
author | jkeil |
---|---|
date | Mon, 03 Sep 2001 16:13:25 +0000 |
parents | 9e23ceba3f65 |
children | a5a4143d5599 |
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 |
1560 | 37 try { |
1559 | 38 DS_VideoDecoder* dec=new DS_VideoDecoder(ci, *format, flip); |
1560 | 39 _d_ptr=d_ptr; |
40 _handle=(void*)dec; | |
41 return 0; | |
42 } catch (FatalError &e) { } | |
169 | 43 |
1560 | 44 _handle=NULL; |
45 return -1; | |
46 | |
169 | 47 } |
48 | |
49 extern "C" void DS_VideoDecoder_Start(){ | |
1545 | 50 DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle; |
1555
076c27342828
Start/Stop state flag fixed - requires for brightness/contrast/etc stuff...
arpi
parents:
1545
diff
changeset
|
51 dec->Start(); |
169 | 52 } |
53 | |
54 extern "C" void DS_VideoDecoder_Stop(){ | |
1545 | 55 DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle; |
1555
076c27342828
Start/Stop state flag fixed - requires for brightness/contrast/etc stuff...
arpi
parents:
1545
diff
changeset
|
56 dec->Stop(); |
169 | 57 } |
58 | |
59 extern "C" void DS_VideoDecoder_Restart(){ | |
60 } | |
61 | |
62 extern "C" void DS_VideoDecoder_Close(){ | |
1559 | 63 DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle; |
1722 | 64 _handle=NULL; |
1559 | 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; |
1592 | 82 /* This printf is annoying with autoquality, * |
83 * should be moved into players code - atmos */ | |
84 //printf("DS_SetValue_DivX(%s),%d)\n",name,value); | |
1545 | 85 return (int) dec->SetValue(name,value); |
169 | 86 } |
87 | |
173 | 88 extern "C" int DS_SetAttr_DivX(char* attribute, int value){ |
89 int result, status, newkey, count; | |
90 if(strcmp(attribute, "Quality")==0){ | |
91 char* keyname="SOFTWARE\\Microsoft\\Scrunch"; | |
92 result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status); | |
93 if(result!=0) | |
94 { | |
95 printf("VideoDecoder::SetExtAttr: registry failure\n"); | |
96 return -1; | |
97 } | |
98 result=RegSetValueExA(newkey, "Current Post Process Mode", 0, REG_DWORD, &value, 4); | |
99 if(result!=0) | |
100 { | |
101 printf("VideoDecoder::SetExtAttr: error writing value\n"); | |
102 return -1; | |
103 } | |
104 value=-1; | |
105 result=RegSetValueExA(newkey, "Force Post Process Mode", 0, REG_DWORD, &value, 4); | |
106 if(result!=0) | |
107 { | |
108 printf("VideoDecoder::SetExtAttr: error writing value\n"); | |
109 return -1; | |
110 } | |
111 RegCloseKey(newkey); | |
112 return 0; | |
113 } | |
169 | 114 |
173 | 115 if( |
116 (strcmp(attribute, "Saturation")==0) || | |
117 (strcmp(attribute, "Hue")==0) || | |
118 (strcmp(attribute, "Contrast")==0) || | |
119 (strcmp(attribute, "Brightness")==0) | |
120 ) | |
121 { | |
122 char* keyname="SOFTWARE\\Microsoft\\Scrunch\\Video"; | |
123 result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status); | |
124 if(result!=0) | |
125 { | |
126 printf("VideoDecoder::SetExtAttr: registry failure\n"); | |
127 return -1; | |
128 } | |
129 result=RegSetValueExA(newkey, attribute, 0, REG_DWORD, &value, 4); | |
130 if(result!=0) | |
131 { | |
132 printf("VideoDecoder::SetExtAttr: error writing value\n"); | |
133 return -1; | |
134 } | |
135 RegCloseKey(newkey); | |
136 return 0; | |
137 } | |
138 | |
139 printf("Unknown attribute!\n"); | |
140 return -200; | |
141 } | |
142 |