mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-17 20:17:55 +02:00
libavdevice sdl: added window_fullscreen option to switch SDL output into fullscreen mode
This commit is contained in:
parent
58bc65952b
commit
fdca977a22
@ -37,6 +37,7 @@ typedef struct {
|
|||||||
char *window_title;
|
char *window_title;
|
||||||
char *icon_title;
|
char *icon_title;
|
||||||
int window_width, window_height; /**< size of the window */
|
int window_width, window_height; /**< size of the window */
|
||||||
|
int window_fullscreen;
|
||||||
int overlay_width, overlay_height; /**< size of the video in the window */
|
int overlay_width, overlay_height; /**< size of the video in the window */
|
||||||
int overlay_x, overlay_y;
|
int overlay_x, overlay_y;
|
||||||
int overlay_fmt;
|
int overlay_fmt;
|
||||||
@ -76,6 +77,7 @@ static int sdl_write_header(AVFormatContext *s)
|
|||||||
AVCodecContext *encctx = st->codec;
|
AVCodecContext *encctx = st->codec;
|
||||||
AVRational sar, dar; /* sample and display aspect ratios */
|
AVRational sar, dar; /* sample and display aspect ratios */
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
int flags = SDL_SWSURFACE | sdl->window_fullscreen ? SDL_FULLSCREEN : 0;
|
||||||
|
|
||||||
if (!sdl->window_title)
|
if (!sdl->window_title)
|
||||||
sdl->window_title = av_strdup(s->filename);
|
sdl->window_title = av_strdup(s->filename);
|
||||||
@ -151,7 +153,7 @@ static int sdl_write_header(AVFormatContext *s)
|
|||||||
|
|
||||||
SDL_WM_SetCaption(sdl->window_title, sdl->icon_title);
|
SDL_WM_SetCaption(sdl->window_title, sdl->icon_title);
|
||||||
sdl->surface = SDL_SetVideoMode(sdl->window_width, sdl->window_height,
|
sdl->surface = SDL_SetVideoMode(sdl->window_width, sdl->window_height,
|
||||||
24, SDL_SWSURFACE);
|
24, flags);
|
||||||
if (!sdl->surface) {
|
if (!sdl->surface) {
|
||||||
av_log(s, AV_LOG_ERROR, "Unable to set video mode: %s\n", SDL_GetError());
|
av_log(s, AV_LOG_ERROR, "Unable to set video mode: %s\n", SDL_GetError());
|
||||||
ret = AVERROR(EINVAL);
|
ret = AVERROR(EINVAL);
|
||||||
@ -209,6 +211,7 @@ static const AVOption options[] = {
|
|||||||
{ "window_title", "set SDL window title", OFFSET(window_title), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
|
{ "window_title", "set SDL window title", OFFSET(window_title), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
|
||||||
{ "icon_title", "set SDL iconified window title", OFFSET(icon_title) , AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
|
{ "icon_title", "set SDL iconified window title", OFFSET(icon_title) , AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
|
||||||
{ "window_size", "set SDL window forced size", OFFSET(window_width), AV_OPT_TYPE_IMAGE_SIZE,{.str=NULL}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
|
{ "window_size", "set SDL window forced size", OFFSET(window_width), AV_OPT_TYPE_IMAGE_SIZE,{.str=NULL}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
|
||||||
|
{ "window_fullscreen", "set SDL window fullscreen", OFFSET(window_fullscreen), AV_OPT_TYPE_INT,{.i64=0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user