Skip to content

Commit

Permalink
encoder/v4l2: Add VP8 stateful encoder
Browse files Browse the repository at this point in the history
This commit adds VP8 stateful encoder with additional necessary v4l2
controls.
  • Loading branch information
bgrzesik committed Jun 7, 2024
1 parent 73b24da commit 12a11e9
Show file tree
Hide file tree
Showing 7 changed files with 427 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/backend/v4l2/controls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,28 @@ impl From<VideoHEVCProfile> for i32 {
}
}

/// Safe wrapper over [`v4l2r::bindings::V4L2_CID_MPEG_VIDEO_VP8_PROFILE`]
#[allow(unused)]
#[repr(i32)]
#[derive(N, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum VideoVP8Profile {
Profile0 = v4l2r::bindings::v4l2_mpeg_video_vp8_profile_V4L2_MPEG_VIDEO_VP8_PROFILE_0 as i32,
Profile1 = v4l2r::bindings::v4l2_mpeg_video_vp8_profile_V4L2_MPEG_VIDEO_VP8_PROFILE_1 as i32,
Profile2 = v4l2r::bindings::v4l2_mpeg_video_vp8_profile_V4L2_MPEG_VIDEO_VP8_PROFILE_2 as i32,
Profile3 = v4l2r::bindings::v4l2_mpeg_video_vp8_profile_V4L2_MPEG_VIDEO_VP8_PROFILE_3 as i32,
}

impl ExtControlTrait for VideoVP8Profile {
const ID: u32 = v4l2r::bindings::V4L2_CID_MPEG_VIDEO_VP8_PROFILE;
type PAYLOAD = i32;
}

impl From<VideoVP8Profile> for i32 {
fn from(value: VideoVP8Profile) -> Self {
value as i32
}
}

/// Safe wrapper over [`v4l2r::bindings::V4L2_CID_MPEG_VIDEO_VP9_PROFILE`]
#[allow(unused)]
#[repr(i32)]
Expand Down
1 change: 1 addition & 0 deletions src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use thiserror::Error;
pub mod av1;
pub mod h264;
pub mod h265;
pub mod vp8;
pub mod vp9;

pub mod stateful;
Expand Down
1 change: 1 addition & 0 deletions src/encoder/stateful.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::encoder::VideoEncoder;

pub mod h264;
pub mod h265;
pub mod vp8;
pub mod vp9;

#[derive(Debug, Error)]
Expand Down
6 changes: 6 additions & 0 deletions src/encoder/stateful/vp8.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright 2024 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#[cfg(feature = "v4l2")]
pub mod v4l2;
Loading

0 comments on commit 12a11e9

Please sign in to comment.