Display YUV File

Hi,
I’d like to dislay a file video 352x288 yuv420planar whit this procedure:

#include “SDL.h”


const int numByteTot=frameRatenumByteFramenumSeconds;
char bufferFrames[numByteTot];
FILE *finput;
SDL_Surface *screen;
SDL_Overlay *videoYUV;
SDL_Rect posizDest;


fread(bufferFrames,1,numByteTot,finput);


screen=SDL_SetVideoMode(352,288,24,SDL_SWSURFACE|SDL_ANYFORMAT);
videoYUV=SDL_CreateYUVOverlay(352,288,SDL_YV12_OVERLAY,screen);


SDL_LockOverlay(videoYUV);
for(i=0;i<numFrameTot;i++){
memcpy(videoYUV->pixels[0],&bufferFrames[i*numByteFrame],352288);
memcpy(videoYUV->pixels[1],&bufferFrames[352
288+inumByteFrame],352288/4);
memcpy(videoYUV->pixels[2],&bufferFrames[352288+352288/4+inumByteFrame],352288/4);
SDL_DisplayYUVOverlay(videoYUV,&posizDest);
}
SDL_UnlockOverlay(videoYUV);

Is this procedure correct?
Do exist another easyest procedure?

Many thanks in advance. By, Roberto

yes, iy is a right way, but i dont think, the
ANYFORMAT option in the setVideoMode would work, just
take it out.
best of luck;

— “ronap at inwind.it” wrote: > Hi,
I’d like to dislay a file video 352x288 yuv420planar________________________________________________________________________
BT Yahoo! Broadband - Save ?80 when you order online today. Hurry! Offer ends 21st December 2003. The way the internet was meant to be. http://uk.rd.yahoo.com/evt=21064/*http://btyahoo.yahoo.co.uk

ronap at inwind.it wrote:

Hi,
I’d like to dislay a file video 352x288 yuv420planar whit this procedure:
videoYUV=SDL_CreateYUVOverlay(352,288,SDL_YV12_OVERLAY,screen);
memcpy(videoYUV->pixels[0],&bufferFrames[i*numByteFrame],352*288);
Is this procedure correct?
Do exist another easyest procedure?

It’s the easiest procedure but MAY not work with certain cards on Win32,
because of alignment issues of the directx overlay surfaces, I found
for instance that a few notebook were able to allocate only 320 pixel or
384 pixel wide overlays, so you should modify every memcpy call with
something like that:

char *dst = videoYUV->pixels[0], *src = &bufferFrames[i*numByteFrame];
int i = 288;

while(i) {
memcpy(dst, src, 352);
dst += videoYUV->pitches[0];
src += 352;
}

Bye,
Gabry

Hi, I want to add a main menu to my game . The clasical start menu of a
simple game, single player , two player, options, quit … I was thinking in use
SDL_ttf to do it but then I started to wonder if exist some SDL based Menu lib
out there… . So , my question is… does anyone knows about a lib to do this
or something else to make this task easy? I dont want to discover the wheel
again.
Thanks in advance.
Regards.

Martin Gonzalez (Mindscout)
ICQ: 29379123
MSN:mgqw at hotmail.com
web: http://www.webklan.com

I think SDL_gui is one of a number of libs that can do this for you.
I’ve personally never used it. Most of my menus are just title screens
with a few buttons you can click :wink:

-bill!On Mon, Dec 15, 2003 at 04:33:00PM -0300, marting at webklan.com wrote:

Hi, I want to add a main menu to my game .

Just out of curiousity, do you have an entirely separate menu loop which has
it’s own keyboard and mouse events? (one that’s separate from the game
loop)?

“Bill Kendrick” wrote in message
news:mailman.1071529930.3430.sdl at libsdl.org…On Mon, Dec 15, 2003 at 04:33:00PM -0300, marting at webklan.com wrote:

Hi, I want to add a main menu to my game .

I think SDL_gui is one of a number of libs that can do this for you.
I’ve personally never used it. Most of my menus are just title screens
with a few buttons you can click :wink:

-bill!