[FFmpeg-devel] [PATCH 1/2] ffplay: options to specify window position

Marton Balint cus at passwd.hu
Tue Oct 2 00:44:11 EEST 2018



On Mon, 1 Oct 2018, Dave Rice wrote:

> From 14d6833b564bd672613d50ecc4c3ede1768eee37 Mon Sep 17 00:00:00 2001
> From: Dave Rice <dave at dericed.com>
> Date: Mon, 1 Oct 2018 17:07:44 -0400
> Subject: [PATCH 1/2] ffplay: options to specify window position
>
> ---
> fftools/ffplay.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/fftools/ffplay.c b/fftools/ffplay.c
> index e375a32ec2..e1ec2e9df2 100644
> --- a/fftools/ffplay.c
> +++ b/fftools/ffplay.c
> @@ -314,6 +314,8 @@ static int default_width  = 640;
> static int default_height = 480;
> static int screen_width  = 0;
> static int screen_height = 0;
> +static int window_x;
> +static int window_y;

static int screen_xleft = SDL_WINDOWPOS_CENTERED;
static int screen_ytop = SDL_WINDOWPOS_CENTERED;

> static int audio_disable;
> static int video_disable;
> static int subtitle_disable;
> @@ -1346,7 +1348,11 @@ static int video_open(VideoState *is)
>     SDL_SetWindowTitle(window, window_title);
>
>     SDL_SetWindowSize(window, w, h);
> -    SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
> +    if (!window_x)
> +        window_x = SDL_WINDOWPOS_CENTERED;
> +    if (!window_y)
> +        window_y = SDL_WINDOWPOS_CENTERED;

unneeded (also 0 pos should work)

> +    SDL_SetWindowPosition(window, window_x, window_y);

SDL_SetWindowPosition(window, screen_xleft, screen_ytop);

>     if (is_full_screen)
>         SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
>     SDL_ShowWindow(window);
> @@ -3602,6 +3608,8 @@ static const OptionDef options[] = {
>     { "framedrop", OPT_BOOL | OPT_EXPERT, { &framedrop }, "drop frames when cpu is too slow", "" },
>     { "infbuf", OPT_BOOL | OPT_EXPERT, { &infinite_buffer }, "don't limit the input buffer size (useful with realtime streams)", "" },
>     { "window_title", OPT_STRING | HAS_ARG, { &window_title }, "set window title", "window title" },
> +    { "window_x", OPT_INT | HAS_ARG | OPT_EXPERT, { &window_x }, "set the x position of the window", "x pos" },
> +    { "window_y", OPT_INT | HAS_ARG | OPT_EXPERT, { &window_y }, "set the y position of the window", "y pos" },

I'd rather not call this "window_*", maybe "left" and "top" or "xleft", 
"ytop".

> #if CONFIG_AVFILTER
>     { "vf", OPT_EXPERT | HAS_ARG, { .func_arg = opt_add_vfilter }, "set video filters", "filter_graph" },
>     { "af", OPT_STRING | HAS_ARG, { &afilters }, "set audio filters", "filter_graph" },
> --

docs update missing.

Thanks,
Marton


More information about the ffmpeg-devel mailing list