aabb005703185a39273aa6fa561a2b3057d1a015
[openwrt/staging/luka.git] /
1 From ae6dba510ac29ef7b0e6c838fb1bcc8b9eb474b7 Mon Sep 17 00:00:00 2001
2 From: Aman Gupta <aman@tmm1.net>
3 Date: Thu, 22 Aug 2019 22:31:37 +0000
4 Subject: [PATCH] staging: bcm2835-codec: add support for
5 V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME
6
7 fixes #3171
8
9 Signed-off-by: Aman Gupta <aman@tmm1.net>
10 ---
11 .../bcm2835-codec/bcm2835-v4l2-codec.c | 19 ++++++++++++++++++-
12 1 file changed, 18 insertions(+), 1 deletion(-)
13
14 --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
15 +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
16 @@ -1587,6 +1587,20 @@ static int bcm2835_codec_s_ctrl(struct v
17 ret = bcm2835_codec_set_level_profile(ctx, ctrl);
18 break;
19
20 + case V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME: {
21 + u32 mmal_bool = 1;
22 +
23 + if (!ctx->component)
24 + break;
25 +
26 + ret = vchiq_mmal_port_parameter_set(ctx->dev->instance,
27 + &ctx->component->output[0],
28 + MMAL_PARAMETER_VIDEO_REQUEST_I_FRAME,
29 + &mmal_bool,
30 + sizeof(mmal_bool));
31 + break;
32 + }
33 +
34 default:
35 v4l2_err(&ctx->dev->v4l2_dev, "Invalid control\n");
36 return -EINVAL;
37 @@ -2311,7 +2325,7 @@ static int bcm2835_codec_open(struct fil
38 hdl = &ctx->hdl;
39 if (dev->role == ENCODE) {
40 /* Encode controls */
41 - v4l2_ctrl_handler_init(hdl, 6);
42 + v4l2_ctrl_handler_init(hdl, 7);
43
44 v4l2_ctrl_new_std_menu(hdl, &bcm2835_codec_ctrl_ops,
45 V4L2_CID_MPEG_VIDEO_BITRATE_MODE,
46 @@ -2355,6 +2369,9 @@ static int bcm2835_codec_open(struct fil
47 BIT(V4L2_MPEG_VIDEO_H264_PROFILE_MAIN) |
48 BIT(V4L2_MPEG_VIDEO_H264_PROFILE_HIGH)),
49 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH);
50 + v4l2_ctrl_new_std(hdl, &bcm2835_codec_ctrl_ops,
51 + V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME,
52 + 0, 0, 0, 0);
53 if (hdl->error) {
54 rc = hdl->error;
55 goto free_ctrl_handler;