mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-12-18 08:58:37 +00:00
sdl: fix overlay size.
The size passed to SDL_CreateYUVOverlay is the size of the video in pixels, it must not take the aspect ratio into account.
This commit is contained in:
parent
2f9907be3e
commit
3ff6b1a2b3
@ -36,8 +36,8 @@ typedef struct {
|
|||||||
SDL_Overlay *overlay;
|
SDL_Overlay *overlay;
|
||||||
char *window_title;
|
char *window_title;
|
||||||
char *icon_title;
|
char *icon_title;
|
||||||
int window_width, window_height;
|
int window_width, window_height; /**< size of the window */
|
||||||
int overlay_width, overlay_height;
|
int overlay_width, overlay_height; /**< size of the video in the window */
|
||||||
int overlay_fmt;
|
int overlay_fmt;
|
||||||
int sdl_was_already_inited;
|
int sdl_was_already_inited;
|
||||||
} SDLContext;
|
} SDLContext;
|
||||||
@ -144,12 +144,12 @@ static int sdl_write_header(AVFormatContext *s)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
sdl->overlay = SDL_CreateYUVOverlay(sdl->overlay_width, sdl->overlay_height,
|
sdl->overlay = SDL_CreateYUVOverlay(encctx->width, encctx->height,
|
||||||
sdl->overlay_fmt, sdl->surface);
|
sdl->overlay_fmt, sdl->surface);
|
||||||
if (!sdl->overlay || sdl->overlay->pitches[0] < sdl->overlay_width) {
|
if (!sdl->overlay || sdl->overlay->pitches[0] < encctx->width) {
|
||||||
av_log(s, AV_LOG_ERROR,
|
av_log(s, AV_LOG_ERROR,
|
||||||
"SDL does not support an overlay with size of %dx%d pixels.\n",
|
"SDL does not support an overlay with size of %dx%d pixels.\n",
|
||||||
sdl->overlay_width, sdl->overlay_height);
|
encctx->width, encctx->height);
|
||||||
ret = AVERROR(EINVAL);
|
ret = AVERROR(EINVAL);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user