Skip to content

Commit

Permalink
video: types: FrameInterval: Add from gst::Fraction
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <[email protected]>
  • Loading branch information
patrickelectric committed Apr 14, 2024
1 parent c9636b8 commit 49495d1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/video/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use super::video_source::VideoSource;
use super::video_source_gst::VideoSourceGst;
use super::video_source_local::VideoSourceLocal;
use super::video_source_redirect::VideoSourceRedirect;
use gst;
use paperclip::actix::Apiv2Schema;
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -41,6 +42,15 @@ pub struct FrameInterval {
pub denominator: u32,
}

impl From<gst::Fraction> for FrameInterval {
fn from(fraction: gst::Fraction) -> Self {
FrameInterval {
numerator: fraction.numer() as u32,
denominator: fraction.denom() as u32,
}
}
}

#[derive(Apiv2Schema, Clone, Debug, Default, Serialize)]
pub struct Control {
pub name: String,
Expand Down

0 comments on commit 49495d1

Please sign in to comment.