您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ v4l2_close函数代码示例

51自学网 2021-06-03 09:29:21
  C++
这篇教程C++ v4l2_close函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中v4l2_close函数的典型用法代码示例。如果您正苦于以下问题:C++ v4l2_close函数的具体用法?C++ v4l2_close怎么用?C++ v4l2_close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了v4l2_close函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: video_device_is_usable

staticintvideo_device_is_usable(const char *dev, char **shortname){    int fd = v4l2_open(dev, O_RDWR);    if (fd < 0)        return 0;    struct v4l2_capability caps;    if (v4l2_ioctl(fd, VIDIOC_QUERYCAP, &caps) != 0)        goto err_1;#ifdef V4L2_CAP_DEVICE_CAPS    const uint32_t device_caps = (caps.capabilities & V4L2_CAP_DEVICE_CAPS) ? caps.device_caps                                                                            : caps.capabilities;#else    const uint32_t device_caps = caps.capabilities;#endif // V4L2_CAP_DEVICE_CAPS    if (!(device_caps & V4L2_CAP_VIDEO_CAPTURE))        goto err_1;    if (!(device_caps & V4L2_CAP_READWRITE))        goto err_1;    *shortname = g_strdup((char *)caps.card);    v4l2_close(fd);    return 1;err_1:    v4l2_close(fd);    return 0;}
开发者ID:eltictacdicta,项目名称:freshplayerplugin,代码行数:34,


示例2: v4l2_postprocess

static void v4l2_postprocess(MSFilter *f){	V4l2State *s=(V4l2State*)f->data;	if (s->fd!=-1){		v4l2_do_munmap(s);		v4l2_close(s);	}}
开发者ID:nightfly19,项目名称:renyang-learn,代码行数:7,


示例3: v4lClose

//close and deallocate everything opened by the other functionsint v4lClose(v4lT* s) {  if( s->fmts ) {    free(s->fmts);    s->fmts = 0;    s->fmtsCount = 0;  }  if( s->frmSizes ) {    free(s->frmSizes);    s->frmSizes = 0;    s->frmSizeCount = 0;  }  if( s->frmIvals ) {    free(s->frmIvals);    s->frmIvals = 0;    s->frmIvalCount = 0;  }  if( s->bufs ) {    for( unsigned int i = 0; i < s->rqbuf.count; i++ )      munmap(s->bufs[i].data, s->bufs[i].length);    free(s->bufs);    s->bufs = 0;  }  v4l2_close(s->cam);  return 0;}
开发者ID:flesniak,项目名称:xilinx-vgain,代码行数:26,


示例4: vid4lin_stream_destroy

/* API: Destroy stream. */static pj_status_t vid4lin_stream_destroy(pjmedia_vid_dev_stream *strm){    vid4lin_stream *stream = (vid4lin_stream*)strm;    unsigned i;    PJ_ASSERT_RETURN(stream != NULL, PJ_EINVAL);    vid4lin_stream_stop(strm);    PJ_LOG(4, (THIS_FILE, "Destroying v4l2 video stream %s", stream->name));    for (i=0; i<stream->buf_cnt; ++i) {	if (stream->buffers[i].start != MAP_FAILED) {	    v4l2_munmap(stream->buffers[i].start, stream->buffers[i].length);	    stream->buffers[i].start = MAP_FAILED;	}    }    if (stream->fd >= 0) {	v4l2_close(stream->fd);	stream->fd = -1;    }    pj_pool_release(stream->pool);    return PJ_SUCCESS;}
开发者ID:carlosdelfino,项目名称:WorkshopTelefoniaAutomacao,代码行数:27,


示例5: StopDeviceInternal

int Video_in_Manager::CloseDeviceInternal(){	if(verbose) printf("CloseDeviceInternal/n");	if(this->fd == -1)	{		throw std::runtime_error("Device not open");	}	if(this->deviceStarted)		StopDeviceInternal();	if(this->buffers!= NULL)	{		for(int i = 0; i < this->buffer_counts; i++)		{			v4l2_munmap(this->buffers[i].start, this->buffers[i].length);			}		delete [] this->buffers;	}	this->buffers = NULL;	//Release memory	v4l2_close(fd);	fd = -1;	return 1;}
开发者ID:TimSC,项目名称:libvideolive,代码行数:26,


示例6: camera_control_backup_system_settings

void camera_control_backup_system_settings(CameraControl* cc, const char* file) {    int AutoAEC = 0;    int AutoAGC = 0;    int Gain = 0;    int Exposure = 0;    int Contrast = 0;    int Brightness = 0;    int fd = open_v4l2_device(cc->cameraID);    if (fd != -1) {        AutoAEC = v4l2_get_control(fd, V4L2_CID_EXPOSURE_AUTO);        AutoAGC = v4l2_get_control(fd, V4L2_CID_AUTOGAIN);        Gain = v4l2_get_control(fd, V4L2_CID_GAIN);        Exposure = v4l2_get_control(fd, V4L2_CID_EXPOSURE);        Contrast = v4l2_get_control(fd, V4L2_CID_CONTRAST);        Brightness = v4l2_get_control(fd, V4L2_CID_BRIGHTNESS);        v4l2_close(fd);        dictionary* ini = dictionary_new(0);        iniparser_set(ini, "PSEye", 0);        iniparser_set_int(ini, "PSEye:AutoAEC", AutoAEC);        iniparser_set_int(ini, "PSEye:AutoAGC", AutoAGC);        iniparser_set_int(ini, "PSEye:Gain", Gain);        iniparser_set_int(ini, "PSEye:Exposure", Exposure);        iniparser_set_int(ini, "PSEye:Contrast", Contrast);        iniparser_set_int(ini, "PSEye:Brightness", Brightness);        iniparser_save_ini(ini, file);        dictionary_del(ini);    }}
开发者ID:kdienes,项目名称:psmoveapi,代码行数:31,


示例7: deviceClose

/**	close device*/static void deviceClose(void){    if (-1 == v4l2_close(fd))        errno_exit("close");    fd = -1;}
开发者ID:twam,项目名称:v4l2grab,代码行数:10,


示例8: main

int main(int argc, char *argv[]){	remove("test.264");	cam = (struct camera *) malloc(sizeof(struct camera));	if (!cam) {		printf("malloc camera failure!/n");		exit(1);	}	cam->device_name = (char *)DEVICE;	cam->buffers = NULL;	cam->width = SET_WIDTH;	cam->height = SET_HEIGHT;	cam->fps = 30;//设置 30 fps	framelength=sizeof(unsigned char)*cam->width * cam->height * 2;	v4l2_init(cam);	init(Buff);	//创建线程	printf("Making thread.../n");	thread_create();	printf("Waiting for thread.../n");	thread_wait();	printf("-----------end program------------");	v4l2_close(cam);	return 0;}
开发者ID:MagicPrince666,项目名称:v4l2_x264,代码行数:35,


示例9: close_device

static int close_device (void) {	if (-1 == v4l2_close (fd))		return -1;	fd = -1;	return 0;}
开发者ID:xia-lin,项目名称:pcduino-scratch,代码行数:7,


示例10: v4l2_close

status_e UVCVisionCam::deinit(){    if (m_dev)        v4l2_close(&m_dev);    m_frame.clear();    return STATUS_SUCCESS;}
开发者ID:aosp,项目名称:dvp,代码行数:7,


示例11: main

int main(int argc, char **argv) {	cam = (Camera *) malloc(sizeof(Camera));	if (!cam) {		printf("malloc camera failure!/n");		exit(1);	}	cam->device_name = "/dev/video0";	cam->buffers = NULL;	cam->width = 640;	cam->height = 480;	cam->display_depth = 5; /* RGB24 */	enc = (Encoder*)malloc(sizeof(Encoder));   	v4l2_init(cam);	init_x264_encoder(enc, cam->width, cam->height);	h264_buf = (uint8_t *) malloc(sizeof(uint8_t) * cam->width * cam->height * 2); 		if (0 != pthread_create(&mythread, NULL, (void *) capture_encode_thread, NULL)) {		fprintf(stderr, "thread create fail/n");	}	pthread_join(mythread, NULL);	printf("-----------end program------------");	v4l2_close(cam);	close_x264_encoder(enc);	free(h264_buf); 	h264_buf = 0 ;	return 0;}
开发者ID:iam6000,项目名称:SkyTXIOT,代码行数:31,


示例12: msv4l2_close

static int msv4l2_close(V4l2State *s){	if (s->fd!=-1){		v4l2_close(s->fd);		s->fd=-1;		s->configured=FALSE;	}	return 0;}
开发者ID:dmonakhov,项目名称:mediastreamer2,代码行数:8,


示例13: cameraClose

void cameraClose(){	type = V4L2_BUF_TYPE_VIDEO_CAPTURE;	xioctl(fd, VIDIOC_STREAMOFF, &type);	for (i = 0; i < n_buffers; ++i)			v4l2_munmap(buffers[i].start, buffers[i].length);	v4l2_close(fd);}
开发者ID:Xianleewu,项目名称:camrtsp,代码行数:8,


示例14: AccessClose

void AccessClose( vlc_object_t *obj ){    access_t *access = (access_t *)obj;    demux_sys_t *sys = (demux_sys_t *)access->p_sys;    ControlsDeinit( obj, sys->controls );    v4l2_close( sys->i_fd );    free( sys );}
开发者ID:CSRedRat,项目名称:vlc,代码行数:9,


示例15: AccessClose

void AccessClose( vlc_object_t *obj ){    access_t *access = (access_t *)obj;    access_sys_t *sys = access->p_sys;    if (sys->bufv != NULL)        StopMmap (sys->fd, sys->bufv, sys->bufc);    ControlsDeinit( obj, sys->controls );    v4l2_close (sys->fd);    free( sys );}
开发者ID:0xheart0,项目名称:vlc,代码行数:11,


示例16: xioctl

CaptureThread::~CaptureThread(){    try{    type = V4L2_BUF_TYPE_VIDEO_CAPTURE;    xioctl(fd, VIDIOC_STREAMOFF, &type);    /*for (int i = 0; i < n_buffers; ++i)           v4l2_munmap(buffers[i].start, buffers[i].length);*/        v4l2_close(fd);    }catch(...){}    fd = -1;}
开发者ID:xian0gang,项目名称:test,代码行数:12,


示例17: gst_v4l2_allocator_finalize

static voidgst_v4l2_allocator_finalize (GObject * obj){  GstV4l2Allocator *allocator = (GstV4l2Allocator *) obj;  GST_LOG_OBJECT (obj, "called");  v4l2_close (allocator->video_fd);  gst_atomic_queue_unref (allocator->free_queue);  G_OBJECT_CLASS (parent_class)->finalize (obj);}
开发者ID:BigBrother-International,项目名称:gst-plugins-good,代码行数:12,


示例18: v4l1_close

int v4l1_close(int fd){	int index, result;	index = v4l1_get_index(fd);	if (index == -1)		return SYS_CLOSE(fd);	/* Abuse stream_lock to stop 2 closes from racing and trying to free the	   resources twice */	pthread_mutex_lock(&devices[index].stream_lock);	devices[index].open_count--;	result = devices[index].open_count != 0;	pthread_mutex_unlock(&devices[index].stream_lock);	if (result)		return v4l2_close(fd);	/* Free resources */	if (devices[index].v4l1_frame_pointer != MAP_FAILED) {		if (devices[index].v4l1_frame_buf_map_count)			V4L1_LOG("v4l1 capture buffer still mapped: %d times on close()/n",					devices[index].v4l1_frame_buf_map_count);		else			SYS_MUNMAP(devices[index].v4l1_frame_pointer,					V4L1_NO_FRAMES * V4L1_FRAME_BUF_SIZE);		devices[index].v4l1_frame_pointer = MAP_FAILED;	}	/* Remove the fd from our list of managed fds before closing it, because as	   soon as we've done the actual close the fd maybe returned by an open in	   another thread and we don't want to intercept calls to this new fd. */	devices[index].fd = -1;	result = v4l2_close(fd);	V4L1_LOG("close: %d/n", fd);	return result;}
开发者ID:Distrotech,项目名称:v4l-utils,代码行数:40,


示例19: fg_unref

void fg_unref(fg_grabber *fg){    // Make sure we free all memory (backwards!)    if (v4l2_close(fg->fd) != 0)        fg_debug_error("fg_close(): warning: failed closing device file");    free(fg->device);    free(fg->inputs);    free(fg->tuners);    free(fg->controls);    free(fg);}
开发者ID:grimmohe,项目名称:libfg2,代码行数:13,


示例20: CamaraClose

int CamaraClose(struct camera_context *cam){	enum v4l2_buf_type	type;	int i;	type = V4L2_BUF_TYPE_VIDEO_CAPTURE;	xioctl(cam->fd, VIDIOC_STREAMOFF, &type);	for (i = 0; i < cam->buf_data.buf_n; ++i)		v4l2_munmap(cam->buf_data.start[i], cam->buf_data.length[i]);	v4l2_close(cam->fd);    return 0;}
开发者ID:HarveyLiuFly,项目名称:rebvo,代码行数:13,


示例21: DemuxOpen

int DemuxOpen( vlc_object_t *obj ){    demux_t *demux = (demux_t *)obj;    demux_sys_t *sys = malloc (sizeof (*sys));    if (unlikely(sys == NULL))        return VLC_ENOMEM;    demux->p_sys = sys;    ParseMRL( obj, demux->psz_location );    char *path = var_InheritString (obj, CFG_PREFIX"dev");    if (unlikely(path == NULL))        goto error; /* probably OOM */    msg_Dbg (obj, "opening device '%s'", path);    int rawfd = vlc_open (path, O_RDWR);    if (rawfd == -1)    {        msg_Err (obj, "cannot open device '%s': %m", path);        free (path);        goto error;    }    free (path);    int fd = v4l2_fd_open (rawfd, 0);    if (fd == -1)    {        msg_Warn (obj, "cannot initialize user-space library: %m");        /* fallback to direct kernel mode anyway */        fd = rawfd;    }    sys->fd = fd;    if (InitVideo (demux, fd))    {        v4l2_close (fd);        goto error;    }    sys->controls = ControlsInit (VLC_OBJECT(demux), fd);    demux->pf_demux = NULL;    demux->pf_control = DemuxControl;    demux->info.i_update = 0;    demux->info.i_title = 0;    demux->info.i_seekpoint = 0;    return VLC_SUCCESS;error:    free (sys);    return VLC_EGENERIC;}
开发者ID:brendonjustin,项目名称:vlc,代码行数:51,


示例22: vx_source_v4l2_close

int vx_source_v4l2_close(vx_source* s){    vx_source_v4l2 *source = VX_V4L2_CAST(s);//    int i = 0;//    for (i = 0; i < source->_requestbuffers.count; ++i)//        v4l2_munmap(source->buffers[i].start, source->buffers[i].length);    if (source->_fd != 0)        source->_fd = v4l2_close(source->_fd);    printf("%s %d/n",__FUNCTION__,__LINE__);    return 0;}
开发者ID:motobhakta,项目名称:libvx,代码行数:14,


示例23: Video_device_dealloc

static void Video_device_dealloc(Video_device *self){  if(self->fd >= 0)    {      if(self->buffers)	{	  Video_device_unmap(self);	}      v4l2_close(self->fd);    }  self->ob_type->tp_free((PyObject *)self);}
开发者ID:chubahowsmall,项目名称:python-v4l2capture,代码行数:14,


示例24: v4l2_preprocess

static void v4l2_preprocess(MSFilter *f){	V4l2State *s=(V4l2State*)f->data;	if (s->fd==-1 && v4l2_open(s)!=0) {		return;	}	if (!s->configured && v4l2_configure(s)!=0){		return;	}	if (v4l2_do_mmap(s)==0){		ms_message("V4L2 video capture started.");	}else{		v4l2_close(s);	}	s->start_time=f->ticker->time;}
开发者ID:nightfly19,项目名称:renyang-learn,代码行数:15,


示例25: destructor

static void destructor(void *arg){	struct vidsrc_st *st = arg;	if (st->run) {		st->run = false;		pthread_join(st->thread, NULL);	}	stop_capturing(st);	uninit_device(st);	if (st->fd >= 0)		v4l2_close(st->fd);}
开发者ID:Studio-Link-v2,项目名称:baresip,代码行数:15,


示例26: Video_device_unmap

static PyObject *Video_device_close(Video_device *self){  if(self->fd >= 0)    {      if(self->buffers)	{	  Video_device_unmap(self);	}      v4l2_close(self->fd);      self->fd = -1;    }  Py_RETURN_NONE;}
开发者ID:chubahowsmall,项目名称:python-v4l2capture,代码行数:15,


示例27: xioctl

int CaptureThread::stop() {	running = false;	devam=false;	mutex.lock();	type = V4L2_BUF_TYPE_VIDEO_CAPTURE;	xioctl(fd, VIDIOC_STREAMOFF, &type);	for (unsigned int i = 0; i < n_buffers; ++i)		v4l2_munmap(buffers[i].start, buffers[i].length);	v4l2_close(fd);	fd = -1;	mutex.unlock();	quit();	return 0;}
开发者ID:DHalens,项目名称:kamerka,代码行数:15,


示例28: xioctl

voidV4LThread::CloseSource()	{		unsigned int i;		enum v4l2_buf_type type;		// stop streaming		type = V4L2_BUF_TYPE_SDR_CAPTURE;		xioctl(fd, VIDIOC_STREAMOFF, &type);		for (i = 0; i < n_buffers; i++)			v4l2_munmap(buffers[i].start, buffers[i].length);		v4l2_close(fd);		fd = -1;	}
开发者ID:0x7678,项目名称:rtl-sdrangelove,代码行数:16,


示例29: v4l2_terminate

static void v4l2_terminate(struct v4l2_data *data){	if (data->thread) {		os_event_signal(data->event);		pthread_join(data->thread, NULL);		os_event_destroy(data->event);		data->thread = 0;	}	v4l2_destroy_mmap(&data->buffers);	if (data->dev != -1) {		v4l2_close(data->dev);		data->dev = -1;	}}
开发者ID:Bl00drav3n,项目名称:obs-studio,代码行数:16,



注:本文中的v4l2_close函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ v4l2_ctrl_handler_free函数代码示例
C++ v3s16函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。