examples, video: Use .into() instead of gst::Fraction::new()

Simplifies the code
This commit is contained in:
Vivia Nikolaidou 2022-10-14 16:26:00 +03:00
parent 39bb9abc3c
commit b230d8aab6
4 changed files with 5 additions and 5 deletions

View file

@ -125,7 +125,7 @@ mod cairo_compositor {
// On all pads we can only handle BGRx.
let caps = gst_video::VideoCapsBuilder::new()
.format(gst_video::VideoFormat::Bgrx)
.field("pixel-aspect-ratio", gst::Fraction::new(1, 1))
.pixel_aspect_ratio((1, 1).into())
.build();
vec![

View file

@ -78,7 +78,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
let caps = gst_video::VideoCapsBuilder::new()
.width(800)
.height(800)
.framerate(gst::Fraction::new(15, 1))
.framerate((15, 1).into())
.build();
capsfilter.set_property("caps", &caps);

View file

@ -315,7 +315,7 @@ mod tests {
let caps = video_make_raw_caps(&[crate::VideoFormat::Nv12, crate::VideoFormat::Nv16])
.width(800)
.height(600)
.framerate(gst::Fraction::new(30, 1))
.framerate((30, 1).into())
.build();
assert_eq!(caps.to_string(), "video/x-raw, format=(string){ NV12, NV16 }, width=(int)800, height=(int)600, framerate=(fraction)30/1");
}

View file

@ -1042,8 +1042,8 @@ mod tests {
.format(crate::VideoFormat::I420)
.width(320)
.height(240)
.framerate(gst::Fraction::new(30, 1))
.field("pixel-aspect-ratio", gst::Fraction::new(1, 1))
.framerate((30, 1).into())
.pixel_aspect_ratio((1, 1).into())
.field("interlace-mode", "progressive")
.field("chroma-site", "mpeg2")
.field("colorimetry", "bt709")