media/rpivid: Make SPS / PPS optional in a request

SPS & PPS are optional in requests. Fix. The framework keeps the last
value so this is mostly a matter of changing .required to false when
requesting the controls. Check that SPS has ever been set on frame
start, PPS is valid if all zeros so is at best tricky to check.

Signed-off-by: John Cox <jc@kynesim.co.uk>
This commit is contained in:
John Cox
2024-08-23 16:48:38 +01:00
committed by Dom Cobley
parent 25b9710308
commit e79a4f33c9
4 changed files with 13 additions and 7 deletions

View File

@@ -40,14 +40,14 @@ static const struct rpivid_control rpivid_ctrls[] = {
.id = V4L2_CID_STATELESS_HEVC_SPS,
.ops = &rpivid_hevc_sps_ctrl_ops,
},
.required = true,
.required = false,
},
{
.cfg = {
.id = V4L2_CID_STATELESS_HEVC_PPS,
.ops = &rpivid_hevc_pps_ctrl_ops,
},
.required = true,
.required = false,
},
{
.cfg = {

View File

@@ -1726,6 +1726,12 @@ static void rpivid_h265_setup(struct rpivid_ctx *ctx, struct rpivid_run *run)
unsigned int ctb_size_y;
bool sps_changed = false;
if (!is_sps_set(run->h265.sps)) {
v4l2_warn(&dev->v4l2_dev, "SPS never set\n");
goto fail;
}
// Can't check for PPS easily as all 0's looks valid to me
if (memcmp(&s->sps, run->h265.sps, sizeof(s->sps)) != 0) {
/* SPS changed */
v4l2_info(&dev->v4l2_dev, "SPS changed\n");

View File

@@ -257,11 +257,6 @@ static int rpivid_hevc_validate_sps(const struct v4l2_ctrl_hevc_sps * const sps)
return 1;
}
static inline int is_sps_set(const struct v4l2_ctrl_hevc_sps * const sps)
{
return sps && sps->pic_width_in_luma_samples != 0;
}
static u32 pixelformat_from_sps(const struct v4l2_ctrl_hevc_sps * const sps,
const int index)
{

View File

@@ -20,6 +20,11 @@ struct rpivid_format {
unsigned int capabilities;
};
static inline int is_sps_set(const struct v4l2_ctrl_hevc_sps * const sps)
{
return sps && sps->pic_width_in_luma_samples != 0;
}
extern const struct v4l2_ioctl_ops rpivid_ioctl_ops;
int rpivid_queue_init(void *priv, struct vb2_queue *src_vq,