media: venus: venc: Add support for AUD NALU control
authorStanimir Varbanov <stanimir.varbanov@linaro.org>
Tue, 24 Nov 2020 00:40:12 +0000 (01:40 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 22 Mar 2021 08:25:44 +0000 (09:25 +0100)
Add support for Access Unit Delimiter control into encoder.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/qcom/venus/core.h
drivers/media/platform/qcom/venus/venc.c
drivers/media/platform/qcom/venus/venc_ctrls.c

index 091dcf767a8723ad1bcefe949aab9cf7b0734557..13c18c49714dccc818ef26d9aa08012fc83d8c4b 100644 (file)
@@ -224,6 +224,7 @@ struct venc_controls {
        u32 multi_slice_max_mb;
 
        u32 header_mode;
+       bool aud_enable;
 
        struct {
                u32 h264;
index 6976ed553647d507727e7bd4e5cfab440efbcbc3..505d092dc433dff6cf3b0972a9fb61ab8945ed6d 100644 (file)
@@ -754,6 +754,20 @@ static int venc_set_properties(struct venus_inst *inst)
        if (ret)
                return ret;
 
+       if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H264 ||
+           inst->fmt_cap->pixfmt == V4L2_PIX_FMT_HEVC) {
+               struct hfi_enable en = {};
+
+               ptype = HFI_PROPERTY_PARAM_VENC_H264_GENERATE_AUDNAL;
+
+               if (ctr->aud_enable)
+                       en.enable = 1;
+
+               ret = hfi_session_set_property(inst, ptype, &en);
+               if (ret)
+                       return ret;
+       }
+
        return 0;
 }
 
index a52b8005517370b532368185c4259b53c9a75ad6..16d6c64d5f64d3f694b35aac930bba4da7d963e3 100644 (file)
@@ -276,6 +276,9 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
        case V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID:
                ctr->base_priority_id = ctrl->val;
                break;
+       case V4L2_CID_MPEG_VIDEO_AU_DELIMITER:
+               ctr->aud_enable = ctrl->val;
+               break;
        default:
                return -EINVAL;
        }
@@ -291,7 +294,7 @@ int venc_ctrl_init(struct venus_inst *inst)
 {
        int ret;
 
-       ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 51);
+       ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 52);
        if (ret)
                return ret;
 
@@ -498,6 +501,9 @@ int venc_ctrl_init(struct venus_inst *inst)
                          V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID, 0,
                          6, 1, 0);
 
+       v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops,
+                         V4L2_CID_MPEG_VIDEO_AU_DELIMITER, 0, 1, 1, 0);
+
        ret = inst->ctrl_handler.error;
        if (ret)
                goto err;