ad_faad: Make work with -demuxer lavf
[mplayer/glamo.git] / loader / qtx / qtxload.c
blobf66d7fc33836004ff178685a89e1a43cdada8bce
1 /*
2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <string.h>
23 #include "qtxsdk/components.h"
24 #include "qtxsdk/select.h"
25 #include "loader/ldt_keeper.h"
26 #include "loader/wine/winbase.h"
27 #include "mp_msg.h"
29 unsigned int* x_table[0x00001837];
31 static OSErr (*InitializeQTML)(long flags);
33 int main(void) {
34 void *handler;
35 void *handler2;
36 void* theqtdp=NULL;
37 void* compcall=NULL;
38 void* compcallws=NULL;
39 ComponentResult (*dispatcher)(ComponentParameters *params, Globals glob);
40 ComponentResult ret;
41 ComponentParameters *params;
42 ComponentDescription desc;
43 void *globals=NULL;
44 //unsigned int esp=0;
45 //int i;
47 mp_msg_init();
48 //mp_msg_set_level(10);
50 Setup_LDT_Keeper();
51 printf("loading qts\n");
52 // handler = LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime.qts");
53 handler = LoadLibraryA("QuickTime.qts");
54 theqtdp = GetProcAddress(handler, "theQuickTimeDispatcher");
55 compcall = GetProcAddress(handler, "CallComponent");
56 compcallws = GetProcAddress(handler, "CallComponentFunctionWithStorage");
58 InitializeQTML = 0x6299e590;//GetProcAddress(handler, "InitializeQTML");
59 InitializeQTML(6+16);
61 printf("loading svq3\n");
62 handler2= LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime/QuickTimeEssentials.qtx");
63 printf("done\n");
64 dispatcher = GetProcAddress(handler2, "SMD_ComponentDispatch");
65 // handler = expLoadLibraryA("/usr/local/lib/codecs/On2_VP3.qtx");
66 // dispatcher = GetProcAddress(handler, "CDComponentDispatcher");
67 printf("handler: %p, dispatcher: %p theqtdp: %p\n", handler, dispatcher, theqtdp);
69 // printf("theQuickTimeDispatcher = %p\n",GetProcAddress(handler, "theQuickTimeDispatcher"));
71 // patch svq3 dll:
72 *((void**)0x63214c98) = NULL;
73 *((void**)0x63214c9c) = theqtdp; // theQt...
74 *((void**)0x63214ca0) = compcall; //0xdeadbeef; //dispatcher; // CallCOmponent_ptr
75 *((void**)0x63214ca4) = compcallws; //0xdeadbef2; //dispatcher; // CallComponentWithStorage_ptr
77 desc.componentType=0;
78 desc.componentSubType=0;
79 desc.componentManufacturer=0;
80 desc.componentFlags=0;
81 desc.componentFlagsMask=0;
83 params = malloc(sizeof(ComponentParameters)+2048);
85 params->flags = 0;
86 params->paramSize = 4;
87 params->what = kComponentOpenSelect;
88 params->params[0] = 0x830000; //0x820000|i; //(i<<16)|0x24; //0x820024;
89 ret = dispatcher(params, &globals);
90 printf("!!! CDComponentDispatch() => 0x%X glob=%p\n",ret,globals);
92 // memset(x_table,12,4*0x00001837);
94 //for(i=0;i<=255;i++){
96 // params->what = kComponentVersionSelect;
97 // params->what = kComponentRegisterSelect;
98 // params->what = kComponentOpenSelect;
99 // params->what = kComponentCanDoSelect;
101 printf("params: flags: %d, paramSize: %d, what: %d, params[0] = %x\n",
102 params->flags, params->paramSize, params->what, params->params[0]);
104 // __asm__ volatile ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
105 // printf("ESP=%p\n",esp);
107 *((void**)0x62b7d640) = &x_table[0]; //malloc(0x00001837 * 4); // ugly hack?
109 printf("params=%p &glob=%p x_table=%p\n",params,&globals, &x_table[0]);
111 ret = dispatcher(params, &globals);
113 // __asm__ volatile ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
114 // printf("ESP=%p\n",esp);
116 printf("!!! CDComponentDispatch() => %d glob=%p\n",ret,globals);
117 // if(ret!=-3000) break;
120 // for(i=0;i<0x00001837;i++)
121 // if(x_table[i]) printf("x_table[0x%X] = %p\n",i,x_table[i]);
123 exit(0);
124 //return 0;