int gst_video1_encode(struct videnc_state *st, bool update, const struct vidframe *frame) { int err; if (!st || !frame || frame->fmt != VID_FMT_YUV420P) return EINVAL; if (!st->streamer.valid || !vidsz_cmp(&st->encoder.size, &frame->size)) { pipeline_close(st); err = pipeline_init(st, &frame->size); if (err) { warning("gst_video: pipeline initialization failed\n"); return err; } st->encoder.size = frame->size; } if (update) { debug("gst_video: gstreamer picture update" ", it's not implemented...\n"); } /* * Push frame into pipeline. * Function call will return once frame has been processed completely. */ err = pipeline_push(st, frame); return err; }
/* init the CSF modules */ static int csf_init(void) { int rc; csf_conf_init(&main_conf); if (config_init() < 0) return CSF_ERR; else output_config(); /* start log */ if (main_conf.log_ident[0] == '\0') comm_handle.logp = logger_init(NULL, DEFAULT_WLOG_IDENT, LOG_CONS|LOG_PID, LOG_LOCAL6); else comm_handle.logp = logger_init(NULL, main_conf.log_ident, LOG_CONS|LOG_PID, LOG_LOCAL6); // comm_handle.mntp = monitor_init(NULL, main_conf.monitor_bind_ip, main_conf.monitor_port); comm_handle.sribp = request_info_init(&main_conf); if (main_conf.monitor_enable) { // if (monitor_start() < 0) { // WLOG_ERR("Monitor start failed."); // PRINT("Monitor start failed."); // } } if (main_conf.daemonize) daemonize(1, 1); set_maxfd(); /* * We prealloc the mempool * XXX We use pipeline_queue_size may not be suited? */ mp_init(main_conf.pipeline_queue_size / 10, main_conf.pipeline_queue_size / 2); rc = mod_config_init(&main_conf, &mod_queue_head, &gvcb, &comm_handle); if (rc != CSF_OK) { return (CSF_ERR); } /* * init pipeline module * (call the initialization function defined at protocol source file) */ if (!TAILQ_EMPTY(&mod_queue_head)) { rc = pipeline_init(&mod_queue_head, main_conf.pipeline_queue_size, main_conf.request_timeout); if (rc != PIPELINE_INIT_OK) { WLOG_ERR("Can not init pipeline."); PRINT("Can not init pipeline."); return (CSF_ERR); } } /*init protocol module*/ rc = app_proto_init(main_conf.protocol_module, main_conf.cp_ops, &gvcb, &comm_handle); if (rc < 0) return (CSF_ERR); return (CSF_OK); }