27 #include <SDL_thread.h>
73 SDL_FreeYUVOverlay(sdl->
overlay);
79 SDL_DestroyMutex(sdl->
mutex);
117 overlay_rect->w = encctx->
width;
120 overlay_rect->h = encctx->
height;
127 overlay_rect->x = (sdl->
window_width - overlay_rect->w) / 2;
128 overlay_rect->y = (sdl->
window_height - overlay_rect->h) / 2;
131 #define SDL_BASE_FLAGS (SDL_SWSURFACE|SDL_RESIZABLE)
142 if (SDL_Init(SDL_INIT_VIDEO) != 0) {
161 "SDL does not support an overlay with size of %dx%d pixels\n",
173 SDL_LockMutex(sdl->
mutex);
175 SDL_UnlockMutex(sdl->
mutex);
186 ret = SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_ALLEVENTS);
196 switch (event.type) {
198 switch (event.key.keysym.sym) {
209 case SDL_VIDEORESIZE:
213 SDL_LockMutex(sdl->
mutex);
221 SDL_UnlockMutex(sdl->
mutex);
244 if (SDL_WasInit(SDL_INIT_VIDEO)) {
246 "SDL video subsystem was already inited, aborting\n");
269 "Unsupported pixel format '%s', choose one of yuv420p, yuyv422, or uyvy422\n",
280 av_log(s,
AV_LOG_ERROR,
"Could not create SDL condition variable: %s\n", SDL_GetError());
284 sdl->
mutex = SDL_CreateMutex();
298 SDL_LockMutex(sdl->
mutex);
302 SDL_UnlockMutex(sdl->
mutex);
327 SDL_LockMutex(sdl->
mutex);
329 SDL_MapRGB(sdl->
surface->format, 0, 0, 0));
330 SDL_LockYUVOverlay(sdl->
overlay);
331 for (i = 0; i < 3; i++) {
336 SDL_UnlockYUVOverlay(sdl->
overlay);
341 SDL_UnlockMutex(sdl->
mutex);
346 #define OFFSET(x) offsetof(SDLContext,x)
374 .priv_class = &sdl_class,