[Ffmpeg-devel] [PATCH] Auto-resize ffplay video

Steven Sheehy steven.sheehy
Tue Dec 26 22:12:38 CET 2006


On Sat, Dec 23, 2006 at 15:20:36 CET 2006, Michael Niedermayer wrote:
 > seperate issue seperate patch please

I could've characterized this patch more generically by saying it resolves the 
improper resizing of the video window, if you prefer. In addition, if I were to 
make them separate they would still depend on each other since the patch to 
auto-resize the output modifies text before the exiting from full screen bug. 
Nevertheless, here's the patch for just this issue:

Index: ffplay.c
===================================================================
--- ffplay.c	(revision 7350)
+++ ffplay.c	(working copy)
@@ -2261,8 +2274,8 @@
              if (cur_stream) {
                  screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 0,
 
SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL);
-                cur_stream->width = event.resize.w;
-                cur_stream->height = event.resize.h;
+                cur_stream->width = screen_width = event.resize.w;
+                cur_stream->height = screen_height = event.resize.h;
              }
              break;
          case SDL_QUIT:

 > screen_width / screen_height should either be set to the dimensions of
 > the video or should be at 0 by default and then be overridden by
 > the video w/h if they are 0 where used

I've tried this, but I've found that if you pass a width and height of 0 to the 
initial SDL_SetVideoMode(), it causes the video window to be maximized and 
future SDL_SetVideoMode()'s to be ignored (SDL bug?). screen_width / 
screen_height cannot be set to the video dimensions at declaration time or in 
main() since they can only be determined at a much later point in the program 
when alloc_picture() is called. If have any suggestions to overcome these 
issues, I'd be grateful.

-Steven




More information about the ffmpeg-devel mailing list