Mercurial > mplayer.hg
annotate loader/qtx/qtxload.c @ 30452:fee09b258e8a
Add missing license headers to test programs for external libraries.
author | diego |
---|---|
date | Wed, 03 Feb 2010 08:32:35 +0000 |
parents | 008338d7679f |
children | 70f60913b117 |
rev | line source |
---|---|
30452
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
1 /* |
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
2 * This file is part of MPlayer. |
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
3 * |
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
7 * (at your option) any later version. |
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
8 * |
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
12 * GNU General Public License for more details. |
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
13 * |
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
17 */ |
fee09b258e8a
Add missing license headers to test programs for external libraries.
diego
parents:
30170
diff
changeset
|
18 |
2501 | 19 #include <stdio.h> |
2796 | 20 #include <stdlib.h> |
21 #include <string.h> | |
22 | |
2501 | 23 #include "qtxsdk/components.h" |
2778 | 24 #include "qtxsdk/select.h" |
30170
008338d7679f
Drop -Iloader from CPPFLAGS for the loader subdirectory.
diego
parents:
29263
diff
changeset
|
25 #include "loader/ldt_keeper.h" |
26530 | 26 #include "mp_msg.h" |
2501 | 27 |
27772
145dec34e7d8
Translate a Hungarian comment, thanks to Denes Balatoni.
diego
parents:
27757
diff
changeset
|
28 /* this is what a plain component looks like */ |
2501 | 29 ComponentResult ComponentDummy( |
2778 | 30 ComponentParameters *params, |
2501 | 31 void **globals, |
25589
276d47411414
Fix compilation by replacing a broken macro with in-place code.
diego
parents:
18889
diff
changeset
|
32 ComponentResult (*ComponentDispatch)(ComponentParameters *, void **)) |
2501 | 33 { |
34 printf("ComponentDummy(params: %p, globals: %p, dispatcher: %p) called!\n", | |
35 params, globals, ComponentDispatch); | |
36 printf(" Dummy: global datas: %p\n", *globals); | |
37 printf(" Dummy: returning 0\n"); | |
26757
0fdf04b07ecb
cosmetics: Remove pointless parentheses from return statements.
diego
parents:
26538
diff
changeset
|
38 return 0; |
2501 | 39 } |
40 | |
18889
e60c8c7399d2
get_path as const, patch by Stefan Huehner, stefan AT huehner-org
reynaldo
parents:
16194
diff
changeset
|
41 char *get_path(const char* x){ return strdup(x);} |
2796 | 42 |
3935 | 43 void* LoadLibraryA(char* name); |
2796 | 44 void* GetProcAddress(void* handle,char* func); |
45 | |
46 #define __stdcall __attribute__((__stdcall__)) | |
47 #define __cdecl __attribute__((__cdecl__)) | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28599
diff
changeset
|
48 #define APIENTRY |
2501 | 49 |
3935 | 50 unsigned int* x_table[0x00001837]; |
51 | |
8268 | 52 static OSErr (*InitializeQTML)(long flags); |
53 | |
28599
3ff0da40013d
cosmetics: Replace unused 'argc/argv' in main declarations by 'void'.
diego
parents:
27772
diff
changeset
|
54 int main(void) { |
2501 | 55 void *handler; |
8268 | 56 void *handler2; |
57 void* theqtdp=NULL; | |
58 void* compcall=NULL; | |
59 void* compcallws=NULL; | |
16194 | 60 ComponentResult (*dispatcher)(ComponentParameters *params, Globals glob); |
2796 | 61 ComponentResult ret; |
62 ComponentParameters *params; | |
63 ComponentDescription desc; | |
64 void *globals=NULL; | |
26528
da85ae10987e
Comment out variables only used in commented-out code, fixes the warnings:
diego
parents:
25794
diff
changeset
|
65 //unsigned int esp=0; |
da85ae10987e
Comment out variables only used in commented-out code, fixes the warnings:
diego
parents:
25794
diff
changeset
|
66 //int i; |
2501 | 67 |
8268 | 68 mp_msg_init(); |
25590
62959db3a504
Comment out non-existing mp_msg_set_level function to fix linking.
diego
parents:
25589
diff
changeset
|
69 //mp_msg_set_level(10); |
8268 | 70 |
2501 | 71 Setup_LDT_Keeper(); |
8268 | 72 printf("loading qts\n"); |
73 // handler = LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime.qts"); | |
74 handler = LoadLibraryA("QuickTime.qts"); | |
75 theqtdp = GetProcAddress(handler, "theQuickTimeDispatcher"); | |
25794
2c8cdb9123b8
Fix a ton of illegal identifiers. Identifiers starting with __ or _ and a
diego
parents:
25593
diff
changeset
|
76 compcall = GetProcAddress(handler, "CallComponent"); |
2c8cdb9123b8
Fix a ton of illegal identifiers. Identifiers starting with __ or _ and a
diego
parents:
25593
diff
changeset
|
77 compcallws = GetProcAddress(handler, "CallComponentFunctionWithStorage"); |
8268 | 78 |
79 InitializeQTML = 0x6299e590;//GetProcAddress(handler, "InitializeQTML"); | |
80 InitializeQTML(6+16); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28599
diff
changeset
|
81 |
8268 | 82 printf("loading svq3\n"); |
83 handler2= LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime/QuickTimeEssentials.qtx"); | |
84 printf("done\n"); | |
85 dispatcher = GetProcAddress(handler2, "SMD_ComponentDispatch"); | |
25593 | 86 // handler = expLoadLibraryA("/usr/local/lib/codecs/On2_VP3.qtx"); |
2796 | 87 // dispatcher = GetProcAddress(handler, "CDComponentDispatcher"); |
8268 | 88 printf("handler: %p, dispatcher: %p theqtdp: %p\n", handler, dispatcher, theqtdp); |
89 | |
90 // printf("theQuickTimeDispatcher = %p\n",GetProcAddress(handler, "theQuickTimeDispatcher")); | |
2796 | 91 |
8268 | 92 // patch svq3 dll: |
93 *((void**)0x63214c98) = NULL; | |
94 *((void**)0x63214c9c) = theqtdp; // theQt... | |
95 *((void**)0x63214ca0) = compcall; //0xdeadbeef; //dispatcher; // CallCOmponent_ptr | |
96 *((void**)0x63214ca4) = compcallws; //0xdeadbef2; //dispatcher; // CallComponentWithStorage_ptr | |
3935 | 97 |
2796 | 98 desc.componentType=0; |
99 desc.componentSubType=0; | |
100 desc.componentManufacturer=0; | |
101 desc.componentFlags=0; | |
102 desc.componentFlagsMask=0; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28599
diff
changeset
|
103 |
2796 | 104 params = malloc(sizeof(ComponentParameters)+2048); |
2501 | 105 |
2796 | 106 params->flags = 0; |
8268 | 107 params->paramSize = 4; |
108 params->what = kComponentOpenSelect; | |
109 params->params[0] = 0x830000; //0x820000|i; //(i<<16)|0x24; //0x820024; | |
3935 | 110 ret = dispatcher(params, &globals); |
111 printf("!!! CDComponentDispatch() => 0x%X glob=%p\n",ret,globals); | |
112 | |
113 // memset(x_table,12,4*0x00001837); | |
114 | |
115 //for(i=0;i<=255;i++){ | |
2778 | 116 |
2796 | 117 // params->what = kComponentVersionSelect; |
118 // params->what = kComponentRegisterSelect; | |
8268 | 119 // params->what = kComponentOpenSelect; |
2796 | 120 // params->what = kComponentCanDoSelect; |
2778 | 121 |
2796 | 122 printf("params: flags: %d, paramSize: %d, what: %d, params[0] = %x\n", |
123 params->flags, params->paramSize, params->what, params->params[0]); | |
2778 | 124 |
27757
b5a46071062a
Replace all occurrences of '__volatile__' and '__volatile' by plain 'volatile'.
diego
parents:
26757
diff
changeset
|
125 // __asm__ volatile ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" ); |
3935 | 126 // printf("ESP=%p\n",esp); |
127 | |
128 *((void**)0x62b7d640) = &x_table[0]; //malloc(0x00001837 * 4); // ugly hack? | |
129 | |
130 printf("params=%p &glob=%p x_table=%p\n",params,&globals, &x_table[0]); | |
2778 | 131 |
2796 | 132 ret = dispatcher(params, &globals); |
133 | |
27757
b5a46071062a
Replace all occurrences of '__volatile__' and '__volatile' by plain 'volatile'.
diego
parents:
26757
diff
changeset
|
134 // __asm__ volatile ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" ); |
3935 | 135 // printf("ESP=%p\n",esp); |
2778 | 136 |
3935 | 137 printf("!!! CDComponentDispatch() => %d glob=%p\n",ret,globals); |
138 // if(ret!=-3000) break; | |
139 //} | |
140 | |
141 // for(i=0;i<0x00001837;i++) | |
142 // if(x_table[i]) printf("x_table[0x%X] = %p\n",i,x_table[i]); | |
26538
1b05ff23d572
Remove calls to Restore_LDT_Keeper, exit() is called immediately afterwards
diego
parents:
26537
diff
changeset
|
143 |
2796 | 144 exit(0); |
145 //return 0; | |
2501 | 146 } |