avdevice/sdl2output : fix setting window_size
authorMartin Vignali <martin.vignali@gmail.com>
Tue, 8 May 2018 09:47:13 +0000 (11:47 +0200)
committerMartin Vignali <martin.vignali@gmail.com>
Sat, 19 May 2018 12:55:11 +0000 (14:55 +0200)
libavdevice/sdl2.c

index 48ed977..e363df3 100644 (file)
@@ -206,9 +206,7 @@ static int sdl2_write_header(AVFormatContext *s)
         }
     }
 
-    sdl->window_width = sdl->texture_rect.w = codecpar->width;
-    sdl->window_height = sdl->texture_rect.h = codecpar->height;
-    sdl->texture_rect.x = sdl->texture_rect.y = 0;
+    compute_texture_rect(s);
 
     if (SDL_CreateWindowAndRenderer(sdl->window_width, sdl->window_height,
                                     flags, &sdl->window, &sdl->renderer) != 0){
@@ -219,7 +217,7 @@ static int sdl2_write_header(AVFormatContext *s)
     SDL_SetWindowTitle(sdl->window, sdl->window_title);
 
     sdl->texture = SDL_CreateTexture(sdl->renderer, sdl->texture_fmt, SDL_TEXTUREACCESS_STREAMING,
-                                     sdl->window_width, sdl->window_height);
+                                     codecpar->width, codecpar->height);
 
     if (!sdl->texture) {
         av_log(sdl, AV_LOG_ERROR, "Unable to set create mode: %s\n", SDL_GetError());