mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-06-07 16:08:55 +00:00
video: Use gst_video::VideoCapsBuilder in some plugins
Simplify caps creation codes
This commit is contained in:
parent
fb7929dda6
commit
247702b76d
9 changed files with 72 additions and 197 deletions
|
@ -446,8 +446,8 @@ impl Dav1dDec {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn video_output_formats() -> Vec<glib::SendValue> {
|
fn video_output_formats() -> impl IntoIterator<Item = gst_video::VideoFormat> {
|
||||||
let values = [
|
[
|
||||||
gst_video::VideoFormat::Gray8,
|
gst_video::VideoFormat::Gray8,
|
||||||
#[cfg(target_endian = "little")]
|
#[cfg(target_endian = "little")]
|
||||||
gst_video::VideoFormat::Gray16Le,
|
gst_video::VideoFormat::Gray16Le,
|
||||||
|
@ -482,8 +482,7 @@ fn video_output_formats() -> Vec<glib::SendValue> {
|
||||||
gst_video::VideoFormat::I42212be,
|
gst_video::VideoFormat::I42212be,
|
||||||
#[cfg(target_endian = "big")]
|
#[cfg(target_endian = "big")]
|
||||||
gst_video::VideoFormat::Y44412be,
|
gst_video::VideoFormat::Y44412be,
|
||||||
];
|
]
|
||||||
values.iter().map(|i| i.to_str().to_send_value()).collect()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[glib::object_subclass]
|
#[glib::object_subclass]
|
||||||
|
@ -586,17 +585,8 @@ impl ElementImpl for Dav1dDec {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let src_caps = gst::Caps::builder("video/x-raw")
|
let src_caps = gst_video::VideoCapsBuilder::new()
|
||||||
.field("format", gst::List::from(video_output_formats()))
|
.format_list(video_output_formats())
|
||||||
.field("width", gst::IntRange::new(1, i32::MAX))
|
|
||||||
.field("height", gst::IntRange::new(1, i32::MAX))
|
|
||||||
.field(
|
|
||||||
"framerate",
|
|
||||||
gst::FractionRange::new(
|
|
||||||
gst::Fraction::new(0, 1),
|
|
||||||
gst::Fraction::new(i32::MAX, 1),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let src_pad_template = gst::PadTemplate::new(
|
let src_pad_template = gst::PadTemplate::new(
|
||||||
"src",
|
"src",
|
||||||
|
|
|
@ -13,7 +13,6 @@ use ffv1::decoder::{Decoder, Frame};
|
||||||
use ffv1::record::ConfigRecord;
|
use ffv1::record::ConfigRecord;
|
||||||
|
|
||||||
use gst::glib;
|
use gst::glib;
|
||||||
use gst::prelude::*;
|
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
use gst_video::prelude::*;
|
use gst_video::prelude::*;
|
||||||
use gst_video::subclass::prelude::*;
|
use gst_video::subclass::prelude::*;
|
||||||
|
@ -42,8 +41,8 @@ pub struct Ffv1Dec {
|
||||||
state: Mutex<DecoderState>,
|
state: Mutex<DecoderState>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_all_video_formats() -> Vec<glib::SendValue> {
|
fn get_all_video_formats() -> impl IntoIterator<Item = gst_video::VideoFormat> {
|
||||||
let values = [
|
[
|
||||||
VideoFormat::Gray8,
|
VideoFormat::Gray8,
|
||||||
VideoFormat::Gray16Le,
|
VideoFormat::Gray16Le,
|
||||||
VideoFormat::Gray16Be,
|
VideoFormat::Gray16Be,
|
||||||
|
@ -81,9 +80,7 @@ fn get_all_video_formats() -> Vec<glib::SendValue> {
|
||||||
VideoFormat::Gbra12be,
|
VideoFormat::Gbra12be,
|
||||||
VideoFormat::Y41b,
|
VideoFormat::Y41b,
|
||||||
VideoFormat::Yuv9,
|
VideoFormat::Yuv9,
|
||||||
];
|
]
|
||||||
|
|
||||||
values.iter().map(|i| i.to_str().to_send_value()).collect()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_output_format(record: &ConfigRecord) -> Option<VideoFormat> {
|
fn get_output_format(record: &ConfigRecord) -> Option<VideoFormat> {
|
||||||
|
@ -339,17 +336,8 @@ impl ElementImpl for Ffv1Dec {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let src_caps = gst::Caps::builder("video/x-raw")
|
let src_caps = gst_video::VideoCapsBuilder::new()
|
||||||
.field("format", gst::List::from(get_all_video_formats()))
|
.format_list(get_all_video_formats())
|
||||||
.field("width", gst::IntRange::new(1, i32::MAX))
|
|
||||||
.field("height", gst::IntRange::new(1, i32::MAX))
|
|
||||||
.field(
|
|
||||||
"framerate",
|
|
||||||
gst::FractionRange::new(
|
|
||||||
gst::Fraction::new(0, 1),
|
|
||||||
gst::Fraction::new(i32::MAX, 1),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let src_pad_template = gst::PadTemplate::new(
|
let src_pad_template = gst::PadTemplate::new(
|
||||||
"src",
|
"src",
|
||||||
|
|
|
@ -13,6 +13,7 @@ use gst::glib;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
use gst_video::prelude::*;
|
use gst_video::prelude::*;
|
||||||
use gst_video::subclass::prelude::*;
|
use gst_video::subclass::prelude::*;
|
||||||
|
use gst_video::VideoFormat;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use std::{
|
use std::{
|
||||||
io,
|
io,
|
||||||
|
@ -222,24 +223,10 @@ impl ElementImpl for GifEnc {
|
||||||
|
|
||||||
fn pad_templates() -> &'static [gst::PadTemplate] {
|
fn pad_templates() -> &'static [gst::PadTemplate] {
|
||||||
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
|
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
|
||||||
let sink_caps = gst::Caps::builder("video/x-raw")
|
let sink_caps = gst_video::VideoCapsBuilder::new()
|
||||||
.field(
|
.format_list([VideoFormat::Rgb, VideoFormat::Rgba])
|
||||||
"format",
|
// frame-delay timing in gif is a multiple of 10ms -> max 100fps
|
||||||
gst::List::new([
|
.framerate_range(gst::Fraction::new(1, 1)..gst::Fraction::new(100, 1))
|
||||||
gst_video::VideoFormat::Rgb.to_str(),
|
|
||||||
gst_video::VideoFormat::Rgba.to_str(),
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.field("width", gst::IntRange::new(1, std::u16::MAX as i32))
|
|
||||||
.field("height", gst::IntRange::new(1, std::u16::MAX as i32))
|
|
||||||
.field(
|
|
||||||
"framerate",
|
|
||||||
gst::FractionRange::new(
|
|
||||||
gst::Fraction::new(1, 1),
|
|
||||||
// frame-delay timing in gif is a multiple of 10ms -> max 100fps
|
|
||||||
gst::Fraction::new(100, 1),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let sink_pad_template = gst::PadTemplate::new(
|
let sink_pad_template = gst::PadTemplate::new(
|
||||||
"sink",
|
"sink",
|
||||||
|
|
|
@ -15,7 +15,6 @@ use gst::subclass::prelude::*;
|
||||||
use gst_base::subclass::prelude::*;
|
use gst_base::subclass::prelude::*;
|
||||||
use gst_video::subclass::prelude::*;
|
use gst_video::subclass::prelude::*;
|
||||||
|
|
||||||
use std::i32;
|
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
@ -75,26 +74,24 @@ impl ObjectSubclass for HsvDetector {
|
||||||
type ParentType = gst_video::VideoFilter;
|
type ParentType = gst_video::VideoFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn video_input_formats() -> Vec<glib::SendValue> {
|
fn video_input_formats() -> impl IntoIterator<Item = gst_video::VideoFormat> {
|
||||||
let values = [
|
[
|
||||||
gst_video::VideoFormat::Rgbx,
|
gst_video::VideoFormat::Rgbx,
|
||||||
gst_video::VideoFormat::Xrgb,
|
gst_video::VideoFormat::Xrgb,
|
||||||
gst_video::VideoFormat::Bgrx,
|
gst_video::VideoFormat::Bgrx,
|
||||||
gst_video::VideoFormat::Xbgr,
|
gst_video::VideoFormat::Xbgr,
|
||||||
gst_video::VideoFormat::Rgb,
|
gst_video::VideoFormat::Rgb,
|
||||||
gst_video::VideoFormat::Bgr,
|
gst_video::VideoFormat::Bgr,
|
||||||
];
|
]
|
||||||
values.iter().map(|i| i.to_str().to_send_value()).collect()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn video_output_formats() -> Vec<glib::SendValue> {
|
fn video_output_formats() -> impl IntoIterator<Item = gst_video::VideoFormat> {
|
||||||
let values = [
|
[
|
||||||
gst_video::VideoFormat::Rgba,
|
gst_video::VideoFormat::Rgba,
|
||||||
gst_video::VideoFormat::Argb,
|
gst_video::VideoFormat::Argb,
|
||||||
gst_video::VideoFormat::Bgra,
|
gst_video::VideoFormat::Bgra,
|
||||||
gst_video::VideoFormat::Abgr,
|
gst_video::VideoFormat::Abgr,
|
||||||
];
|
]
|
||||||
values.iter().map(|i| i.to_str().to_send_value()).collect()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HsvDetector {
|
impl HsvDetector {
|
||||||
|
@ -361,17 +358,8 @@ impl ElementImpl for HsvDetector {
|
||||||
|
|
||||||
fn pad_templates() -> &'static [gst::PadTemplate] {
|
fn pad_templates() -> &'static [gst::PadTemplate] {
|
||||||
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
|
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
|
||||||
let caps = gst::Caps::builder("video/x-raw")
|
let caps = gst_video::VideoCapsBuilder::new()
|
||||||
.field("format", gst::List::from(video_output_formats()))
|
.format_list(video_output_formats())
|
||||||
.field("width", gst::IntRange::new(0, i32::MAX))
|
|
||||||
.field("height", gst::IntRange::new(0, i32::MAX))
|
|
||||||
.field(
|
|
||||||
"framerate",
|
|
||||||
gst::FractionRange::new(
|
|
||||||
gst::Fraction::new(0, 1),
|
|
||||||
gst::Fraction::new(i32::MAX, 1),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let src_pad_template = gst::PadTemplate::new(
|
let src_pad_template = gst::PadTemplate::new(
|
||||||
|
@ -383,17 +371,8 @@ impl ElementImpl for HsvDetector {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// sink pad capabilities
|
// sink pad capabilities
|
||||||
let caps = gst::Caps::builder("video/x-raw")
|
let caps = gst_video::VideoCapsBuilder::new()
|
||||||
.field("format", gst::List::from(video_input_formats()))
|
.format_list(video_input_formats())
|
||||||
.field("width", gst::IntRange::new(0, i32::MAX))
|
|
||||||
.field("height", gst::IntRange::new(0, i32::MAX))
|
|
||||||
.field(
|
|
||||||
"framerate",
|
|
||||||
gst::FractionRange::new(
|
|
||||||
gst::Fraction::new(0, 1),
|
|
||||||
gst::Fraction::new(i32::MAX, 1),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let sink_pad_template = gst::PadTemplate::new(
|
let sink_pad_template = gst::PadTemplate::new(
|
||||||
|
@ -427,11 +406,11 @@ impl BaseTransformImpl for HsvDetector {
|
||||||
let mut other_caps = caps.clone();
|
let mut other_caps = caps.clone();
|
||||||
if direction == gst::PadDirection::Src {
|
if direction == gst::PadDirection::Src {
|
||||||
for s in other_caps.make_mut().iter_mut() {
|
for s in other_caps.make_mut().iter_mut() {
|
||||||
s.set("format", gst::List::from(video_input_formats()));
|
s.set("format", gst::List::new(video_input_formats()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for s in other_caps.make_mut().iter_mut() {
|
for s in other_caps.make_mut().iter_mut() {
|
||||||
s.set("format", gst::List::from(video_output_formats()));
|
s.set("format", gst::List::new(video_output_formats()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ use gst::subclass::prelude::*;
|
||||||
use gst_base::subclass::prelude::*;
|
use gst_base::subclass::prelude::*;
|
||||||
use gst_video::subclass::prelude::*;
|
use gst_video::subclass::prelude::*;
|
||||||
|
|
||||||
use std::i32;
|
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
@ -295,31 +294,19 @@ impl ElementImpl for HsvFilter {
|
||||||
fn pad_templates() -> &'static [gst::PadTemplate] {
|
fn pad_templates() -> &'static [gst::PadTemplate] {
|
||||||
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
|
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
|
||||||
// src pad capabilities
|
// src pad capabilities
|
||||||
let caps = gst::Caps::builder("video/x-raw")
|
let caps = gst_video::VideoCapsBuilder::new()
|
||||||
.field(
|
.format_list([
|
||||||
"format",
|
gst_video::VideoFormat::Rgbx,
|
||||||
gst::List::new([
|
gst_video::VideoFormat::Xrgb,
|
||||||
gst_video::VideoFormat::Rgbx.to_str(),
|
gst_video::VideoFormat::Bgrx,
|
||||||
gst_video::VideoFormat::Xrgb.to_str(),
|
gst_video::VideoFormat::Xbgr,
|
||||||
gst_video::VideoFormat::Bgrx.to_str(),
|
gst_video::VideoFormat::Rgba,
|
||||||
gst_video::VideoFormat::Xbgr.to_str(),
|
gst_video::VideoFormat::Argb,
|
||||||
gst_video::VideoFormat::Rgba.to_str(),
|
gst_video::VideoFormat::Bgra,
|
||||||
gst_video::VideoFormat::Argb.to_str(),
|
gst_video::VideoFormat::Abgr,
|
||||||
gst_video::VideoFormat::Bgra.to_str(),
|
gst_video::VideoFormat::Rgb,
|
||||||
gst_video::VideoFormat::Abgr.to_str(),
|
gst_video::VideoFormat::Bgr,
|
||||||
gst_video::VideoFormat::Rgb.to_str(),
|
])
|
||||||
gst_video::VideoFormat::Bgr.to_str(),
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.field("width", gst::IntRange::new(0, i32::MAX))
|
|
||||||
.field("height", gst::IntRange::new(0, i32::MAX))
|
|
||||||
.field(
|
|
||||||
"framerate",
|
|
||||||
gst::FractionRange::new(
|
|
||||||
gst::Fraction::new(0, 1),
|
|
||||||
gst::Fraction::new(i32::MAX, 1),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let src_pad_template = gst::PadTemplate::new(
|
let src_pad_template = gst::PadTemplate::new(
|
||||||
|
|
|
@ -553,31 +553,19 @@ impl ElementImpl for Rav1Enc {
|
||||||
|
|
||||||
fn pad_templates() -> &'static [gst::PadTemplate] {
|
fn pad_templates() -> &'static [gst::PadTemplate] {
|
||||||
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
|
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
|
||||||
let sink_caps = gst::Caps::builder("video/x-raw")
|
let sink_caps = gst_video::VideoCapsBuilder::new()
|
||||||
.field(
|
.format_list([
|
||||||
"format",
|
gst_video::VideoFormat::I420,
|
||||||
gst::List::new([
|
gst_video::VideoFormat::Y42b,
|
||||||
gst_video::VideoFormat::I420.to_str(),
|
gst_video::VideoFormat::Y444,
|
||||||
gst_video::VideoFormat::Y42b.to_str(),
|
gst_video::VideoFormat::I42010le,
|
||||||
gst_video::VideoFormat::Y444.to_str(),
|
gst_video::VideoFormat::I42210le,
|
||||||
gst_video::VideoFormat::I42010le.to_str(),
|
gst_video::VideoFormat::Y44410le,
|
||||||
gst_video::VideoFormat::I42210le.to_str(),
|
gst_video::VideoFormat::I42012le,
|
||||||
gst_video::VideoFormat::Y44410le.to_str(),
|
gst_video::VideoFormat::I42212le,
|
||||||
gst_video::VideoFormat::I42012le.to_str(),
|
gst_video::VideoFormat::Y44412le,
|
||||||
gst_video::VideoFormat::I42212le.to_str(),
|
gst_video::VideoFormat::Gray8,
|
||||||
gst_video::VideoFormat::Y44412le.to_str(),
|
])
|
||||||
gst_video::VideoFormat::Gray8.to_str(),
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.field("width", gst::IntRange::new(1, std::i32::MAX))
|
|
||||||
.field("height", gst::IntRange::new(1, std::i32::MAX))
|
|
||||||
.field(
|
|
||||||
"framerate",
|
|
||||||
gst::FractionRange::new(
|
|
||||||
gst::Fraction::new(0, 1),
|
|
||||||
gst::Fraction::new(std::i32::MAX, 1),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let sink_pad_template = gst::PadTemplate::new(
|
let sink_pad_template = gst::PadTemplate::new(
|
||||||
"sink",
|
"sink",
|
||||||
|
|
|
@ -253,25 +253,13 @@ impl ElementImpl for PngEncoder {
|
||||||
|
|
||||||
fn pad_templates() -> &'static [gst::PadTemplate] {
|
fn pad_templates() -> &'static [gst::PadTemplate] {
|
||||||
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
|
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
|
||||||
let sink_caps = gst::Caps::builder("video/x-raw")
|
let sink_caps = gst_video::VideoCapsBuilder::new()
|
||||||
.field(
|
.format_list([
|
||||||
"format",
|
gst_video::VideoFormat::Gray8,
|
||||||
gst::List::new([
|
gst_video::VideoFormat::Gray16Be,
|
||||||
gst_video::VideoFormat::Gray8.to_str(),
|
gst_video::VideoFormat::Rgb,
|
||||||
gst_video::VideoFormat::Gray16Be.to_str(),
|
gst_video::VideoFormat::Rgba,
|
||||||
gst_video::VideoFormat::Rgb.to_str(),
|
])
|
||||||
gst_video::VideoFormat::Rgba.to_str(),
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
.field("width", gst::IntRange::new(1, std::i32::MAX))
|
|
||||||
.field("height", gst::IntRange::new(1, std::i32::MAX))
|
|
||||||
.field(
|
|
||||||
"framerate",
|
|
||||||
gst::FractionRange::new(
|
|
||||||
gst::Fraction::new(1, 1),
|
|
||||||
gst::Fraction::new(std::i32::MAX, 1),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let sink_pad_template = gst::PadTemplate::new(
|
let sink_pad_template = gst::PadTemplate::new(
|
||||||
"sink",
|
"sink",
|
||||||
|
|
|
@ -349,17 +349,8 @@ impl ElementImpl for RoundedCorners {
|
||||||
|
|
||||||
fn pad_templates() -> &'static [gst::PadTemplate] {
|
fn pad_templates() -> &'static [gst::PadTemplate] {
|
||||||
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
|
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
|
||||||
let sink_caps = gst::Caps::builder("video/x-raw")
|
let sink_caps = gst_video::VideoCapsBuilder::new()
|
||||||
.field("format", VideoFormat::I420.to_str())
|
.format(VideoFormat::I420)
|
||||||
.field("width", gst::IntRange::new(1, i32::MAX))
|
|
||||||
.field("height", gst::IntRange::new(1, i32::MAX))
|
|
||||||
.field(
|
|
||||||
"framerate",
|
|
||||||
gst::FractionRange::new(
|
|
||||||
gst::Fraction::new(0, 1),
|
|
||||||
gst::Fraction::new(i32::MAX, 1),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let sink_pad_template = gst::PadTemplate::new(
|
let sink_pad_template = gst::PadTemplate::new(
|
||||||
"sink",
|
"sink",
|
||||||
|
@ -369,20 +360,8 @@ impl ElementImpl for RoundedCorners {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let src_caps = gst::Caps::builder("video/x-raw")
|
let src_caps = gst_video::VideoCapsBuilder::new()
|
||||||
.field(
|
.format_list([VideoFormat::I420, VideoFormat::A420])
|
||||||
"format",
|
|
||||||
gst::List::new([VideoFormat::A420.to_str(), VideoFormat::I420.to_str()]),
|
|
||||||
)
|
|
||||||
.field("width", gst::IntRange::new(1, i32::MAX))
|
|
||||||
.field("height", gst::IntRange::new(1, i32::MAX))
|
|
||||||
.field(
|
|
||||||
"framerate",
|
|
||||||
gst::FractionRange::new(
|
|
||||||
gst::Fraction::new(0, 1),
|
|
||||||
gst::Fraction::new(i32::MAX, 1),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let src_pad_template = gst::PadTemplate::new(
|
let src_pad_template = gst::PadTemplate::new(
|
||||||
"src",
|
"src",
|
||||||
|
|
|
@ -233,25 +233,14 @@ impl ElementImpl for ColorDetect {
|
||||||
|
|
||||||
fn pad_templates() -> &'static [gst::PadTemplate] {
|
fn pad_templates() -> &'static [gst::PadTemplate] {
|
||||||
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
|
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
|
||||||
let formats = gst::List::new([
|
let caps = gst_video::VideoCapsBuilder::new()
|
||||||
VideoFormat::Rgb.to_str(),
|
.format_list([
|
||||||
VideoFormat::Rgba.to_str(),
|
VideoFormat::Rgb,
|
||||||
VideoFormat::Argb.to_str(),
|
VideoFormat::Rgba,
|
||||||
VideoFormat::Bgr.to_str(),
|
VideoFormat::Argb,
|
||||||
VideoFormat::Bgra.to_str(),
|
VideoFormat::Bgr,
|
||||||
]);
|
VideoFormat::Bgra,
|
||||||
|
])
|
||||||
let caps = gst::Caps::builder("video/x-raw")
|
|
||||||
.field("format", &formats)
|
|
||||||
.field("width", gst::IntRange::new(1, i32::MAX))
|
|
||||||
.field("height", gst::IntRange::new(1, i32::MAX))
|
|
||||||
.field(
|
|
||||||
"framerate",
|
|
||||||
gst::FractionRange::new(
|
|
||||||
gst::Fraction::new(0, 1),
|
|
||||||
gst::Fraction::new(i32::MAX, 1),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let sink_pad_template = gst::PadTemplate::new(
|
let sink_pad_template = gst::PadTemplate::new(
|
||||||
"sink",
|
"sink",
|
||||||
|
|
Loading…
Reference in a new issue