Mercurial > sdl-ios-xcode
annotate docs/html/sdloverlay.html @ 773:da0a2ad35bf4
Date: Sun, 4 Jan 2004 23:48:19 +0100
From: Max Horn
Subject: Re: Again Audio CD patch
Am 04.01.2004 um 22:38 schrieb Sam Lantinga:
>
> Okay, I fixed the buffering problems by simply using a 4 second buffer
> instead of a 1 second buffer. However, using your code I can't play an
> entire CD - the playback stops after the first song.
>
Found the problem: FSReadFork returns eofErr when the file is finished.
However, we check its return value for errors, and if anything but
noErr occurs, the reader thread aborts its current iteration. That is
bad, because it aborts before it can ever set the flag which tells that
the file is over (also, any remaining data which FSRead did return is
lost - so you'd not hear about to 4 seconds from the end of the file.
Furthermore, the computed data size was 8 bytes to high (I forgot to
account for the fact that the size of an (A)IFF chunk always contains
the chunk header & size fields, too). This is enough to make it work.
However, the end condition is rather fragile, so I tuned some other
things to be pessimistic (check for <= 0 instead of == 0, when eofErr
is encountered enforce mReadFilePosition == mFileLength). You never
know...
The attached patch fixes the issue for me.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 05 Jan 2004 00:57:51 +0000 |
parents | e5bc29de3f0a |
children | 355632dca928 |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_Overlay</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.64 |
0 | 8 "><LINK |
9 REL="HOME" | |
10 TITLE="SDL Library Documentation" | |
11 HREF="index.html"><LINK | |
12 REL="UP" | |
13 TITLE="Video" | |
14 HREF="video.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_VideoInfo" | |
17 HREF="sdlvideoinfo.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="Window Management" | |
20 HREF="wm.html"></HEAD | |
21 ><BODY | |
22 CLASS="REFENTRY" | |
23 BGCOLOR="#FFF8DC" | |
24 TEXT="#000000" | |
25 LINK="#0000ee" | |
26 VLINK="#551a8b" | |
27 ALINK="#ff0000" | |
28 ><DIV | |
29 CLASS="NAVHEADER" | |
30 ><TABLE | |
31 WIDTH="100%" | |
32 BORDER="0" | |
33 CELLPADDING="0" | |
34 CELLSPACING="0" | |
35 ><TR | |
36 ><TH | |
37 COLSPAN="3" | |
38 ALIGN="center" | |
39 >SDL Library Documentation</TH | |
40 ></TR | |
41 ><TR | |
42 ><TD | |
43 WIDTH="10%" | |
44 ALIGN="left" | |
45 VALIGN="bottom" | |
46 ><A | |
47 HREF="sdlvideoinfo.html" | |
48 >Prev</A | |
49 ></TD | |
50 ><TD | |
51 WIDTH="80%" | |
52 ALIGN="center" | |
53 VALIGN="bottom" | |
54 ></TD | |
55 ><TD | |
56 WIDTH="10%" | |
57 ALIGN="right" | |
58 VALIGN="bottom" | |
59 ><A | |
60 HREF="wm.html" | |
61 >Next</A | |
62 ></TD | |
63 ></TR | |
64 ></TABLE | |
65 ><HR | |
66 ALIGN="LEFT" | |
67 WIDTH="100%"></DIV | |
68 ><H1 | |
69 ><A | |
70 NAME="SDLOVERLAY" | |
71 >SDL_Overlay</A | |
72 ></H1 | |
73 ><DIV | |
74 CLASS="REFNAMEDIV" | |
75 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
76 NAME="AEN3080" |
0 | 77 ></A |
78 ><H2 | |
79 >Name</H2 | |
80 >SDL_Overlay -- YUV video overlay</DIV | |
81 ><DIV | |
82 CLASS="REFSECT1" | |
83 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
84 NAME="AEN3083" |
0 | 85 ></A |
86 ><H2 | |
87 >Structure Definition</H2 | |
88 ><PRE | |
89 CLASS="PROGRAMLISTING" | |
90 >typedef struct{ | |
91 Uint32 format; | |
92 int w, h; | |
93 int planes; | |
94 Uint16 *pitches; | |
95 Uint8 **pixels; | |
96 Uint32 hw_overlay:1; | |
97 } SDL_Overlay;</PRE | |
98 ></DIV | |
99 ><DIV | |
100 CLASS="REFSECT1" | |
101 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
102 NAME="AEN3086" |
0 | 103 ></A |
104 ><H2 | |
105 >Structure Data</H2 | |
106 ><DIV | |
107 CLASS="INFORMALTABLE" | |
108 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
109 NAME="AEN3088" |
0 | 110 ></A |
111 ><P | |
112 ></P | |
113 ><TABLE | |
114 BORDER="0" | |
115 CLASS="CALSTABLE" | |
116 ><TBODY | |
117 ><TR | |
118 ><TD | |
119 ALIGN="LEFT" | |
120 VALIGN="TOP" | |
121 ><TT | |
122 CLASS="STRUCTFIELD" | |
123 ><I | |
124 >format</I | |
125 ></TT | |
126 ></TD | |
127 ><TD | |
128 ALIGN="LEFT" | |
129 VALIGN="TOP" | |
130 >Overlay format (see below)</TD | |
131 ></TR | |
132 ><TR | |
133 ><TD | |
134 ALIGN="LEFT" | |
135 VALIGN="TOP" | |
136 ><TT | |
137 CLASS="STRUCTFIELD" | |
138 ><I | |
139 >w, h</I | |
140 ></TT | |
141 ></TD | |
142 ><TD | |
143 ALIGN="LEFT" | |
144 VALIGN="TOP" | |
145 >Width and height of overlay</TD | |
146 ></TR | |
147 ><TR | |
148 ><TD | |
149 ALIGN="LEFT" | |
150 VALIGN="TOP" | |
151 ><TT | |
152 CLASS="STRUCTFIELD" | |
153 ><I | |
154 >planes</I | |
155 ></TT | |
156 ></TD | |
157 ><TD | |
158 ALIGN="LEFT" | |
159 VALIGN="TOP" | |
160 >Number of planes in the overlay. Usually either 1 or 3</TD | |
161 ></TR | |
162 ><TR | |
163 ><TD | |
164 ALIGN="LEFT" | |
165 VALIGN="TOP" | |
166 ><TT | |
167 CLASS="STRUCTFIELD" | |
168 ><I | |
169 >pitches</I | |
170 ></TT | |
171 ></TD | |
172 ><TD | |
173 ALIGN="LEFT" | |
174 VALIGN="TOP" | |
175 >An array of pitches, one for each plane. Pitch is the length of a row in bytes.</TD | |
176 ></TR | |
177 ><TR | |
178 ><TD | |
179 ALIGN="LEFT" | |
180 VALIGN="TOP" | |
181 ><TT | |
182 CLASS="STRUCTFIELD" | |
183 ><I | |
184 >pixels</I | |
185 ></TT | |
186 ></TD | |
187 ><TD | |
188 ALIGN="LEFT" | |
189 VALIGN="TOP" | |
190 >An array of pointers to teh data of each plane. The overlay should be locked before these pointers are used.</TD | |
191 ></TR | |
192 ><TR | |
193 ><TD | |
194 ALIGN="LEFT" | |
195 VALIGN="TOP" | |
196 ><TT | |
197 CLASS="STRUCTFIELD" | |
198 ><I | |
199 >hw_overlay</I | |
200 ></TT | |
201 ></TD | |
202 ><TD | |
203 ALIGN="LEFT" | |
204 VALIGN="TOP" | |
205 >This will be set to 1 if the overlay is hardware accelerated.</TD | |
206 ></TR | |
207 ></TBODY | |
208 ></TABLE | |
209 ><P | |
210 ></P | |
211 ></DIV | |
212 ></DIV | |
213 ><DIV | |
214 CLASS="REFSECT1" | |
215 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
216 NAME="AEN3115" |
0 | 217 ></A |
218 ><H2 | |
219 >Description</H2 | |
220 ><P | |
221 >A <SPAN | |
222 CLASS="STRUCTNAME" | |
223 >SDL_Overlay</SPAN | |
224 > is similar to a <A | |
225 HREF="sdlsurface.html" | |
226 ><SPAN | |
227 CLASS="STRUCTNAME" | |
228 >SDL_Surface</SPAN | |
229 ></A | |
230 > except it stores a YUV overlay. All the fields are read only, except for <TT | |
231 CLASS="STRUCTFIELD" | |
232 ><I | |
233 >pixels</I | |
234 ></TT | |
235 > which should be <A | |
236 HREF="sdllockyuvoverlay.html" | |
237 >locked</A | |
238 > before use. The <TT | |
239 CLASS="STRUCTFIELD" | |
240 ><I | |
241 >format</I | |
242 ></TT | |
243 > field stores the format of the overlay which is one of the following: | |
244 <PRE | |
245 CLASS="PROGRAMLISTING" | |
246 >#define SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U */ | |
247 #define SDL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V */ | |
248 #define SDL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 */ | |
249 #define SDL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 */ | |
250 #define SDL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 */</PRE | |
251 > | |
252 More information on YUV formats can be found at <A | |
253 HREF="http://www.webartz.com/fourcc/indexyuv.htm" | |
254 TARGET="_top" | |
255 >http://www.webartz.com/fourcc/indexyuv.htm</A | |
256 >.</P | |
257 ></DIV | |
258 ><DIV | |
259 CLASS="REFSECT1" | |
260 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
261 NAME="AEN3126" |
0 | 262 ></A |
263 ><H2 | |
264 >See Also</H2 | |
265 ><P | |
266 ><A | |
267 HREF="sdlcreateyuvoverlay.html" | |
268 ><TT | |
269 CLASS="FUNCTION" | |
270 >SDL_CreateYUVOverlay</TT | |
271 ></A | |
272 >, | |
273 <A | |
274 HREF="sdllockyuvoverlay.html" | |
275 ><TT | |
276 CLASS="FUNCTION" | |
277 >SDL_LockYUVOverlay</TT | |
278 ></A | |
279 >, | |
280 <A | |
281 HREF="sdlunlockyuvoverlay.html" | |
282 ><TT | |
283 CLASS="FUNCTION" | |
284 >SDL_UnlockYUVOverlay</TT | |
285 ></A | |
286 >, | |
287 <A | |
288 HREF="sdlfreeyuvoverlay.html" | |
289 ><TT | |
290 CLASS="FUNCTION" | |
291 >SDL_FreeYUVOverlay</TT | |
292 ></A | |
293 ></P | |
294 ></DIV | |
295 ><DIV | |
296 CLASS="NAVFOOTER" | |
297 ><HR | |
298 ALIGN="LEFT" | |
299 WIDTH="100%"><TABLE | |
300 WIDTH="100%" | |
301 BORDER="0" | |
302 CELLPADDING="0" | |
303 CELLSPACING="0" | |
304 ><TR | |
305 ><TD | |
306 WIDTH="33%" | |
307 ALIGN="left" | |
308 VALIGN="top" | |
309 ><A | |
310 HREF="sdlvideoinfo.html" | |
311 >Prev</A | |
312 ></TD | |
313 ><TD | |
314 WIDTH="34%" | |
315 ALIGN="center" | |
316 VALIGN="top" | |
317 ><A | |
318 HREF="index.html" | |
319 >Home</A | |
320 ></TD | |
321 ><TD | |
322 WIDTH="33%" | |
323 ALIGN="right" | |
324 VALIGN="top" | |
325 ><A | |
326 HREF="wm.html" | |
327 >Next</A | |
328 ></TD | |
329 ></TR | |
330 ><TR | |
331 ><TD | |
332 WIDTH="33%" | |
333 ALIGN="left" | |
334 VALIGN="top" | |
335 >SDL_VideoInfo</TD | |
336 ><TD | |
337 WIDTH="34%" | |
338 ALIGN="center" | |
339 VALIGN="top" | |
340 ><A | |
341 HREF="video.html" | |
342 >Up</A | |
343 ></TD | |
344 ><TD | |
345 WIDTH="33%" | |
346 ALIGN="right" | |
347 VALIGN="top" | |
348 >Window Management</TD | |
349 ></TR | |
350 ></TABLE | |
351 ></DIV | |
352 ></BODY | |
353 ></HTML | |
354 > |