[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

Marton Balint cus at passwd.hu
Wed Oct 19 21:54:28 CEST 2011


On Wed, 19 Oct 2011, Jean First wrote:

> 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.

This really should be tested first on an older SDL version to see if it 
does make any significant difference. But to tell you the truth, I am not 
much into doing or keeping workarounds for ancient library versions.

> --- > 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);

The read thread is still running when you free the pictures here, have you 
considered the concurrency issues?

> +#else
>     video_open(is);
> +#endif
> }
>
> static void toggle_pause(VideoState *is)
> -- 
> 1.7.6.1
>

Regards,
Marton


More information about the ffmpeg-devel mailing list