Using SDL_DisplayYUVOverlay and SDL_BlitSurface/SDL_UpdateRects together

I’m trying to create a custom OSD menu for a mediaplayer.

The Idea is to display a menu in the middle of the video window, with
the video rolling in the background.

Is there Multiple layers I can draw on so I don’t have to care about vid
fps (without drawing the menu on every frame)?

I would like to just draw the OSD Menu once, and then just update when I
select or navigate in it.

Ive tried 3 methods:

1: The video is blit to the screen with SDL_DisplayYUVOverlay.

What I tried to do first was simply SDL_BlitSurface and SDL_UpdateRects
to put the menu bmp onto the screen.

This got the desired effect, of menu front and vid rolling in the back.

But when I want to quit the menu, the video will never update in the
area where I used update rect. How can I fix this?

2: Ive also tried using double buffering and SDL_Flip. But then the
video wont even show, ill just get my OSD and black background.

Why is SDL_flip (I just call it once to show the menu), prohibiting the
SDL_DisplayYUVOverlay from displaying anything?

3: Then I tried to tie my SDL_Overlay to a secondary surface. Use
SDL_DisplayYUVOverlay to blit it onto.

Then blit the vid frame and the OSD to the screen with SDL_BlitSurface
and then SDL_Flip.

This resulted in horrible vid performance.

The solution I had for method 1, but having tried yet:

When I close my OSD Menu, I need to recreate the screen (free surface +
setvideomode), and create the overlay again with this new screen tied.

This way the SDL_DisplayYUVOverlay, will successfully draw the video
after the menu. But will create an image skip I would guess.

Best Regards

Martin Havn.—

Martin Havn wrote:

I?m trying to create a custom OSD menu for a mediaplayer.

The Idea is to display a menu in the middle of the video window, with
the video rolling in the background.

Is there Multiple layers I can draw on so I don?t have to care about
vid fps (without drawing the menu on every frame)?

I would like to just draw the OSD Menu once, and then just update when
I select or navigate in it.

Ive tried 3 methods:

1: The video is blit to the screen with SDL_DisplayYUVOverlay.

What I tried to do first was simply SDL_BlitSurface and
SDL_UpdateRects to put the menu bmp onto the screen.

This got the desired effect, of menu front and vid rolling in the back.

But when I want to quit the menu, the video will never update in the
area where I used update rect. How can I fix this?

You have to repaint it to its original color. Usually a shade of blue
(0x0000FF) or pink (0xFF00FF).

Btw, I think that’s the best way to handle it, provided your hardware
provides a real overlay (i.e. one that does colorkeying over a given color).

Stepahne