[FFmpeg-devel] [PATCH 2/3] sdl: fix overlay size.
Stefano Sabatini
stefasab at gmail.com
Sat Jun 9 23:08:31 CEST 2012
On date Saturday 2012-06-09 21:26:51 +0200, Nicolas George encoded:
> The size passed to SDL_CreateYUVOverlay is the size
> of the video in pixels, it must not take the aspect ratio
> into account.
>
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
> libavdevice/sdl.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/libavdevice/sdl.c b/libavdevice/sdl.c
> index e4609a2..c80d41c 100644
> --- a/libavdevice/sdl.c
> +++ b/libavdevice/sdl.c
> @@ -36,8 +36,8 @@ typedef struct {
> SDL_Overlay *overlay;
> char *window_title;
> char *icon_title;
> - int window_width, window_height;
> - int overlay_width, overlay_height;
> + int window_width, window_height; /**< size of the window */
> + int overlay_width, overlay_height; /**< size of the video in the window */
> int overlay_fmt;
> int sdl_was_already_inited;
> } SDLContext;
> @@ -144,12 +144,12 @@ static int sdl_write_header(AVFormatContext *s)
> 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);
> - 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,
> "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);
> goto fail;
> }
Should be fine if tested, thanks.
--
FFmpeg = Faithless & Free Mega Perfectionist Evil Gadget
More information about the ffmpeg-devel
mailing list