[FFmpeg-devel] [PATCH 2/2] ffplay: 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 14:13:56 CEST 2011


This patch may fix issues on older libsdl version, but I did not check it because libsdl 1.2.14 is already 2 years old.
---
 ffplay.c |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index ffd6ae5..4f78ef3 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -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);
@@ -2708,7 +2713,13 @@ static void stream_cycle_channel(VideoState *is, int codec_type)
 static void toggle_full_screen(VideoState *is)
 {
     is_full_screen = !is_full_screen;
+
+#if defined(__APPLE__) && SDL_VERSION_ATLEAST(1, 2, 14)
+    /* OSX needs to empty the picture_queue */
+    free_all_pictures(is);
+#else
     video_open(is);
+#endif
 }
 
 static void toggle_pause(VideoState *is)
-- 
1.7.6.1



More information about the ffmpeg-devel mailing list