aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Vignali <martin.vignali@gmail.com>2018-05-08 11:55:40 +0200
committerMartin Vignali <martin.vignali@gmail.com>2018-05-19 14:55:15 +0200
commit411f7141a3c328e73dea468cad59d42f087b5c1d (patch)
tree1b22bb9e0a365b92fd2fc353db0a58cad42b54c5
parent644130bcaa22ed42718e1e0aabcb0e398b8414ff (diff)
downloadffmpeg-411f7141a3c328e73dea468cad59d42f087b5c1d.tar.gz
avdevice/sdl2 : add option to define if the window quit action is available
-rw-r--r--doc/outdevs.texi5
-rw-r--r--libavdevice/sdl2.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/doc/outdevs.texi b/doc/outdevs.texi
index daf7b1ae62..c2906b9371 100644
--- a/doc/outdevs.texi
+++ b/doc/outdevs.texi
@@ -396,6 +396,11 @@ downscaled according to the aspect ratio.
@item window_fullscreen
Set fullscreen mode when non-zero value is provided.
Default value is zero.
+
+@item window_enable_quit
+Enable quit action (using window button or keyboard key)
+when non-zero value is provided.
+Default value is 1 (enable quit action)
@end table
@subsection Interactive commands
diff --git a/libavdevice/sdl2.c b/libavdevice/sdl2.c
index e363df398d..da5143078e 100644
--- a/libavdevice/sdl2.c
+++ b/libavdevice/sdl2.c
@@ -42,6 +42,7 @@ typedef struct {
int window_width, window_height; /**< size of the window */
int window_fullscreen;
int window_borderless;
+ int enable_quit_action;
SDL_Texture *texture;
int texture_fmt;
@@ -277,7 +278,7 @@ static int sdl2_write_packet(AVFormatContext *s, AVPacket *pkt)
}
}
- if (quit) {
+ if (quit && sdl->enable_quit_action) {
sdl2_write_trailer(s);
return AVERROR(EIO);
}
@@ -338,6 +339,7 @@ static const AVOption options[] = {
{ "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_BOOL, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
{ "window_borderless", "set SDL window border off", OFFSET(window_borderless), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
+ { "window_enable_quit", "set if quit action is available", OFFSET(enable_quit_action), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
{ NULL },
};