Esempio n. 1
0
static void v4l_postprocess(MSFilter *f){
	V4lState *s=(V4lState*)f->data;
	if (s->auto_started){
		v4l_stop_capture(s);
		v4l_stop(f,NULL);
	}
	else
	{
		v4l_stop_capture(s);
	}
}
Esempio n. 2
0
int v4l_cam_value(char*  device_name) {
	int fd = open(device_name, O_RDWR | O_NONBLOCK /* required */);

	if (v4l_check_capabilities(fd)) {
		return -1;
	}

	if (v4l_check_format(fd)) {
		return -1;
	}

	if(v4l_check_avaible_shots(fd)) {
		return -1;
	}

	int buf_length = 0;
	char* image_memmory = NULL;
	if(v4l_mmap_frame(fd, &image_memmory, &buf_length)) {
		return -1;
	}

	if(v4l_start_capture(fd)) {
		v4l_stop_capture(fd, image_memmory, buf_length);
		return -1;
	}

	int res = 0;
	if(v4l_wait_shot(fd) == 0) {
		res = v4l_read_frame(fd, image_memmory, buf_length);
	}

	v4l_stop_capture(fd, image_memmory, buf_length);

	close(fd);
	if (res >= 0) {
		return (res * 10240.0) / 64.0; //64 - because auto
	}

	return res;
}
Esempio n. 3
0
static void v4l_postprocess(MSFilter *f){
	V4lState *s=(V4lState*)f->data;
	v4l_stop_capture(s);
}