extern int send_eventv(eventq_t q, int type, va_list args) { tcvp_event_t *te = NULL; int ret = -1; if(type == -1) { te = tcalloc(sizeof(*te)); te->type = -1; } else if(type <= event_num && event_tab[type] && event_tab[type]->alloc) { te = event_tab[type]->alloc(type, args); } else { tc2_print("EVENT", TC2_PRINT_WARNING, "unknown event #%i\n", type); } if(te) { if(type >= 0) tc2_print("EVENT", TC2_PRINT_DEBUG, "sending %s\n", event_tab[type]->name); ret = eventq_send(q, te); tcfree(te); } return ret; }
extern int set_var(xtk_widget_t *w, void *p) { widget_data_t *wd = xtk_widget_get_data(w); char *d = wd->action_data; if(d) { XTK_SLIDER(w, s); if(s) { double *pos = tcalloc(sizeof(*pos)); *pos = *((double*)p); change_variable(d, "double", pos); } } return 0; }
void * g_tcalloc(size_t size, int size2) { if (root_mem_context == NULL) { init_root(); } return tcalloc(size * size2, root_mem_context); }
extern tcvp_pipe_t * new_pipe(tcvp_player_t *sh, muxed_stream_t *ms, stream_t *s) { tcvp_pipe_t *pipe = NULL, *pp = NULL, *pn = NULL; tcconf_section_t *f, *mcf; tcconf_section_t *pr = NULL; void *cs = NULL; int skip = 0; switch(s->stream_type){ case STREAM_TYPE_VIDEO: pr = tcconf_getsection(sh->profile, "video"); break; case STREAM_TYPE_AUDIO: pr = tcconf_getsection(sh->profile, "audio"); break; case STREAM_TYPE_SUBTITLE: pr = tcconf_getsection(sh->profile, "subtitle"); break; } if(!pr) return NULL; while((f = tcconf_nextsection(pr, "filter", &cs))){ char *type, *id = NULL; filter_new_t fn; if(skip){ tcfree(f); continue; } pn = NULL; if(tcconf_getvalue(f, "type", "%s", &type) < 1){ tc2_print("STREAM", TC2_PRINT_WARNING, "bad filter specification\n"); continue; } if(tcconf_getvalue(f, "id", "%s", &id) > 0) tchash_find(sh->filters, id, -1, &pn); if(!pn){ tc2_print("STREAM", TC2_PRINT_DEBUG, "opening new filter: %s\n", type); if(!(fn = tc2_get_symbol(type, "new"))) break; mcf = tcconf_merge(NULL, f); tcconf_merge(mcf, sh->conf); if(sh->outfile) tcconf_setvalue(mcf, "mux/url", "%s", sh->outfile); if(!(pn = fn(pp? &pp->format: s, mcf, sh->timer, ms))){ tc2_print("STREAM", TC2_PRINT_WARNING, "error opening filter '%s'\n", type); break; } if(id){ char *cid = tcalloc(strlen(id) + 1); strcpy(cid, id); tcattr_set(cid, "stream-shared", sh, NULL, NULL); tcattr_set(pn, "id", cid, NULL, pid_free); tchash_replace(sh->filters, id, -1, pn, NULL); } tcfree(mcf); } else { tcref(pn); } if(id) free(id); if(!pipe) pipe = pn; if(pp) pp->next = pn; pp = pn; free(type); tcfree(f); if(pp->next){ while((pp = pp->next)) tcref(pp); skip = 1; } } if(!pn){ close_pipe(pipe); pipe = NULL; } tcfree(pr); return pipe; }