static gboolean _video_on_open(gpointer data) { const int timeout = 10000; VideoPhonePlugin * video = data; PhonePluginHelper * helper = video->helper; #ifdef DEBUG fprintf(stderr, "DEBUG: %s() \"%s\"\n", __func__, video->device); #endif if((video->fd = open(video->device, O_RDWR)) < 0) { error_set_code(1, "%s: %s (%s)", video->device, "Could not open the video capture device", strerror(errno)); helper->error(helper->phone, error_get(NULL), 1); video->source = g_timeout_add(timeout, _video_on_open, video); return FALSE; } if(_open_setup(video) != 0) { helper->error(helper->phone, error_get(NULL), 1); close(video->fd); video->fd = -1; video->source = g_timeout_add(timeout, _video_on_open, video); return FALSE; } video->source = 0; #ifdef DEBUG fprintf(stderr, "DEBUG: %s() %dx%d\n", __func__, video->format.fmt.pix.width, video->format.fmt.pix.height); #endif /* FIXME allow the window to be smaller */ gtk_widget_set_size_request(video->area, video->format.fmt.pix.width, video->format.fmt.pix.height); return FALSE; }
static gboolean _camera_on_open(gpointer data) { Camera * camera = data; #ifdef DEBUG fprintf(stderr, "DEBUG: %s() \"%s\"\n", __func__, camera->device); #endif camera->source = 0; if((camera->fd = open(camera->device, O_RDWR)) < 0) { error_set_code(1, "%s: %s (%s)", camera->device, _("Could not open the video capture device"), strerror(errno)); _camera_error(camera, error_get(), 1); return FALSE; } if(_open_setup(camera) != 0) { _camera_error(camera, error_get(), 1); close(camera->fd); camera->fd = -1; /* FIXME also free camera->buffers */ return FALSE; } #ifdef DEBUG fprintf(stderr, "DEBUG: %s() %dx%d\n", __func__, camera->format.fmt.pix.width, camera->format.fmt.pix.height); #endif gtk_widget_set_sensitive(GTK_WIDGET(_camera_toolbar[0].widget), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(_camera_toolbar[2].widget), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(_camera_toolbar[4].widget), TRUE); /* FIXME allow the window to be smaller */ gtk_widget_set_size_request(camera->area, camera->format.fmt.pix.width, camera->format.fmt.pix.height); return FALSE; }