annotate loader/qtx/qtxload.c @ 30543:ee0b9c3bbf29

Add support for decoding 4:2:2 and 4:4:4 Theora files. Patch by Giorgio Vazzana [mywing81 gmail com]
author reimar
date Sun, 14 Feb 2010 15:39:52 +0000
parents fee09b258e8a
children 70f60913b117
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
alex
parents:
diff changeset
19 #include <stdio.h>
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
20 #include <stdlib.h>
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
21 #include <string.h>
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
22
2501
alex
parents:
diff changeset
23 #include "qtxsdk/components.h"
2778
arpi
parents: 2768
diff changeset
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
59466c2ce1f0 Add missing #include, fixes the warning:
diego
parents: 26528
diff changeset
26 #include "mp_msg.h"
2501
alex
parents:
diff changeset
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
alex
parents:
diff changeset
29 ComponentResult ComponentDummy(
2778
arpi
parents: 2768
diff changeset
30 ComponentParameters *params,
2501
alex
parents:
diff changeset
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
alex
parents:
diff changeset
33 {
alex
parents:
diff changeset
34 printf("ComponentDummy(params: %p, globals: %p, dispatcher: %p) called!\n",
alex
parents:
diff changeset
35 params, globals, ComponentDispatch);
alex
parents:
diff changeset
36 printf(" Dummy: global datas: %p\n", *globals);
alex
parents:
diff changeset
37 printf(" Dummy: returning 0\n");
26757
0fdf04b07ecb cosmetics: Remove pointless parentheses from return statements.
diego
parents: 26538
diff changeset
38 return 0;
2501
alex
parents:
diff changeset
39 }
alex
parents:
diff changeset
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
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
42
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
43 void* LoadLibraryA(char* name);
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
44 void* GetProcAddress(void* handle,char* func);
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
45
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
46 #define __stdcall __attribute__((__stdcall__))
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
47 #define __cdecl __attribute__((__cdecl__))
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28599
diff changeset
48 #define APIENTRY
2501
alex
parents:
diff changeset
49
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
50 unsigned int* x_table[0x00001837];
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
51
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
52 static OSErr (*InitializeQTML)(long flags);
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
53
28599
3ff0da40013d cosmetics: Replace unused 'argc/argv' in main declarations by 'void'.
diego
parents: 27772
diff changeset
54 int main(void) {
2501
alex
parents:
diff changeset
55 void *handler;
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
56 void *handler2;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
57 void* theqtdp=NULL;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
58 void* compcall=NULL;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
59 void* compcallws=NULL;
16194
167342641f0b Remove stray MSDOS linebreaks
ivo
parents: 8268
diff changeset
60 ComponentResult (*dispatcher)(ComponentParameters *params, Globals glob);
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
61 ComponentResult ret;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
62 ComponentParameters *params;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
63 ComponentDescription desc;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
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
alex
parents:
diff changeset
67
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
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
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
70
2501
alex
parents:
diff changeset
71 Setup_LDT_Keeper();
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
72 printf("loading qts\n");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
73 // handler = LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime.qts");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
74 handler = LoadLibraryA("QuickTime.qts");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
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
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
78
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
79 InitializeQTML = 0x6299e590;//GetProcAddress(handler, "InitializeQTML");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
80 InitializeQTML(6+16);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28599
diff changeset
81
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
82 printf("loading svq3\n");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
83 handler2= LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime/QuickTimeEssentials.qtx");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
84 printf("done\n");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
85 dispatcher = GetProcAddress(handler2, "SMD_ComponentDispatch");
25593
96ce0ca753ff /usr/lib/win32 --> /usr/local/lib/codecs
diego
parents: 25592
diff changeset
86 // handler = expLoadLibraryA("/usr/local/lib/codecs/On2_VP3.qtx");
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
87 // dispatcher = GetProcAddress(handler, "CDComponentDispatcher");
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
88 printf("handler: %p, dispatcher: %p theqtdp: %p\n", handler, dispatcher, theqtdp);
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
89
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
90 // printf("theQuickTimeDispatcher = %p\n",GetProcAddress(handler, "theQuickTimeDispatcher"));
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
91
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
92 // patch svq3 dll:
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
93 *((void**)0x63214c98) = NULL;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
94 *((void**)0x63214c9c) = theqtdp; // theQt...
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
95 *((void**)0x63214ca0) = compcall; //0xdeadbeef; //dispatcher; // CallCOmponent_ptr
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
96 *((void**)0x63214ca4) = compcallws; //0xdeadbef2; //dispatcher; // CallComponentWithStorage_ptr
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
97
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
98 desc.componentType=0;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
99 desc.componentSubType=0;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
100 desc.componentManufacturer=0;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
101 desc.componentFlags=0;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
102 desc.componentFlagsMask=0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28599
diff changeset
103
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
104 params = malloc(sizeof(ComponentParameters)+2048);
2501
alex
parents:
diff changeset
105
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
106 params->flags = 0;
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
107 params->paramSize = 4;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
108 params->what = kComponentOpenSelect;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
109 params->params[0] = 0x830000; //0x820000|i; //(i<<16)|0x24; //0x820024;
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
110 ret = dispatcher(params, &globals);
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
111 printf("!!! CDComponentDispatch() => 0x%X glob=%p\n",ret,globals);
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
112
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
113 // memset(x_table,12,4*0x00001837);
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
114
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
115 //for(i=0;i<=255;i++){
2778
arpi
parents: 2768
diff changeset
116
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
117 // params->what = kComponentVersionSelect;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
118 // params->what = kComponentRegisterSelect;
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
119 // params->what = kComponentOpenSelect;
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
120 // params->what = kComponentCanDoSelect;
2778
arpi
parents: 2768
diff changeset
121
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
122 printf("params: flags: %d, paramSize: %d, what: %d, params[0] = %x\n",
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
123 params->flags, params->paramSize, params->what, params->params[0]);
2778
arpi
parents: 2768
diff changeset
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
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
126 // printf("ESP=%p\n",esp);
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
127
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
128 *((void**)0x62b7d640) = &x_table[0]; //malloc(0x00001837 * 4); // ugly hack?
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
129
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
130 printf("params=%p &glob=%p x_table=%p\n",params,&globals, &x_table[0]);
2778
arpi
parents: 2768
diff changeset
131
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
132 ret = dispatcher(params, &globals);
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
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
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
135 // printf("ESP=%p\n",esp);
2778
arpi
parents: 2768
diff changeset
136
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
137 printf("!!! CDComponentDispatch() => %d glob=%p\n",ret,globals);
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
138 // if(ret!=-3000) break;
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
139 //}
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
140
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
141 // for(i=0;i<0x00001837;i++)
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
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
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
144 exit(0);
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
145 //return 0;
2501
alex
parents:
diff changeset
146 }