Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL_CreateYUVSurface failure #164

Closed
jengelh opened this issue Mar 6, 2022 · 0 comments
Closed

SDL_CreateYUVSurface failure #164

jengelh opened this issue Mar 6, 2022 · 0 comments
Milestone

Comments

@jengelh
Copy link

jengelh commented Mar 6, 2022

Input

#include <SDL.h>
int main()
{
        SDL_Init(SDL_INIT_VIDEO);
        auto surf = SDL_SetVideoMode(640,480,24,0);
        if (surf == nullptr)
                return 1;
        auto ovl = SDL_CreateYUVOverlay(640,480,SDL_YV12_OVERLAY,surf);
        if (ovl == nullptr)
                return 1;
        printf("pixels=%p\n", ovl->pixels);
        return 0;
}

Output on sdl12-compat 1.2.52

pixels=(nil)

Output on SDL 1.2.15

pixels=0x1cce0e0

As a result, /usr/bin/mplayer crashes when built with SDL1 API and then used with mplayer -vo sdl something.mkv.

sulix added a commit to sulix/sdl12-compat that referenced this issue Mar 7, 2022
Some applications, such as mplayer with -vo sdl will access the 'pixels'
member of an SDL_Overlay immediately after creating it, without ever
locking it. This works on (at least some backends for) SDL 1.2, but
crashed on sdl12-compat, as pixels remained unset until
SDL_LockYUVOverlay() is called.

Set pixels in SDL_CreateYUVOverlay(), as well as hwdata->dirty, which
makes it possible to have a working YUV overlay without ever
locking/unlocking it. This is required for mplayer's sdl vo backend to
function.

Fixes issue libsdl-org#164
@icculus icculus closed this as completed in f498010 Mar 7, 2022
@sezero sezero added this to the 1.2.54 milestone Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants