168b2d8c9dc6b571bce3fbfb5b94b36bb6a71a9f
[openwrt/staging/jow.git] /
1 From bf9263611ac50bbe7b0113782468f653a28d2e52 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 14 Mar 2023 14:29:52 +0000
4 Subject: [PATCH] staging: bcm2835-codec: Add
5 V4L2_CID_MPEG_VIDEO_B_FRAMES control
6
7 FFmpeg insists on trying to set V4L2_CID_MPEG_VIDEO_B_FRAMES to
8 0, and generates an error should it fail.
9 As our encoder doesn't support B frames, add a stub handler for
10 it to silence FFmpeg.
11
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
13 ---
14 .../vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c | 10 +++++++++-
15 1 file changed, 9 insertions(+), 1 deletion(-)
16
17 --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
18 +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
19 @@ -2367,6 +2367,10 @@ static int bcm2835_codec_s_ctrl(struct v
20 sizeof(u32_value));
21 break;
22 }
23 + case V4L2_CID_MPEG_VIDEO_B_FRAMES:
24 + ret = 0;
25 + break;
26 +
27 case V4L2_CID_JPEG_COMPRESSION_QUALITY:
28 if (!ctx->component)
29 break;
30 @@ -3356,7 +3360,7 @@ static int bcm2835_codec_open(struct fil
31 case ENCODE:
32 {
33 /* Encode controls */
34 - v4l2_ctrl_handler_init(hdl, 11);
35 + v4l2_ctrl_handler_init(hdl, 12);
36
37 v4l2_ctrl_new_std_menu(hdl, &bcm2835_codec_ctrl_ops,
38 V4L2_CID_MPEG_VIDEO_BITRATE_MODE,
39 @@ -3417,6 +3421,10 @@ static int bcm2835_codec_open(struct fil
40 v4l2_ctrl_new_std(hdl, &bcm2835_codec_ctrl_ops,
41 V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME,
42 0, 0, 0, 0);
43 + v4l2_ctrl_new_std(hdl, &bcm2835_codec_ctrl_ops,
44 + V4L2_CID_MPEG_VIDEO_B_FRAMES,
45 + 0, 0,
46 + 1, 0);
47 if (hdl->error) {
48 rc = hdl->error;
49 goto free_ctrl_handler;