static void stream_close(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);

    packet_queue_destroy(&is->videoq);

    packet_queue_destroy(&is->audioq);

    packet_queue_destroy(&is->subtitleq);



    /* free all pictures */

    for (i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) {

        vp = &is->pictq[i];

#if CONFIG_AVFILTER

        avfilter_unref_bufferp(&vp->picref);

#endif

        if (vp->bmp) {

            SDL_FreeYUVOverlay(vp->bmp);

            vp->bmp = NULL;

        }

    }

    SDL_DestroyMutex(is->pictq_mutex);

    SDL_DestroyCond(is->pictq_cond);

    SDL_DestroyMutex(is->subpq_mutex);

    SDL_DestroyCond(is->subpq_cond);

    SDL_DestroyCond(is->continue_read_thread);

#if !CONFIG_AVFILTER

    sws_freeContext(is->img_convert_ctx);

#endif

    av_free(is);

}

static void stream_close(VideoState *is)

{

    VideoPicture *vp;

    int i;

    

    is->abort_request = 1;

    SDL_WaitThread(is->read_tid, NULL);

    SDL_WaitThread(is->refresh_tid, NULL);

    packet_queue_destroy(&is->videoq);

    packet_queue_destroy(&is->audioq);

    packet_queue_destroy(&is->subtitleq);



    

    for (i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) {

        vp = &is->pictq[i];

#if CONFIG_AVFILTER

        avfilter_unref_bufferp(&vp->picref);

#endif

        if (vp->bmp) {

            SDL_FreeYUVOverlay(vp->bmp);

            vp->bmp = NULL;

        }

    }

    SDL_DestroyMutex(is->pictq_mutex);

    SDL_DestroyCond(is->pictq_cond);

    SDL_DestroyMutex(is->subpq_mutex);

    SDL_DestroyCond(is->subpq_cond);

    SDL_DestroyCond(is->continue_read_thread);

#if !CONFIG_AVFILTER

    sws_freeContext(is->img_convert_ctx);

#endif

    av_free(is);

}

static void FUNC_0(VideoState *VAR_0)

{

    VideoPicture *vp;

    int VAR_1;

    

    VAR_0->abort_request = 1;

    SDL_WaitThread(VAR_0->read_tid, NULL);

    SDL_WaitThread(VAR_0->refresh_tid, NULL);

    packet_queue_destroy(&VAR_0->videoq);

    packet_queue_destroy(&VAR_0->audioq);

    packet_queue_destroy(&VAR_0->subtitleq);



    

    for (VAR_1 = 0; VAR_1 < VIDEO_PICTURE_QUEUE_SIZE; VAR_1++) {

        vp = &VAR_0->pictq[VAR_1];

#if CONFIG_AVFILTER

        avfilter_unref_bufferp(&vp->picref);

#endif

        if (vp->bmp) {

            SDL_FreeYUVOverlay(vp->bmp);

            vp->bmp = NULL;

        }

    }

    SDL_DestroyMutex(VAR_0->pictq_mutex);

    SDL_DestroyCond(VAR_0->pictq_cond);

    SDL_DestroyMutex(VAR_0->subpq_mutex);

    SDL_DestroyCond(VAR_0->subpq_cond);

    SDL_DestroyCond(VAR_0->continue_read_thread);

#if !CONFIG_AVFILTER

    sws_freeContext(VAR_0->img_convert_ctx);

#endif

    av_free(VAR_0);

}

static void FUNC_0(VideoState *VAR_0)
{ VideoPicture *vp; int VAR_1; VAR_0->abort_request = 1; SDL_WaitThread(VAR_0->read_tid, NULL); SDL_WaitThread(VAR_0->refresh_tid, NULL); packet_queue_destroy(&VAR_0->videoq); packet_queue_destroy(&VAR_0->audioq); packet_queue_destroy(&VAR_0->subtitleq); for (VAR_1 = 0; VAR_1 < VIDEO_PICTURE_QUEUE_SIZE; VAR_1++) { vp = &VAR_0->pictq[VAR_1]; #if CONFIG_AVFILTER
avfilter_unref_bufferp(&vp->picref); #endif
if (vp->bmp) { SDL_FreeYUVOverlay(vp->bmp); vp->bmp = NULL; } } SDL_DestroyMutex(VAR_0->pictq_mutex); SDL_DestroyCond(VAR_0->pictq_cond); SDL_DestroyMutex(VAR_0->subpq_mutex); SDL_DestroyCond(VAR_0->subpq_cond); SDL_DestroyCond(VAR_0->continue_read_thread); #if !CONFIG_AVFILTER
sws_freeContext(VAR_0->img_convert_ctx); #endif
av_free(VAR_0); }