static int tc_x11_configure(TCModuleInstance *self, const char *options, vob_t *vob) { TCX11PrivateData *priv = NULL; int ret = 0, skew_lim = SKEW_LIM_DEFAULT; TC_MODULE_SELF_CHECK(self, "configure"); priv = self->userdata; if (options != NULL) { optstr_get(options, "skew_limit", "%i", &skew_lim); if (skew_lim < SKEW_LIM_MIN || skew_lim > SKEW_LIM_MAX) { tc_log_warn(MOD_NAME, "skew limit value out of range," " reset to defaults [%i]", SKEW_LIM_DEFAULT); } } priv->skew = 0; priv->reftime = 0; priv->expired = 0; priv->frame_delay = (uint64_t)(1000000.0 / vob->fps); /* microseconds */ priv->skew_limit = priv->frame_delay / frame_delay_divs[skew_lim]; if (verbose >= TC_DEBUG) { tc_log_info(MOD_NAME, "frame delay: %lu ms", (unsigned long)priv->frame_delay); tc_log_info(MOD_NAME, "skew limit: %li ms", (long)priv->skew_limit); } ret = tc_timer_init_soft(&priv->timer, 0); if (ret != 0) { tc_log_error(MOD_NAME, "configure: can't initialize timer"); return TC_ERROR; } /* nothing to do here, yet */ ret = tc_x11source_is_display_name(vob->video_in_file); if (ret == TC_FALSE) { tc_log_error(MOD_NAME, "configure: given source doesn't look like" " a DISPLAY specifier"); return TC_ERROR; } ret = tc_x11source_open(&priv->src, vob->video_in_file, TC_X11_MODE_BEST, vob->im_v_codec); if (ret != 0) { tc_log_error(MOD_NAME, "configure: failed to open X11 connection" " to '%s'", vob->video_in_file); return TC_ERROR; } return TC_OK; }
void probe_x11(info_t *ipipe) { #ifdef HAVE_X11 TCX11Source xsrc; int err = tc_x11source_open(&xsrc, ipipe->name, TC_X11_MODE_PLAIN, TC_CODEC_RGB); /* performances and colorspaces doesn't really matters here */ if (err == 0) { tc_x11source_probe(&xsrc, ipipe->probe_info); tc_x11source_close(&xsrc); } #else /* HAVE_x11 */ tc_log_error(__FILE__, "No support for X11 compiled in"); ipipe->probe_info->codec = TC_CODEC_UNKNOWN; ipipe->probe_info->magic = TC_MAGIC_UNKNOWN; #endif /* HAVE_X11 */ return; }