.vidioc_enum_framesizes = vidioc_enum_framesizes,
};
-static int bcm2835_codec_set_ctrls(struct bcm2835_codec_ctx *ctx)
-{
- /*
- * Query the control handler for the value of the various controls and
- * set them.
- */
- const u32 control_ids[] = {
- V4L2_CID_MPEG_VIDEO_BITRATE_MODE,
- V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER,
- V4L2_CID_MPEG_VIDEO_HEADER_MODE,
- V4L2_CID_MPEG_VIDEO_H264_I_PERIOD,
- V4L2_CID_MPEG_VIDEO_H264_LEVEL,
- V4L2_CID_MPEG_VIDEO_H264_PROFILE,
- };
- int i;
-
- for (i = 0; i < ARRAY_SIZE(control_ids); i++) {
- struct v4l2_ctrl *ctrl;
-
- ctrl = v4l2_ctrl_find(&ctx->hdl, control_ids[i]);
- if (ctrl)
- bcm2835_codec_s_ctrl(ctrl);
- }
-
- return 0;
-}
-
static int bcm2835_codec_create_component(struct bcm2835_codec_ctx *ctx)
{
struct bcm2835_codec_dev *dev = ctx->dev;
ctx->q_data[V4L2_M2M_SRC].sizeimage,
ctx->component->output[0].minimum_buffer.size);
- /* Now we have a component we can set all the ctrls */
- bcm2835_codec_set_ctrls(ctx);
-
/* Enable SPS Timing header so framerate information is encoded
* in the H264 header.
*/
ctx->q_data[V4L2_M2M_DST].sizeimage,
ctx->component->output[0].minimum_buffer.size);
}
+
+ /* Now we have a component we can set all the ctrls */
+ ret = v4l2_ctrl_handler_setup(&ctx->hdl);
+
v4l2_dbg(2, debug, &dev->v4l2_dev, "%s: component created as %s\n",
__func__, components[dev->role]);
file->private_data = &ctx->fh;
ctx->dev = dev;
hdl = &ctx->hdl;
- if (dev->role == ENCODE) {
+ switch (dev->role) {
+ case ENCODE:
+ {
/* Encode controls */
v4l2_ctrl_handler_init(hdl, 9);
}
ctx->fh.ctrl_handler = hdl;
v4l2_ctrl_handler_setup(hdl);
- } else if (dev->role == DECODE) {
+ }
+ break;
+ case DECODE:
+ {
v4l2_ctrl_handler_init(hdl, 1);
v4l2_ctrl_new_std(hdl, &bcm2835_codec_ctrl_ops,
ctx->fh.ctrl_handler = hdl;
v4l2_ctrl_handler_setup(hdl);
}
+ break;
+ case ISP:
+ case DEINTERLACE:
+ {
+ v4l2_ctrl_handler_init(hdl, 0);
+ }
+ break;
+ }
ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx, &queue_init);