v4l2-compliance: detect V4L2_PIX_FMT_MPEG1_SLICE decoders
RFC PATCH 1/1 v4l2-compliance: detect V4L2_PIX_FMT_MPEG1_SLICE decoders
determine_codec_mask() gives up on a compressed format it does not know, so a decoder that lists 'MG1S' is not tested as a stateless decoder and fails VIDIOC_(TRY_)DECODER_CMD.
The format and flags are added to the headers and v4l2-pix-formats.h by hand; sync-with-kernel replaces them once the kernel series is in.
---
For the kernel RFC "media: stateless MPEG-1 decoding, cedrus support":
https://lore.kernel.org/r/[email protected]
Tested with it on an Orange Pi Zero2 (cedrus): 49 of 49 tests pass. Developed with Claude (Anthropic) as a coding assistant; I reviewed and tested it.
--- include/linux/v4l2-controls.h | 3 +++ include/linux/videodev2.h | 1 + utils/common/v4l2-pix-formats.h | 1 + utils/v4l2-compliance/v4l2-compliance.cpp | 1 + 4 files changed, 6 insertions(+)
include/linux/v4l2-controls.h +3 -0
@@ -1986,6 +1986,7 @@ struct v4l2_ctrl_vp8_frame {/* Stateless MPEG-2 controls */ #define V4L2_MPEG2_SEQ_FLAG_PROGRESSIVE 0x01 +#define V4L2_MPEG2_SEQ_FLAG_MPEG1 0x02#define V4L2_CID_STATELESS_MPEG2_SEQUENCE (V4L2_CID_CODEC_STATELESS_BASE+220)/**
@@ -2034,6 +2035,8 @@ struct v4l2_ctrl_mpeg2_sequence {#define V4L2_MPEG2_PIC_FLAG_ALT_SCAN 0x0020#define V4L2_MPEG2_PIC_FLAG_REPEAT_FIRST 0x0040#define V4L2_MPEG2_PIC_FLAG_PROGRESSIVE 0x0080 +#define V4L2_MPEG2_PIC_FLAG_FULL_PEL_FORWARD 0x0100 +#define V4L2_MPEG2_PIC_FLAG_FULL_PEL_BACKWARD 0x0200#define V4L2_CID_STATELESS_MPEG2_PICTURE (V4L2_CID_CODEC_STATELESS_BASE+221)/**
include/linux/videodev2.h +1 -0
@@ -734,6 +734,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1')/* MPEG-1 ES */ #define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2')/* MPEG-2 ES */ #define V4L2_PIX_FMT_MPEG2_SLICE v4l2_fourcc('M', 'G', '2', 'S')/* MPEG-2 parsed slice data */ +#define V4L2_PIX_FMT_MPEG1_SLICE v4l2_fourcc('M', 'G', '1', 'S')/* MPEG-1 parsed slice data */ #define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4')/* MPEG-4 part 2 ES */ #define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D')/* Xvid */ #define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G')/* SMPTE 421M Annex G compliant stream */
utils/common/v4l2-pix-formats.h +1 -0
@@ -223,6 +223,7 @@case V4L2_PIX_FMT_H263 :return "H.263" ;case V4L2_PIX_FMT_MPEG1 :return "MPEG-1 ES" ;case V4L2_PIX_FMT_MPEG2 :return "MPEG-2 ES" ; +case V4L2_PIX_FMT_MPEG1_SLICE :return "MPEG-1 Parsed Slice Data" ;case V4L2_PIX_FMT_MPEG2_SLICE :return "MPEG-2 Parsed Slice Data" ;case V4L2_PIX_FMT_MPEG4 :return "MPEG-4 Part 2 ES" ;case V4L2_PIX_FMT_XVID :return "Xvid" ;
utils/v4l2-compliance/v4l2-compliance.cpp +1 -0
@@ -604,6 +604,7 @@ static void determine_codec_mask(struct node &node) case V4L2_PIX_FMT_FWHT: mask |= STATEFUL_DECODER; break; + case V4L2_PIX_FMT_MPEG1_SLICE: case V4L2_PIX_FMT_MPEG2_SLICE: case V4L2_PIX_FMT_H264_SLICE: case V4L2_PIX_FMT_HEVC_SLICE:
---
base-commit: d2e89246cefcb6371425361b12c4ca2a36a662d2
change-id: 20261119-v4l-utils-mpeg1-slice-7b90f7304a8d
Best regards,
Signature · 1 line
Arun Iyengar <[email protected]>
Please drop this RFC: v2 of the kernel series has no new pixel format and stock v4l2-compliance passes.
https://lore.kernel.org/r/[email protected]
Quoted 92 lines · On Thu, Nov 19, 2026 at 8:44 AM Arun Iyengar via B4 Relay…
From: Arun Iyengar <[email protected]>
determine_codec_mask()gives up on a compressed format it does not know, so a decoder that lists 'MG1S' is not tested as a stateless decoder and fails VIDIOC_(TRY_)DECODER_CMD.The format and flags are added to the headers and
v4l2-pix-formats.hby hand; sync-with-kernel replaces them once the kernel series is in.Signed-off-by Arun Iyengar <[email protected]>---
For the kernel RFC "media: stateless MPEG-1 decoding, cedrus support":
https://lore.kernel.org/r/[email protected]Tested with it on an Orange Pi Zero2 (cedrus): 49 of 49 tests pass. Developed with Claude (Anthropic) as a coding assistant; I reviewed and tested it.
--- include/linux/v4l2-controls.h | 3 +++ include/linux/videodev2.h | 1 + utils/common/v4l2-pix-formats.h | 1 + utils/v4l2-compliance/v4l2-compliance.cpp | 1 + 4 files changed, 6 insertions(+)include/linux/v4l2-controls.h +3
-0@@ -1986,6 +1986,7 @@ struct v4l2_ctrl_vp8_frame {/* Stateless MPEG-2 controls */ #define V4L2_MPEG2_SEQ_FLAG_PROGRESSIVE 0x01 +#define V4L2_MPEG2_SEQ_FLAG_MPEG1 0x02#define V4L2_CID_STATELESS_MPEG2_SEQUENCE (V4L2_CID_CODEC_STATELESS_BASE+220)/** @@ -2034,6 +2035,8 @@ struct v4l2_ctrl_mpeg2_sequence {#define V4L2_MPEG2_PIC_FLAG_ALT_SCAN 0x0020#define V4L2_MPEG2_PIC_FLAG_REPEAT_FIRST 0x0040#define V4L2_MPEG2_PIC_FLAG_PROGRESSIVE 0x0080 +#define V4L2_MPEG2_PIC_FLAG_FULL_PEL_FORWARD 0x0100 +#define V4L2_MPEG2_PIC_FLAG_FULL_PEL_BACKWARD 0x0200#define V4L2_CID_STATELESS_MPEG2_PICTURE (V4L2_CID_CODEC_STATELESS_BASE+221)/** include/linux/videodev2.h +1
-0@@ -734,6 +734,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1')/* MPEG-1 ES */ #define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2')/* MPEG-2 ES */ #define V4L2_PIX_FMT_MPEG2_SLICE v4l2_fourcc('M', 'G', '2', 'S')/* MPEG-2 parsed slice data */ +#define V4L2_PIX_FMT_MPEG1_SLICE v4l2_fourcc('M', 'G', '1', 'S')/* MPEG-1 parsed slice data */ #define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4')/* MPEG-4 part 2 ES */ #define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D')/* Xvid */ #define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G')/* SMPTE 421M Annex G compliant stream */ utils/common/v4l2-pix-formats.h +1
-0@@ -223,6 +223,7 @@case V4L2_PIX_FMT_H263 :return "H.263" ;case V4L2_PIX_FMT_MPEG1 :return "MPEG-1 ES" ;case V4L2_PIX_FMT_MPEG2 :return "MPEG-2 ES" ; +case V4L2_PIX_FMT_MPEG1_SLICE :return "MPEG-1 Parsed Slice Data" ;case V4L2_PIX_FMT_MPEG2_SLICE :return "MPEG-2 Parsed Slice Data" ;case V4L2_PIX_FMT_MPEG4 :return "MPEG-4 Part 2 ES" ;case V4L2_PIX_FMT_XVID :return "Xvid" ;utils/v4l2-compliance/v4l2-compliance.cpp +1
-1@@ -604,6 +604,7 @@ static void determine_codec_mask(struct node &node) case V4L2_PIX_FMT_FWHT: mask |= STATEFUL_DECODER; break; + case V4L2_PIX_FMT_MPEG1_SLICE: case V4L2_PIX_FMT_MPEG2_SLICE: case V4L2_PIX_FMT_H264_SLICE: case V4L2_PIX_FMT_HEVC_SLICE: ---base-commit:
d2e89246cefcb6371425361b12c4ca2a36a662d2
change-id: 20261119-v4l-utils-mpeg1-slice-7b90f7304a8dBest regards,
--
Arun Iyengar <[email protected]>