YUV Overlay behavior Linux/Windows

Hi everyone,

I’m using SDL 1.2 to play a video stream through an SDL YUV Overlay.
While running under Windows and moving the window (grabbing it by the
frame and moving it all around the desktop) in which I play my video,
the video stops as if the program was frozen until I stop moving the SDL
window. This behaviour is different than under Linux for when I move the
SDL window, the video keeps being displayed normally.

It doesn’t come as a problem to me, except that the program freezes
completely depending on the time I move the window, but I was wondering
if this behaviour was normal or not and if there was a good explanation
to this. Is it related to how the video memory is accessed while being
in Windows or Linux, the type of video card I’m using? Or just something
wrong I’ve done?

Here’s how I initialize / run my SDL YUV Overlay in a mix of code and
pseudo-code, don’t mind about whether it can compile or not, it’s just
for you to understand the way I do this…

// Initialization
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
cerr << "Error: Cannot initialize SDL: " << SDL_GetError() << endl;
return false;
}
screen = SDL_SetVideoMode(width, height, 32, SDL_DOUBLEBUF|
SDL_HWSURFACE|
SDL_HWPALETTE|
SDL_ANYFORMAT|
SDL_RESIZABLE);
if(screen == 0){
cerr << "Error: Cannot set video mode: " << SDL_GetError() << endl;
return false;
}

overlay = SDL_CreateYUVOverlay(width, height, SDL_YV12_OVERLAY,
        screen);

if(overlay == 0){
    cerr << "Error: Cannot create YUV overlay: " << SDL_GetError() 

<< endl;
return false;
}

// Linking the stream to the overlay:
SDL_LockYUVOverlay(overlay);
if(SDL_MUSTLOCK(screen))
SDL_LockSurface(screen);

    /*Linking the video stream data to the YUV overlay planes...*/

    SDL_UnlockYUVOverlay(overlay);
    if(SDL_MUSTLOCK(screen))
        SDL_UnlockSurface(screen);

// Displaying the stream on the overlay:
SDL_Rect rectangle;
rectangle.x = rectangle.y = 0;
rectangle.w = (Uint16)screen->w;
rectangle.h = (Uint16)screen->h;
SDL_DisplayYUVOverlay(overlay, &rectangle);

Thanks for the help,

Jerome

This issue is not specific to videos. Windows blocks inside the message
loop while you’re moving the window around.

See ya,
–SamOn Wed, May 27, 2009 at 11:45 AM, Jerome Guilmette < Jerome.Guilmette at cadensimaging.com> wrote:

Hi everyone,

I’m using SDL 1.2 to play a video stream through an SDL YUV Overlay. While
running under Windows and moving the window (grabbing it by the frame and
moving it all around the desktop) in which I play my video, the video stops
as if the program was frozen until I stop moving the SDL window. This
behaviour is different than under Linux for when I move the SDL window, the
video keeps being displayed normally.

It doesn’t come as a problem to me, except that the program freezes
completely depending on the time I move the window, but I was wondering if
this behaviour was normal or not and if there was a good explanation to
this. Is it related to how the video memory is accessed while being in
Windows or Linux, the type of video card I’m using? Or just something wrong
I’ve done?

Here’s how I initialize / run my SDL YUV Overlay in a mix of code and
pseudo-code, don’t mind about whether it can compile or not, it’s just for
you to understand the way I do this…

// Initialization
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
cerr << "Error: Cannot initialize SDL: " << SDL_GetError() << endl;
return false;
}
screen = SDL_SetVideoMode(width, height, 32, SDL_DOUBLEBUF|
SDL_HWSURFACE|
SDL_HWPALETTE|
SDL_ANYFORMAT|
SDL_RESIZABLE);
if(screen == 0){
cerr << "Error: Cannot set video mode: " << SDL_GetError() << endl;
return false;
}

overlay = SDL_CreateYUVOverlay(width, height, SDL_YV12_OVERLAY,
screen);

if(overlay == 0){
cerr << "Error: Cannot create YUV overlay: " << SDL_GetError() <<
endl;
return false;
}

// Linking the stream to the overlay:
SDL_LockYUVOverlay(overlay);
if(SDL_MUSTLOCK(screen))
SDL_LockSurface(screen);
/Linking the video stream data to the YUV overlay planes…/

  SDL_UnlockYUVOverlay(overlay);
  if(SDL_MUSTLOCK(screen))
      SDL_UnlockSurface(screen);

