1 //! Definition of CODEC class controls. 2 3 use bitflags::bitflags; 4 use enumn::N; 5 6 use crate::bindings; 7 use crate::bindings::v4l2_ctrl_fwht_params; 8 use crate::bindings::v4l2_ctrl_h264_decode_params; 9 use crate::bindings::v4l2_ctrl_h264_pps; 10 use crate::bindings::v4l2_ctrl_h264_pred_weights; 11 use crate::bindings::v4l2_ctrl_h264_scaling_matrix; 12 use crate::bindings::v4l2_ctrl_h264_slice_params; 13 use crate::bindings::v4l2_ctrl_h264_sps; 14 use crate::bindings::v4l2_ctrl_vp8_frame; 15 use crate::controls::ExtControlTrait; 16 17 bitflags! { 18 /// FWHT Flags. 19 #[derive(Clone, Copy, Debug)] 20 pub struct FwhtFlags: u32 { 21 const INTERLACED = bindings::V4L2_FWHT_FL_IS_INTERLACED as u32; 22 const BOTTOM_FIRST = bindings::V4L2_FWHT_FL_IS_BOTTOM_FIRST as u32; 23 const ALTERNATE = bindings::V4L2_FWHT_FL_IS_ALTERNATE as u32; 24 const BOTTOM_FIELD = bindings::V4L2_FWHT_FL_IS_BOTTOM_FIELD as u32; 25 const UNCOMPRESSED = bindings::V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED as u32; 26 const CB_COMPRESSED = bindings::V4L2_FWHT_FL_CB_IS_UNCOMPRESSED as u32; 27 const CR_COMPRESSED = bindings::V4L2_FWHT_FL_CR_IS_UNCOMPRESSED as u32; 28 const CHROMA_FULL_HEIGHT = bindings::V4L2_FWHT_FL_CHROMA_FULL_HEIGHT as u32; 29 const CHROMA_FULL_WIDTH = bindings::V4L2_FWHT_FL_CHROMA_FULL_WIDTH as u32; 30 const ALPHA_UNCOMPRESSED = bindings::V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED as u32; 31 const I_FRAME = bindings::V4L2_FWHT_FL_I_FRAME as u32; 32 } 33 } 34 35 pub struct H264DecodeMode; 36 impl ExtControlTrait for H264DecodeMode { 37 const ID: u32 = bindings::V4L2_CID_STATELESS_H264_DECODE_MODE; 38 type PAYLOAD = i32; 39 } 40 41 pub struct H264StartCode; 42 impl ExtControlTrait for H264StartCode { 43 const ID: u32 = bindings::V4L2_CID_STATELESS_H264_START_CODE; 44 type PAYLOAD = i32; 45 } 46 47 pub struct H264Sps; 48 impl ExtControlTrait for H264Sps { 49 const ID: u32 = bindings::V4L2_CID_STATELESS_H264_SPS; 50 type PAYLOAD = v4l2_ctrl_h264_sps; 51 } 52 53 pub struct H264Pps; 54 impl ExtControlTrait for H264Pps { 55 const ID: u32 = bindings::V4L2_CID_STATELESS_H264_PPS; 56 type PAYLOAD = v4l2_ctrl_h264_pps; 57 } 58 59 pub struct H264ScalingMatrix; 60 impl ExtControlTrait for H264ScalingMatrix { 61 const ID: u32 = bindings::V4L2_CID_STATELESS_H264_SCALING_MATRIX; 62 type PAYLOAD = v4l2_ctrl_h264_scaling_matrix; 63 } 64 65 pub struct H264PredWeights; 66 impl ExtControlTrait for H264PredWeights { 67 const ID: u32 = bindings::V4L2_CID_STATELESS_H264_PRED_WEIGHTS; 68 type PAYLOAD = v4l2_ctrl_h264_pred_weights; 69 } 70 71 pub struct H264SliceParams; 72 impl ExtControlTrait for H264SliceParams { 73 const ID: u32 = bindings::V4L2_CID_STATELESS_H264_SLICE_PARAMS; 74 type PAYLOAD = v4l2_ctrl_h264_slice_params; 75 } 76 77 pub struct H264DecodeParams; 78 impl ExtControlTrait for H264DecodeParams { 79 const ID: u32 = bindings::V4L2_CID_STATELESS_H264_DECODE_PARAMS; 80 type PAYLOAD = v4l2_ctrl_h264_decode_params; 81 } 82 83 pub struct FwhtParams; 84 impl ExtControlTrait for FwhtParams { 85 const ID: u32 = bindings::V4L2_CID_STATELESS_FWHT_PARAMS; 86 type PAYLOAD = v4l2_ctrl_fwht_params; 87 } 88 89 bitflags! { 90 /// VP8 Segment Flags. 91 #[derive(Clone, Copy, Debug)] 92 pub struct VP8SegmentFlags: u32 { 93 const ENABLED = bindings::V4L2_VP8_SEGMENT_FLAG_ENABLED; 94 const UPDATE_MAP = bindings::V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP; 95 const UPDATE_FEATURE_DATA = bindings::V4L2_VP8_SEGMENT_FLAG_UPDATE_FEATURE_DATA; 96 const DELTA_VALUE_MODE = bindings::V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE; 97 } 98 } 99 100 bitflags! { 101 /// VP8 Loop Filter Flags. 102 #[derive(Clone, Copy, Debug)] 103 pub struct VP8LoopFilterFlags: u32 { 104 const ADJ_ENABLE = bindings::V4L2_VP8_LF_ADJ_ENABLE; 105 const DELTA_UPDATE = bindings::V4L2_VP8_LF_DELTA_UPDATE; 106 const FILTER_TYPE_SIMPLE = bindings::V4L2_VP8_LF_FILTER_TYPE_SIMPLE; 107 } 108 } 109 110 bitflags! { 111 /// VP8 Frame Flags. 112 #[derive(Clone, Copy, Debug)] 113 pub struct VP8FrameFlags: u32 { 114 const KEY_FRAME = bindings::V4L2_VP8_FRAME_FLAG_KEY_FRAME; 115 const EXPERIMENTAL = bindings::V4L2_VP8_FRAME_FLAG_EXPERIMENTAL; 116 const SHOW_FRAME = bindings::V4L2_VP8_FRAME_FLAG_SHOW_FRAME; 117 const NO_SKIP_COEFF = bindings::V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF; 118 const SIGN_BIAS_GOLDEN = bindings::V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN; 119 const SIGN_BIAS_ALT = bindings::V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT; 120 } 121 } 122 123 pub struct Vp8Frame; 124 impl ExtControlTrait for Vp8Frame { 125 const ID: u32 = bindings::V4L2_CID_STATELESS_VP8_FRAME; 126 type PAYLOAD = v4l2_ctrl_vp8_frame; 127 } 128 129 /// Safe wrapper over [`v4l2r::bindings::V4L2_CID_MPEG_VIDEO_HEADER_MODE`] 130 #[repr(i32)] 131 #[derive(N, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 132 pub enum VideoHeaderMode { 133 Separate = bindings::v4l2_mpeg_video_header_mode_V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE as i32, 134 JoinedWith1stFrame = 135 bindings::v4l2_mpeg_video_header_mode_V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME 136 as i32, 137 } 138 139 impl ExtControlTrait for VideoHeaderMode { 140 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_HEADER_MODE; 141 type PAYLOAD = i32; 142 } 143 144 impl From<VideoHeaderMode> for i32 { from(value: VideoHeaderMode) -> Self145 fn from(value: VideoHeaderMode) -> Self { 146 value as i32 147 } 148 } 149 150 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_BITRATE`] 151 #[repr(transparent)] 152 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 153 pub struct VideoBitrate(pub i32); 154 155 impl ExtControlTrait for VideoBitrate { 156 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_BITRATE; 157 type PAYLOAD = i32; 158 } 159 160 impl From<VideoBitrate> for i32 { from(value: VideoBitrate) -> Self161 fn from(value: VideoBitrate) -> Self { 162 value.0 163 } 164 } 165 166 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_BITRATE_PEAK`] 167 #[repr(transparent)] 168 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 169 pub struct VideoBitratePeak(pub i32); 170 171 impl ExtControlTrait for VideoBitratePeak { 172 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_BITRATE_PEAK; 173 type PAYLOAD = i32; 174 } 175 176 impl From<VideoBitratePeak> for i32 { from(value: VideoBitratePeak) -> Self177 fn from(value: VideoBitratePeak) -> Self { 178 value.0 179 } 180 } 181 182 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_CONSTANT_QUALITY`] 183 #[repr(transparent)] 184 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 185 pub struct VideoConstantQuality(pub i32); 186 187 impl ExtControlTrait for VideoConstantQuality { 188 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_CONSTANT_QUALITY; 189 type PAYLOAD = i32; 190 } 191 192 impl From<VideoConstantQuality> for i32 { from(value: VideoConstantQuality) -> Self193 fn from(value: VideoConstantQuality) -> Self { 194 value.0 195 } 196 } 197 198 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_BITRATE_MODE`] 199 #[repr(i32)] 200 #[derive(N, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 201 pub enum VideoBitrateMode { 202 VariableBitrate = 203 bindings::v4l2_mpeg_video_bitrate_mode_V4L2_MPEG_VIDEO_BITRATE_MODE_VBR as i32, 204 ConstantBitrate = 205 bindings::v4l2_mpeg_video_bitrate_mode_V4L2_MPEG_VIDEO_BITRATE_MODE_CBR as i32, 206 ConstantQuality = bindings::v4l2_mpeg_video_bitrate_mode_V4L2_MPEG_VIDEO_BITRATE_MODE_CQ as i32, 207 } 208 209 impl ExtControlTrait for VideoBitrateMode { 210 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_BITRATE_MODE; 211 type PAYLOAD = i32; 212 } 213 214 impl From<VideoBitrateMode> for i32 { from(value: VideoBitrateMode) -> Self215 fn from(value: VideoBitrateMode) -> Self { 216 value as i32 217 } 218 } 219 220 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME`] 221 #[repr(transparent)] 222 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 223 pub struct VideoForceKeyFrame; 224 225 impl ExtControlTrait for VideoForceKeyFrame { 226 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME; 227 type PAYLOAD = i32; 228 } 229 230 impl From<VideoForceKeyFrame> for i32 { from(_value: VideoForceKeyFrame) -> Self231 fn from(_value: VideoForceKeyFrame) -> Self { 232 1 233 } 234 } 235 236 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_GOP_SIZE`] 237 #[repr(transparent)] 238 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 239 pub struct VideoGopSize(pub i32); 240 241 impl ExtControlTrait for VideoGopSize { 242 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_GOP_SIZE; 243 type PAYLOAD = i32; 244 } 245 246 impl From<VideoGopSize> for i32 { from(value: VideoGopSize) -> Self247 fn from(value: VideoGopSize) -> Self { 248 value.0 249 } 250 } 251 252 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_B_FRAMES`] 253 #[repr(transparent)] 254 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 255 pub struct VideoBFrames(pub i32); 256 257 impl ExtControlTrait for VideoBFrames { 258 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_B_FRAMES; 259 type PAYLOAD = i32; 260 } 261 262 impl From<VideoBFrames> for i32 { from(value: VideoBFrames) -> Self263 fn from(value: VideoBFrames) -> Self { 264 value.0 265 } 266 } 267 268 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_H264_MIN_QP`] 269 #[repr(transparent)] 270 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 271 pub struct VideoH264MinQp(pub i32); 272 273 impl ExtControlTrait for VideoH264MinQp { 274 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_H264_MIN_QP; 275 type PAYLOAD = i32; 276 } 277 278 impl From<VideoH264MinQp> for i32 { from(value: VideoH264MinQp) -> Self279 fn from(value: VideoH264MinQp) -> Self { 280 value.0 281 } 282 } 283 284 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_H264_MAX_QP`] 285 #[repr(transparent)] 286 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 287 pub struct VideoH264MaxQp(pub i32); 288 289 impl ExtControlTrait for VideoH264MaxQp { 290 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_H264_MAX_QP; 291 type PAYLOAD = i32; 292 } 293 294 impl From<VideoH264MaxQp> for i32 { from(value: VideoH264MaxQp) -> Self295 fn from(value: VideoH264MaxQp) -> Self { 296 value.0 297 } 298 } 299 300 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_H264_I_PERIOD`] 301 #[repr(transparent)] 302 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 303 pub struct VideoH264IPeriod(pub i32); 304 305 impl ExtControlTrait for VideoH264IPeriod { 306 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_H264_I_PERIOD; 307 type PAYLOAD = i32; 308 } 309 310 impl From<VideoH264IPeriod> for i32 { from(value: VideoH264IPeriod) -> Self311 fn from(value: VideoH264IPeriod) -> Self { 312 value.0 313 } 314 } 315 316 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_H264_LEVEL`] 317 #[repr(i32)] 318 #[derive(N, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 319 pub enum VideoH264Level { 320 L1_0 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_1_0 as i32, 321 L1B = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_1B as i32, 322 L1_1 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_1_1 as i32, 323 L1_2 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_1_2 as i32, 324 L1_3 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_1_3 as i32, 325 L2_0 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_2_0 as i32, 326 L2_1 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_2_1 as i32, 327 L2_2 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_2_2 as i32, 328 L3_0 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_3_0 as i32, 329 L3_1 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_3_1 as i32, 330 L3_2 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_3_2 as i32, 331 L4_0 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_4_0 as i32, 332 L4_1 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_4_1 as i32, 333 L4_2 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_4_2 as i32, 334 L5_0 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_5_0 as i32, 335 L5_1 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_5_1 as i32, 336 L5_2 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_5_2 as i32, 337 L6_0 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_6_0 as i32, 338 L6_1 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_6_1 as i32, 339 L6_2 = bindings::v4l2_mpeg_video_h264_level_V4L2_MPEG_VIDEO_H264_LEVEL_6_2 as i32, 340 } 341 342 impl ExtControlTrait for VideoH264Level { 343 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_H264_LEVEL; 344 type PAYLOAD = i32; 345 } 346 347 impl From<VideoH264Level> for i32 { from(value: VideoH264Level) -> Self348 fn from(value: VideoH264Level) -> Self { 349 value as i32 350 } 351 } 352 353 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_H264_PROFILE`] 354 #[repr(i32)] 355 #[derive(N, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 356 pub enum VideoH264Profile { 357 Baseline = bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE as i32, 358 ConstrainedBaseline = 359 bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE 360 as i32, 361 Main = bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_MAIN as i32, 362 Extended = bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED as i32, 363 High = bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_HIGH as i32, 364 High10 = bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10 as i32, 365 High422 = bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422 as i32, 366 High444Predictive = 367 bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE 368 as i32, 369 High10Intra = 370 bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10_INTRA as i32, 371 High422Intra = 372 bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422_INTRA as i32, 373 High444Intra = 374 bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_INTRA as i32, 375 Cavlc444Intra = 376 bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_CAVLC_444_INTRA as i32, 377 ScalableBaseline = 378 bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_BASELINE 379 as i32, 380 ScalableHigh = 381 bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH as i32, 382 ScalableHighIntra = 383 bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA 384 as i32, 385 StereoHigh = 386 bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH as i32, 387 MultiviewHigh = 388 bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH as i32, 389 ConstrainedHigh = 390 bindings::v4l2_mpeg_video_h264_profile_V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH as i32, 391 } 392 393 impl ExtControlTrait for VideoH264Profile { 394 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_H264_PROFILE; 395 type PAYLOAD = i32; 396 } 397 398 impl From<VideoH264Profile> for i32 { from(value: VideoH264Profile) -> Self399 fn from(value: VideoH264Profile) -> Self { 400 value as i32 401 } 402 } 403 404 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR`] 405 #[repr(transparent)] 406 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 407 pub struct VideoPrependSpsPpsToIdr(pub bool); 408 409 impl ExtControlTrait for VideoPrependSpsPpsToIdr { 410 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR; 411 type PAYLOAD = i32; 412 } 413 414 impl From<VideoPrependSpsPpsToIdr> for i32 { from(value: VideoPrependSpsPpsToIdr) -> Self415 fn from(value: VideoPrependSpsPpsToIdr) -> Self { 416 value.0 as i32 417 } 418 } 419 420 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_HEVC_MIN_QP`] 421 #[repr(transparent)] 422 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 423 pub struct VideoHEVCMinQp(pub i32); 424 425 impl ExtControlTrait for VideoHEVCMinQp { 426 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_HEVC_MIN_QP; 427 type PAYLOAD = i32; 428 } 429 430 impl From<VideoHEVCMinQp> for i32 { from(value: VideoHEVCMinQp) -> Self431 fn from(value: VideoHEVCMinQp) -> Self { 432 value.0 433 } 434 } 435 436 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_HEVC_MAX_QP`] 437 #[repr(transparent)] 438 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 439 pub struct VideoHEVCMaxQp(pub i32); 440 441 impl ExtControlTrait for VideoHEVCMaxQp { 442 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_HEVC_MAX_QP; 443 type PAYLOAD = i32; 444 } 445 446 impl From<VideoHEVCMaxQp> for i32 { from(value: VideoHEVCMaxQp) -> Self447 fn from(value: VideoHEVCMaxQp) -> Self { 448 value.0 449 } 450 } 451 452 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_HEVC_LEVEL`] 453 #[repr(i32)] 454 #[derive(N, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 455 pub enum VideoHEVCLevel { 456 L1_0 = bindings::v4l2_mpeg_video_hevc_level_V4L2_MPEG_VIDEO_HEVC_LEVEL_1 as i32, 457 L2_0 = bindings::v4l2_mpeg_video_hevc_level_V4L2_MPEG_VIDEO_HEVC_LEVEL_2 as i32, 458 L2_1 = bindings::v4l2_mpeg_video_hevc_level_V4L2_MPEG_VIDEO_HEVC_LEVEL_2_1 as i32, 459 L3_0 = bindings::v4l2_mpeg_video_hevc_level_V4L2_MPEG_VIDEO_HEVC_LEVEL_3 as i32, 460 L3_1 = bindings::v4l2_mpeg_video_hevc_level_V4L2_MPEG_VIDEO_HEVC_LEVEL_3_1 as i32, 461 L4_0 = bindings::v4l2_mpeg_video_hevc_level_V4L2_MPEG_VIDEO_HEVC_LEVEL_4 as i32, 462 L4_1 = bindings::v4l2_mpeg_video_hevc_level_V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1 as i32, 463 L5_0 = bindings::v4l2_mpeg_video_hevc_level_V4L2_MPEG_VIDEO_HEVC_LEVEL_5 as i32, 464 L5_1 = bindings::v4l2_mpeg_video_hevc_level_V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1 as i32, 465 L5_2 = bindings::v4l2_mpeg_video_hevc_level_V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2 as i32, 466 L6_0 = bindings::v4l2_mpeg_video_hevc_level_V4L2_MPEG_VIDEO_HEVC_LEVEL_6 as i32, 467 L6_1 = bindings::v4l2_mpeg_video_hevc_level_V4L2_MPEG_VIDEO_HEVC_LEVEL_6_1 as i32, 468 L6_2 = bindings::v4l2_mpeg_video_hevc_level_V4L2_MPEG_VIDEO_HEVC_LEVEL_6_2 as i32, 469 } 470 471 impl ExtControlTrait for VideoHEVCLevel { 472 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_HEVC_LEVEL; 473 type PAYLOAD = i32; 474 } 475 476 impl From<VideoHEVCLevel> for i32 { from(value: VideoHEVCLevel) -> Self477 fn from(value: VideoHEVCLevel) -> Self { 478 value as i32 479 } 480 } 481 482 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_HEVC_PROFILE`] 483 #[repr(i32)] 484 #[derive(N, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 485 pub enum VideoHEVCProfile { 486 Main = bindings::v4l2_mpeg_video_hevc_profile_V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN as i32, 487 Main10 = bindings::v4l2_mpeg_video_hevc_profile_V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10 as i32, 488 MainStill = 489 bindings::v4l2_mpeg_video_hevc_profile_V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE 490 as i32, 491 } 492 493 impl ExtControlTrait for VideoHEVCProfile { 494 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_HEVC_PROFILE; 495 type PAYLOAD = i32; 496 } 497 498 impl From<VideoHEVCProfile> for i32 { from(value: VideoHEVCProfile) -> Self499 fn from(value: VideoHEVCProfile) -> Self { 500 value as i32 501 } 502 } 503 504 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_VP8_PROFILE`] 505 #[repr(i32)] 506 #[derive(N, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 507 pub enum VideoVP8Profile { 508 Profile0 = bindings::v4l2_mpeg_video_vp8_profile_V4L2_MPEG_VIDEO_VP8_PROFILE_0 as i32, 509 Profile1 = bindings::v4l2_mpeg_video_vp8_profile_V4L2_MPEG_VIDEO_VP8_PROFILE_1 as i32, 510 Profile2 = bindings::v4l2_mpeg_video_vp8_profile_V4L2_MPEG_VIDEO_VP8_PROFILE_2 as i32, 511 Profile3 = bindings::v4l2_mpeg_video_vp8_profile_V4L2_MPEG_VIDEO_VP8_PROFILE_3 as i32, 512 } 513 514 impl ExtControlTrait for VideoVP8Profile { 515 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_VP8_PROFILE; 516 type PAYLOAD = i32; 517 } 518 519 impl From<VideoVP8Profile> for i32 { from(value: VideoVP8Profile) -> Self520 fn from(value: VideoVP8Profile) -> Self { 521 value as i32 522 } 523 } 524 525 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_VP9_PROFILE`] 526 #[repr(i32)] 527 #[derive(N, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 528 pub enum VideoVP9Profile { 529 Profile0 = bindings::v4l2_mpeg_video_vp9_profile_V4L2_MPEG_VIDEO_VP9_PROFILE_0 as i32, 530 Profile1 = bindings::v4l2_mpeg_video_vp9_profile_V4L2_MPEG_VIDEO_VP9_PROFILE_1 as i32, 531 Profile2 = bindings::v4l2_mpeg_video_vp9_profile_V4L2_MPEG_VIDEO_VP9_PROFILE_2 as i32, 532 Profile3 = bindings::v4l2_mpeg_video_vp9_profile_V4L2_MPEG_VIDEO_VP9_PROFILE_3 as i32, 533 } 534 535 impl ExtControlTrait for VideoVP9Profile { 536 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_VP9_PROFILE; 537 type PAYLOAD = i32; 538 } 539 540 impl From<VideoVP9Profile> for i32 { from(value: VideoVP9Profile) -> Self541 fn from(value: VideoVP9Profile) -> Self { 542 value as i32 543 } 544 } 545 546 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_VPX_MIN_QP`] 547 #[repr(transparent)] 548 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 549 pub struct VideoVPXMinQp(pub i32); 550 551 impl ExtControlTrait for VideoVPXMinQp { 552 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_VPX_MIN_QP; 553 type PAYLOAD = i32; 554 } 555 556 impl From<VideoVPXMinQp> for i32 { from(value: VideoVPXMinQp) -> Self557 fn from(value: VideoVPXMinQp) -> Self { 558 value.0 559 } 560 } 561 562 /// Safe wrapper over [`bindings::V4L2_CID_MPEG_VIDEO_VPX_MAX_QP`] 563 #[repr(transparent)] 564 #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] 565 pub struct VideoVPXMaxQp(pub i32); 566 567 impl ExtControlTrait for VideoVPXMaxQp { 568 const ID: u32 = bindings::V4L2_CID_MPEG_VIDEO_VPX_MAX_QP; 569 type PAYLOAD = i32; 570 } 571 572 impl From<VideoVPXMaxQp> for i32 { from(value: VideoVPXMaxQp) -> Self573 fn from(value: VideoVPXMaxQp) -> Self { 574 value.0 575 } 576 } 577