5e5f1a7bf8b061533e11f1560e7bdebbcf0e7c15
[oweals/openwrt.git] /
1 From 7f9fd2338e3a9d7b46b6904bbd7f97851e9b3f52 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Mon, 18 Feb 2019 15:56:42 +0000
4 Subject: [PATCH] staging: bcm2835_codec: Include timing info in SPS
5  headers
6
7 Inserting timing information into the VUI block of the SPS is
8 optional with the VPU encoder.
9 GStreamer appears to require them when using V4L2 M2M, therefore
10 set the option to enable them from the encoder.
11
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
13 ---
14  .../vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c | 12 ++++++++++++
15  1 file changed, 12 insertions(+)
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 @@ -1785,6 +1785,8 @@ static int bcm2835_codec_create_componen
20                 goto destroy_component;
21  
22         if (dev->role == ENCODE) {
23 +               u32 param = 1;
24 +
25                 if (ctx->q_data[V4L2_M2M_SRC].sizeimage <
26                         ctx->component->output[0].minimum_buffer.size)
27                         v4l2_err(&dev->v4l2_dev, "buffer size mismatch sizeimage %u < min size %u\n",
28 @@ -1793,6 +1795,16 @@ static int bcm2835_codec_create_componen
29  
30                 /* Now we have a component we can set all the ctrls */
31                 bcm2835_codec_set_ctrls(ctx);
32 +
33 +               /* Enable SPS Timing header so framerate information is encoded
34 +                * in the H264 header.
35 +                */
36 +               vchiq_mmal_port_parameter_set(
37 +                                       ctx->dev->instance,
38 +                                       &ctx->component->output[0],
39 +                                       MMAL_PARAMETER_VIDEO_ENCODE_SPS_TIMING,
40 +                                       &param, sizeof(param));
41 +
42         } else {
43                 if (ctx->q_data[V4L2_M2M_DST].sizeimage <
44                         ctx->component->output[0].minimum_buffer.size)