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;
|
|
47 dec->StartInternal();
|
169
|
48 }
|
|
49
|
|
50 extern "C" void DS_VideoDecoder_Stop(){
|
1545
|
51 DS_VideoDecoder* dec=(DS_VideoDecoder*) _handle;
|
|
52 dec->StopInternal();
|
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;
|
|
75 return (int) dec->SetValue(name,value);
|
169
|
76 }
|
|
77
|
173
|
78 extern "C" int DS_SetAttr_DivX(char* attribute, int value){
|
|
79 int result, status, newkey, count;
|
|
80 if(strcmp(attribute, "Quality")==0){
|
|
81 char* keyname="SOFTWARE\\Microsoft\\Scrunch";
|
|
82 result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status);
|
|
83 if(result!=0)
|
|
84 {
|
|
85 printf("VideoDecoder::SetExtAttr: registry failure\n");
|
|
86 return -1;
|
|
87 }
|
|
88 result=RegSetValueExA(newkey, "Current Post Process Mode", 0, REG_DWORD, &value, 4);
|
|
89 if(result!=0)
|
|
90 {
|
|
91 printf("VideoDecoder::SetExtAttr: error writing value\n");
|
|
92 return -1;
|
|
93 }
|
|
94 value=-1;
|
|
95 result=RegSetValueExA(newkey, "Force Post Process Mode", 0, REG_DWORD, &value, 4);
|
|
96 if(result!=0)
|
|
97 {
|
|
98 printf("VideoDecoder::SetExtAttr: error writing value\n");
|
|
99 return -1;
|
|
100 }
|
|
101 RegCloseKey(newkey);
|
|
102 return 0;
|
|
103 }
|
169
|
104
|
173
|
105 if(
|
|
106 (strcmp(attribute, "Saturation")==0) ||
|
|
107 (strcmp(attribute, "Hue")==0) ||
|
|
108 (strcmp(attribute, "Contrast")==0) ||
|
|
109 (strcmp(attribute, "Brightness")==0)
|
|
110 )
|
|
111 {
|
|
112 char* keyname="SOFTWARE\\Microsoft\\Scrunch\\Video";
|
|
113 result=RegCreateKeyExA(HKEY_CURRENT_USER, keyname, 0, 0, 0, 0, 0, &newkey, &status);
|
|
114 if(result!=0)
|
|
115 {
|
|
116 printf("VideoDecoder::SetExtAttr: registry failure\n");
|
|
117 return -1;
|
|
118 }
|
|
119 result=RegSetValueExA(newkey, attribute, 0, REG_DWORD, &value, 4);
|
|
120 if(result!=0)
|
|
121 {
|
|
122 printf("VideoDecoder::SetExtAttr: error writing value\n");
|
|
123 return -1;
|
|
124 }
|
|
125 RegCloseKey(newkey);
|
|
126 return 0;
|
|
127 }
|
|
128
|
|
129 printf("Unknown attribute!\n");
|
|
130 return -200;
|
|
131 }
|
|
132
|