ca3d454f4ba8f41f5d8b3f272e8ccb9fef431177
[openwrt/staging/linusw.git] /
1 From 8c2356e38c9a51356a9f0eacf08f4de6521ad0bd Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Sun, 13 Dec 2020 16:45:58 +0000
4 Subject: [PATCH] staging/vc04_services/codec: Add support for CID
5 MPEG_HEADER_MODE
6
7 Control V4L2_CID_MPEG_VIDEO_HEADER_MODE controls whether the encoder
8 is meant to emit the header bytes as a separate packet or with the
9 first encoded frame.
10 Add support for it.
11
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
13 ---
14 .../bcm2835-codec/bcm2835-v4l2-codec.c | 18 +++++++++++++++++-
15 1 file changed, 17 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 @@ -1692,6 +1692,17 @@ static int bcm2835_codec_s_ctrl(struct v
20 sizeof(ctrl->val));
21 break;
22
23 + case V4L2_CID_MPEG_VIDEO_HEADER_MODE:
24 + if (!ctx->component)
25 + break;
26 +
27 + ret = vchiq_mmal_port_parameter_set(ctx->dev->instance,
28 + &ctx->component->output[0],
29 + MMAL_PARAMETER_VIDEO_ENCODE_HEADERS_WITH_FRAME,
30 + &ctrl->val,
31 + sizeof(ctrl->val));
32 + break;
33 +
34 case V4L2_CID_MPEG_VIDEO_H264_I_PERIOD:
35 if (!ctx->component)
36 break;
37 @@ -1963,6 +1974,7 @@ static int bcm2835_codec_set_ctrls(struc
38 const u32 control_ids[] = {
39 V4L2_CID_MPEG_VIDEO_BITRATE_MODE,
40 V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER,
41 + V4L2_CID_MPEG_VIDEO_HEADER_MODE,
42 V4L2_CID_MPEG_VIDEO_H264_I_PERIOD,
43 V4L2_CID_MPEG_VIDEO_H264_LEVEL,
44 V4L2_CID_MPEG_VIDEO_H264_PROFILE,
45 @@ -2515,7 +2527,7 @@ static int bcm2835_codec_open(struct fil
46 hdl = &ctx->hdl;
47 if (dev->role == ENCODE) {
48 /* Encode controls */
49 - v4l2_ctrl_handler_init(hdl, 7);
50 + v4l2_ctrl_handler_init(hdl, 9);
51
52 v4l2_ctrl_new_std_menu(hdl, &bcm2835_codec_ctrl_ops,
53 V4L2_CID_MPEG_VIDEO_BITRATE_MODE,
54 @@ -2525,6 +2537,10 @@ static int bcm2835_codec_open(struct fil
55 V4L2_CID_MPEG_VIDEO_BITRATE,
56 25 * 1000, 25 * 1000 * 1000,
57 25 * 1000, 10 * 1000 * 1000);
58 + v4l2_ctrl_new_std_menu(hdl, &bcm2835_codec_ctrl_ops,
59 + V4L2_CID_MPEG_VIDEO_HEADER_MODE,
60 + V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME,
61 + 0, V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME);
62 v4l2_ctrl_new_std(hdl, &bcm2835_codec_ctrl_ops,
63 V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER,
64 0, 1,