这篇教程C++ vb2_is_busy函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中vb2_is_busy函数的典型用法代码示例。如果您正苦于以下问题:C++ vb2_is_busy函数的具体用法?C++ vb2_is_busy怎么用?C++ vb2_is_busy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了vb2_is_busy函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: pwc_s_fmt_vid_capstatic int pwc_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f){ struct pwc_device *pdev = video_drvdata(file); int ret, pixelformat, compression = 0; ret = pwc_vidioc_try_fmt(pdev, f); if (ret < 0) return ret; if (vb2_is_busy(&pdev->vb_queue)) return -EBUSY; pixelformat = f->fmt.pix.pixelformat; PWC_DEBUG_IOCTL("Trying to set format to: width=%d height=%d fps=%d " "format=%c%c%c%c/n", f->fmt.pix.width, f->fmt.pix.height, pdev->vframes, (pixelformat)&255, (pixelformat>>8)&255, (pixelformat>>16)&255, (pixelformat>>24)&255); ret = pwc_set_video_mode(pdev, f->fmt.pix.width, f->fmt.pix.height, pixelformat, 30, &compression, 0); PWC_DEBUG_IOCTL("pwc_set_video_mode(), return=%d/n", ret); pwc_vidioc_fill_fmt(f, pdev->width, pdev->height, pdev->pixfmt); return ret;}
开发者ID:03199618,项目名称:linux,代码行数:30,
示例2: vidioc_s_stdstatic int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm){ struct stk1160 *dev = video_drvdata(file); struct vb2_queue *q = &dev->vb_vidq; if (vb2_is_busy(q)) return -EBUSY; /* Check device presence */ if (!dev->udev) return -ENODEV; /* We need to set this now, before we call stk1160_set_std */ dev->norm = norm; /* This is taken from saa7115 video decoder */ if (dev->norm & V4L2_STD_525_60) { dev->width = 720; dev->height = 480; } else if (dev->norm & V4L2_STD_625_50) { dev->width = 720; dev->height = 576; } else { stk1160_err("invalid standard/n"); return -EINVAL; } stk1160_set_std(dev); v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_std, dev->norm); return 0;}
开发者ID:cyberphox,项目名称:monoev3kernel,代码行数:34,
示例3: fimc_lite_subdev_set_fmtstatic int fimc_lite_subdev_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt){ struct fimc_lite *fimc = v4l2_get_subdevdata(sd); struct v4l2_mbus_framefmt *mf = &fmt->format; struct flite_frame *sink = &fimc->inp_frame; struct flite_frame *source = &fimc->out_frame; const struct fimc_fmt *ffmt; v4l2_dbg(1, debug, sd, "pad%d: code: 0x%x, %dx%d/n", fmt->pad, mf->code, mf->width, mf->height); mutex_lock(&fimc->lock); if ((atomic_read(&fimc->out_path) == FIMC_IO_ISP && sd->entity.stream_count > 0) || (atomic_read(&fimc->out_path) == FIMC_IO_DMA && vb2_is_busy(&fimc->vb_queue))) { mutex_unlock(&fimc->lock); return -EBUSY; } ffmt = fimc_lite_subdev_try_fmt(fimc, cfg, fmt); if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { struct v4l2_mbus_framefmt *src_fmt; mf = __fimc_lite_subdev_get_try_fmt(sd, cfg, fmt->pad); *mf = fmt->format; if (fmt->pad == FLITE_SD_PAD_SINK) { unsigned int pad = FLITE_SD_PAD_SOURCE_DMA; src_fmt = __fimc_lite_subdev_get_try_fmt(sd, cfg, pad); *src_fmt = *mf; } mutex_unlock(&fimc->lock); return 0; } if (fmt->pad == FLITE_SD_PAD_SINK) { sink->f_width = mf->width; sink->f_height = mf->height; sink->fmt = ffmt; /* Set sink crop rectangle */ sink->rect.width = mf->width; sink->rect.height = mf->height; sink->rect.left = 0; sink->rect.top = 0; /* Reset source format and crop rectangle */ source->rect = sink->rect; source->f_width = mf->width; source->f_height = mf->height; } mutex_unlock(&fimc->lock); return 0;}
开发者ID:19Dan01,项目名称:linux,代码行数:59,
示例4: jpeg_enc_vidioc_s_fmt_outstatic int jpeg_enc_vidioc_s_fmt_out(struct file *file, void *priv, struct v4l2_format *f){ struct jpeg_ctx *ctx = priv; struct vb2_queue *vq; struct v4l2_pix_format_mplane *pix; struct jpeg_fmt *fmt; struct jpeg_frame *frame; int ret; int i; ret = jpeg_enc_vidioc_try_fmt(file, priv, f); if (ret) return ret; vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); if (!vq) return -EINVAL; if (vb2_is_busy(vq)) { v4l2_err(&ctx->jpeg_dev->v4l2_dev, "queue (%d) busy/n", f->type); return -EBUSY; } /* TODO: width & height has to be multiple of two */ pix = &f->fmt.pix_mp; fmt = find_format(f); frame = ctx_get_frame(ctx, f->type); if (IS_ERR(frame)) return PTR_ERR(frame); frame->jpeg_fmt = fmt; if (!frame->jpeg_fmt) { v4l2_err(&ctx->jpeg_dev->v4l2_dev, "not supported format values/n"); return -EINVAL; } for (i = 0; i < fmt->memplanes; i++) { ctx->payload[i] = pix->plane_fmt[i].bytesperline * pix->height; ctx->param.enc_param.in_depth[i] = fmt->depth[i]; } frame->width = pix->width; frame->height = pix->height; frame->pixelformat = pix->pixelformat; ctx->param.enc_param.in_width = pix->width; ctx->param.enc_param.in_height = pix->height; ctx->param.enc_param.in_plane = fmt->memplanes; ctx->param.enc_param.in_fmt = fmt->color; return 0;}
开发者ID:cm-3470,项目名称:android_kernel_samsung_degaslte,代码行数:56,
示例5: cx23885_set_tvnormint cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm){ dprintk(1, "%s(norm = 0x%08x) name: [%s]/n", __func__, (unsigned int)norm, v4l2_norm_to_name(norm)); if (dev->tvnorm != norm) { if (vb2_is_busy(&dev->vb2_vidq) || vb2_is_busy(&dev->vb2_vbiq) || vb2_is_busy(&dev->vb2_mpegq)) return -EBUSY; } dev->tvnorm = norm; call_all(dev, video, s_std, norm); return 0;}
开发者ID:mikemvk,项目名称:linux-at91,代码行数:19,
示例6: uvc_queue_allocated/* * Check if buffers have been allocated. */int uvc_queue_allocated(struct uvc_video_queue *queue){ int allocated; mutex_lock(&queue->mutex); allocated = vb2_is_busy(&queue->queue); mutex_unlock(&queue->mutex); return allocated;}
开发者ID:Xilinx,项目名称:linux-xlnx,代码行数:13,
示例7: solo_set_video_typeint solo_set_video_type(struct solo_dev *solo_dev, bool is_50hz){ int i; /* Make sure all video nodes are idle */ if (vb2_is_busy(&solo_dev->vidq)) return -EBUSY; for (i = 0; i < solo_dev->nr_chans; i++) if (vb2_is_busy(&solo_dev->v4l2_enc[i]->vidq)) return -EBUSY; solo_dev->video_type = is_50hz ? SOLO_VO_FMT_TYPE_PAL : SOLO_VO_FMT_TYPE_NTSC; /* Reconfigure for the new standard */ solo_disp_init(solo_dev); solo_enc_init(solo_dev); solo_tw28_init(solo_dev); for (i = 0; i < solo_dev->nr_chans; i++) solo_update_mode(solo_dev->v4l2_enc[i]); return solo_v4l2_set_ch(solo_dev, solo_dev->cur_disp_ch);}
开发者ID:168519,项目名称:linux,代码行数:20,
示例8: solo_set_fmt_capstatic int solo_set_fmt_cap(struct file *file, void *priv, struct v4l2_format *f){ struct solo_dev *solo_dev = video_drvdata(file); if (vb2_is_busy(&solo_dev->vidq)) return -EBUSY; /* For right now, if it doesn't match our running config, * then fail */ return solo_try_fmt_cap(file, priv, f);}
开发者ID:168519,项目名称:linux,代码行数:12,
示例9: fimc_m2m_s_fmt_mplanestatic int fimc_m2m_s_fmt_mplane(struct file *file, void *fh, struct v4l2_format *f){ struct fimc_ctx *ctx = fh_to_ctx(fh); struct fimc_dev *fimc = ctx->fimc_dev; struct vb2_queue *vq; struct fimc_frame *frame; struct v4l2_pix_format_mplane *pix; int i, ret = 0; ret = fimc_try_fmt_mplane(ctx, f); if (ret) return ret; vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); if (vb2_is_busy(vq)) { v4l2_err(fimc->m2m.vfd, "queue (%d) busy/n", f->type); return -EBUSY; } if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) frame = &ctx->s_frame; else frame = &ctx->d_frame; pix = &f->fmt.pix_mp; frame->fmt = fimc_find_format(&pix->pixelformat, NULL, get_m2m_fmt_flags(f->type), 0); if (!frame->fmt) return -EINVAL; /* Update RGB Alpha control state and value range */ fimc_alpha_ctrl_update(ctx); for (i = 0; i < frame->fmt->colplanes; i++) { frame->payload[i] = (pix->width * pix->height * frame->fmt->depth[i]) / 8; } fimc_fill_frame(frame, f); ctx->scaler.enabled = 1; if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) fimc_ctx_state_set(FIMC_PARAMS | FIMC_DST_FMT, ctx); else fimc_ctx_state_set(FIMC_PARAMS | FIMC_SRC_FMT, ctx); dbg("f_w: %d, f_h: %d", frame->f_width, frame->f_height); return 0;}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:53,
示例10: cx23885_set_tvnormint cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm){ struct v4l2_subdev_format format = { .which = V4L2_SUBDEV_FORMAT_ACTIVE, .format.code = MEDIA_BUS_FMT_FIXED, }; dprintk(1, "%s(norm = 0x%08x) name: [%s]/n", __func__, (unsigned int)norm, v4l2_norm_to_name(norm)); if (dev->tvnorm == norm) return 0; if (dev->tvnorm != norm) { if (vb2_is_busy(&dev->vb2_vidq) || vb2_is_busy(&dev->vb2_vbiq) || vb2_is_busy(&dev->vb2_mpegq)) return -EBUSY; } dev->tvnorm = norm; dev->width = 720; dev->height = norm_maxh(norm); dev->field = V4L2_FIELD_INTERLACED; call_all(dev, video, s_std, norm); format.format.width = dev->width; format.format.height = dev->height; format.format.field = dev->field; call_all(dev, pad, set_fmt, NULL, &format); return 0;}static struct video_device *cx23885_vdev_init(struct cx23885_dev *dev, struct pci_dev *pci, struct video_device *template,
开发者ID:ezequielgarcia,项目名称:linux,代码行数:39,
示例11: fimc_cap_s_fmt_mplanestatic int fimc_cap_s_fmt_mplane(struct file *file, void *priv, struct v4l2_format *f){ struct fimc_ctx *ctx = priv; struct fimc_dev *fimc = ctx->fimc_dev; struct fimc_frame *frame; struct v4l2_pix_format_mplane *pix; int ret; int i; if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) return -EINVAL; ret = fimc_vidioc_try_fmt_mplane(file, priv, f); if (ret) return ret; if (vb2_is_busy(&fimc->vid_cap.vbq) || fimc_capture_active(fimc)) return -EBUSY; frame = &ctx->d_frame; pix = &f->fmt.pix_mp; frame->fmt = find_format(f, FMT_FLAGS_M2M | FMT_FLAGS_CAM); if (!frame->fmt) { err("fimc target format not found/n"); return -EINVAL; } for (i = 0; i < frame->fmt->colplanes; i++) { frame->payload[i] = (pix->width * pix->height * frame->fmt->depth[i]) >> 3; } /* Output DMA frame pixel size and offsets. */ frame->f_width = pix->plane_fmt[0].bytesperline * 8 / frame->fmt->depth[0]; frame->f_height = pix->height; frame->width = pix->width; frame->height = pix->height; frame->o_width = pix->width; frame->o_height = pix->height; frame->offs_h = 0; frame->offs_v = 0; ctx->state |= (FIMC_PARAMS | FIMC_DST_FMT); ret = sync_capture_fmt(ctx); return ret;}
开发者ID:jerem,项目名称:hi35xx-buildroot,代码行数:50,
示例12: vidioc_s_fmt_vid_capstatic int vidioc_s_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f){ struct stk1160 *dev = video_drvdata(file); struct vb2_queue *q = &dev->vb_vidq; if (vb2_is_busy(q)) return -EBUSY; vidioc_try_fmt_vid_cap(file, priv, f); /* We don't support any format changes */ return 0;}
开发者ID:cyberphox,项目名称:monoev3kernel,代码行数:15,
示例13: vidioc_s_inputstatic int vidioc_s_input(struct file *file, void *priv, unsigned int i){ struct stk1160 *dev = video_drvdata(file); if (vb2_is_busy(&dev->vb_vidq)) return -EBUSY; if (i > STK1160_MAX_INPUT) return -EINVAL; dev->ctl_input = i; stk1160_select_input(dev); return 0;}
开发者ID:cyberphox,项目名称:monoev3kernel,代码行数:16,
示例14: video_s_fmtstatic int video_s_fmt(struct file *file, void *fh, struct v4l2_format *f){ struct camss_video *video = video_drvdata(file); int ret; if (vb2_is_busy(&video->vb2_q)) return -EBUSY; ret = __video_try_fmt(video, f); if (ret < 0) return ret; video->active_fmt = *f; return 0;}
开发者ID:ReneNyffenegger,项目名称:linux,代码行数:16,
示例15: jpeg_dec_vidioc_s_fmt_outstatic int jpeg_dec_vidioc_s_fmt_out(struct file *file, void *priv, struct v4l2_format *f){ struct jpeg_ctx *ctx = priv; struct vb2_queue *vq; struct v4l2_pix_format_mplane *pix; struct jpeg_fmt *fmt; int ret; int i; ret = jpeg_dec_vidioc_try_fmt(file, priv, f); if (ret) return ret; vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); if (!vq) return -EINVAL; if (vb2_is_busy(vq)) { v4l2_err(&ctx->dev->v4l2_dev, "queue (%d) busy/n", f->type); return -EBUSY; } /* TODO: width & height has to be multiple of two */ pix = &f->fmt.pix_mp; fmt = find_format(f); for (i = 0; i < fmt->memplanes; i++) ctx->payload[i] = pix->plane_fmt[i].bytesperline * pix->height; ctx->param.dec_param.in_width = pix->width; ctx->param.dec_param.in_height = pix->height; ctx->param.dec_param.in_plane = fmt->memplanes; ctx->param.dec_param.in_depth = fmt->depth[0]; ctx->param.dec_param.in_fmt = fmt->color; if((pix->plane_fmt[0].sizeimage % 32) == 0) ctx->param.dec_param.size = (pix->plane_fmt[0].sizeimage / 32); else ctx->param.dec_param.size = (pix->plane_fmt[0].sizeimage / 32) + 1; ctx->param.dec_param.mem_size = pix->plane_fmt[0].sizeimage; return 0;}
开发者ID:ARMP,项目名称:ARMP-i9300,代码行数:44,
示例16: vidioc_s_stdstatic int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm){ struct smi2021 *smi2021 = video_drvdata(file); if (vb2_is_busy(&smi2021->vb2q)) return -EBUSY; smi2021->cur_norm = norm; if (norm & V4L2_STD_525_60) smi2021->cur_height = SMI2021_NTSC_LINES; else if (norm & V4L2_STD_625_50) smi2021->cur_height = SMI2021_PAL_LINES; else return -EINVAL; v4l2_device_call_all(&smi2021->v4l2_dev, 0, core, s_std, smi2021->cur_norm); return 0;}
开发者ID:binkybear,项目名称:kangaroo,代码行数:19,
示例17: dt3155_s_stdstatic int dt3155_s_std(struct file *filp, void *p, v4l2_std_id norm){ struct dt3155_priv *pd = video_drvdata(filp); if (pd->std == norm) return 0; if (vb2_is_busy(&pd->vidq)) return -EBUSY; pd->std = norm; if (pd->std & V4L2_STD_525_60) { pd->csr2 = VT_60HZ; pd->width = 640; pd->height = 480; } else { pd->csr2 = VT_50HZ; pd->width = 768; pd->height = 576; } return 0;}
开发者ID:Lyude,项目名称:linux,代码行数:20,
示例18: jpeg_enc_vidioc_s_fmt_capstatic int jpeg_enc_vidioc_s_fmt_cap(struct file *file, void *priv, struct v4l2_format *f){ struct jpeg_ctx *ctx = priv; struct vb2_queue *vq; struct v4l2_pix_format_mplane *pix; struct jpeg_fmt *fmt; int ret; int i; ret = jpeg_enc_vidioc_try_fmt(file, priv, f); if (ret) return ret; vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); if (!vq) return -EINVAL; if (vb2_is_busy(vq)) { v4l2_err(&ctx->dev->v4l2_dev, "queue (%d) busy/n", f->type); return -EBUSY; } pix = &f->fmt.pix_mp; fmt = find_format(f); if (!fmt) return -EINVAL; for (i = 0; i < fmt->memplanes; i++) ctx->payload[i] = pix->plane_fmt[i].bytesperline * pix->height; ctx->param.enc_param.out_width = pix->height; ctx->param.enc_param.out_height = pix->width; ctx->param.enc_param.out_plane = fmt->memplanes; ctx->param.enc_param.out_depth = fmt->depth[0]; ctx->param.enc_param.out_fmt = fmt->color; return 0;}
开发者ID:Frontier314,项目名称:frontkernel35,代码行数:40,
示例19: vidioc_s_fmtstatic int vidioc_s_fmt(struct file *file, void *prv, struct v4l2_format *f){ struct g2d_ctx *ctx = prv; struct g2d_dev *dev = ctx->dev; struct vb2_queue *vq; struct g2d_frame *frm; struct g2d_fmt *fmt; int ret = 0; /* Adjust all values accordingly to the hardware capabilities * and chosen format. */ ret = vidioc_try_fmt(file, prv, f); if (ret) return ret; vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type); if (vb2_is_busy(vq)) { v4l2_err(&dev->v4l2_dev, "queue (%d) bust/n", f->type); return -EBUSY; } frm = get_frame(ctx, f->type); if (IS_ERR(frm)) return PTR_ERR(frm); fmt = find_fmt(f); if (!fmt) return -EINVAL; frm->width = f->fmt.pix.width; frm->height = f->fmt.pix.height; frm->size = f->fmt.pix.sizeimage; /* Reset crop settings */ frm->o_width = 0; frm->o_height = 0; frm->c_width = frm->width; frm->c_height = frm->height; frm->right = frm->width; frm->bottom = frm->height; frm->fmt = fmt; frm->stride = f->fmt.pix.bytesperline; return 0;}
开发者ID:7799,项目名称:linux,代码行数:39,
示例20: vb2_thread_start/* * This function should not be used for anything else but the videobuf2-dvb * support. If you think you have another good use-case for this, then please * contact the linux-media mailinglist first. */int vb2_thread_start(struct vb2_queue *q, vb2_thread_fnc fnc, void *priv, const char *thread_name){ struct vb2_threadio_data *threadio; int ret = 0; if (q->threadio) return -EBUSY; if (vb2_is_busy(q)) return -EBUSY; if (WARN_ON(q->fileio)) return -EBUSY; threadio = kzalloc(sizeof(*threadio), GFP_KERNEL); if (threadio == NULL) return -ENOMEM; threadio->fnc = fnc; threadio->priv = priv; ret = __vb2_init_fileio(q, !q->is_output); dprintk(3, "file io: vb2_init_fileio result: %d/n", ret); if (ret) goto nomem; q->threadio = threadio; threadio->thread = kthread_run(vb2_thread, q, "vb2-%s", thread_name); if (IS_ERR(threadio->thread)) { ret = PTR_ERR(threadio->thread); threadio->thread = NULL; goto nothread; } return 0;nothread: __vb2_cleanup_fileio(q);nomem: kfree(threadio); return ret;}
开发者ID:Chong-Li,项目名称:cse522,代码行数:43,
示例21: fimc_m2m_s_fmt_mplanestatic int fimc_m2m_s_fmt_mplane(struct file *file, void *fh, struct v4l2_format *f){ struct fimc_ctx *ctx = fh_to_ctx(fh); struct fimc_dev *fimc = ctx->fimc_dev; struct fimc_fmt *fmt; struct vb2_queue *vq; struct fimc_frame *frame; int ret; ret = fimc_try_fmt_mplane(ctx, f); if (ret) return ret; vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); if (vb2_is_busy(vq)) { v4l2_err(&fimc->m2m.vfd, "queue (%d) busy/n", f->type); return -EBUSY; } if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) frame = &ctx->s_frame; else frame = &ctx->d_frame; fmt = fimc_find_format(&f->fmt.pix_mp.pixelformat, NULL, get_m2m_fmt_flags(f->type), 0); if (!fmt) return -EINVAL; __set_frame_format(frame, fmt, &f->fmt.pix_mp); /* Update RGB Alpha control state and value range */ fimc_alpha_ctrl_update(ctx); return 0;}
开发者ID:Niisp,项目名称:MT6795.kernel,代码行数:38,
示例22: rvin_s_fmt_vid_capstatic int rvin_s_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f){ struct rvin_dev *vin = video_drvdata(file); struct rvin_source_fmt source; int ret; if (vb2_is_busy(&vin->queue)) return -EBUSY; ret = __rvin_try_format(vin, V4L2_SUBDEV_FORMAT_ACTIVE, &f->fmt.pix, &source); if (ret) return ret; vin->source.width = source.width; vin->source.height = source.height; vin->format = f->fmt.pix; rvin_reset_crop_compose(vin); return 0;}
开发者ID:AshishNamdev,项目名称:linux,代码行数:24,
示例23: vidioc_venc_s_fmt_outstatic int vidioc_venc_s_fmt_out(struct file *file, void *priv, struct v4l2_format *f){ struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv); struct vb2_queue *vq; struct mtk_q_data *q_data; int ret, i; struct mtk_video_fmt *fmt; struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); if (!vq) { mtk_v4l2_err("fail to get vq"); return -EINVAL; } if (vb2_is_busy(vq)) { mtk_v4l2_err("queue busy"); return -EBUSY; } q_data = mtk_venc_get_q_data(ctx, f->type); if (!q_data) { mtk_v4l2_err("fail to get q data"); return -EINVAL; } fmt = mtk_venc_find_format(f); if (!fmt) { f->fmt.pix.pixelformat = mtk_video_formats[OUT_FMT_IDX].fourcc; fmt = mtk_venc_find_format(f); } pix_fmt_mp->height = clamp(pix_fmt_mp->height, MTK_VENC_MIN_H, MTK_VENC_MAX_H); pix_fmt_mp->width = clamp(pix_fmt_mp->width, MTK_VENC_MIN_W, MTK_VENC_MAX_W); q_data->visible_width = f->fmt.pix_mp.width; q_data->visible_height = f->fmt.pix_mp.height; q_data->fmt = fmt; ret = vidioc_try_fmt(f, q_data->fmt); if (ret) return ret; q_data->coded_width = f->fmt.pix_mp.width; q_data->coded_height = f->fmt.pix_mp.height; q_data->field = f->fmt.pix_mp.field; ctx->colorspace = f->fmt.pix_mp.colorspace; ctx->ycbcr_enc = f->fmt.pix_mp.ycbcr_enc; ctx->quantization = f->fmt.pix_mp.quantization; ctx->xfer_func = f->fmt.pix_mp.xfer_func; for (i = 0; i < f->fmt.pix_mp.num_planes; i++) { struct v4l2_plane_pix_format *plane_fmt; plane_fmt = &f->fmt.pix_mp.plane_fmt[i]; q_data->bytesperline[i] = plane_fmt->bytesperline; q_data->sizeimage[i] = plane_fmt->sizeimage; } return 0;}
开发者ID:avagin,项目名称:linux,代码行数:66,
示例24: vidioc_venc_s_fmt_capstatic int vidioc_venc_s_fmt_cap(struct file *file, void *priv, struct v4l2_format *f){ struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv); struct vb2_queue *vq; struct mtk_q_data *q_data; int i, ret; struct mtk_video_fmt *fmt; vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); if (!vq) { mtk_v4l2_err("fail to get vq"); return -EINVAL; } if (vb2_is_busy(vq)) { mtk_v4l2_err("queue busy"); return -EBUSY; } q_data = mtk_venc_get_q_data(ctx, f->type); if (!q_data) { mtk_v4l2_err("fail to get q data"); return -EINVAL; } fmt = mtk_venc_find_format(f); if (!fmt) { f->fmt.pix.pixelformat = mtk_video_formats[CAP_FMT_IDX].fourcc; fmt = mtk_venc_find_format(f); } q_data->fmt = fmt; ret = vidioc_try_fmt(f, q_data->fmt); if (ret) return ret; q_data->coded_width = f->fmt.pix_mp.width; q_data->coded_height = f->fmt.pix_mp.height; q_data->field = f->fmt.pix_mp.field; for (i = 0; i < f->fmt.pix_mp.num_planes; i++) { struct v4l2_plane_pix_format *plane_fmt; plane_fmt = &f->fmt.pix_mp.plane_fmt[i]; q_data->bytesperline[i] = plane_fmt->bytesperline; q_data->sizeimage[i] = plane_fmt->sizeimage; } if (ctx->state == MTK_STATE_FREE) { ret = venc_if_init(ctx, q_data->fmt->fourcc); if (ret) { mtk_v4l2_err("venc_if_init failed=%d, codec type=%x", ret, q_data->fmt->fourcc); return -EBUSY; } ctx->state = MTK_STATE_INIT; } return 0;}
开发者ID:avagin,项目名称:linux,代码行数:61,
示例25: vidioc_vdec_s_fmtstatic int vidioc_vdec_s_fmt(struct file *file, void *priv, struct v4l2_format *f){ struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv); struct v4l2_pix_format_mplane *pix_mp; struct mtk_q_data *q_data; int ret = 0; struct mtk_video_fmt *fmt; mtk_v4l2_debug(3, "[%d]", ctx->id); q_data = mtk_vdec_get_q_data(ctx, f->type); if (!q_data) return -EINVAL; pix_mp = &f->fmt.pix_mp; if ((f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) && vb2_is_busy(&ctx->m2m_ctx->out_q_ctx.q)) { mtk_v4l2_err("out_q_ctx buffers already requested"); ret = -EBUSY; } if ((f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) && vb2_is_busy(&ctx->m2m_ctx->cap_q_ctx.q)) { mtk_v4l2_err("cap_q_ctx buffers already requested"); ret = -EBUSY; } fmt = mtk_vdec_find_format(f); if (fmt == NULL) { if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { f->fmt.pix.pixelformat = mtk_video_formats[OUT_FMT_IDX].fourcc; fmt = mtk_vdec_find_format(f); } else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { f->fmt.pix.pixelformat = mtk_video_formats[CAP_FMT_IDX].fourcc; fmt = mtk_vdec_find_format(f); } } q_data->fmt = fmt; vidioc_try_fmt(f, q_data->fmt); if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { q_data->sizeimage[0] = pix_mp->plane_fmt[0].sizeimage; q_data->coded_width = pix_mp->width; q_data->coded_height = pix_mp->height; ctx->colorspace = f->fmt.pix_mp.colorspace; ctx->ycbcr_enc = f->fmt.pix_mp.ycbcr_enc; ctx->quantization = f->fmt.pix_mp.quantization; ctx->xfer_func = f->fmt.pix_mp.xfer_func; if (ctx->state == MTK_STATE_FREE) { ret = vdec_if_init(ctx, q_data->fmt->fourcc); if (ret) { mtk_v4l2_err("[%d]: vdec_if_init() fail ret=%d", ctx->id, ret); return -EINVAL; } ctx->state = MTK_STATE_INIT; } } return 0;}
开发者ID:AshishNamdev,项目名称:linux,代码行数:66,
示例26: fimc_capture_set_formatstatic int fimc_capture_set_format(struct fimc_dev *fimc, struct v4l2_format *f){ struct fimc_ctx *ctx = fimc->vid_cap.ctx; struct v4l2_pix_format_mplane *pix = &f->fmt.pix_mp; struct v4l2_mbus_framefmt *mf = &fimc->vid_cap.mf; struct fimc_frame *ff = &ctx->d_frame; struct fimc_fmt *s_fmt = NULL; int ret, i; if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) return -EINVAL; if (vb2_is_busy(&fimc->vid_cap.vbq)) return -EBUSY; /* Pre-configure format at camera interface input, for JPEG only */ if (pix->pixelformat == V4L2_PIX_FMT_JPEG) { fimc_capture_try_format(ctx, &pix->width, &pix->height, NULL, &pix->pixelformat, FIMC_SD_PAD_SINK); ctx->s_frame.f_width = pix->width; ctx->s_frame.f_height = pix->height; } /* Try the format at the scaler and the DMA output */ ff->fmt = fimc_capture_try_format(ctx, &pix->width, &pix->height, NULL, &pix->pixelformat, FIMC_SD_PAD_SOURCE); if (!ff->fmt) return -EINVAL; /* Update RGB Alpha control state and value range */ fimc_alpha_ctrl_update(ctx); /* Try to match format at the host and the sensor */ if (!fimc->vid_cap.user_subdev_api) { mf->code = ff->fmt->mbus_code; mf->width = pix->width; mf->height = pix->height; fimc_md_graph_lock(fimc); ret = fimc_pipeline_try_format(ctx, mf, &s_fmt, true); fimc_md_graph_unlock(fimc); if (ret) return ret; pix->width = mf->width; pix->height = mf->height; } fimc_adjust_mplane_format(ff->fmt, pix->width, pix->height, pix); for (i = 0; i < ff->fmt->colplanes; i++) ff->payload[i] = (pix->width * pix->height * ff->fmt->depth[i]) / 8; set_frame_bounds(ff, pix->width, pix->height); /* Reset the composition rectangle if not yet configured */ if (!(ctx->state & FIMC_DST_CROP)) set_frame_crop(ff, 0, 0, pix->width, pix->height); fimc_capture_mark_jpeg_xfer(ctx, fimc_fmt_is_jpeg(ff->fmt->color)); /* Reset cropping and set format at the camera interface input */ if (!fimc->vid_cap.user_subdev_api) { ctx->s_frame.fmt = s_fmt; set_frame_bounds(&ctx->s_frame, pix->width, pix->height); set_frame_crop(&ctx->s_frame, 0, 0, pix->width, pix->height); } return ret;}
开发者ID:artynet,项目名称:linux-3.3.8,代码行数:67,
示例27: rvin_reset_format//.........这里部分代码省略......... v4l2_subdev_free_pad_config(pad_cfg); return 0;}static int rvin_querycap(struct file *file, void *priv, struct v4l2_capability *cap){ struct rvin_dev *vin = video_drvdata(file); strscpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); strscpy(cap->card, "R_Car_VIN", sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(vin->dev)); return 0;}static int rvin_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f){ struct rvin_dev *vin = video_drvdata(file); return rvin_try_format(vin, V4L2_SUBDEV_FORMAT_TRY, &f->fmt.pix, NULL, NULL);}static int rvin_s_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f){ struct rvin_dev *vin = video_drvdata(file); struct v4l2_rect crop, compose; int ret; if (vb2_is_busy(&vin->queue)) return -EBUSY; ret = rvin_try_format(vin, V4L2_SUBDEV_FORMAT_ACTIVE, &f->fmt.pix, &crop, &compose); if (ret) return ret; vin->format = f->fmt.pix; vin->crop = crop; vin->compose = compose; vin->source = crop; return 0;}static int rvin_g_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f){ struct rvin_dev *vin = video_drvdata(file); f->fmt.pix = vin->format; return 0;}static int rvin_enum_fmt_vid_cap(struct file *file, void *priv, struct v4l2_fmtdesc *f){ if (f->index >= ARRAY_SIZE(rvin_formats)) return -EINVAL; f->pixelformat = rvin_formats[f->index].fourcc;
开发者ID:AlexShiLucky,项目名称:linux,代码行数:67,
注:本文中的vb2_is_busy函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ vb2_plane_size函数代码示例 C++ vb2_get_drv_priv函数代码示例 |