示例#1
0
文件: udp.c 项目: Acidburn0zzz/libav
static int udp_close(URLContext *h)
{
    UDPContext *s = h->priv_data;

    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);
    return 0;
}
示例#2
0
文件: udp.c 项目: dreamerc/mplayer
static int udp_close(URLContext *h)
{
    UDPContext *s = h->priv_data;

    if (s->is_multicast && !(h->flags & URL_WRONLY))
        udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);
    closesocket(s->udp_fd);
    av_free(s);
    return 0;
}
示例#3
0
TinyRet tiny_udp_multicast_close(int fd)
{
    udp_leave_multicast_group(fd);

#ifdef _WIN32
    closesocket(fd);
#else
    shutdown(fd, SHUT_RDWR);
    close(fd);
#endif

    return TINY_RET_OK;
}
示例#4
0
文件: udp.c 项目: quantsini/cog
static int udp_close(URLContext *h)
{
    UDPContext *s = h->priv_data;

    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
    pthread_mutex_destroy(&s->mutex);
    pthread_cond_destroy(&s->cond);
#endif
    return 0;
}
示例#5
0
文件: udp.c 项目: VFR-maniac/ffmpeg
static int udp_close(URLContext *h)
{
    UDPContext *s = h->priv_data;

    if (s->is_multicast && (h->flags & AVIO_FLAG_READ))
        udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr,(struct sockaddr *)&s->local_addr_storage);
    closesocket(s->udp_fd);
#if HAVE_PTHREAD_CANCEL
    if (s->thread_started) {
        int ret;
        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
    av_fifo_freep(&s->fifo);
    return 0;
}
示例#6
0
TinyRet tiny_leave_multicast_group(int fd)
{
    return udp_leave_multicast_group(fd);
}