From: Jean First <[email protected]> Hi,
I've reformated/formulated the commit message, removed a cosmetic change and fixed an obvious compile error on non-apple. Janne ---8<--- The blue channel went missing when toggling fullscreen on Mac OS X. 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. Signed-off-by: Janne Grunau <[email protected]> --- avplay.c | 31 +++++++++++++++++++++++++------ 1 files changed, 25 insertions(+), 6 deletions(-) diff --git a/avplay.c b/avplay.c index 225f81a..bb50aa7 100644 --- a/avplay.c +++ b/avplay.c @@ -1214,18 +1214,14 @@ retry: } } -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->parse_tid, NULL); - SDL_WaitThread(is->refresh_tid, NULL); /* free all pictures */ for(i=0;i<VIDEO_PICTURE_QUEUE_SIZE; i++) { - vp = &is->pictq[i]; + vp = &cur_stream->pictq[i]; #if CONFIG_AVFILTER if (vp->picref) { avfilter_unref_buffer(vp->picref); @@ -1237,6 +1233,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->parse_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); @@ -2681,7 +2688,13 @@ static void stream_cycle_channel(VideoState *is, int codec_type) static void toggle_full_screen(void) { is_full_screen = !is_full_screen; + +#if defined(__APPLE__) && SDL_VERSION_ATLEAST(1, 2, 14) + /* OSX needs to empty the picturequeue */ + free_all_pictures(cur_stream); +#else video_open(cur_stream); +#endif } static void toggle_pause(void) @@ -2836,8 +2849,14 @@ static void event_loop(void) break; case SDL_VIDEORESIZE: if (cur_stream) { +#if defined(__APPLE__) && !SDL_VERSION_ATLEAST(1, 2, 14) + /* setting bits_per_pixel = 0 or 32 causes blank video on OS X and older SDL */ + screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 24, + SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL); +#else screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 0, SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL); +#endif screen_width = cur_stream->width = event.resize.w; screen_height= cur_stream->height= event.resize.h; } -- 1.7.7 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
