示例#1
0
文件: conf.c 项目: rvs/libtc
static void
conf_free(void *p)
{
    conf_section *sec = p;
    tclist_destroy(sec->entries, tcfree);
    tclist_destroy(sec->merge, free);
    if(sec->name)
	free(sec->name);
}
示例#2
0
文件: play.c 项目: xaradevil/tcvp
static int
del_stream(stream_player_t *sp, int s)
{
    tcvp_player_t *sh = sp->shared;
    int ss = sp->smap[s];
    struct sp_stream *str = sp->streams + s;

    tc2_print("STREAM", TC2_PRINT_DEBUG, "deleting stream %i\n", s);

    if(ss == sh->vs)
        sh->vs = -1;
    else if(ss == sh->as)
        sh->as = -1;

    pthread_mutex_lock(&sp->lock);

    close_pipe(str->pipe);
    str->pipe = NULL;
    str->end = NULL;

    if(str->packets){
        tclist_destroy(str->packets, tcfree);
        str->packets = NULL;
    }

    sp->ms->used_streams[s] = 0;
    sp->nbuf &= ~(1ULL << s);

    if(sp->fail == sp->ms->n_streams){
        tcvp_event_send(sh->sq, TCVP_STATE, TCVP_STATE_ERROR);
    }

    if(str->sp){
        if(!--sp->pstreams){
            pthread_mutex_lock(&sh->lock);
            if(!--sh->nstreams)
                tcvp_event_send(sh->sq, TCVP_STATE, TCVP_STATE_END);
            pthread_mutex_unlock(&sh->lock);
            sp->state = STOP;
        }
    }

    pthread_cond_broadcast(&sp->cond);
    pthread_mutex_unlock(&sp->lock);

    return 0;
}
示例#3
0
文件: conf.c 项目: rvs/libtc
static void
free_entry(void *p)
{
    tcc_entry *te = p;

    switch(te->type){
    case TCC_VALUE: 
	tclist_destroy(te->value.values, free_value);
	free(te->value.key);
	break;

    case TCC_SECTION:
    case TCC_MSECTION:
	tcfree(te->section);
	break;
    }
}