Embedding smpeg screen in an SDL screen

hi all,

I’m seeking advice and/or code examples of how to embed an SMPEG
screen within a larger SDL screen. All SMPEG examples I’ve seen
have the SMPEG screen being the entire window.

I’m aiming to have a full-screen display, which includes one
inset rectangle with an mpeg moving being played.

I’ve got the movie playing. I’ve got the full screen. I just
can’t position the smpeg region within context of the broader
window.

Many thanks in advance!

regards

Just make a new surface, and point SMPEG to it, rather than to your
window’s surface.

I did this when I was working on VidSlide (unfinished title :^/ ).

It allowed me to turn a video file into a puzzle. :slight_smile:

-bill!On Fri, May 24, 2002 at 10:34:00PM +1000, Richard Keech wrote:

hi all,

I’m seeking advice and/or code examples of how to embed an SMPEG
screen within a larger SDL screen. All SMPEG examples I’ve seen
have the SMPEG screen being the entire window.

thanks Bill,

Yes, but how to position the inset surface within the main
surface?On Sat, 2002-05-25 at 03:56, nbs wrote:

On Fri, May 24, 2002 at 10:34:00PM +1000, Richard Keech wrote:

hi all,

I’m seeking advice and/or code examples of how to embed an SMPEG
screen within a larger SDL screen. All SMPEG examples I’ve seen
have the SMPEG screen being the entire window.

Just make a new surface, and point SMPEG to it, rather than to your
window’s surface.

I did this when I was working on VidSlide (unfinished title :^/ ).

It allowed me to turn a video file into a puzzle. :slight_smile:

I was simply SDL_BlitSurface()'ing it each frame (or, rather, each
frame I cared about… eg, if the movie is 60fps but I only cared about
the game being 30fps, I just blit every 30th of a second)

-bill!On Sat, May 25, 2002 at 06:30:19AM +1000, Richard Keech wrote:

thanks Bill,

Yes, but how to position the inset surface within the main
surface?

thanks Bill,

Yes, but how to position the inset surface within the main
surface?

Use SMPEG_move(), see smpeg.h for the prototype.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

At 06:30 AM 5/25/2002 +1000, you wrote:

thanks Bill,

Yes, but how to position the inset surface within the main
surface?

I did this with a SDL_Rect, you just blit the smpeg surface onto your main
surface .

     if(SDL_mutexP(smpeg_holder_lock) == -1) return 0;

     if (top) 

SDL_BlitSurface(sdl_smpeg_holder,NULL,sdl_screen,&Screen_smpeg_Target);
else
SDL_BlitSurface(sdl_smpeg_holder,NULL,sdl_screen,&Screen_smpeg_Target_bottom);

     if(SDL_mutexV(smpeg_holder_lock) == -1) return -1;

you use a mutex to keep the threads happy

also for the initialization i did this

     sdl_smpeg_target = 

SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,16,63488,2016,31,0);
//created as a software surface to avoid a
potential crash
SDL_DisplayFormat(sdl_smpeg_target);

     sdl_smpeg_holder = 

SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,16,63488,2016,31,0);
SDL_DisplayFormat(sdl_smpeg_holder);

     mpeg = SMPEG_new("c:\\tmp\\random2.mpeg",&info,1);

     SMPEG_enableaudio(mpeg, 1);
     SMPEG_enablevideo(mpeg, 1);
     SMPEG_setvolume(mpeg, 100);

     smpeg_mutex_lock = SDL_CreateMutex();// keep threads happy
     smpeg_holder_lock = SDL_CreateMutex();
     SMPEG_setdisplay(mpeg,sdl_smpeg_target ,NULL/* 

smpeg_mutex_lock*/, update_smpeg);
SMPEG_scaleXY(mpeg, sdl_smpeg_target->w, sdl_smpeg_target->h);
SMPEG_loop(mpeg, 1);
SMPEG_play(mpeg);

Shane>On Sat, 2002-05-25 at 03:56, nbs wrote:

On Fri, May 24, 2002 at 10:34:00PM +1000, Richard Keech wrote:

hi all,

I’m seeking advice and/or code examples of how to embed an SMPEG
screen within a larger SDL screen. All SMPEG examples I’ve seen
have the SMPEG screen being the entire window.

Just make a new surface, and point SMPEG to it, rather than to your
window’s surface.

I did this when I was working on VidSlide (unfinished title :^/ ).

It allowed me to turn a video file into a puzzle. :slight_smile:


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl