annotate libmpcodecs/vd_qtvideo.c @ 15296:f2c1c1034d66

synced with 1.56
author gabrov
date Fri, 29 Apr 2005 19:36:42 +0000
parents 860f06087aac
children 6ff3379a0862
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
1 #include <stdio.h>
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
2 #include <stdlib.h>
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
3
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
4 #include "config.h"
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
5
9502
241bba8f60e8 MACOSX support patch, based on Dan Christiansens work
alex
parents: 9405
diff changeset
6 #if defined(USE_QTX_CODECS) || defined(MACOSX)
12356
6a61d694f7d3 minimal fix for alex's 1000000000000l compile errors. imo the fix in
rfelker
parents: 12194
diff changeset
7 #include "wine/windef.h"
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
8
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
9 #include "mp_msg.h"
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
10 #include "vd_internal.h"
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
11
9405
a4444e7ee56a real cygwin support by Sascha Sommer <saschasommer@freenet.de>
alex
parents: 8473
diff changeset
12 #ifdef WIN32_LOADER
8451
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
13 #include "ldt_keeper.h"
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
14 #endif
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
15
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
16 static vd_info_t info = {
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
17 "Quicktime Video decoder",
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
18 "qtvideo",
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
19 "A'rpi",
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
20 "Sascha Sommer",
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
21 "win32"
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
22 };
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
23
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
24 LIBVD_EXTERN(qtvideo)
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
25
8282
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
26 #include "../bswap.h"
9502
241bba8f60e8 MACOSX support patch, based on Dan Christiansens work
alex
parents: 9405
diff changeset
27
241bba8f60e8 MACOSX support patch, based on Dan Christiansens work
alex
parents: 9405
diff changeset
28 #ifdef MACOSX
241bba8f60e8 MACOSX support patch, based on Dan Christiansens work
alex
parents: 9405
diff changeset
29 #include <QuickTime/ImageCodec.h>
241bba8f60e8 MACOSX support patch, based on Dan Christiansens work
alex
parents: 9405
diff changeset
30 #define dump_ImageDescription(x)
241bba8f60e8 MACOSX support patch, based on Dan Christiansens work
alex
parents: 9405
diff changeset
31 #else
8270
badd24741e4a loader support
arpi
parents: 8188
diff changeset
32 #include "qtx/qtxsdk/components.h"
9502
241bba8f60e8 MACOSX support patch, based on Dan Christiansens work
alex
parents: 9405
diff changeset
33 #endif
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
34
13606
73086ea05489 fix compilation on macosx with --enable-qtx patch by Zachary Bedell <zaclist@adirondack.net>
faust3
parents: 13188
diff changeset
35 #if defined(USE_QTX_CODECS) && !defined(MACOSX)
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
36 //#include "wine/windef.h"
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
37
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
38 HMODULE WINAPI LoadLibraryA(LPCSTR);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
39 FARPROC WINAPI GetProcAddress(HMODULE,LPCSTR);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
40 int WINAPI FreeLibrary(HMODULE);
9502
241bba8f60e8 MACOSX support patch, based on Dan Christiansens work
alex
parents: 9405
diff changeset
41 #endif
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
42
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
43 //static ComponentDescription desc; // for FindNextComponent()
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
44 static ComponentInstance ci=NULL; // codec handle
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
45 //static CodecInfo cinfo; // for ImageCodecGetCodecInfo()
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
46 //Component prev=NULL;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
47 //ComponentResult cres; //
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
48 static CodecCapabilities codeccap; // for decpar
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
49 static CodecDecompressParams decpar; // for ImageCodecPreDecompress()
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
50 //static ImageSubCodecDecompressCapabilities icap; // for ImageCodecInitialize()
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
51 static Rect OutBufferRect; //the dimensions of our GWorld
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
52
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
53 static GWorldPtr OutBufferGWorld = NULL;//a GWorld is some kind of description for a drawing environment
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
54 static ImageDescriptionHandle framedescHandle;
14528
860f06087aac preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents: 13606
diff changeset
55 static HINSTANCE qtime_qts; // handle to the preloaded quicktime.qts
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
56 static HMODULE handler;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
57
13606
73086ea05489 fix compilation on macosx with --enable-qtx patch by Zachary Bedell <zaclist@adirondack.net>
faust3
parents: 13188
diff changeset
58 #if defined(USE_QTX_CODECS) && !defined(MACOSX)
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
59 static Component (*FindNextComponent)(Component prev,ComponentDescription* desc);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
60 static OSErr (*GetComponentInfo)(Component prev,ComponentDescription* desc,Handle h1,Handle h2,Handle h3);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
61 static long (*CountComponents)(ComponentDescription* desc);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
62 static OSErr (*InitializeQTML)(long flags);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
63 static OSErr (*EnterMovies)(void);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
64 static ComponentInstance (*OpenComponent)(Component c);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
65 static ComponentResult (*ImageCodecInitialize)(ComponentInstance ci,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
66 ImageSubCodecDecompressCapabilities * cap);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
67 static ComponentResult (*ImageCodecBeginBand)(ComponentInstance ci,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
68 CodecDecompressParams * params,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
69 ImageSubCodecDecompressRecord * drp,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
70 long flags);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
71 static ComponentResult (*ImageCodecDrawBand)(ComponentInstance ci,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
72 ImageSubCodecDecompressRecord * drp);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
73 static ComponentResult (*ImageCodecEndBand)(ComponentInstance ci,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
74 ImageSubCodecDecompressRecord * drp,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
75 OSErr result,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
76 long flags);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
77 static ComponentResult (*ImageCodecGetCodecInfo)(ComponentInstance ci,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
78 CodecInfo * info);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
79 static ComponentResult (*ImageCodecPreDecompress)(ComponentInstance ci,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
80 CodecDecompressParams * params);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
81 static ComponentResult (*ImageCodecBandDecompress)(ComponentInstance ci,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
82 CodecDecompressParams * params);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
83 static PixMapHandle (*GetGWorldPixMap)(GWorldPtr offscreenGWorld);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
84 static OSErr (*QTNewGWorldFromPtr)(GWorldPtr *gw,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
85 OSType pixelFormat,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
86 const Rect *boundsRect,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
87 CTabHandle cTable,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
88 /*GDHandle*/void* aGDevice, //unused anyway
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
89 GWorldFlags flags,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
90 void *baseAddr,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
91 long rowBytes);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
92 static OSErr (*NewHandleClear)(Size byteCount);
9502
241bba8f60e8 MACOSX support patch, based on Dan Christiansens work
alex
parents: 9405
diff changeset
93 #endif
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
94
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
95 // to set/get/query special features/parameters
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
96 static int control(sh_video_t *sh,int cmd,void* arg,...){
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
97 return CONTROL_UNKNOWN;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
98 }
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
99
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
100 static int codec_inited=0;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
101
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
102 // init driver
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
103 static int init(sh_video_t *sh){
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
104 long result = 1;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
105 ComponentResult cres;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
106 ComponentDescription desc;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
107 Component prev=NULL;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
108 CodecInfo cinfo; // for ImageCodecGetCodecInfo()
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
109 ImageSubCodecDecompressCapabilities icap; // for ImageCodecInitialize()
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
110
9502
241bba8f60e8 MACOSX support patch, based on Dan Christiansens work
alex
parents: 9405
diff changeset
111 #ifdef MACOSX
241bba8f60e8 MACOSX support patch, based on Dan Christiansens work
alex
parents: 9405
diff changeset
112 EnterMovies();
241bba8f60e8 MACOSX support patch, based on Dan Christiansens work
alex
parents: 9405
diff changeset
113 #else
241bba8f60e8 MACOSX support patch, based on Dan Christiansens work
alex
parents: 9405
diff changeset
114
9405
a4444e7ee56a real cygwin support by Sascha Sommer <saschasommer@freenet.de>
alex
parents: 8473
diff changeset
115 #ifdef WIN32_LOADER
8270
badd24741e4a loader support
arpi
parents: 8188
diff changeset
116 Setup_LDT_Keeper();
badd24741e4a loader support
arpi
parents: 8188
diff changeset
117 #endif
badd24741e4a loader support
arpi
parents: 8188
diff changeset
118
14528
860f06087aac preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents: 13606
diff changeset
119 //preload quicktime.qts to avoid the problems caused by the hardcoded path inside the dll
860f06087aac preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents: 13606
diff changeset
120 qtime_qts = LoadLibraryA("QuickTime.qts");
860f06087aac preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents: 13606
diff changeset
121 if(!qtime_qts){
860f06087aac preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents: 13606
diff changeset
122 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"unable to load QuickTime.qts\n" );
860f06087aac preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents: 13606
diff changeset
123 return 0;
860f06087aac preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents: 13606
diff changeset
124 }
860f06087aac preload quicktime.qts, this allows us to ignore the hardcoded path inside the dlls so that quicktime.qts doesn't need to be in the windows system dir, patch by Gianluigi Tiesi <mplayer at netfarm.it>, comments by myself
faust3
parents: 13606
diff changeset
125
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
126 handler = LoadLibraryA("qtmlClient.dll");
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
127 if(!handler){
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
128 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"unable to load qtmlClient.dll\n");
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
129 return 0;
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
130 }
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
131
8451
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
132 InitializeQTML = (OSErr (*)(long))GetProcAddress(handler, "InitializeQTML");
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
133 EnterMovies = (OSErr (*)(void))GetProcAddress(handler, "EnterMovies");
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
134 FindNextComponent = (Component (*)(Component,ComponentDescription*))GetProcAddress(handler, "FindNextComponent");
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
135 CountComponents = (long (*)(ComponentDescription*))GetProcAddress(handler, "CountComponents");
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
136 GetComponentInfo = (OSErr (*)(Component,ComponentDescription*,Handle,Handle,Handle))GetProcAddress(handler, "GetComponentInfo");
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
137 OpenComponent = (ComponentInstance (*)(Component))GetProcAddress(handler, "OpenComponent");
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
138 ImageCodecInitialize = (ComponentResult (*)(ComponentInstance,ImageSubCodecDecompressCapabilities *))GetProcAddress(handler, "ImageCodecInitialize");
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
139 ImageCodecGetCodecInfo = (ComponentResult (*)(ComponentInstance,CodecInfo *))GetProcAddress(handler, "ImageCodecGetCodecInfo");
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
140 ImageCodecBeginBand = (ComponentResult (*)(ComponentInstance,CodecDecompressParams *,ImageSubCodecDecompressRecord *,long))GetProcAddress(handler, "ImageCodecBeginBand");
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
141 ImageCodecPreDecompress = (ComponentResult (*)(ComponentInstance,CodecDecompressParams *))GetProcAddress(handler, "ImageCodecPreDecompress");
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
142 ImageCodecBandDecompress = (ComponentResult (*)(ComponentInstance,CodecDecompressParams *))GetProcAddress(handler, "ImageCodecBandDecompress");
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
143 GetGWorldPixMap = (PixMapHandle (*)(GWorldPtr))GetProcAddress(handler, "GetGWorldPixMap");
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
144 QTNewGWorldFromPtr = (OSErr(*)(GWorldPtr *,OSType,const Rect *,CTabHandle,void*,GWorldFlags,void *,long))GetProcAddress(handler, "QTNewGWorldFromPtr");
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
145 NewHandleClear = (OSErr(*)(Size))GetProcAddress(handler, "NewHandleClear");
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
146 // = GetProcAddress(handler, "");
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
147
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
148 if(!InitializeQTML || !EnterMovies || !FindNextComponent || !ImageCodecBandDecompress){
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
149 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"invalid qtmlClient.dll!\n");
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
150 return 0;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
151 }
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
152
8162
98951b7331e1 no need to EnterMovies(), do minimal InitializeQTML only
arpi
parents: 8160
diff changeset
153 result=InitializeQTML(6+16);
98951b7331e1 no need to EnterMovies(), do minimal InitializeQTML only
arpi
parents: 8160
diff changeset
154 // result=InitializeQTML(0);
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
155 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"InitializeQTML returned %i\n",result);
8162
98951b7331e1 no need to EnterMovies(), do minimal InitializeQTML only
arpi
parents: 8160
diff changeset
156 // result=EnterMovies();
98951b7331e1 no need to EnterMovies(), do minimal InitializeQTML only
arpi
parents: 8160
diff changeset
157 // printf("EnterMovies->%d\n",result);
9502
241bba8f60e8 MACOSX support patch, based on Dan Christiansens work
alex
parents: 9405
diff changeset
158 #endif /* !MACOSX */
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
159
8428
2090c9d9bb03 moved component lister up, as it messes up 'desc'
arpi
parents: 8321
diff changeset
160 #if 0
2090c9d9bb03 moved component lister up, as it messes up 'desc'
arpi
parents: 8321
diff changeset
161 memset(&desc,0,sizeof(desc));
2090c9d9bb03 moved component lister up, as it messes up 'desc'
arpi
parents: 8321
diff changeset
162 while((prev=FindNextComponent(prev,&desc))){
2090c9d9bb03 moved component lister up, as it messes up 'desc'
arpi
parents: 8321
diff changeset
163 ComponentDescription desc2;
2090c9d9bb03 moved component lister up, as it messes up 'desc'
arpi
parents: 8321
diff changeset
164 unsigned char* c1=&desc2.componentType;
2090c9d9bb03 moved component lister up, as it messes up 'desc'
arpi
parents: 8321
diff changeset
165 unsigned char* c2=&desc2.componentSubType;
2090c9d9bb03 moved component lister up, as it messes up 'desc'
arpi
parents: 8321
diff changeset
166 memset(&desc2,0,sizeof(desc2));
2090c9d9bb03 moved component lister up, as it messes up 'desc'
arpi
parents: 8321
diff changeset
167 // printf("juhee %p (%p)\n",prev,&desc);
2090c9d9bb03 moved component lister up, as it messes up 'desc'
arpi
parents: 8321
diff changeset
168 GetComponentInfo(prev,&desc2,NULL,NULL,NULL);
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
169 mp_msg(MSGT_DECVIDEO,MSGL_DGB2,"DESC: %c%c%c%c/%c%c%c%c [0x%X/0x%X] 0x%X\n",
8428
2090c9d9bb03 moved component lister up, as it messes up 'desc'
arpi
parents: 8321
diff changeset
170 c1[3],c1[2],c1[1],c1[0],
2090c9d9bb03 moved component lister up, as it messes up 'desc'
arpi
parents: 8321
diff changeset
171 c2[3],c2[2],c2[1],c2[0],
2090c9d9bb03 moved component lister up, as it messes up 'desc'
arpi
parents: 8321
diff changeset
172 desc2.componentType,desc2.componentSubType,
2090c9d9bb03 moved component lister up, as it messes up 'desc'
arpi
parents: 8321
diff changeset
173 desc2.componentFlags);
2090c9d9bb03 moved component lister up, as it messes up 'desc'
arpi
parents: 8321
diff changeset
174 }
2090c9d9bb03 moved component lister up, as it messes up 'desc'
arpi
parents: 8321
diff changeset
175 #endif
2090c9d9bb03 moved component lister up, as it messes up 'desc'
arpi
parents: 8321
diff changeset
176
2090c9d9bb03 moved component lister up, as it messes up 'desc'
arpi
parents: 8321
diff changeset
177
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
178 memset(&desc,0,sizeof(desc));
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
179 desc.componentType= (((unsigned char)'i')<<24)|
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
180 (((unsigned char)'m')<<16)|
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
181 (((unsigned char)'d')<<8)|
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
182 (((unsigned char)'c'));
8282
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
183 #if 0
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
184 desc.componentSubType=
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
185 (((unsigned char)'S'<<24))|
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
186 (((unsigned char)'V')<<16)|
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
187 (((unsigned char)'Q')<<8)|
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
188 (((unsigned char)'3'));
8282
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
189 #else
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
190 desc.componentSubType = bswap_32(sh->format);
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
191 #endif
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
192 desc.componentManufacturer=0;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
193 desc.componentFlags=0;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
194 desc.componentFlagsMask=0;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
195
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
196 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"Count = %d\n",CountComponents(&desc));
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
197 prev=FindNextComponent(NULL,&desc);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
198 if(!prev){
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
199 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Cannot find requested component\n");
8282
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
200 return(0);
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
201 }
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
202 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"Found it! ID = 0x%X\n",prev);
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
203
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
204 ci=OpenComponent(prev);
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
205 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ci=%p\n",ci);
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
206
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
207 memset(&icap,0,sizeof(icap));
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
208 cres=ImageCodecInitialize(ci,&icap);
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
209 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecInitialize->%p size=%d (%d)\n",cres,icap.recordSize,icap.decompressRecordSize);
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
210
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
211 memset(&cinfo,0,sizeof(cinfo));
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
212 cres=ImageCodecGetCodecInfo(ci,&cinfo);
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
213 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"Flags: compr: 0x%X decomp: 0x%X format: 0x%X\n",
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
214 cinfo.compressFlags, cinfo.decompressFlags, cinfo.formatFlags);
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
215 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"Codec name: %.*s\n",((unsigned char*)&cinfo.typeName)[0],
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
216 ((unsigned char*)&cinfo.typeName)+1);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
217
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
218 //make a yuy2 gworld
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
219 OutBufferRect.top=0;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
220 OutBufferRect.left=0;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
221 OutBufferRect.right=sh->disp_w;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
222 OutBufferRect.bottom=sh->disp_h;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
223
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
224 //Fill the imagedescription for our SVQ3 frame
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
225 //we can probably get this from Demuxer
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
226 #if 0
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
227 framedescHandle=(ImageDescriptionHandle)NewHandleClear(sizeof(ImageDescription)+200);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
228 printf("framedescHandle=%p *p=%p\n",framedescHandle,*framedescHandle);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
229 { FILE* f=fopen("/root/.wine/fake_windows/IDesc","r");
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
230 if(!f) printf("filenot found: IDesc\n");
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
231 fread(*framedescHandle,sizeof(ImageDescription)+200,1,f);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
232 fclose(f);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
233 }
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
234 #else
8471
0b7839c27be9 Sorenson 1/3 encoding just for fun :)
arpi
parents: 8451
diff changeset
235 if(!sh->ImageDesc) sh->ImageDesc=(sh->bih+1); // hack for SVQ3-in-AVI
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
236 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageDescription size: %d\n",((ImageDescription*)(sh->ImageDesc))->idSize);
8301
d867439e3940 - fixed 10l bug (imagedesc handle allocation)
arpi
parents: 8282
diff changeset
237 framedescHandle=(ImageDescriptionHandle)NewHandleClear(((ImageDescription*)(sh->ImageDesc))->idSize);
d867439e3940 - fixed 10l bug (imagedesc handle allocation)
arpi
parents: 8282
diff changeset
238 memcpy(*framedescHandle,sh->ImageDesc,((ImageDescription*)(sh->ImageDesc))->idSize);
8471
0b7839c27be9 Sorenson 1/3 encoding just for fun :)
arpi
parents: 8451
diff changeset
239 dump_ImageDescription(*framedescHandle);
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
240 #endif
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
241 //Find codecscomponent for video decompression
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
242 // result = FindCodec ('SVQ1',anyCodec,&compressor,&decompressor );
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
243 // printf("FindCodec SVQ1 returned:%i compressor: 0x%X decompressor: 0x%X\n",result,compressor,decompressor);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
244
13188
f60bc2314146 small gcc warning fixes
rathann
parents: 12356
diff changeset
245 sh->context = (void *)kYUVSPixelFormat;
8301
d867439e3940 - fixed 10l bug (imagedesc handle allocation)
arpi
parents: 8282
diff changeset
246 #if 1
8282
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
247 {
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
248 int imgfmt = sh->codec->outfmt[sh->outfmtidx];
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
249 int qt_imgfmt;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
250 switch(imgfmt)
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
251 {
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
252 case IMGFMT_YUY2:
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
253 qt_imgfmt = kYUVSPixelFormat;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
254 break;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
255 case IMGFMT_YVU9:
8301
d867439e3940 - fixed 10l bug (imagedesc handle allocation)
arpi
parents: 8282
diff changeset
256 qt_imgfmt = 0x73797639; //kYVU9PixelFormat;
d867439e3940 - fixed 10l bug (imagedesc handle allocation)
arpi
parents: 8282
diff changeset
257 break;
d867439e3940 - fixed 10l bug (imagedesc handle allocation)
arpi
parents: 8282
diff changeset
258 case IMGFMT_YV12:
d867439e3940 - fixed 10l bug (imagedesc handle allocation)
arpi
parents: 8282
diff changeset
259 qt_imgfmt = 0x79343230;
8282
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
260 break;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
261 case IMGFMT_UYVY:
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
262 qt_imgfmt = kUYVY422PixelFormat;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
263 break;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
264 case IMGFMT_YVYU:
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
265 qt_imgfmt = kYVYU422PixelFormat;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
266 imgfmt = IMGFMT_YUY2;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
267 break;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
268 case IMGFMT_RGB16:
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
269 qt_imgfmt = k16LE555PixelFormat;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
270 break;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
271 case IMGFMT_BGR24:
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
272 qt_imgfmt = k24BGRPixelFormat;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
273 break;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
274 case IMGFMT_BGR32:
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
275 qt_imgfmt = k32BGRAPixelFormat;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
276 break;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
277 case IMGFMT_RGB32:
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
278 qt_imgfmt = k32RGBAPixelFormat;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
279 break;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
280 default:
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
281 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Unknown requested csp\n");
8282
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
282 return(0);
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
283 }
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
284 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"imgfmt: %s qt_imgfmt: %.4s\n", vo_format_name(imgfmt), &qt_imgfmt);
13188
f60bc2314146 small gcc warning fixes
rathann
parents: 12356
diff changeset
285 sh->context = (void *)qt_imgfmt;
8282
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
286 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,imgfmt)) return 0;
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
287 }
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
288 #else
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
289 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0;
8282
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
290 #endif
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
291
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
292 return 1;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
293 }
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
294
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
295 // uninit driver
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
296 static void uninit(sh_video_t *sh){
9502
241bba8f60e8 MACOSX support patch, based on Dan Christiansens work
alex
parents: 9405
diff changeset
297 #ifdef MACOSX
241bba8f60e8 MACOSX support patch, based on Dan Christiansens work
alex
parents: 9405
diff changeset
298 ExitMovies();
241bba8f60e8 MACOSX support patch, based on Dan Christiansens work
alex
parents: 9405
diff changeset
299 #endif
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
300 }
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
301
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
302 // decode a frame
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
303 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
304 long result = 1;
8321
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
305 int i;
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
306 mp_image_t* mpi;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
307 ComponentResult cres;
8473
12d19b01d4c6 handle mencoder's 0-byte 'skipped frames'
arpi
parents: 8471
diff changeset
308
12d19b01d4c6 handle mencoder's 0-byte 'skipped frames'
arpi
parents: 8471
diff changeset
309 if(len<=0) return NULL; // skipped frame
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
310
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
311 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
312 sh->disp_w, sh->disp_h);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
313 if(!mpi) return NULL;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
314
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
315 decpar.data = (char*)data;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
316 decpar.bufferSize = len;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
317 (**framedescHandle).dataSize=len;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
318
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
319 if(!codec_inited){
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
320 result = QTNewGWorldFromPtr(
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
321 &OutBufferGWorld,
8282
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
322 // kYUVSPixelFormat, //pixel format of new GWorld == YUY2
13188
f60bc2314146 small gcc warning fixes
rathann
parents: 12356
diff changeset
323 (OSType)sh->context,
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
324 &OutBufferRect, //we should benchmark if yvu9 is faster for svq3, too
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
325 0,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
326 0,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
327 0,
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
328 mpi->planes[0],
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
329 mpi->stride[0]);
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
330 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"NewGWorldFromPtr returned:%d\n",65536-(result&0xffff));
8282
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
331 // if (65536-(result&0xFFFF) != 10000)
b2c8b627d598 some fixes
alex
parents: 8270
diff changeset
332 // return NULL;
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
333
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
334 // printf("IDesc=%d\n",sizeof(ImageDescription));
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
335
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
336 decpar.imageDescription = framedescHandle;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
337 decpar.startLine=0;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
338 decpar.stopLine=(**framedescHandle).height;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
339 decpar.frameNumber = 1; //1
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
340 // decpar.conditionFlags=0xFFD; // first
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
341 // decpar.callerFlags=0x2001; // first
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
342 decpar.matrixFlags = 0;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
343 decpar.matrixType = 0;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
344 decpar.matrix = 0;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
345 decpar.capabilities=&codeccap;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
346 // decpar.accuracy = 0x1680000; //codecNormalQuality;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
347 decpar.accuracy = codecNormalQuality;
8431
e0a26ef29fc3 we don't need to pass gworld :)
arpi
parents: 8430
diff changeset
348 // decpar.port = OutBufferGWorld;
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
349 // decpar.preferredOffscreenPixelSize=17207;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
350
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
351 // decpar.sequenceID=malloc(1000);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
352 // memset(decpar.sequenceID,0,1000);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
353
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
354 // SrcRect.top=17207;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
355 // SrcRect.left=0;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
356 // SrcRect.right=0;//image_width;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
357 // SrcRect.bottom=0;//image_height;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
358
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
359 // decpar.srcRect = SrcRect;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
360 decpar.srcRect = OutBufferRect;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
361
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
362 decpar.transferMode = srcCopy;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
363 decpar.dstPixMap = **GetGWorldPixMap( OutBufferGWorld);//destPixmap;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
364
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
365 cres=ImageCodecPreDecompress(ci,&decpar);
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
366 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecPreDecompress cres=0x%X\n",cres);
8430
e3804a802aac print list of supported output colorspaces
arpi
parents: 8428
diff changeset
367
e3804a802aac print list of supported output colorspaces
arpi
parents: 8428
diff changeset
368 if(decpar.wantedDestinationPixelTypes)
e3804a802aac print list of supported output colorspaces
arpi
parents: 8428
diff changeset
369 { OSType *p=*(decpar.wantedDestinationPixelTypes);
e3804a802aac print list of supported output colorspaces
arpi
parents: 8428
diff changeset
370 if(p) while(*p){
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
371 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"supported csp: 0x%08X %.4s\n",*p,p);
8430
e3804a802aac print list of supported output colorspaces
arpi
parents: 8428
diff changeset
372 ++p;
e3804a802aac print list of supported output colorspaces
arpi
parents: 8428
diff changeset
373 }
e3804a802aac print list of supported output colorspaces
arpi
parents: 8428
diff changeset
374 }
e3804a802aac print list of supported output colorspaces
arpi
parents: 8428
diff changeset
375
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
376
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
377 // decpar.conditionFlags=0x10FFF; // first
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
378 // decpar.preferredOffscreenPixelSize=17207;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
379
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
380 // decpar.conditionFlags=0x10FFD; // first
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
381
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
382 // cres=ImageCodecPreDecompress(ci,&decpar);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
383 // printf("ImageCodecPreDecompress cres=0x%X\n",cres);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
384
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
385
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
386 codec_inited=1;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
387 }
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
388
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
389 #if 0
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
390 if(decpar.frameNumber==124){
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
391 decpar.frameNumber=1;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
392 cres=ImageCodecPreDecompress(ci,&decpar);
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
393 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecPreDecompress cres=0x%X\n",cres);
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
394 }
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
395 #endif
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
396
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
397 cres=ImageCodecBandDecompress(ci,&decpar);
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
398
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
399 ++decpar.frameNumber;
8321
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
400
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
401 if(cres&0xFFFF){
12194
81f8e4f97b38 printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents: 9502
diff changeset
402 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecBandDecompress cres=0x%X (-0x%X) %d\n",cres,-cres,cres);
8321
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
403 return NULL;
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
404 }
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
405
8321
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
406 // for(i=0;i<8;i++)
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
407 // printf("img_base[%d]=%p\n",i,((int*)decpar.dstPixMap.baseAddr)[i]);
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
408
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
409 if((int)sh->context==0x73797639){ // Sorenson 16-bit YUV -> std YVU9
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
410
8451
fb88ccbc5ccc compiler warning fixes
arpi
parents: 8431
diff changeset
411 short *src0=(short *)((char*)decpar.dstPixMap.baseAddr+0x20);
8321
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
412
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
413 for(i=0;i<mpi->h;i++){
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
414 int x;
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
415 unsigned char* dst=mpi->planes[0]+i*mpi->stride[0];
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
416 unsigned short* src=src0+i*((mpi->w+15)&(~15));
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
417 for(x=0;x<mpi->w;x++) dst[x]=src[x];
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
418 }
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
419 src0+=((mpi->w+15)&(~15))*((mpi->h+15)&(~15));
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
420 for(i=0;i<mpi->h/4;i++){
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
421 int x;
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
422 unsigned char* dst=mpi->planes[1]+i*mpi->stride[1];
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
423 unsigned short* src=src0+i*(((mpi->w+63)&(~63))/4);
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
424 for(x=0;x<mpi->w/4;x++) dst[x]=src[x];
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
425 src+=((mpi->w+63)&(~63))/4;
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
426 }
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
427 src0+=(((mpi->w+63)&(~63))/4)*(((mpi->h+63)&(~63))/4);
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
428 for(i=0;i<mpi->h/4;i++){
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
429 int x;
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
430 unsigned char* dst=mpi->planes[2]+i*mpi->stride[2];
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
431 unsigned short* src=src0+i*(((mpi->w+63)&(~63))/4);
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
432 for(x=0;x<mpi->w/4;x++) dst[x]=src[x];
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
433 src+=((mpi->w+63)&(~63))/4;
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
434 }
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
435
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
436 }
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
437
ca24204fb547 SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents: 8301
diff changeset
438
8160
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
439 return mpi;
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
440 }
2be30233c532 qt video dll codecs support
arpi
parents:
diff changeset
441 #endif