I’m working on the SDL output plugin for the videolan project
(www.videolan.org)
I want to display the YUV overlay AND some RGB(A) surfaces on the
screen.
the overlay contains the decoded yuv images from the mpeg file. I want
to add on-screen messages to this images.
(Title, icons, text …). messages are bitmap data loaded in
SDL_Surfaces.
I want to display the overlay as a background and add the messages in
the foreground.
I’ve tried this :
SDL_LockYUVOverlay(p_vout->p_sys->p_overlay);
/* copy the data into video buffers /
/ Y first /
memcpy(p_vout->p_sys->p_overlay->pixels[0], //to
p_vout->p_rendered_pic->p_y, //from
p_vout->p_sys->p_overlay->h * //size = height * length of
a row in bytes
p_vout->p_sys->p_overlay->pitches[0]);
/ then V /
memcpy(…);
/ and U */
disp.w = …
disp.h = …
disp.x = …
disp.y = …
/* add a BMP message */
image = SDL_LoadBMP(“videolan.bmp”); //my test - TODO: load image only
once
dest.x = …
dest.y
…
/* Display overlay */
SDL_DisplayYUVOverlay( p_vout->p_sys->p_overlay , &disp );
SDL_UnlockSurface ( p_vout->p_sys->p_display );
SDL_BlitSurface(image, NULL, p_vout->p_sys->p_display, &dest);
/* Flip screen to display message*/
//SDL_Flip(p_vout->p_sys->p_display); <----- THISLINE
SDL_LockSurface ( p_vout->p_sys->p_display );
SDL_UnlockYUVOverlay(p_vout->p_sys->p_overlay);
//–
If I try this I only the movie (overlay)
when I uncomment THISLINE: I only see my message on a black
background…
(detail: what exactly happend is: I can see the first image of my movie
(I can’t say if it’s only 1 frame or 2) then my message (bmp) on a black
background)
How can I do to see both ?
my overlay is accelerated (hw_overlay).
Another question:
Is it possible to “combine” overlay with RGB surfaces to obtain
transparency (see the movie through the surface) At last will colorkey
work ?
Thanks–
Xavier Servettaz
Ps: I’m new to overlay so perhaps I missunderstood something