How to set SDL_Surface position (x,y) in the screen

Hello,

In SDL a surface is set up by SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags)

But how do you specify the position where you want that surface to be in your screen?

For example, in X, if you have a xinerama configuration with two displays (one besides the other in xinerama configuration) and you want your SDL surface to cover exactly the second display, ?how can you do that?

I have several displays, not only two, and my idea is to play a different video with SDL in each display by means of the xinerama capabilities, positioning one SDL surface in each display. This means having several surfaces and set the surface position independently for each one. Is this possible?

Thank you very much for your answers.

Enrique Terleira Iraz?bal

http://www.indra.es/

C/ Mar Egeo 4, Pol?gono Industrial 1
28830 San Fernado de Henares- Madrid (ESPA?A)
Tel: +34-91-626-8683
@Enrique_Terleira
www.indra.es http://www.indra.es/

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: image/gif
Size: 2299 bytes
Desc: image001.gif
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20080507/5844d57b/attachment.gif

Hello,

In SDL a surface is set up by SDL_SetVideoMode(int width,
int height, int bpp, Uint32 flags)

But how do you specify
the position where you want that surface to be in your screen?

For example, in X, if
you have a xinerama configuration with two displays (one besides the other in
xinerama configuration) and you want your SDL surface to cover exactly the
second display, ?how
can you do that?

SDL_PUTENV(“SDL_VIDEO_WINDOW_POS=”);
plus the X, Y coords of the top-left corner. Not sure what the syntax for string concatenation is for C.

For example, if you wanted something to cover an entire secondary
screen that’s positioned to the right of your main screen, and the main
screen is 1240 pixels wide, the string you’d need to pass is
"SDL_VIDEO_WINDOW_POS=1240, 0".

I have several displays,
not only two, and my idea is to play a different video with SDL in each
display
by means of the xinerama capabilities, positioning one SDL surface in each display.
This
means having several surfaces and set the surface position independently
for each one. Is this
possible?
Currently no. This will be possible under SDL 1.3 when it gets released, though.
----- Original Message -----
From: eterleira@eservicios.indra.es (Enrique Terleira)
To: sdl at lists.libsdl.org
Sent: Wednesday, May 7, 2008 2:21:11 AM
Subject: [SDL] How to set SDL_Surface position (x,y) in the screen

http://lists.libsdl.org/pipermail/sdl-libsdl.org/2008-May/065117.htmlThank
you for your answer, it’s been very helpful.

I have another question though.

What I want to achieve is to display a different video file in each
physical display.

If I have, say, 7 displays in a xinerama configuration, I can create a
SDL_Surface that covers the 7 displays.

Then, if I have 7 video files, I could decode all of them
simultaneously, and draw the frames of video 1 in display 1, the frames
of video 2 in display 2, etc., just having 7 SDL_DisplayYUVOverlay
functions with the correct SDL_Rect parameter for each one, so the video
is displayed exactly in the display I want for each video.

I could do that in different threads, for exmple.

What worries me is the performance decrease that this could cause in the
program, since each video has to be played at 25 frames/seg. I would
have seven threads, and all of them should have to draw a frame in less
than 1/25 s.

Do you think that this is possible to do? Is there any problem that I
haven considered?

Than you very much.> ----- Original Message -----

From: http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (terleira iraz?bal, enrique) (@Enrique_Terleira)
To: sdl at lists.libsdl.org http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Sent: Wednesday, May 7, 2008 2:21:11 AM
Subject: [SDL] How to set SDL_Surface position (x,y) in the screen

/Hello,
/>/
/
/In SDL a surface is set up by SDL_SetVideoMode(int width,
/int height, int bpp, Uint32 flags)
/
/
/But how do you specify
/the position where you want that surface to be in your screen?
/
/
/For example, in X, if
/you have a xinerama configuration with two displays (one besides the other in
/xinerama configuration) and you want your SDL surface to cover exactly the
/second display, ?how
/can you do that?
/
SDL_PUTENV(“SDL_VIDEO_WINDOW_POS=”);
plus the X, Y coords of the top-left corner. Not sure what the syntax for string concatenation is for C.

For example, if you wanted something to cover an entire secondary
screen that’s positioned to the right of your main screen, and the main
screen is 1240 pixels wide, the string you’d need to pass is
"SDL_VIDEO_WINDOW_POS=1240, 0".

/I have several displays,
/not only two, and my idea is to play a different video with SDL in each
/display
/by means of the xinerama capabilities, positioning one SDL surface in each display.
This
/means having several surfaces and set the surface position independently
/for each one. Is this
/possible?
/Currently no. This will be possible under SDL 1.3 when it gets released, though.

What I want to achieve is to display a different video file in each
physical display.

If I have, say, 7 displays in a xinerama configuration, I can create a
SDL_Surface that covers the 7 displays.

Your only chance with 1.2.x SDL is to launch 7 processes, and do a video
decode in every process, every app could be easily directed to the correct
display by prefixing the command invocation with the correct DISPLAY
enviroment variable.

Then, if I have 7 video files, I could decode all of them simultaneously,

and draw the frames of video 1 in display 1, the frames of video 2 in
display 2, etc., just having 7 SDL_DisplayYUVOverlay functions with the
correct SDL_Rect parameter for each one, so the video is displayed exactly
in the display I want for each video.

If videos are not too big (let’s say 640x480), you can easily do it with a
decent dual core CPU.

We have an app that decodes up 12 MPEG1 video streams (352x288/25fps) on a
single big overlay (accelerated through xv). The output is displayed on big
hd TVs.

We used for the prototype a 3.0ghz HT P4, that was barely sufficient, then
dual core cpus started to be widely available and our current production
machine is a mac mini (with ubuntu linux), that does the job with less of
50% of average cpu load.–
Bye,
Gabry