[FFmpeg-devel] [PATCH] fix missing blue channel when switching from/to fullscren on OSX and libsdl 1.2.14. Fixes issue 548

Jean First jeanfirst at gmail.com
Wed Oct 19 23:41:34 CEST 2011


Updated
---
 ffplay.c |   34 ++++++++++++++++++++++++++--------
 1 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index ffd6ae5..9d8c96a 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -101,7 +101,7 @@ typedef struct VideoPicture {
     int skip;
     SDL_Overlay *bmp;
     int width, height; /* source height & width */
-    int allocated;
+    int allocated, fullscreentoggled;
     enum PixelFormat pix_fmt;
 
 #if CONFIG_AVFILTER
@@ -863,15 +863,9 @@ static void video_audio_display(VideoState *s)
     }
 }
 
-static void stream_close(VideoState *is)
-{
+static void free_all_pictures(VideoState *is){
     VideoPicture *vp;
     int i;
-    /* XXX: use a special url_shutdown call to abort parse cleanly */
-    is->abort_request = 1;
-    SDL_WaitThread(is->read_tid, NULL);
-    SDL_WaitThread(is->refresh_tid, NULL);
-
     /* free all pictures */
     for(i=0;i<VIDEO_PICTURE_QUEUE_SIZE; i++) {
         vp = &is->pictq[i];
@@ -886,6 +880,17 @@ static void stream_close(VideoState *is)
             vp->bmp = NULL;
         }
     }
+}
+
+static void stream_close(VideoState *is)
+{
+    /* XXX: use a special url_shutdown call to abort parse cleanly */
+    is->abort_request = 1;
+    SDL_WaitThread(is->read_tid, NULL);
+    SDL_WaitThread(is->refresh_tid, NULL);
+
+    free_all_pictures(is);
+
     SDL_DestroyMutex(is->pictq_mutex);
     SDL_DestroyCond(is->pictq_cond);
     SDL_DestroyMutex(is->subpq_mutex);
@@ -1342,6 +1347,11 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
 
     vp->duration = frame_delay;
 
+    if(vp->fullscreentoggled){
+        free_all_pictures(is);
+        vp->fullscreentoggled = 0;
+    }
+
     /* alloc or resize hardware picture buffer */
     if (!vp->bmp ||
 #if CONFIG_AVFILTER
@@ -2707,8 +2717,16 @@ static void stream_cycle_channel(VideoState *is, int codec_type)
 
 static void toggle_full_screen(VideoState *is)
 {
+    VideoPicture *vp;
     is_full_screen = !is_full_screen;
+
+#if defined(__APPLE__) && SDL_VERSION_ATLEAST(1, 2, 14)
+    /* OSX needs to empty the picture_queue */
+    vp = &is->pictq[is->pictq_windex];
+    vp->fullscreentoggled = 1;
+#else
     video_open(is);
+#endif
 }
 
 static void toggle_pause(VideoState *is)
-- 
1.7.7



More information about the ffmpeg-devel mailing list