static int udp_close(URLContext *h)

{

    UDPContext *s = h->priv_data;

    int ret;



    if (s->is_multicast && (h->flags & AVIO_FLAG_READ))

        udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);

    closesocket(s->udp_fd);

    av_fifo_free(s->fifo);

#if HAVE_PTHREADS

    if (s->thread_started) {

        pthread_cancel(s->circular_buffer_thread);

        ret = pthread_join(s->circular_buffer_thread, NULL);

        if (ret != 0)

            av_log(h, AV_LOG_ERROR, "pthread_join(): %s\n", strerror(ret));

    }



    pthread_mutex_destroy(&s->mutex);

    pthread_cond_destroy(&s->cond);

#endif

    return 0;

}

static int udp_close(URLContext *h)

{

    UDPContext *s = h->priv_data;

    int ret;



    if (s->is_multicast && (h->flags & AVIO_FLAG_READ))

        udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);

    closesocket(s->udp_fd);

    av_fifo_free(s->fifo);

#if HAVE_PTHREADS

    if (s->thread_started) {

        pthread_cancel(s->circular_buffer_thread);

        ret = pthread_join(s->circular_buffer_thread, NULL);

        if (ret != 0)

            av_log(h, AV_LOG_ERROR, "pthread_join(): %s\n", strerror(ret));

    }



    pthread_mutex_destroy(&s->mutex);

    pthread_cond_destroy(&s->cond);

#endif

    return 0;

}

static int FUNC_0(URLContext *VAR_0)

{

    UDPContext *s = VAR_0->priv_data;

    int VAR_1;



    if (s->is_multicast && (VAR_0->flags & AVIO_FLAG_READ))

        udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);

    closesocket(s->udp_fd);

    av_fifo_free(s->fifo);

#if HAVE_PTHREADS

    if (s->thread_started) {

        pthread_cancel(s->circular_buffer_thread);

        VAR_1 = pthread_join(s->circular_buffer_thread, NULL);

        if (VAR_1 != 0)

            av_log(VAR_0, AV_LOG_ERROR, "pthread_join(): %s\n", strerror(VAR_1));

    }



    pthread_mutex_destroy(&s->mutex);

    pthread_cond_destroy(&s->cond);

#endif

    return 0;

}

static int FUNC_0(URLContext *VAR_0)
{ UDPContext *s = VAR_0->priv_data; int VAR_1; if (s->is_multicast && (VAR_0->flags & AVIO_FLAG_READ))
udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr); closesocket(s->udp_fd); av_fifo_free(s->fifo); #if HAVE_PTHREADS
if (s->thread_started) { pthread_cancel(s->circular_buffer_thread); VAR_1 = pthread_join(s->circular_buffer_thread, NULL); if (VAR_1 != 0)
av_log(VAR_0, AV_LOG_ERROR, "pthread_join(): %s\n", strerror(VAR_1)); } pthread_mutex_destroy(&s->mutex); pthread_cond_destroy(&s->cond); #endif
return 0; }