// Displaying the stream on the overlay:
SDL_Rect rectangle;
rectangle.x = rectangle.y = 0;
rectangle.w = (Uint16)screen->w;
rectangle.h = (Uint16)screen->h;
SDL_DisplayYUVOverlay(overlay, &rectangle);

Thanks for the help,

Jerome


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Thanks, although it doesn’t solve my issue, it gives an answer why it’s
happening.

Jerome

Sam Lantinga wrote:

This issue is not specific to videos. Windows blocks inside the message
loop while you’re moving the window around.

See ya,
–SamOn Wed, May 27, 2009 at 11:45 AM, Jerome Guilmette Jerome.Guilmette@cadensimaging.com wrote:

Hi everyone,

I'm using SDL 1.2 to play a video stream through an SDL YUV Overlay.
While running under Windows and moving the window (grabbing it by the
frame and moving it all around the desktop) in which I play my video,
the video stops as if the program was frozen until I stop moving the
SDL window. This behaviour is different than under Linux for when I
move the SDL window, the video keeps being displayed normally.

It doesn't come as a problem to me, except that the program freezes
completely depending on the time I move the window, but I was
wondering if this behaviour was normal or not and if there was a good
explanation to this. Is it related to how the video memory is accessed
while being in Windows or Linux, the type of video card I'm using? Or
just something wrong I've done?

Here's how I initialize / run my SDL YUV Overlay in a mix of code and
pseudo-code, don't mind about whether it can compile or not, it's just
for you to understand the way I do this..

// Initialization
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
cerr << "Error: Cannot initialize SDL: " << SDL_GetError() << endl;
return false;
}
screen = SDL_SetVideoMode(width, height, 32, SDL_DOUBLEBUF|
SDL_HWSURFACE|
SDL_HWPALETTE|
SDL_ANYFORMAT|
SDL_RESIZABLE);
if(screen == 0){
cerr << "Error: Cannot set video mode: " << SDL_GetError() << endl;
return false;
}

overlay = SDL_CreateYUVOverlay(width, height, SDL_YV12_OVERLAY,
screen);

if(overlay == 0){
cerr << "Error: Cannot create YUV overlay: " << SDL_GetError() <<
endl;
return false;
}

// Linking the stream to the overlay:
SDL_LockYUVOverlay(overlay);
if(SDL_MUSTLOCK(screen))
SDL_LockSurface(screen);
/*Linking the video stream data to the YUV overlay planes...*/

SDL_UnlockYUVOverlay(overlay);
if(SDL_MUSTLOCK(screen))
SDL_UnlockSurface(screen);

// Displaying the stream on the overlay:
SDL_Rect rectangle;
rectangle.x = rectangle.y = 0;
rectangle.w = (Uint16)screen->w;
rectangle.h = (Uint16)screen->h;
SDL_DisplayYUVOverlay(overlay, &rectangle);

Thanks for the help,

Jerome
_______________________________________________
SDL mailing list
SDL@lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


JA©rA’me Guilmette
Head Developer, Telecommunication Systems
DA©veloppeur principal, SystA?mes de TA©lA©communication
CADENS Imaging

116 principale, suite 200
Granby (QuA©bec), J2G 2V2
CANADA

Tel : 450 534-0009
Fax : 450 534-0110
E-mail : Jerome.Guilmette@CadensImaging.com

Notice: This message is confidential and is intended for the exclusive use of the addressee. Any other person is strictly prohibited from disclosing, distributing or reproducing it. If the addressee cannot be reached or is unknown to you, please inform the sender by return e-mail immediately and delete this message and destroy all copies. Internet communications are subject to the risk of data corruption, other transmission errors and loss of confidentiality. Please advise us immediately.

Avis : Ce message est confidentiel et est A l’usage exclusif de son destinataire. Il est strictement interdit A toute autre personne de le diffuser, le distribuer ou le reproduire. Si le destinataire ne peut Aatre joint ou vous est inconnu, veuillez informer l’expA©diteur par courrier A©lectronique immA©diatement et effacer ce message et en dA©truire toute copie. Les communications par Internet sont exposA©es au risque d’altA©ration des donnA©es, A d’autres erreurs de transmission et A la perte de confidentialitA©. Si vous dA©sirez que nous communiquions avec vous par un autre moyen, veuillez nous en aviser immA©diatement.