feat: 支持在线升级功能

This commit is contained in:
mofeng-git
2026-02-11 19:41:19 +08:00
parent 60b294e0ab
commit 934dc48208
36 changed files with 945 additions and 100 deletions

View File

@@ -32,8 +32,7 @@ fn init_hwcodec_logging() {
}
/// H.264 encoder type (detected from hwcodec)
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Default)]
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub enum H264EncoderType {
/// NVIDIA NVENC
Nvenc,
@@ -69,7 +68,6 @@ impl std::fmt::Display for H264EncoderType {
}
}
/// Map codec name to encoder type
fn codec_name_to_type(name: &str) -> H264EncoderType {
if name.contains("nvenc") {
@@ -90,8 +88,7 @@ fn codec_name_to_type(name: &str) -> H264EncoderType {
}
/// Input pixel format for H264 encoder
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Default)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum H264InputFormat {
/// YUV420P (I420) - planar Y, U, V
Yuv420p,
@@ -112,7 +109,6 @@ pub enum H264InputFormat {
Bgr24,
}
/// H.264 encoder configuration
#[derive(Debug, Clone)]
pub struct H264Config {

View File

@@ -30,8 +30,7 @@ fn init_hwcodec_logging() {
}
/// H.265 encoder type (detected from hwcodec)
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Default)]
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub enum H265EncoderType {
/// NVIDIA NVENC
Nvenc,
@@ -67,7 +66,6 @@ impl std::fmt::Display for H265EncoderType {
}
}
impl From<EncoderBackend> for H265EncoderType {
fn from(backend: EncoderBackend) -> Self {
match backend {
@@ -83,8 +81,7 @@ impl From<EncoderBackend> for H265EncoderType {
}
/// Input pixel format for H265 encoder
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Default)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum H265InputFormat {
/// YUV420P (I420) - planar Y, U, V
Yuv420p,
@@ -105,7 +102,6 @@ pub enum H265InputFormat {
Bgr24,
}
/// H.265 encoder configuration
#[derive(Debug, Clone)]
pub struct H265Config {

View File

@@ -76,7 +76,6 @@ impl BitratePreset {
}
}
impl std::fmt::Display for BitratePreset {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {

View File

@@ -30,8 +30,7 @@ fn init_hwcodec_logging() {
}
/// VP8 encoder type (detected from hwcodec)
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Default)]
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub enum VP8EncoderType {
/// VAAPI (Intel on Linux)
Vaapi,
@@ -52,7 +51,6 @@ impl std::fmt::Display for VP8EncoderType {
}
}
impl From<EncoderBackend> for VP8EncoderType {
fn from(backend: EncoderBackend) -> Self {
match backend {
@@ -64,8 +62,7 @@ impl From<EncoderBackend> for VP8EncoderType {
}
/// Input pixel format for VP8 encoder
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Default)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum VP8InputFormat {
/// YUV420P (I420) - planar Y, U, V
Yuv420p,
@@ -74,7 +71,6 @@ pub enum VP8InputFormat {
Nv12,
}
/// VP8 encoder configuration
#[derive(Debug, Clone)]
pub struct VP8Config {

View File

@@ -30,8 +30,7 @@ fn init_hwcodec_logging() {
}
/// VP9 encoder type (detected from hwcodec)
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Default)]
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub enum VP9EncoderType {
/// VAAPI (Intel on Linux)
Vaapi,
@@ -52,7 +51,6 @@ impl std::fmt::Display for VP9EncoderType {
}
}
impl From<EncoderBackend> for VP9EncoderType {
fn from(backend: EncoderBackend) -> Self {
match backend {
@@ -64,8 +62,7 @@ impl From<EncoderBackend> for VP9EncoderType {
}
/// Input pixel format for VP9 encoder
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Default)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum VP9InputFormat {
/// YUV420P (I420) - planar Y, U, V
Yuv420p,
@@ -74,7 +71,6 @@ pub enum VP9InputFormat {
Nv12,
}
/// VP9 encoder configuration
#[derive(Debug, Clone)]
pub struct VP9Config {

View File

@@ -82,7 +82,8 @@ impl V4l2rCaptureStream {
let actual_format = PixelFormat::from_v4l2r(actual_fmt.pixelformat).unwrap_or(format);
let stride = actual_fmt
.plane_fmt.first()
.plane_fmt
.first()
.map(|p| p.bytesperline)
.unwrap_or_else(|| match actual_format.bytes_per_pixel() {
Some(bpp) => actual_resolution.width * bpp as u32,