On Sun, Sep 28, 2014 at 10:08 AM, Luca Barbato <[email protected]> wrote:
> Prevent a segfault on close.
>
> CC: [email protected]
> ---
>
>  avplay.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/avplay.c b/avplay.c
> index 58da984..338a881 100644
> --- a/avplay.c
> +++ b/avplay.c
> @@ -1269,13 +1269,17 @@ static void alloc_picture(void *opaque)
>          SDL_FreeYUVOverlay(vp->bmp);
>
>  #if CONFIG_AVFILTER
> -    vp->width   = is->out_video_filter->inputs[0]->w;
> -    vp->height  = is->out_video_filter->inputs[0]->h;
> -    vp->pix_fmt = is->out_video_filter->inputs[0]->format;
> +    if (is->out_video_filter) {
> +        vp->width   = is->out_video_filter->inputs[0]->w;
> +        vp->height  = is->out_video_filter->inputs[0]->h;
> +        vp->pix_fmt = is->out_video_filter->inputs[0]->format;
> +    } else
>  #else
> -    vp->width   = is->video_st->codec->width;
> -    vp->height  = is->video_st->codec->height;
> -    vp->pix_fmt = is->video_st->codec->pix_fmt;
> +    {
> +        vp->width   = is->video_st->codec->width;
> +        vp->height  = is->video_st->codec->height;
> +        vp->pix_fmt = is->video_st->codec->pix_fmt;
> +    }
>  #endif
>
>      vp->bmp = SDL_CreateYUVOverlay(vp->width, vp->height,
> @@ -1660,6 +1664,8 @@ static int video_thread(void *arg)
>  #if CONFIG_AVFILTER
>      av_freep(&vfilters);
>      avfilter_graph_free(&graph);
> +    is->in_video_filter  = NULL;
> +    is->out_video_filter = NULL;
>  #endif
>      av_free_packet(&pkt);
>      av_frame_free(&frame);

I think it should be fine.
-- 
Vittorio
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to