Mercurial > mplayer.hg
annotate loader/dshow/DS_VideoDec.c @ 2674:aadcae54d45c
started mencoder documentation
author | gabucino |
---|---|
date | Sun, 04 Nov 2001 11:20:11 +0000 |
parents | 4b3f3f850896 |
children |
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" |
2072 | 6 #include "wine/winerror.h" |
1545 | 7 //#include <cpuinfo.h> |
1063 | 8 |
2072 | 9 //#include <unistd.h> |
10 //#include <fcntl.h> | |
11 //#include <errno.h> | |
12 //#include <sys/types.h> | |
13 //#include <sys/mman.h> | |
169 | 14 |
2072 | 15 //#include <cstdio> |
16 //#include <iostream> | |
17 //#include <strstream> | |
18 | |
19 #include "registry.h" | |
1545 | 20 //#include <wine/winreg.h> |
169 | 21 |
22 #include "DS_VideoDec.h" | |
23 | |
2067 | 24 #include "ldt_keeper.h" |
25 | |
1545 | 26 static void* _handle; // will be parameter later... |
27 static char** _d_ptr; // will be parameter later... | |
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 |