Beispiel #1
0
dt_camctl_t *dt_camctl_new()
{
  dt_camctl_t *camctl=g_malloc(sizeof(dt_camctl_t));
  memset(camctl,0,sizeof(dt_camctl_t));
  dt_print(DT_DEBUG_CAMCTL,"[camera_control] creating new context %lx\n",(unsigned long int)camctl);

  // Initialize gphoto2 context and setup dispatch callbacks
  camctl->gpcontext = gp_context_new();
  gp_context_set_idle_func( camctl->gpcontext , (GPContextIdleFunc)_idle_func_dispatch, camctl );
  gp_context_set_status_func( camctl->gpcontext , (GPContextStatusFunc)_status_func_dispatch, camctl );
  gp_context_set_error_func( camctl->gpcontext , (GPContextErrorFunc)_error_func_dispatch, camctl );
  gp_context_set_message_func( camctl->gpcontext , (GPContextMessageFunc)_message_func_dispatch, camctl );

  // Load all camera drivers we know...
  gp_abilities_list_new( &camctl->gpcams );
  gp_abilities_list_load( camctl->gpcams, camctl->gpcontext );
  dt_print(DT_DEBUG_CAMCTL,"[camera_control] loaded %d camera drivers.\n", gp_abilities_list_count( camctl->gpcams ) );

  dt_pthread_mutex_init(&camctl->lock, NULL);

  // Let's detect cameras connexted
  dt_camctl_detect_cameras(camctl);


  return camctl;
}
Beispiel #2
0
void
gp_glue_context_set_message_func (GPGlueContext *gluecontext, GPGlueContextMessageFunc message_func, void *data)
{
	gluecontext->message_func = message_func;
	gluecontext->message_data = data;

	gp_context_set_message_func (gluecontext->context, gp_glue_message_func_wrapper, gluecontext);
}
Beispiel #3
0
void Context::init_messages() {
	gp_context_set_error_func(context, error_func, NULL);
	gp_context_set_message_func(context, msg_func, NULL);
	gp_context_set_status_func(context, status_func, NULL);
	// debug logging is massive
	const char *debug_enable = getenv("GPWRAP_LOG_DEBUG");
	static bool debug_created;
	if (debug_enable && debug_enable[0] == '1' && !debug_created) {
		debug_created = true;
		// maybe should have a top-level class for this as it's not context specific
		// typecast because just enum vs int in header, should be safe
		gp_log_add_func(GP_LOG_DEBUG, reinterpret_cast<GPLogFunc>(log_func), NULL);
	}
}
Beispiel #4
0
void
gp_params_init (GPParams *p, char **envp)
{
	if (!p)
		return;

	memset (p, 0, sizeof (GPParams));

	p->folder = strdup ("/");
	if (!p->folder) {
		fprintf (stderr, _("Not enough memory."));
		fputc ('\n', stderr);
		exit (1);
	}

	gp_camera_new (&p->camera);

	p->cols = 79;
	p->flags = FLAGS_RECURSE;

	/* Create a context. Report progress only if users will see it. */
	p->context = gp_context_new ();
	gp_context_set_cancel_func    (p->context, ctx_cancel_func,  p);
	gp_context_set_error_func     (p->context, ctx_error_func,   p);
	gp_context_set_status_func    (p->context, ctx_status_func,  p);
	gp_context_set_message_func   (p->context, ctx_message_func, p);
	if (isatty (STDOUT_FILENO))
		gp_context_set_progress_funcs (p->context,
			ctx_progress_start_func, ctx_progress_update_func,
			ctx_progress_stop_func, p);

	p->_abilities_list = NULL;

	p->debug_func_id = -1;

	p->envp = envp;
}
Beispiel #5
0
int		init(t_cam *c)
{
  c->liveview = 0;
  c->liveview_fps = 30;
  c->liveview_fps_time = 1000000 / 30;
  pthread_mutex_init(&c->liveview_mutex, NULL);
  pthread_cond_init(&c->liveview_condvar, NULL);
  c->folder_path = strdup("/tmp/");
  c->camera_value_list = NULL;

  gp_context_set_error_func(c->context, (GPContextErrorFunc)error_func, NULL);
  gp_context_set_message_func(c->context, (GPContextMessageFunc)message_func, NULL);

  gp_camera_new(&c->camera);
  c->context = gp_context_new();
  printf("Camera Init\n");
  c->ret = gp_camera_init(c->camera, c->context);
  if (c->ret != GP_OK) {
    printf("gp_camera_init: %d\n", c->ret);
    return (GP_ERROR);
  }
  /*  get_initial_camera_values(t_cam *c); */
  return (GP_OK);
}