summaryrefslogtreecommitdiffstats
path: root/fftools/ffplay.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2018-11-24 23:09:24 +0100
committerMarton Balint <cus@passwd.hu>2018-12-02 00:57:10 +0100
commit418c90faac6522c73481650d000e9f5f030187cb (patch)
treeba31d8f4d4a3e9da2d9592f6819b570bb2f6ff53 /fftools/ffplay.c
parent9a39c5449f5aef1c02bd46538bbbad4590064602 (diff)
downloadffmpeg-streaming-418c90faac6522c73481650d000e9f5f030187cb.zip
ffmpeg-streaming-418c90faac6522c73481650d000e9f5f030187cb.tar.gz
ffplay: fix -x and -y options when only one of them is used
Previously if only -y was used then nothing happened, if only -x then zero window height was set which is undefined in SDL and caused a black window. From now on if only one dimension is set we calculate the other based on size/aspect of the shown content. Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'fftools/ffplay.c')
-rw-r--r--fftools/ffplay.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 37a853f..6a195e5 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -1322,7 +1322,11 @@ static void sigterm_handler(int sig)
static void set_default_window_size(int width, int height, AVRational sar)
{
SDL_Rect rect;
- calculate_display_rect(&rect, 0, 0, INT_MAX, height, width, height, sar);
+ int max_width = screen_width ? screen_width : INT_MAX;
+ int max_height = screen_height ? screen_height : INT_MAX;
+ if (max_width == INT_MAX && max_height == INT_MAX)
+ max_height = height;
+ calculate_display_rect(&rect, 0, 0, max_width, max_height, width, height, sar);
default_width = rect.w;
default_height = rect.h;
}
@@ -1331,13 +1335,8 @@ static int video_open(VideoState *is)
{
int w,h;
- if (screen_width) {
- w = screen_width;
- h = screen_height;
- } else {
- w = default_width;
- h = default_height;
- }
+ w = screen_width ? screen_width : default_width;
+ h = screen_height ? screen_height : default_height;
if (!window_title)
window_title = input_filename;
OpenPOWER on IntegriCloud