Mercurial > mplayer.hg
annotate libmpcodecs/vd_qtvideo.c @ 30857:77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
friends) instead of the unsupported, internal ones (ImageCodecBeginBand
etc.). This is a prerequisite for, among others, Apple ProRes 4:2:2 support,
and simplifies the file by quite a bit.
Tested on Linux with all existing QuickTime codecs I could get to work in the
first place; qt261, qtavui, qtsvq3 have no change. qtcvid appears to not give
bit-exact the same output as before, but it looks just the same in playback
to me. qt3ivx stops crashing on exit (so works better than before). With some
extra patches and a codecs.conf entry, ProRes 4:2:2 also works, including on
Linux.
Since codec initialization is now actually done on decoder init instead of on
first frame, fallback should also work a bit better (although usually, qtvideo
is last in the chain). Also made the decoder complain explicitly if the
demuxer data is not there (ie., the user tried to run without -demuxer mov).
This patch is a cleaned up version of what Andrew Wason (rectalogic A
rectalogic D com) posted to mplayer-dev-eng in June.
author | sesse |
---|---|
date | Mon, 15 Mar 2010 12:05:56 +0000 |
parents | 4c3685b029f7 |
children | 22ec9cfbb129 |
rev | line source |
---|---|
30421
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
1 /* |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
2 * This file is part of MPlayer. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
3 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
7 * (at your option) any later version. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
8 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
12 * GNU General Public License for more details. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
13 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
17 */ |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
18 |
8160 | 19 #include <stdio.h> |
20 #include <stdlib.h> | |
21263
db9754cebfab
Move #include <QuickTime/ImageCodec.h> before internal headers
uau
parents:
18771
diff
changeset
|
21 #include <inttypes.h> |
8160 | 22 |
23 #include "config.h" | |
28196
504aa3e3076a
Reorder #includes and #ifdefs to avoid warnings and excessive #ifdeffery.
diego
parents:
27432
diff
changeset
|
24 #include "mp_msg.h" |
504aa3e3076a
Reorder #includes and #ifdefs to avoid warnings and excessive #ifdeffery.
diego
parents:
27432
diff
changeset
|
25 #include "mpbswap.h" |
504aa3e3076a
Reorder #includes and #ifdefs to avoid warnings and excessive #ifdeffery.
diego
parents:
27432
diff
changeset
|
26 #include "vd_internal.h" |
8160 | 27 |
27388
ac03760f7fcc
Rename all preprocessor directives related to Apple / Mac OS X.
diego
parents:
26754
diff
changeset
|
28 #ifdef CONFIG_QUICKTIME |
21263
db9754cebfab
Move #include <QuickTime/ImageCodec.h> before internal headers
uau
parents:
18771
diff
changeset
|
29 #include <QuickTime/ImageCodec.h> |
db9754cebfab
Move #include <QuickTime/ImageCodec.h> before internal headers
uau
parents:
18771
diff
changeset
|
30 #define dump_ImageDescription(x) |
28196
504aa3e3076a
Reorder #includes and #ifdefs to avoid warnings and excessive #ifdeffery.
diego
parents:
27432
diff
changeset
|
31 #else |
504aa3e3076a
Reorder #includes and #ifdefs to avoid warnings and excessive #ifdeffery.
diego
parents:
27432
diff
changeset
|
32 #include "loader/ldt_keeper.h" |
504aa3e3076a
Reorder #includes and #ifdefs to avoid warnings and excessive #ifdeffery.
diego
parents:
27432
diff
changeset
|
33 #include "loader/qtx/qtxsdk/components.h" |
22577
a033e5519802
Include loader/ prefix in #include path everywhere.
diego
parents:
21264
diff
changeset
|
34 #include "loader/wine/windef.h" |
8451 | 35 #endif |
36 | |
30504
cc27da5d7286
Mark all ad_info_t/vd_info_t structure declarations as const.
diego
parents:
30421
diff
changeset
|
37 static const vd_info_t info = { |
8160 | 38 "Quicktime Video decoder", |
39 "qtvideo", | |
40 "A'rpi", | |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
41 "Sascha Sommer", |
8160 | 42 "win32" |
43 }; | |
44 | |
45 LIBVD_EXTERN(qtvideo) | |
46 | |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
47 static mp_image_t* mpi; |
8160 | 48 static Rect OutBufferRect; //the dimensions of our GWorld |
49 | |
50 static GWorldPtr OutBufferGWorld = NULL;//a GWorld is some kind of description for a drawing environment | |
51 static ImageDescriptionHandle framedescHandle; | |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
52 static ImageSequence imageSeq; |
8160 | 53 |
27388
ac03760f7fcc
Rename all preprocessor directives related to Apple / Mac OS X.
diego
parents:
26754
diff
changeset
|
54 #ifndef CONFIG_QUICKTIME |
28196
504aa3e3076a
Reorder #includes and #ifdefs to avoid warnings and excessive #ifdeffery.
diego
parents:
27432
diff
changeset
|
55 HMODULE WINAPI LoadLibraryA(LPCSTR); |
504aa3e3076a
Reorder #includes and #ifdefs to avoid warnings and excessive #ifdeffery.
diego
parents:
27432
diff
changeset
|
56 FARPROC WINAPI GetProcAddress(HMODULE,LPCSTR); |
504aa3e3076a
Reorder #includes and #ifdefs to avoid warnings and excessive #ifdeffery.
diego
parents:
27432
diff
changeset
|
57 int WINAPI FreeLibrary(HMODULE); |
504aa3e3076a
Reorder #includes and #ifdefs to avoid warnings and excessive #ifdeffery.
diego
parents:
27432
diff
changeset
|
58 static HINSTANCE qtime_qts; // handle to the preloaded quicktime.qts |
504aa3e3076a
Reorder #includes and #ifdefs to avoid warnings and excessive #ifdeffery.
diego
parents:
27432
diff
changeset
|
59 static HMODULE handler; |
8160 | 60 static OSErr (*InitializeQTML)(long flags); |
61 static OSErr (*EnterMovies)(void); | |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
62 static OSErr (*ExitMovies)(void); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
63 static OSErr (*DecompressSequenceBegin)(ImageSequence *seqID, |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
64 ImageDescriptionHandle desc, |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
65 CGrafPtr port, |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
66 /*GDHandle*/void* gdh, |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
67 const Rect *srcRect, |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
68 MatrixRecordPtr matrix, |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
69 short mode, |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
70 RgnHandle mask, |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
71 CodecFlags flags, |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
72 CodecQ accuracy, |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
73 DecompressorComponent codec); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
74 static OSErr (*DecompressSequenceFrameS)(ImageSequence seqID, |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
75 Ptr data, |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
76 long dataSize, |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
77 CodecFlags inFlags, |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
78 CodecFlags *outFlags, |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
79 ICMCompletionProcRecordPtr asyncCompletionProc); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28198
diff
changeset
|
80 static PixMapHandle (*GetGWorldPixMap)(GWorldPtr offscreenGWorld); |
8160 | 81 static OSErr (*QTNewGWorldFromPtr)(GWorldPtr *gw, |
82 OSType pixelFormat, | |
83 const Rect *boundsRect, | |
84 CTabHandle cTable, | |
85 /*GDHandle*/void* aGDevice, //unused anyway | |
86 GWorldFlags flags, | |
87 void *baseAddr, | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28198
diff
changeset
|
88 long rowBytes); |
30812 | 89 static Handle (*NewHandleClear)(Size byteCount); |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
90 static void (*DisposeHandle)(Handle h); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
91 static void (*DisposeGWorld)(GWorldPtr offscreenGWorld); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
92 static OSErr (*CDSequenceEnd)(ImageSequence seqID); |
27388
ac03760f7fcc
Rename all preprocessor directives related to Apple / Mac OS X.
diego
parents:
26754
diff
changeset
|
93 #endif /* #ifndef CONFIG_QUICKTIME */ |
8160 | 94 |
95 // to set/get/query special features/parameters | |
96 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
97 return CONTROL_UNKNOWN; | |
98 } | |
99 | |
100 // init driver | |
101 static int init(sh_video_t *sh){ | |
28198 | 102 #ifndef CONFIG_QUICKTIME |
30812 | 103 OSErr result = 1; |
28198 | 104 #endif |
8160 | 105 |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
106 if (sh->ImageDesc == NULL) { |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
107 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"sh->ImageDesc not set, cannot use binary QuickTime codecs (try -demuxer mov?)\n"); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
108 return 0; |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
109 } |
9502
241bba8f60e8
MACOSX support patch, based on Dan Christiansens work
alex
parents:
9405
diff
changeset
|
110 |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
111 #ifndef CONFIG_QUICKTIME |
9405
a4444e7ee56a
real cygwin support by Sascha Sommer <saschasommer@freenet.de>
alex
parents:
8473
diff
changeset
|
112 #ifdef WIN32_LOADER |
8270 | 113 Setup_LDT_Keeper(); |
114 #endif | |
115 | |
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
|
116 //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
|
117 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
|
118 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
|
119 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
|
120 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
|
121 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28198
diff
changeset
|
122 |
8160 | 123 handler = LoadLibraryA("qtmlClient.dll"); |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
124 if(!handler){ |
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
125 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
|
126 return 0; |
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
127 } |
8160 | 128 |
8451 | 129 InitializeQTML = (OSErr (*)(long))GetProcAddress(handler, "InitializeQTML"); |
130 EnterMovies = (OSErr (*)(void))GetProcAddress(handler, "EnterMovies"); | |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
131 ExitMovies = (OSErr (*)(void))GetProcAddress(handler, "ExitMovies"); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
132 DecompressSequenceBegin = (OSErr (*)(ImageSequence*,ImageDescriptionHandle,CGrafPtr,void *,const Rect *,MatrixRecordPtr,short,RgnHandle,CodecFlags,CodecQ,DecompressorComponent))GetProcAddress(handler, "DecompressSequenceBegin"); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
133 DecompressSequenceFrameS = (OSErr (*)(ImageSequence,Ptr,long,CodecFlags,CodecFlags*,ICMCompletionProcRecordPtr))GetProcAddress(handler, "DecompressSequenceFrameS"); |
8451 | 134 GetGWorldPixMap = (PixMapHandle (*)(GWorldPtr))GetProcAddress(handler, "GetGWorldPixMap"); |
135 QTNewGWorldFromPtr = (OSErr(*)(GWorldPtr *,OSType,const Rect *,CTabHandle,void*,GWorldFlags,void *,long))GetProcAddress(handler, "QTNewGWorldFromPtr"); | |
136 NewHandleClear = (OSErr(*)(Size))GetProcAddress(handler, "NewHandleClear"); | |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
137 DisposeHandle = (void (*)(Handle))GetProcAddress(handler, "DisposeHandle"); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
138 DisposeGWorld = (void (*)(GWorldPtr))GetProcAddress(handler, "DisposeGWorld"); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
139 CDSequenceEnd = (OSErr (*)(ImageSequence))GetProcAddress(handler, "CDSequenceEnd"); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28198
diff
changeset
|
140 |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
141 if(!InitializeQTML || !EnterMovies || !DecompressSequenceBegin || !DecompressSequenceFrameS){ |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
142 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"invalid qtmlClient.dll!\n"); |
8160 | 143 return 0; |
144 } | |
145 | |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
146 result=InitializeQTML(kInitializeQTMLDisableDirectSound | |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
147 kInitializeQTMLUseGDIFlag | |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
148 kInitializeQTMLDisableDDClippers); |
30812 | 149 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"InitializeQTML returned %d\n",result); |
27388
ac03760f7fcc
Rename all preprocessor directives related to Apple / Mac OS X.
diego
parents:
26754
diff
changeset
|
150 #endif /* CONFIG_QUICKTIME */ |
8160 | 151 |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
152 result=EnterMovies(); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
153 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"EnterMovies returned %d\n",result); |
8160 | 154 |
155 //make a yuy2 gworld | |
156 OutBufferRect.top=0; | |
157 OutBufferRect.left=0; | |
158 OutBufferRect.right=sh->disp_w; | |
159 OutBufferRect.bottom=sh->disp_h; | |
160 | |
161 //Fill the imagedescription for our SVQ3 frame | |
162 //we can probably get this from Demuxer | |
8471 | 163 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
|
164 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageDescription size: %d\n",((ImageDescription*)(sh->ImageDesc))->idSize); |
8301 | 165 framedescHandle=(ImageDescriptionHandle)NewHandleClear(((ImageDescription*)(sh->ImageDesc))->idSize); |
166 memcpy(*framedescHandle,sh->ImageDesc,((ImageDescription*)(sh->ImageDesc))->idSize); | |
8471 | 167 dump_ImageDescription(*framedescHandle); |
8160 | 168 |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
169 (**framedescHandle).cType = bswap_32(sh->format); |
13188 | 170 sh->context = (void *)kYUVSPixelFormat; |
8282 | 171 { |
172 int imgfmt = sh->codec->outfmt[sh->outfmtidx]; | |
173 int qt_imgfmt; | |
174 switch(imgfmt) | |
175 { | |
176 case IMGFMT_YUY2: | |
177 qt_imgfmt = kYUVSPixelFormat; | |
178 break; | |
179 case IMGFMT_YVU9: | |
8301 | 180 qt_imgfmt = 0x73797639; //kYVU9PixelFormat; |
181 break; | |
182 case IMGFMT_YV12: | |
183 qt_imgfmt = 0x79343230; | |
8282 | 184 break; |
185 case IMGFMT_UYVY: | |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
186 qt_imgfmt = k2vuyPixelFormat; |
8282 | 187 break; |
188 case IMGFMT_YVYU: | |
189 qt_imgfmt = kYVYU422PixelFormat; | |
190 imgfmt = IMGFMT_YUY2; | |
191 break; | |
192 case IMGFMT_RGB16: | |
193 qt_imgfmt = k16LE555PixelFormat; | |
194 break; | |
195 case IMGFMT_BGR24: | |
196 qt_imgfmt = k24BGRPixelFormat; | |
197 break; | |
198 case IMGFMT_BGR32: | |
199 qt_imgfmt = k32BGRAPixelFormat; | |
200 break; | |
201 case IMGFMT_RGB32: | |
202 qt_imgfmt = k32RGBAPixelFormat; | |
203 break; | |
204 default: | |
12194
81f8e4f97b38
printf -> mp_msg, error msg when qtmlClient.dll is missing
faust3
parents:
9502
diff
changeset
|
205 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Unknown requested csp\n"); |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
206 return 0; |
8282 | 207 } |
17366 | 208 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"imgfmt: %s qt_imgfmt: %.4s\n", vo_format_name(imgfmt), (char *)&qt_imgfmt); |
13188 | 209 sh->context = (void *)qt_imgfmt; |
8282 | 210 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,imgfmt)) return 0; |
211 } | |
8160 | 212 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28198
diff
changeset
|
213 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE, |
8160 | 214 sh->disp_w, sh->disp_h); |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
215 if(!mpi) return 0; |
30614
ed516abd6137
Fix the stack crash(SYS3171) on OS/2 when playing qtaudio/qtvideo.
komh
parents:
30504
diff
changeset
|
216 |
8160 | 217 result = QTNewGWorldFromPtr( |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28198
diff
changeset
|
218 &OutBufferGWorld, |
13188 | 219 (OSType)sh->context, |
8160 | 220 &OutBufferRect, //we should benchmark if yvu9 is faster for svq3, too |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28198
diff
changeset
|
221 0, |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28198
diff
changeset
|
222 0, |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28198
diff
changeset
|
223 0, |
8160 | 224 mpi->planes[0], |
225 mpi->stride[0]); | |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
226 if (result) { |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
227 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"QTNewGWorldFromPtr result=%d\n",result); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
228 return 0; |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
229 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28198
diff
changeset
|
230 |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
231 result = DecompressSequenceBegin(&imageSeq, framedescHandle, (CGrafPtr)OutBufferGWorld, |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
232 NULL, NULL, NULL, srcCopy, NULL, 0, |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
233 codecNormalQuality, 0); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
234 if(result) { |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
235 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"DecompressSequenceBegin result=%d\n",result); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
236 return 0; |
8430 | 237 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28198
diff
changeset
|
238 |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
239 return 1; |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
240 } |
8160 | 241 |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
242 // uninit driver |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
243 static void uninit(sh_video_t *sh){ |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
244 OSErr result; |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
245 if(OutBufferGWorld) { |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
246 DisposeGWorld(OutBufferGWorld); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
247 OutBufferGWorld = NULL; |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
248 } |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
249 if(framedescHandle) { |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
250 DisposeHandle((Handle)framedescHandle); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
251 framedescHandle = NULL; |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
252 } |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
253 if(imageSeq) { |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
254 CDSequenceEnd(imageSeq); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
255 imageSeq = 0; |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
256 } |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
257 result=ExitMovies(); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
258 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ExitMovies returned %d\n",result); |
8160 | 259 } |
260 | |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
261 // decode a frame |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
262 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
263 OSErr result = 1; |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
264 CodecFlags ignore; |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
265 |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
266 if(len<=0) return NULL; // skipped frame |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
267 |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
268 #ifdef WIN32_LOADER |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
269 Setup_FS_Segment(); |
8160 | 270 #endif |
271 | |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
272 result = DecompressSequenceFrameS(imageSeq, data, len, 0, &ignore, NULL); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
273 if(result) { |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
274 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"DecompressSequenceFrameS result=0x%d\n",result); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
275 return NULL; |
8321
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
276 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28198
diff
changeset
|
277 |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
278 if((int)sh->context==0x73797639){ // Sorenson 16-bit YUV -> std YVU9 |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
279 int i; |
8321
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
280 |
30857
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
281 PixMap dstPixMap = **GetGWorldPixMap(OutBufferGWorld); |
77ce62f13d42
Use the high-level QuickTime decoding APIs (DecompressSequenceFrameS and
sesse
parents:
30812
diff
changeset
|
282 short *src0=(short *)((char*)dstPixMap.baseAddr+0x20); |
8321
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
283 |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
284 for(i=0;i<mpi->h;i++){ |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
285 int x; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
286 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
|
287 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
|
288 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
|
289 } |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
290 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
|
291 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
|
292 int x; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
293 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
|
294 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
|
295 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
|
296 src+=((mpi->w+63)&(~63))/4; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
297 } |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
298 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
|
299 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
|
300 int x; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
301 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
|
302 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
|
303 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
|
304 src+=((mpi->w+63)&(~63))/4; |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
305 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28198
diff
changeset
|
306 |
8321
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
307 } |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
308 |
ca24204fb547
SVQ1 support (ugly hack... - really we need 'syuv' support in swscaler :))
arpi
parents:
8301
diff
changeset
|
309 |
8160 | 310 return mpi; |
311 } |