mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-30 14:00:29 +00:00
Update for new #[glib::object_subclass] attribute macro
This commit is contained in:
parent
5dd0a23986
commit
dc0c5f7611
56 changed files with 233 additions and 621 deletions
|
@ -6,7 +6,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -60,6 +59,7 @@ struct State {
|
||||||
buffer: RingBuffer,
|
buffer: RingBuffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct AudioEcho {
|
pub struct AudioEcho {
|
||||||
settings: Mutex<Settings>,
|
settings: Mutex<Settings>,
|
||||||
state: Mutex<Option<State>>,
|
state: Mutex<Option<State>>,
|
||||||
|
@ -85,22 +85,12 @@ impl AudioEcho {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for AudioEcho {
|
impl ObjectSubclass for AudioEcho {
|
||||||
const NAME: &'static str = "RsAudioEcho";
|
const NAME: &'static str = "RsAudioEcho";
|
||||||
type Type = super::AudioEcho;
|
type Type = super::AudioEcho;
|
||||||
type ParentType = gst_base::BaseTransform;
|
type ParentType = gst_base::BaseTransform;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
settings: Mutex::new(Default::default()),
|
|
||||||
state: Mutex::new(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for AudioEcho {
|
impl ObjectImpl for AudioEcho {
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
// License along with FFmpeg; if not, write to the Free Software
|
// License along with FFmpeg; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -1701,15 +1700,12 @@ impl AudioLoudNorm {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for AudioLoudNorm {
|
impl ObjectSubclass for AudioLoudNorm {
|
||||||
const NAME: &'static str = "RsAudioLoudNorm";
|
const NAME: &'static str = "RsAudioLoudNorm";
|
||||||
type Type = super::AudioLoudNorm;
|
type Type = super::AudioLoudNorm;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use byte_slice_cast::*;
|
use byte_slice_cast::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -42,6 +41,7 @@ struct State {
|
||||||
adapter: gst_base::UniqueAdapter,
|
adapter: gst_base::UniqueAdapter,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct AudioRNNoise {
|
pub struct AudioRNNoise {
|
||||||
state: Mutex<Option<State>>,
|
state: Mutex<Option<State>>,
|
||||||
}
|
}
|
||||||
|
@ -189,21 +189,12 @@ impl AudioRNNoise {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for AudioRNNoise {
|
impl ObjectSubclass for AudioRNNoise {
|
||||||
const NAME: &'static str = "AudioRNNoise";
|
const NAME: &'static str = "AudioRNNoise";
|
||||||
type Type = super::AudioRNNoise;
|
type Type = super::AudioRNNoise;
|
||||||
type ParentType = gst_base::BaseTransform;
|
type ParentType = gst_base::BaseTransform;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
state: Mutex::new(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for AudioRNNoise {}
|
impl ObjectImpl for AudioRNNoise {}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
use gst::{gst_debug, gst_error};
|
use gst::{gst_debug, gst_error};
|
||||||
|
@ -34,25 +33,17 @@ struct State {
|
||||||
audio_info: Option<gst_audio::AudioInfo>,
|
audio_info: Option<gst_audio::AudioInfo>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct ClaxonDec {
|
pub struct ClaxonDec {
|
||||||
state: AtomicRefCell<Option<State>>,
|
state: AtomicRefCell<Option<State>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for ClaxonDec {
|
impl ObjectSubclass for ClaxonDec {
|
||||||
const NAME: &'static str = "ClaxonDec";
|
const NAME: &'static str = "ClaxonDec";
|
||||||
type Type = super::ClaxonDec;
|
type Type = super::ClaxonDec;
|
||||||
type ParentType = gst_audio::AudioDecoder;
|
type ParentType = gst_audio::AudioDecoder;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
state: AtomicRefCell::new(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for ClaxonDec {}
|
impl ObjectImpl for ClaxonDec {}
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
|
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -314,15 +313,12 @@ impl CsoundFilter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for CsoundFilter {
|
impl ObjectSubclass for CsoundFilter {
|
||||||
const NAME: &'static str = "CsoundFilter";
|
const NAME: &'static str = "CsoundFilter";
|
||||||
type Type = super::CsoundFilter;
|
type Type = super::CsoundFilter;
|
||||||
type ParentType = gst_base::BaseTransform;
|
type ParentType = gst_base::BaseTransform;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
let csound = Csound::new();
|
let csound = Csound::new();
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
use gst::{gst_debug, gst_error, gst_warning};
|
use gst::{gst_debug, gst_error, gst_warning};
|
||||||
|
@ -18,6 +17,8 @@ use atomic_refcell::AtomicRefCell;
|
||||||
|
|
||||||
use byte_slice_cast::*;
|
use byte_slice_cast::*;
|
||||||
|
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
header_bufs: (
|
header_bufs: (
|
||||||
Option<gst::Buffer>,
|
Option<gst::Buffer>,
|
||||||
|
@ -30,11 +31,11 @@ struct State {
|
||||||
reorder_map: Option<[usize; 8]>,
|
reorder_map: Option<[usize; 8]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct LewtonDec {
|
pub struct LewtonDec {
|
||||||
state: AtomicRefCell<Option<State>>,
|
state: AtomicRefCell<Option<State>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
use once_cell::sync::Lazy;
|
|
||||||
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
gst::DebugCategory::new(
|
gst::DebugCategory::new(
|
||||||
"lewtondec",
|
"lewtondec",
|
||||||
|
@ -43,21 +44,12 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for LewtonDec {
|
impl ObjectSubclass for LewtonDec {
|
||||||
const NAME: &'static str = "LewtonDec";
|
const NAME: &'static str = "LewtonDec";
|
||||||
type Type = super::LewtonDec;
|
type Type = super::LewtonDec;
|
||||||
type ParentType = gst_audio::AudioDecoder;
|
type ParentType = gst_audio::AudioDecoder;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
state: AtomicRefCell::new(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for LewtonDec {}
|
impl ObjectImpl for LewtonDec {}
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -49,6 +48,7 @@ impl Default for State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct FileSink {
|
pub struct FileSink {
|
||||||
settings: Mutex<Settings>,
|
settings: Mutex<Settings>,
|
||||||
state: Mutex<State>,
|
state: Mutex<State>,
|
||||||
|
@ -106,22 +106,13 @@ impl FileSink {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for FileSink {
|
impl ObjectSubclass for FileSink {
|
||||||
const NAME: &'static str = "RsFileSink";
|
const NAME: &'static str = "RsFileSink";
|
||||||
type Type = super::FileSink;
|
type Type = super::FileSink;
|
||||||
type ParentType = gst_base::BaseSink;
|
type ParentType = gst_base::BaseSink;
|
||||||
type Interfaces = (gst::URIHandler,);
|
type Interfaces = (gst::URIHandler,);
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
settings: Mutex::new(Default::default()),
|
|
||||||
state: Mutex::new(Default::default()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for FileSink {
|
impl ObjectImpl for FileSink {
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -49,6 +48,7 @@ impl Default for State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct FileSrc {
|
pub struct FileSrc {
|
||||||
settings: Mutex<Settings>,
|
settings: Mutex<Settings>,
|
||||||
state: Mutex<State>,
|
state: Mutex<State>,
|
||||||
|
@ -120,22 +120,13 @@ impl FileSrc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for FileSrc {
|
impl ObjectSubclass for FileSrc {
|
||||||
const NAME: &'static str = "RsFileSrc";
|
const NAME: &'static str = "RsFileSrc";
|
||||||
type Type = super::FileSrc;
|
type Type = super::FileSrc;
|
||||||
type ParentType = gst_base::BaseSrc;
|
type ParentType = gst_base::BaseSrc;
|
||||||
type Interfaces = (gst::URIHandler,);
|
type Interfaces = (gst::URIHandler,);
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
settings: Mutex::new(Default::default()),
|
|
||||||
state: Mutex::new(Default::default()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for FileSrc {
|
impl ObjectImpl for FileSrc {
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -545,15 +544,12 @@ impl Decrypter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for Decrypter {
|
impl ObjectSubclass for Decrypter {
|
||||||
const NAME: &'static str = "RsSodiumDecryptor";
|
const NAME: &'static str = "RsSodiumDecryptor";
|
||||||
type Type = super::Decrypter;
|
type Type = super::Decrypter;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -335,15 +334,12 @@ impl Encrypter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for Encrypter {
|
impl ObjectSubclass for Encrypter {
|
||||||
const NAME: &'static str = "RsSodiumEncrypter";
|
const NAME: &'static str = "RsSodiumEncrypter";
|
||||||
type Type = super::Encrypter;
|
type Type = super::Encrypter;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -22,7 +22,6 @@ use futures::lock::Mutex as FutMutex;
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
|
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
@ -504,15 +503,12 @@ impl AppSrc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for AppSrc {
|
impl ObjectSubclass for AppSrc {
|
||||||
const NAME: &'static str = "RsTsAppSrc";
|
const NAME: &'static str = "RsTsAppSrc";
|
||||||
type Type = super::AppSrc;
|
type Type = super::AppSrc;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let src_pad_handler = AppSrcPadHandler::default();
|
let src_pad_handler = AppSrcPadHandler::default();
|
||||||
|
|
|
@ -20,7 +20,6 @@ use futures::future::{abortable, AbortHandle};
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
|
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
@ -391,15 +390,12 @@ impl InputSelector {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for InputSelector {
|
impl ObjectSubclass for InputSelector {
|
||||||
const NAME: &'static str = "RsTsInputSelector";
|
const NAME: &'static str = "RsTsInputSelector";
|
||||||
type Type = super::InputSelector;
|
type Type = super::InputSelector;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|
|
@ -20,7 +20,6 @@ use futures::future::{abortable, AbortHandle, Aborted};
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
|
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
@ -1335,15 +1334,12 @@ impl JitterBuffer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for JitterBuffer {
|
impl ObjectSubclass for JitterBuffer {
|
||||||
const NAME: &'static str = "RsTsJitterBuffer";
|
const NAME: &'static str = "RsTsJitterBuffer";
|
||||||
type Type = super::JitterBuffer;
|
type Type = super::JitterBuffer;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let sink_pad_handler = SinkHandler::default();
|
let sink_pad_handler = SinkHandler::default();
|
||||||
|
|
|
@ -20,7 +20,6 @@ use futures::future::BoxFuture;
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
|
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
@ -572,15 +571,12 @@ impl ProxySink {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for ProxySink {
|
impl ObjectSubclass for ProxySink {
|
||||||
const NAME: &'static str = "RsTsProxySink";
|
const NAME: &'static str = "RsTsProxySink";
|
||||||
type Type = super::ProxySink;
|
type Type = super::ProxySink;
|
||||||
type Interfaces = ();
|
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -1113,19 +1109,12 @@ impl ProxySrc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for ProxySrc {
|
impl ObjectSubclass for ProxySrc {
|
||||||
const NAME: &'static str = "RsTsProxySrc";
|
const NAME: &'static str = "RsTsProxySrc";
|
||||||
type Type = super::ProxySrc;
|
type Type = super::ProxySrc;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|
|
@ -20,7 +20,6 @@ use futures::future::BoxFuture;
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
|
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
@ -692,15 +691,12 @@ impl Queue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for Queue {
|
impl ObjectSubclass for Queue {
|
||||||
const NAME: &'static str = "RsTsQueue";
|
const NAME: &'static str = "RsTsQueue";
|
||||||
type Type = super::Queue;
|
type Type = super::Queue;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|
|
@ -21,7 +21,6 @@ use futures::lock::Mutex as FutMutex;
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
|
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
@ -545,15 +544,12 @@ impl TcpClientSrc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for TcpClientSrc {
|
impl ObjectSubclass for TcpClientSrc {
|
||||||
const NAME: &'static str = "RsTsTcpClientSrc";
|
const NAME: &'static str = "RsTsTcpClientSrc";
|
||||||
type Type = super::TcpClientSrc;
|
type Type = super::TcpClientSrc;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let src_pad_handler = TcpClientSrcPadHandler::default();
|
let src_pad_handler = TcpClientSrcPadHandler::default();
|
||||||
|
|
|
@ -21,7 +21,6 @@ use futures::lock::Mutex;
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
|
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
@ -944,15 +943,12 @@ fn try_into_socket_addr(element: &super::UdpSink, host: &str, port: i32) -> Resu
|
||||||
Ok(SocketAddr::new(addr, port))
|
Ok(SocketAddr::new(addr, port))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for UdpSink {
|
impl ObjectSubclass for UdpSink {
|
||||||
const NAME: &'static str = "RsTsUdpSink";
|
const NAME: &'static str = "RsTsUdpSink";
|
||||||
type Type = super::UdpSink;
|
type Type = super::UdpSink;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let settings = Arc::new(StdMutex::new(Settings::default()));
|
let settings = Arc::new(StdMutex::new(Settings::default()));
|
||||||
|
|
|
@ -20,7 +20,6 @@ use futures::lock::Mutex as FutMutex;
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
|
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
@ -686,15 +685,12 @@ impl UdpSrc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for UdpSrc {
|
impl ObjectSubclass for UdpSrc {
|
||||||
const NAME: &'static str = "RsTsUdpSrc";
|
const NAME: &'static str = "RsTsUdpSrc";
|
||||||
type Type = super::UdpSrc;
|
type Type = super::UdpSrc;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let src_pad_handler = UdpSrcPadHandler::default();
|
let src_pad_handler = UdpSrcPadHandler::default();
|
||||||
|
|
|
@ -301,15 +301,12 @@ mod imp_src {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for ElementSrcTest {
|
impl ObjectSubclass for ElementSrcTest {
|
||||||
const NAME: &'static str = "TsElementSrcTest";
|
const NAME: &'static str = "TsElementSrcTest";
|
||||||
type Type = super::ElementSrcTest;
|
type Type = super::ElementSrcTest;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = glib::subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
ElementSrcTest {
|
ElementSrcTest {
|
||||||
|
@ -636,15 +633,12 @@ mod imp_sink {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for ElementSinkTest {
|
impl ObjectSubclass for ElementSinkTest {
|
||||||
const NAME: &'static str = "TsElementSinkTest";
|
const NAME: &'static str = "TsElementSinkTest";
|
||||||
type Type = super::ElementSinkTest;
|
type Type = super::ElementSinkTest;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = glib::subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
ElementSinkTest {
|
ElementSinkTest {
|
||||||
|
|
|
@ -17,7 +17,6 @@ use url::Url;
|
||||||
|
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -103,7 +102,7 @@ impl Default for State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Default)]
|
||||||
pub struct ReqwestHttpSrc {
|
pub struct ReqwestHttpSrc {
|
||||||
client: Mutex<Option<ClientContext>>,
|
client: Mutex<Option<ClientContext>>,
|
||||||
external_client: Mutex<Option<ClientContext>>,
|
external_client: Mutex<Option<ClientContext>>,
|
||||||
|
@ -1112,23 +1111,11 @@ impl URIHandlerImpl for ReqwestHttpSrc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for ReqwestHttpSrc {
|
impl ObjectSubclass for ReqwestHttpSrc {
|
||||||
const NAME: &'static str = "ReqwestHttpSrc";
|
const NAME: &'static str = "ReqwestHttpSrc";
|
||||||
type Type = super::ReqwestHttpSrc;
|
type Type = super::ReqwestHttpSrc;
|
||||||
type ParentType = gst_base::PushSrc;
|
type ParentType = gst_base::PushSrc;
|
||||||
type Interfaces = (gst::URIHandler,);
|
type Interfaces = (gst::URIHandler,);
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
client: Mutex::new(None),
|
|
||||||
external_client: Mutex::new(None),
|
|
||||||
settings: Mutex::new(Default::default()),
|
|
||||||
state: Mutex::new(Default::default()),
|
|
||||||
canceller: Mutex::new(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -965,15 +964,12 @@ impl Transcriber {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for Transcriber {
|
impl ObjectSubclass for Transcriber {
|
||||||
const NAME: &'static str = "RsAwsTranscriber";
|
const NAME: &'static str = "RsAwsTranscriber";
|
||||||
type Type = super::Transcriber;
|
type Type = super::Transcriber;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
|
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
@ -90,6 +89,7 @@ struct Settings {
|
||||||
buffer_size: u64,
|
buffer_size: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct S3Sink {
|
pub struct S3Sink {
|
||||||
settings: Mutex<Settings>,
|
settings: Mutex<Settings>,
|
||||||
state: Mutex<State>,
|
state: Mutex<State>,
|
||||||
|
@ -341,23 +341,12 @@ impl S3Sink {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for S3Sink {
|
impl ObjectSubclass for S3Sink {
|
||||||
const NAME: &'static str = "RusotoS3Sink";
|
const NAME: &'static str = "RusotoS3Sink";
|
||||||
type Type = super::S3Sink;
|
type Type = super::S3Sink;
|
||||||
type ParentType = gst_base::BaseSink;
|
type ParentType = gst_base::BaseSink;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
settings: Mutex::new(Default::default()),
|
|
||||||
state: Mutex::new(Default::default()),
|
|
||||||
canceller: Mutex::new(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for S3Sink {
|
impl ObjectImpl for S3Sink {
|
||||||
|
|
|
@ -14,7 +14,6 @@ use once_cell::sync::Lazy;
|
||||||
use rusoto_s3::*;
|
use rusoto_s3::*;
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
|
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -37,6 +36,13 @@ enum StreamingState {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for StreamingState {
|
||||||
|
fn default() -> StreamingState {
|
||||||
|
StreamingState::Stopped
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct S3Src {
|
pub struct S3Src {
|
||||||
url: Mutex<Option<GstS3Url>>,
|
url: Mutex<Option<GstS3Url>>,
|
||||||
state: Mutex<StreamingState>,
|
state: Mutex<StreamingState>,
|
||||||
|
@ -196,23 +202,13 @@ impl S3Src {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for S3Src {
|
impl ObjectSubclass for S3Src {
|
||||||
const NAME: &'static str = "RusotoS3Src";
|
const NAME: &'static str = "RusotoS3Src";
|
||||||
type Type = super::S3Src;
|
type Type = super::S3Src;
|
||||||
type ParentType = gst_base::BaseSrc;
|
type ParentType = gst_base::BaseSrc;
|
||||||
type Interfaces = (gst::URIHandler,);
|
type Interfaces = (gst::URIHandler,);
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
url: Mutex::new(None),
|
|
||||||
state: Mutex::new(StreamingState::Stopped),
|
|
||||||
canceller: Mutex::new(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for S3Src {
|
impl ObjectImpl for S3Src {
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
|
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -201,15 +200,12 @@ impl JsonGstEnc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for JsonGstEnc {
|
impl ObjectSubclass for JsonGstEnc {
|
||||||
const NAME: &'static str = "RsJsonGstEnc";
|
const NAME: &'static str = "RsJsonGstEnc";
|
||||||
type Type = super::JsonGstEnc;
|
type Type = super::JsonGstEnc;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -863,15 +862,12 @@ impl JsonGstParse {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for JsonGstParse {
|
impl ObjectSubclass for JsonGstParse {
|
||||||
const NAME: &'static str = "RsJsonGstParse";
|
const NAME: &'static str = "RsJsonGstParse";
|
||||||
type Type = super::JsonGstParse;
|
type Type = super::JsonGstParse;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::gst_error;
|
use gst::gst_error;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
@ -119,15 +118,12 @@ impl RegEx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for RegEx {
|
impl ObjectSubclass for RegEx {
|
||||||
const NAME: &'static str = "RsRegEx";
|
const NAME: &'static str = "RsRegEx";
|
||||||
type Type = super::RegEx;
|
type Type = super::RegEx;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -422,15 +421,12 @@ impl TextWrap {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for TextWrap {
|
impl ObjectSubclass for TextWrap {
|
||||||
const NAME: &'static str = "RsTextWrap";
|
const NAME: &'static str = "RsTextWrap";
|
||||||
type Type = super::TextWrap;
|
type Type = super::TextWrap;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -114,16 +113,12 @@ impl Identity {
|
||||||
// This trait registers our type with the GObject object system and
|
// This trait registers our type with the GObject object system and
|
||||||
// provides the entry points for creating a new instance and setting
|
// provides the entry points for creating a new instance and setting
|
||||||
// up the class data
|
// up the class data
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for Identity {
|
impl ObjectSubclass for Identity {
|
||||||
const NAME: &'static str = "RsIdentity";
|
const NAME: &'static str = "RsIdentity";
|
||||||
type Type = super::Identity;
|
type Type = super::Identity;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
// This macro provides some boilerplate.
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
// Called when a new instance is to be created. We need to return an instance
|
// Called when a new instance is to be created. We need to return an instance
|
||||||
// of our struct here and also get the class struct passed in case it's needed
|
// of our struct here and also get the class struct passed in case it's needed
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::gst_info;
|
use gst::gst_info;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
@ -44,16 +43,12 @@ pub struct ProgressBin {
|
||||||
// This trait registers our type with the GObject object system and
|
// This trait registers our type with the GObject object system and
|
||||||
// provides the entry points for creating a new instance and setting
|
// provides the entry points for creating a new instance and setting
|
||||||
// up the class data
|
// up the class data
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for ProgressBin {
|
impl ObjectSubclass for ProgressBin {
|
||||||
const NAME: &'static str = "RsProgressBin";
|
const NAME: &'static str = "RsProgressBin";
|
||||||
type Type = super::ProgressBin;
|
type Type = super::ProgressBin;
|
||||||
type ParentType = gst::Bin;
|
type ParentType = gst::Bin;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
// This macro provides some boilerplate.
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
// Called when a new instance is to be created. We need to return an instance
|
// Called when a new instance is to be created. We need to return an instance
|
||||||
// of our struct here and also get the class struct passed in case it's needed
|
// of our struct here and also get the class struct passed in case it's needed
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -55,6 +54,7 @@ struct State {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Struct containing all the element data
|
// Struct containing all the element data
|
||||||
|
#[derive(Default)]
|
||||||
pub struct Rgb2Gray {
|
pub struct Rgb2Gray {
|
||||||
settings: Mutex<Settings>,
|
settings: Mutex<Settings>,
|
||||||
state: Mutex<Option<State>>,
|
state: Mutex<Option<State>>,
|
||||||
|
@ -90,25 +90,12 @@ impl Rgb2Gray {
|
||||||
// This trait registers our type with the GObject object system and
|
// This trait registers our type with the GObject object system and
|
||||||
// provides the entry points for creating a new instance and setting
|
// provides the entry points for creating a new instance and setting
|
||||||
// up the class data
|
// up the class data
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for Rgb2Gray {
|
impl ObjectSubclass for Rgb2Gray {
|
||||||
const NAME: &'static str = "RsRgb2Gray";
|
const NAME: &'static str = "RsRgb2Gray";
|
||||||
type Type = super::Rgb2Gray;
|
type Type = super::Rgb2Gray;
|
||||||
type ParentType = gst_base::BaseTransform;
|
type ParentType = gst_base::BaseTransform;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
// This macro provides some boilerplate
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
// Called when a new instance is to be created. We need to return an instance
|
|
||||||
// of our struct here.
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
settings: Mutex::new(Default::default()),
|
|
||||||
state: Mutex::new(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implementation of glib::Object virtual methods
|
// Implementation of glib::Object virtual methods
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -89,7 +88,17 @@ struct ClockWait {
|
||||||
flushing: bool,
|
flushing: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for ClockWait {
|
||||||
|
fn default() -> ClockWait {
|
||||||
|
ClockWait {
|
||||||
|
clock_id: None,
|
||||||
|
flushing: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Struct containing all the element data
|
// Struct containing all the element data
|
||||||
|
#[derive(Default)]
|
||||||
pub struct SineSrc {
|
pub struct SineSrc {
|
||||||
settings: Mutex<Settings>,
|
settings: Mutex<Settings>,
|
||||||
state: Mutex<State>,
|
state: Mutex<State>,
|
||||||
|
@ -144,29 +153,12 @@ impl SineSrc {
|
||||||
// This trait registers our type with the GObject object system and
|
// This trait registers our type with the GObject object system and
|
||||||
// provides the entry points for creating a new instance and setting
|
// provides the entry points for creating a new instance and setting
|
||||||
// up the class data
|
// up the class data
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for SineSrc {
|
impl ObjectSubclass for SineSrc {
|
||||||
const NAME: &'static str = "RsSineSrc";
|
const NAME: &'static str = "RsSineSrc";
|
||||||
type Type = super::SineSrc;
|
type Type = super::SineSrc;
|
||||||
type ParentType = gst_base::PushSrc;
|
type ParentType = gst_base::PushSrc;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
// This macro provides some boilerplate.
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
// Called when a new instance is to be created. We need to return an instance
|
|
||||||
// of our struct here.
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
settings: Mutex::new(Default::default()),
|
|
||||||
state: Mutex::new(Default::default()),
|
|
||||||
clock_wait: Mutex::new(ClockWait {
|
|
||||||
clock_id: None,
|
|
||||||
flushing: true,
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implementation of glib::Object virtual methods
|
// Implementation of glib::Object virtual methods
|
||||||
|
|
|
@ -163,27 +163,17 @@ GStreamer is based on the GLib object system ([GObject](https://developer.gnome.
|
||||||
So, as a next step we need to register a new type for our RGB to Grayscale converter GStreamer element with the GObject type system, and then register that type with GStreamer to be able to create new instances of it. We do this with the following code
|
So, as a next step we need to register a new type for our RGB to Grayscale converter GStreamer element with the GObject type system, and then register that type with GStreamer to be able to create new instances of it. We do this with the following code
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
pub struct Rgb2Gray{}
|
#[derive(Default)]
|
||||||
|
pub struct Rgb2Gray {}
|
||||||
|
|
||||||
impl Rgb2Gray{}
|
impl Rgb2Gray {}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for Rgb2Gray {
|
impl ObjectSubclass for Rgb2Gray {
|
||||||
const NAME: &'static str = "RsRgb2Gray";
|
const NAME: &'static str = "RsRgb2Gray";
|
||||||
type Type = super::Rgb2Gray;
|
type Type = super::Rgb2Gray;
|
||||||
type ParentType = gst_base::BaseTransform;
|
type ParentType = gst_base::BaseTransform;
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
// This macro provides some boilerplate
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn class_init(klass: &mut subclass::simple::ClassStruct<Self>) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -231,19 +221,15 @@ In addition, we also define a `register` function (the one that is already calle
|
||||||
As a next step we implement the `new` funtion and `class_init` functions. In the first version, this struct is empty for now but we will later use it to store all state of our element.
|
As a next step we implement the `new` funtion and `class_init` functions. In the first version, this struct is empty for now but we will later use it to store all state of our element.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
pub struct Rgb2Gray {
|
#[derive(Default)]
|
||||||
}
|
pub struct Rgb2Gray {}
|
||||||
|
|
||||||
impl Rgb2Gray{}
|
impl Rgb2Gray {}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for Rgb2Gray {
|
impl ObjectSubclass for Rgb2Gray {
|
||||||
[...]
|
[...]
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn class_init(klass: &mut Self::Class) {
|
fn class_init(klass: &mut Self::Class) {
|
||||||
klass.set_metadata(
|
klass.set_metadata(
|
||||||
"RGB-GRAY Converter",
|
"RGB-GRAY Converter",
|
||||||
|
@ -281,18 +267,17 @@ With all this defined, `gst-inspect-1.0` should be able to show some more inform
|
||||||
```rust
|
```rust
|
||||||
// all imports...
|
// all imports...
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct Rgb2Gray {}
|
pub struct Rgb2Gray {}
|
||||||
|
|
||||||
impl Rgb2Gray {}
|
impl Rgb2Gray {}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for Rgb2Gray {
|
impl ObjectSubclass for Rgb2Gray {
|
||||||
const NAME: &'static str = "RsRgb2Gray";
|
const NAME: &'static str = "RsRgb2Gray";
|
||||||
type Type = super::Rgb2Gray;
|
type Type = super::Rgb2Gray;
|
||||||
type ParentType = gst_base::BaseTransform;
|
type ParentType = gst_base::BaseTransform;
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for Rgb2Gray {}
|
impl ObjectImpl for Rgb2Gray {}
|
||||||
|
@ -424,20 +409,16 @@ struct State {
|
||||||
out_info: gst_video::VideoInfo,
|
out_info: gst_video::VideoInfo,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct Rgb2Gray {
|
pub struct Rgb2Gray {
|
||||||
state: Mutex<Option<State>>
|
state: Mutex<Option<State>>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Rgb2Gray{}
|
impl Rgb2Gray{}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for Rgb2Gray {
|
impl ObjectSubclass for Rgb2Gray {
|
||||||
[...]
|
[...]
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
state: Mutex::new(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -752,29 +733,7 @@ impl Default for Settings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static PROPERTIES: [subclass::Property; 2] = [
|
#[derive(Default)]
|
||||||
subclass::Property("invert", |name| {
|
|
||||||
glib::ParamSpec::boolean(
|
|
||||||
name,
|
|
||||||
"Invert",
|
|
||||||
"Invert grayscale output",
|
|
||||||
DEFAULT_INVERT,
|
|
||||||
glib::ParamFlags::READWRITE,
|
|
||||||
)
|
|
||||||
}),
|
|
||||||
subclass::Property("shift", |name| {
|
|
||||||
glib::ParamSpec::uint(
|
|
||||||
name,
|
|
||||||
"Shift",
|
|
||||||
"Shift grayscale output (wrapping around)",
|
|
||||||
0,
|
|
||||||
255,
|
|
||||||
DEFAULT_SHIFT,
|
|
||||||
glib::ParamFlags::READWRITE,
|
|
||||||
)
|
|
||||||
}),
|
|
||||||
];
|
|
||||||
|
|
||||||
pub struct Rgb2Gray {
|
pub struct Rgb2Gray {
|
||||||
settings: Mutex<Settings>,
|
settings: Mutex<Settings>,
|
||||||
state: Mutex<Option<State>>,
|
state: Mutex<Option<State>>,
|
||||||
|
@ -782,39 +741,46 @@ pub struct Rgb2Gray {
|
||||||
|
|
||||||
impl Rgb2Gray{...}
|
impl Rgb2Gray{...}
|
||||||
|
|
||||||
impl ObjectSubclass for Rgb2Gray {
|
impl ObjectImpl for Rgb2Gray {
|
||||||
[...]
|
fn properties() -> &'static [glib::ParamSpec] {
|
||||||
|
// Metadata for the properties
|
||||||
|
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
|
||||||
|
vec![
|
||||||
|
glib::ParamSpec::boolean(
|
||||||
|
"invert",
|
||||||
|
"Invert",
|
||||||
|
"Invert grayscale output",
|
||||||
|
DEFAULT_INVERT,
|
||||||
|
glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING,
|
||||||
|
),
|
||||||
|
glib::ParamSpec::uint(
|
||||||
|
"shift",
|
||||||
|
"Shift",
|
||||||
|
"Shift grayscale output (wrapping around)",
|
||||||
|
0,
|
||||||
|
255,
|
||||||
|
DEFAULT_SHIFT,
|
||||||
|
glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
fn new() -> Self {
|
PROPERTIES.as_ref()
|
||||||
Self {
|
|
||||||
settings: Mutex::new(Default::default()),
|
|
||||||
state: Mutex::new(None),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
This should all be rather straightforward: we define a `Settings` struct that stores the two values, implement the [`Default`](https://doc.rust-lang.org/nightly/std/default/trait.Default.html) trait for it, then define a two-element array with property metadata (names, description, ranges, default value, writability), and then store the default value of our `Settings` struct inside another `Mutex` inside the element struct.
|
This should all be rather straightforward: we define a `Settings` struct that stores the two values, implement the [`Default`](https://doc.rust-lang.org/nightly/std/default/trait.Default.html) trait for it, then define a two-element array with property metadata (names, description, ranges, default value, writability), and then store the default value of our `Settings` struct inside another `Mutex` inside the element struct.
|
||||||
|
|
||||||
In the next step we have to make use of these: we need to tell the GObject type system about the properties, and we need to implement functions that are called whenever a property value is set or get.
|
In the next step we have to implement functions that are called whenever a property value is set or get.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
impl ObjectSubclass for Rgb2Gray {
|
|
||||||
fn class_init(klass: &mut Self::Class) {
|
|
||||||
[...]
|
|
||||||
klass.install_properties(&PROPERTIES);
|
|
||||||
[...]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ObjectImpl for Rgb2Gray {
|
impl ObjectImpl for Rgb2Gray {
|
||||||
[...]
|
[...]
|
||||||
|
|
||||||
fn set_property(&self, obj: &Self::Type, id: usize, value: &glib::Value) {
|
fn set_property(&self, obj: &Self::Type, _id: usize, value: &glib::Value, pspec: &glib::ParamSpec) {
|
||||||
let prop = &PROPERTIES[id];
|
match pspec.get_name() {
|
||||||
|
"invert" => {
|
||||||
match *prop {
|
|
||||||
subclass::Property("invert", ..) => {
|
|
||||||
let mut settings = self.settings.lock().unwrap();
|
let mut settings = self.settings.lock().unwrap();
|
||||||
let invert = value.get_some().expect("type checked upstream");
|
let invert = value.get_some().expect("type checked upstream");
|
||||||
gst_info!(
|
gst_info!(
|
||||||
|
@ -826,7 +792,7 @@ impl ObjectImpl for Rgb2Gray {
|
||||||
);
|
);
|
||||||
settings.invert = invert;
|
settings.invert = invert;
|
||||||
}
|
}
|
||||||
subclass::Property("shift", ..) => {
|
"shift" => {
|
||||||
let mut settings = self.settings.lock().unwrap();
|
let mut settings = self.settings.lock().unwrap();
|
||||||
let shift = value.get_some().expect("type checked upstream");
|
let shift = value.get_some().expect("type checked upstream");
|
||||||
gst_info!(
|
gst_info!(
|
||||||
|
@ -842,15 +808,13 @@ impl ObjectImpl for Rgb2Gray {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_property(&self, _obj: &Self::Type, id: usize) -> glib::Value {
|
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||||
let prop = &PROPERTIES[id];
|
match pspec.get_name() {
|
||||||
|
"invert" => {
|
||||||
match *prop {
|
|
||||||
subclass::Property("invert", ..) => {
|
|
||||||
let settings = self.settings.lock().unwrap();
|
let settings = self.settings.lock().unwrap();
|
||||||
settings.invert.to_value()
|
settings.invert.to_value()
|
||||||
}
|
}
|
||||||
subclass::Property("shift", ..) => {
|
"shift" => {
|
||||||
let settings = self.settings.lock().unwrap();
|
let settings = self.settings.lock().unwrap();
|
||||||
settings.shift.to_value()
|
settings.shift.to_value()
|
||||||
}
|
}
|
||||||
|
@ -860,7 +824,7 @@ impl ObjectImpl for Rgb2Gray {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
`Property` values can be changed from any thread at any time, that’s why the `Mutex` is needed here to protect our struct. And we’re using a new mutex to be able to have it locked only for the shorted possible amount of time: we don’t want to keep it locked for the whole time of the `transform` function, otherwise applications trying to set/get values would block for up to the processing time of one frame.
|
Property values can be changed from any thread at any time, that’s why the `Mutex` is needed here to protect our struct. And we’re using a new mutex to be able to have it locked only for the shorted possible amount of time: we don’t want to keep it locked for the whole time of the `transform` function, otherwise applications trying to set/get values would block for up to the processing time of one frame.
|
||||||
|
|
||||||
In the property setter/getter functions we are working with a `glib::Value`. This is a dynamically typed value type that can contain values of any type, together with the type information of the contained value. Here we’re using it to handle an unsigned integer (`u32`) and a boolean for our two properties. To know which property is currently set/get, we get an identifier passed which is the index into our `PROPERTIES` array. We then simply match on the name of that to decide which property was meant
|
In the property setter/getter functions we are working with a `glib::Value`. This is a dynamically typed value type that can contain values of any type, together with the type information of the contained value. Here we’re using it to handle an unsigned integer (`u32`) and a boolean for our two properties. To know which property is currently set/get, we get an identifier passed which is the index into our `PROPERTIES` array. We then simply match on the name of that to decide which property was meant
|
||||||
|
|
||||||
|
|
|
@ -70,48 +70,6 @@ impl Default for Settings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Metadata for the properties
|
|
||||||
static PROPERTIES: [Property; 5] = [
|
|
||||||
Property::UInt(
|
|
||||||
"samples-per-buffer",
|
|
||||||
"Samples Per Buffer",
|
|
||||||
"Number of samples per output buffer",
|
|
||||||
(1, u32::MAX),
|
|
||||||
DEFAULT_SAMPLES_PER_BUFFER,
|
|
||||||
PropertyMutability::ReadWrite,
|
|
||||||
),
|
|
||||||
Property::UInt(
|
|
||||||
"freq",
|
|
||||||
"Frequency",
|
|
||||||
"Frequency",
|
|
||||||
(1, u32::MAX),
|
|
||||||
DEFAULT_FREQ,
|
|
||||||
PropertyMutability::ReadWrite,
|
|
||||||
),
|
|
||||||
Property::Double(
|
|
||||||
"volume",
|
|
||||||
"Volume",
|
|
||||||
"Output volume",
|
|
||||||
(0.0, 10.0),
|
|
||||||
DEFAULT_VOLUME,
|
|
||||||
PropertyMutability::ReadWrite,
|
|
||||||
),
|
|
||||||
Property::Boolean(
|
|
||||||
"mute",
|
|
||||||
"Mute",
|
|
||||||
"Mute",
|
|
||||||
DEFAULT_MUTE,
|
|
||||||
PropertyMutability::ReadWrite,
|
|
||||||
),
|
|
||||||
Property::Boolean(
|
|
||||||
"is-live",
|
|
||||||
"Is Live",
|
|
||||||
"(Pseudo) live output",
|
|
||||||
DEFAULT_IS_LIVE,
|
|
||||||
PropertyMutability::ReadWrite,
|
|
||||||
),
|
|
||||||
];
|
|
||||||
|
|
||||||
// Stream-specific state, i.e. audio format configuration
|
// Stream-specific state, i.e. audio format configuration
|
||||||
// and sample offset
|
// and sample offset
|
||||||
struct State {
|
struct State {
|
||||||
|
@ -133,6 +91,7 @@ impl Default for State {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Struct containing all the element data
|
// Struct containing all the element data
|
||||||
|
#[derive(Default)]
|
||||||
pub struct SineSrc {
|
pub struct SineSrc {
|
||||||
settings: Mutex<Settings>,
|
settings: Mutex<Settings>,
|
||||||
state: Mutex<State>,
|
state: Mutex<State>,
|
||||||
|
@ -146,28 +105,12 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for SineSrc {
|
impl ObjectSubclass for SineSrc {
|
||||||
const NAME: &'static str = "RsSineSrc";
|
const NAME: &'static str = "RsSineSrc";
|
||||||
type Type = super::SineSrc;
|
type Type = super::SineSrc;
|
||||||
type ParentType = gst_base::PushSrc;
|
type ParentType = gst_base::PushSrc;
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
// This macro provides some boilerplate.
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
// Called when a new instance is to be created. We need to return an instance
|
|
||||||
// of our struct here.
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
settings: Mutex::new(Default::default()),
|
|
||||||
state: Mutex::new(Default::default()),
|
|
||||||
clock_wait: Mutex::new(ClockWait {
|
|
||||||
clock_id: None,
|
|
||||||
flushing: true,
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called exactly once when registering the type. Used for
|
// Called exactly once when registering the type. Used for
|
||||||
// setting up metadata for all instances, e.g. the name and
|
// setting up metadata for all instances, e.g. the name and
|
||||||
|
@ -223,13 +166,61 @@ impl ObjectSubclass for SineSrc {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
klass.add_pad_template(src_pad_template);
|
klass.add_pad_template(src_pad_template);
|
||||||
|
|
||||||
// Install all our properties
|
|
||||||
klass.install_properties(&PROPERTIES);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for SineSrc {
|
impl ObjectImpl for SineSrc {
|
||||||
|
// Metadata for the properties
|
||||||
|
fn properties() -> &'static [glib::ParamSpec] {
|
||||||
|
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
|
||||||
|
vec![
|
||||||
|
glib::ParamSpec::uint(
|
||||||
|
"samples-per-buffer",
|
||||||
|
"Samples Per Buffer",
|
||||||
|
"Number of samples per output buffer",
|
||||||
|
1,
|
||||||
|
u32::MAX,
|
||||||
|
DEFAULT_SAMPLES_PER_BUFFER,
|
||||||
|
glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY,
|
||||||
|
),
|
||||||
|
glib::ParamSpec::uint(
|
||||||
|
"freq",
|
||||||
|
"Frequency",
|
||||||
|
"Frequency",
|
||||||
|
1,
|
||||||
|
u32::MAX,
|
||||||
|
DEFAULT_FREQ,
|
||||||
|
glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING,
|
||||||
|
),
|
||||||
|
glib::ParamSpec::double(
|
||||||
|
"volume",
|
||||||
|
"Volume",
|
||||||
|
"Output volume",
|
||||||
|
0.0,
|
||||||
|
10.0,
|
||||||
|
DEFAULT_VOLUME,
|
||||||
|
glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING,
|
||||||
|
),
|
||||||
|
glib::ParamSpec::boolean(
|
||||||
|
"mute",
|
||||||
|
"Mute",
|
||||||
|
"Mute",
|
||||||
|
DEFAULT_MUTE,
|
||||||
|
glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING,
|
||||||
|
),
|
||||||
|
glib::ParamSpec::boolean(
|
||||||
|
"is-live",
|
||||||
|
"Is Live",
|
||||||
|
"(Pseudo) live output",
|
||||||
|
DEFAULT_IS_LIVE,
|
||||||
|
glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
PROPERTIES.as_ref()
|
||||||
|
}
|
||||||
|
|
||||||
// Called right after construction of a new instance
|
// Called right after construction of a new instance
|
||||||
fn constructed(&self, obj: &Self::Type) {
|
fn constructed(&self, obj: &Self::Type) {
|
||||||
// Call the parent class' ::constructed() implementation first
|
// Call the parent class' ::constructed() implementation first
|
||||||
|
@ -243,11 +234,15 @@ impl ObjectImpl for SineSrc {
|
||||||
|
|
||||||
// Called whenever a value of a property is changed. It can be called
|
// Called whenever a value of a property is changed. It can be called
|
||||||
// at any time from any thread.
|
// at any time from any thread.
|
||||||
fn set_property(&self, obj: &Self::Type, id: u32, value: &glib::Value) {
|
fn set_property(
|
||||||
let prop = &PROPERTIES[id as usize];
|
&self,
|
||||||
|
obj: &Self::Type,
|
||||||
match *prop {
|
_id: usize,
|
||||||
Property::UInt("samples-per-buffer", ..) => {
|
value: &glib::Value,
|
||||||
|
pspec: &glib::ParamSpec,
|
||||||
|
) {
|
||||||
|
match pspec.get_name() {
|
||||||
|
"samples-per-buffer" => {
|
||||||
let mut settings = self.settings.lock().unwrap();
|
let mut settings = self.settings.lock().unwrap();
|
||||||
let samples_per_buffer = value.get_some().expect("type checked upstream");
|
let samples_per_buffer = value.get_some().expect("type checked upstream");
|
||||||
gst_info!(
|
gst_info!(
|
||||||
|
@ -260,10 +255,9 @@ impl ObjectImpl for SineSrc {
|
||||||
settings.samples_per_buffer = samples_per_buffer;
|
settings.samples_per_buffer = samples_per_buffer;
|
||||||
drop(settings);
|
drop(settings);
|
||||||
|
|
||||||
let _ =
|
let _ = obj.post_message(gst::message::Latency::builder().src(obj).build());
|
||||||
obj.post_message(&gst::Message::new_latency().src(Some(obj)).build());
|
|
||||||
}
|
}
|
||||||
Property::UInt("freq", ..) => {
|
"freq" => {
|
||||||
let mut settings = self.settings.lock().unwrap();
|
let mut settings = self.settings.lock().unwrap();
|
||||||
let freq = value.get_some().expect("type checked upstream");
|
let freq = value.get_some().expect("type checked upstream");
|
||||||
gst_info!(
|
gst_info!(
|
||||||
|
@ -275,7 +269,7 @@ impl ObjectImpl for SineSrc {
|
||||||
);
|
);
|
||||||
settings.freq = freq;
|
settings.freq = freq;
|
||||||
}
|
}
|
||||||
Property::Double("volume", ..) => {
|
"volume" => {
|
||||||
let mut settings = self.settings.lock().unwrap();
|
let mut settings = self.settings.lock().unwrap();
|
||||||
let volume = value.get_some().expect("type checked upstream");
|
let volume = value.get_some().expect("type checked upstream");
|
||||||
gst_info!(
|
gst_info!(
|
||||||
|
@ -287,7 +281,7 @@ impl ObjectImpl for SineSrc {
|
||||||
);
|
);
|
||||||
settings.volume = volume;
|
settings.volume = volume;
|
||||||
}
|
}
|
||||||
Property::Boolean("mute", ..) => {
|
"mute" => {
|
||||||
let mut settings = self.settings.lock().unwrap();
|
let mut settings = self.settings.lock().unwrap();
|
||||||
let mute = value.get_some().expect("type checked upstream");
|
let mute = value.get_some().expect("type checked upstream");
|
||||||
gst_info!(
|
gst_info!(
|
||||||
|
@ -299,7 +293,7 @@ impl ObjectImpl for SineSrc {
|
||||||
);
|
);
|
||||||
settings.mute = mute;
|
settings.mute = mute;
|
||||||
}
|
}
|
||||||
Property::Boolean("is-live", ..) => {
|
"is-live" => {
|
||||||
let mut settings = self.settings.lock().unwrap();
|
let mut settings = self.settings.lock().unwrap();
|
||||||
let is_live = value.get_some().expect("type checked upstream");
|
let is_live = value.get_some().expect("type checked upstream");
|
||||||
gst_info!(
|
gst_info!(
|
||||||
|
@ -317,27 +311,25 @@ impl ObjectImpl for SineSrc {
|
||||||
|
|
||||||
// Called whenever a value of a property is read. It can be called
|
// Called whenever a value of a property is read. It can be called
|
||||||
// at any time from any thread.
|
// at any time from any thread.
|
||||||
fn get_property(&self, _obj: &Self::Type, id: u32) -> glib::Value {
|
fn get_property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||||
let prop = &PROPERTIES[id as usize];
|
match pspec.get_name() {
|
||||||
|
"samples-per-buffer" => {
|
||||||
match *prop {
|
|
||||||
Property::UInt("samples-per-buffer", ..) => {
|
|
||||||
let settings = self.settings.lock().unwrap();
|
let settings = self.settings.lock().unwrap();
|
||||||
settings.samples_per_buffer.to_value()
|
settings.samples_per_buffer.to_value()
|
||||||
}
|
}
|
||||||
Property::UInt("freq", ..) => {
|
"freq" => {
|
||||||
let settings = self.settings.lock().unwrap();
|
let settings = self.settings.lock().unwrap();
|
||||||
settings.freq.to_value()
|
settings.freq.to_value()
|
||||||
}
|
}
|
||||||
Property::Double("volume", ..) => {
|
"volume" => {
|
||||||
let settings = self.settings.lock().unwrap();
|
let settings = self.settings.lock().unwrap();
|
||||||
settings.volume.to_value()
|
settings.volume.to_value()
|
||||||
}
|
}
|
||||||
Property::Boolean("mute", ..) => {
|
"mute" => {
|
||||||
let settings = self.settings.lock().unwrap();
|
let settings = self.settings.lock().unwrap();
|
||||||
settings.mute.to_value()
|
settings.mute.to_value()
|
||||||
}
|
}
|
||||||
Property::Boolean("is-live", ..) => {
|
"is-live" => {
|
||||||
let settings = self.settings.lock().unwrap();
|
let settings = self.settings.lock().unwrap();
|
||||||
settings.is_live.to_value()
|
settings.is_live.to_value()
|
||||||
}
|
}
|
||||||
|
@ -827,6 +819,16 @@ struct ClockWait {
|
||||||
flushing: bool,
|
flushing: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for ClockWait {
|
||||||
|
fn default() -> Self {
|
||||||
|
ClockWait {
|
||||||
|
clock_id: None,
|
||||||
|
flushing: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
struct SineSrc {
|
struct SineSrc {
|
||||||
settings: Mutex<Settings>,
|
settings: Mutex<Settings>,
|
||||||
state: Mutex<State>,
|
state: Mutex<State>,
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -42,37 +41,25 @@ struct Stream {
|
||||||
stream: gst::Stream,
|
stream: gst::Stream,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
struct State {
|
struct State {
|
||||||
pads: Vec<Stream>,
|
pads: Vec<Stream>,
|
||||||
num_audio: usize,
|
num_audio: usize,
|
||||||
num_video: usize,
|
num_video: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct CustomSource {
|
pub struct CustomSource {
|
||||||
source: OnceCell<gst::Element>,
|
source: OnceCell<gst::Element>,
|
||||||
state: Mutex<State>,
|
state: Mutex<State>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for CustomSource {
|
impl ObjectSubclass for CustomSource {
|
||||||
const NAME: &'static str = "FallbackSrcCustomSource";
|
const NAME: &'static str = "FallbackSrcCustomSource";
|
||||||
type Type = super::CustomSource;
|
type Type = super::CustomSource;
|
||||||
type ParentType = gst::Bin;
|
type ParentType = gst::Bin;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
source: OnceCell::default(),
|
|
||||||
state: Mutex::new(State {
|
|
||||||
pads: vec![],
|
|
||||||
num_audio: 0,
|
|
||||||
num_video: 0,
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for CustomSource {
|
impl ObjectImpl for CustomSource {
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -172,27 +171,18 @@ struct State {
|
||||||
stats: Stats,
|
stats: Stats,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct FallbackSrc {
|
pub struct FallbackSrc {
|
||||||
settings: Mutex<Settings>,
|
settings: Mutex<Settings>,
|
||||||
state: Mutex<Option<State>>,
|
state: Mutex<Option<State>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for FallbackSrc {
|
impl ObjectSubclass for FallbackSrc {
|
||||||
const NAME: &'static str = "FallbackSrc";
|
const NAME: &'static str = "FallbackSrc";
|
||||||
type Type = super::FallbackSrc;
|
type Type = super::FallbackSrc;
|
||||||
type ParentType = gst::Bin;
|
type ParentType = gst::Bin;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
settings: Mutex::new(Settings::default()),
|
|
||||||
state: Mutex::new(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for FallbackSrc {
|
impl ObjectImpl for FallbackSrc {
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -62,15 +61,12 @@ pub struct VideoFallbackSource {
|
||||||
settings: Mutex<Settings>,
|
settings: Mutex<Settings>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for VideoFallbackSource {
|
impl ObjectSubclass for VideoFallbackSource {
|
||||||
const NAME: &'static str = "FallbackSrcVideoFallbackSource";
|
const NAME: &'static str = "FallbackSrcVideoFallbackSource";
|
||||||
type Type = super::VideoFallbackSource;
|
type Type = super::VideoFallbackSource;
|
||||||
type ParentType = gst::Bin;
|
type ParentType = gst::Bin;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("src").unwrap();
|
let templ = klass.get_pad_template("src").unwrap();
|
||||||
|
|
|
@ -27,7 +27,6 @@ use gst_base::prelude::*;
|
||||||
#[cfg(feature = "v1_18")]
|
#[cfg(feature = "v1_18")]
|
||||||
use gst_base::subclass::prelude::*;
|
use gst_base::subclass::prelude::*;
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
#[cfg(not(feature = "v1_18"))]
|
#[cfg(not(feature = "v1_18"))]
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
#[cfg(not(feature = "v1_18"))]
|
#[cfg(not(feature = "v1_18"))]
|
||||||
|
@ -643,15 +642,12 @@ impl FallbackSwitch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for FallbackSwitch {
|
impl ObjectSubclass for FallbackSwitch {
|
||||||
const NAME: &'static str = "FallbackSwitch";
|
const NAME: &'static str = "FallbackSwitch";
|
||||||
type Type = super::FallbackSwitch;
|
type Type = super::FallbackSwitch;
|
||||||
type ParentType = gst_base::Aggregator;
|
type ParentType = gst_base::Aggregator;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -1617,15 +1616,12 @@ impl ToggleRecord {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for ToggleRecord {
|
impl ObjectSubclass for ToggleRecord {
|
||||||
const NAME: &'static str = "RsToggleRecord";
|
const NAME: &'static str = "RsToggleRecord";
|
||||||
type Type = super::ToggleRecord;
|
type Type = super::ToggleRecord;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::gst_debug;
|
use gst::gst_debug;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -23,27 +22,18 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
gst::DebugCategory::new("cdgdec", gst::DebugColorFlags::empty(), Some("CDG decoder"))
|
gst::DebugCategory::new("cdgdec", gst::DebugColorFlags::empty(), Some("CDG decoder"))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct CdgDec {
|
pub struct CdgDec {
|
||||||
cdg_inter: Mutex<Box<cdg_renderer::CdgInterpreter>>,
|
cdg_inter: Mutex<Box<cdg_renderer::CdgInterpreter>>,
|
||||||
output_info: Mutex<Option<gst_video::VideoInfo>>,
|
output_info: Mutex<Option<gst_video::VideoInfo>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for CdgDec {
|
impl ObjectSubclass for CdgDec {
|
||||||
const NAME: &'static str = "CdgDec";
|
const NAME: &'static str = "CdgDec";
|
||||||
type Type = super::CdgDec;
|
type Type = super::CdgDec;
|
||||||
type ParentType = gst_video::VideoDecoder;
|
type ParentType = gst_video::VideoDecoder;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
cdg_inter: Mutex::new(Box::new(cdg_renderer::CdgInterpreter::new())),
|
|
||||||
output_info: Mutex::new(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for CdgDec {}
|
impl ObjectImpl for CdgDec {}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::format::Bytes;
|
use gst::format::Bytes;
|
||||||
use gst::gst_debug;
|
use gst::gst_debug;
|
||||||
|
@ -25,6 +24,7 @@ const CDG_CMD_MEMORY_PRESET: u8 = 1;
|
||||||
const CDG_CMD_MEMORY_LOAD_COLOR_TABLE_1: u8 = 30;
|
const CDG_CMD_MEMORY_LOAD_COLOR_TABLE_1: u8 = 30;
|
||||||
const CDG_CMD_MEMORY_LOAD_COLOR_TABLE_2: u8 = 31;
|
const CDG_CMD_MEMORY_LOAD_COLOR_TABLE_2: u8 = 31;
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct CdgParse;
|
pub struct CdgParse;
|
||||||
|
|
||||||
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
|
@ -35,19 +35,12 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for CdgParse {
|
impl ObjectSubclass for CdgParse {
|
||||||
const NAME: &'static str = "CdgParse";
|
const NAME: &'static str = "CdgParse";
|
||||||
type Type = super::CdgParse;
|
type Type = super::CdgParse;
|
||||||
type ParentType = gst_base::BaseParse;
|
type ParentType = gst_base::BaseParse;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for CdgParse {}
|
impl ObjectImpl for CdgParse {}
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
|
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -70,6 +69,7 @@ struct State {
|
||||||
last_cc708_change: gst::ClockTime,
|
last_cc708_change: gst::ClockTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct CCDetect {
|
pub struct CCDetect {
|
||||||
settings: Mutex<Settings>,
|
settings: Mutex<Settings>,
|
||||||
state: Mutex<Option<State>>,
|
state: Mutex<Option<State>>,
|
||||||
|
@ -214,22 +214,12 @@ impl CCDetect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for CCDetect {
|
impl ObjectSubclass for CCDetect {
|
||||||
const NAME: &'static str = "CCDetect";
|
const NAME: &'static str = "CCDetect";
|
||||||
type Type = super::CCDetect;
|
type Type = super::CCDetect;
|
||||||
type ParentType = gst_base::BaseTransform;
|
type ParentType = gst_base::BaseTransform;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
settings: Mutex::new(Default::default()),
|
|
||||||
state: Mutex::new(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for CCDetect {
|
impl ObjectImpl for CCDetect {
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
|
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -436,10 +435,15 @@ impl Cea608Overlay {
|
||||||
self.negotiate(element, &mut state)?;
|
self.negotiate(element, &mut state)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for meta in buffer.iter_meta::<gst_video::VideoTimeCodeMeta>() {
|
||||||
|
println!("timecode {}", meta.get_tc());
|
||||||
|
}
|
||||||
|
|
||||||
for meta in buffer.iter_meta::<gst_video::VideoCaptionMeta>() {
|
for meta in buffer.iter_meta::<gst_video::VideoCaptionMeta>() {
|
||||||
if meta.get_caption_type() == gst_video::VideoCaptionType::Cea708Cdp {
|
if meta.get_caption_type() == gst_video::VideoCaptionType::Cea708Cdp {
|
||||||
match extract_cdp(meta.get_data()) {
|
match extract_cdp(meta.get_data()) {
|
||||||
Ok(data) => {
|
Ok(data) => {
|
||||||
|
println!("meh {:?}", meta.get_data());
|
||||||
self.decode_cc_data(pad, element, &mut state, data);
|
self.decode_cc_data(pad, element, &mut state, data);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
@ -536,15 +540,12 @@ impl Cea608Overlay {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for Cea608Overlay {
|
impl ObjectSubclass for Cea608Overlay {
|
||||||
const NAME: &'static str = "RsCea608Overlay";
|
const NAME: &'static str = "RsCea608Overlay";
|
||||||
type Type = super::Cea608Overlay;
|
type Type = super::Cea608Overlay;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -371,15 +370,12 @@ impl Cea608ToTt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for Cea608ToTt {
|
impl ObjectSubclass for Cea608ToTt {
|
||||||
const NAME: &'static str = "Cea608ToTt";
|
const NAME: &'static str = "Cea608ToTt";
|
||||||
type Type = super::Cea608ToTt;
|
type Type = super::Cea608ToTt;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::structure;
|
use gst::structure;
|
||||||
|
@ -445,15 +444,12 @@ impl MccEnc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for MccEnc {
|
impl ObjectSubclass for MccEnc {
|
||||||
const NAME: &'static str = "RsMccEnc";
|
const NAME: &'static str = "RsMccEnc";
|
||||||
type Type = super::MccEnc;
|
type Type = super::MccEnc;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -1118,15 +1117,12 @@ impl MccParse {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for MccParse {
|
impl ObjectSubclass for MccParse {
|
||||||
const NAME: &'static str = "RsMccParse";
|
const NAME: &'static str = "RsMccParse";
|
||||||
type Type = super::MccParse;
|
type Type = super::MccParse;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
|
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::structure;
|
use gst::structure;
|
||||||
|
@ -333,15 +332,12 @@ impl SccEnc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for SccEnc {
|
impl ObjectSubclass for SccEnc {
|
||||||
const NAME: &'static str = "RsSccEnc";
|
const NAME: &'static str = "RsSccEnc";
|
||||||
type Type = super::SccEnc;
|
type Type = super::SccEnc;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
|
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -998,15 +997,12 @@ impl SccParse {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for SccParse {
|
impl ObjectSubclass for SccParse {
|
||||||
const NAME: &'static str = "RsSccParse";
|
const NAME: &'static str = "RsSccParse";
|
||||||
type Type = super::SccParse;
|
type Type = super::SccParse;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -975,15 +974,12 @@ impl TtToCea608 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for TtToCea608 {
|
impl ObjectSubclass for TtToCea608 {
|
||||||
const NAME: &'static str = "TtToCea608";
|
const NAME: &'static str = "TtToCea608";
|
||||||
type Type = super::TtToCea608;
|
type Type = super::TtToCea608;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
|
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
|
||||||
// Boston, MA 02110-1335, USA.
|
// Boston, MA 02110-1335, USA.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::gst_log;
|
use gst::gst_log;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
@ -188,15 +187,12 @@ impl ElementImpl for TtToJson {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for TtToJson {
|
impl ObjectSubclass for TtToJson {
|
||||||
const NAME: &'static str = "RsTtToJson";
|
const NAME: &'static str = "RsTtToJson";
|
||||||
type Type = super::TtToJson;
|
type Type = super::TtToJson;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -21,6 +20,7 @@ use std::i32;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
struct NegotiationInfos {
|
struct NegotiationInfos {
|
||||||
input_state:
|
input_state:
|
||||||
Option<gst_video::VideoCodecState<'static, gst_video::video_codec_state::Readable>>,
|
Option<gst_video::VideoCodecState<'static, gst_video::video_codec_state::Readable>>,
|
||||||
|
@ -28,6 +28,7 @@ struct NegotiationInfos {
|
||||||
video_meta_supported: bool,
|
video_meta_supported: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct Dav1dDec {
|
pub struct Dav1dDec {
|
||||||
decoder: Mutex<dav1d::Decoder>,
|
decoder: Mutex<dav1d::Decoder>,
|
||||||
negotiation_infos: Mutex<NegotiationInfos>,
|
negotiation_infos: Mutex<NegotiationInfos>,
|
||||||
|
@ -345,26 +346,12 @@ fn video_output_formats() -> Vec<glib::SendValue> {
|
||||||
values.iter().map(|i| i.to_str().to_send_value()).collect()
|
values.iter().map(|i| i.to_str().to_send_value()).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for Dav1dDec {
|
impl ObjectSubclass for Dav1dDec {
|
||||||
const NAME: &'static str = "RsDav1dDec";
|
const NAME: &'static str = "RsDav1dDec";
|
||||||
type Type = super::Dav1dDec;
|
type Type = super::Dav1dDec;
|
||||||
type ParentType = gst_video::VideoDecoder;
|
type ParentType = gst_video::VideoDecoder;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
decoder: Mutex::new(dav1d::Decoder::new()),
|
|
||||||
negotiation_infos: Mutex::new(NegotiationInfos {
|
|
||||||
input_state: None,
|
|
||||||
output_info: None,
|
|
||||||
video_meta_supported: false,
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for Dav1dDec {}
|
impl ObjectImpl for Dav1dDec {}
|
||||||
|
|
|
@ -13,7 +13,6 @@ use std::sync::Mutex;
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
use ::flavors::parser as flavors;
|
use ::flavors::parser as flavors;
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
use gst::{gst_debug, gst_error, gst_log, gst_trace, gst_warning};
|
use gst::{gst_debug, gst_error, gst_log, gst_trace, gst_warning};
|
||||||
|
@ -120,15 +119,12 @@ struct Metadata {
|
||||||
video_bitrate: Option<u32>,
|
video_bitrate: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for FlvDemux {
|
impl ObjectSubclass for FlvDemux {
|
||||||
const NAME: &'static str = "RsFlvDemux";
|
const NAME: &'static str = "RsFlvDemux";
|
||||||
type Type = super::FlvDemux;
|
type Type = super::FlvDemux;
|
||||||
type ParentType = gst::Element;
|
type ParentType = gst::Element;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use atomic_refcell::AtomicRefCell;
|
use atomic_refcell::AtomicRefCell;
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::gst_debug;
|
use gst::gst_debug;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -121,6 +120,7 @@ impl State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct GifEnc {
|
pub struct GifEnc {
|
||||||
state: AtomicRefCell<Option<State>>,
|
state: AtomicRefCell<Option<State>>,
|
||||||
settings: Mutex<Settings>,
|
settings: Mutex<Settings>,
|
||||||
|
@ -130,22 +130,12 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
gst::DebugCategory::new("gifenc", gst::DebugColorFlags::empty(), Some("GIF encoder"))
|
gst::DebugCategory::new("gifenc", gst::DebugColorFlags::empty(), Some("GIF encoder"))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for GifEnc {
|
impl ObjectSubclass for GifEnc {
|
||||||
const NAME: &'static str = "GifEnc";
|
const NAME: &'static str = "GifEnc";
|
||||||
type Type = super::GifEnc;
|
type Type = super::GifEnc;
|
||||||
type ParentType = gst_video::VideoEncoder;
|
type ParentType = gst_video::VideoEncoder;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
state: AtomicRefCell::new(None),
|
|
||||||
settings: Mutex::new(Default::default()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for GifEnc {
|
impl ObjectImpl for GifEnc {
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -62,6 +61,7 @@ struct State {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Struct containing all the element data
|
// Struct containing all the element data
|
||||||
|
#[derive(Default)]
|
||||||
pub struct HsvDetector {
|
pub struct HsvDetector {
|
||||||
settings: Mutex<Settings>,
|
settings: Mutex<Settings>,
|
||||||
state: AtomicRefCell<Option<State>>,
|
state: AtomicRefCell<Option<State>>,
|
||||||
|
@ -75,24 +75,12 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for HsvDetector {
|
impl ObjectSubclass for HsvDetector {
|
||||||
const NAME: &'static str = "HsvDetector";
|
const NAME: &'static str = "HsvDetector";
|
||||||
type Type = super::HsvDetector;
|
type Type = super::HsvDetector;
|
||||||
type ParentType = gst_base::BaseTransform;
|
type ParentType = gst_base::BaseTransform;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
// Boilerplate macro
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
// Creates a new instance.
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
settings: Mutex::new(Default::default()),
|
|
||||||
state: AtomicRefCell::new(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for HsvDetector {
|
impl ObjectImpl for HsvDetector {
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -57,6 +56,7 @@ struct State {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Struct containing all the element data
|
// Struct containing all the element data
|
||||||
|
#[derive(Default)]
|
||||||
pub struct HsvFilter {
|
pub struct HsvFilter {
|
||||||
settings: Mutex<Settings>,
|
settings: Mutex<Settings>,
|
||||||
state: AtomicRefCell<Option<State>>,
|
state: AtomicRefCell<Option<State>>,
|
||||||
|
@ -70,24 +70,12 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for HsvFilter {
|
impl ObjectSubclass for HsvFilter {
|
||||||
const NAME: &'static str = "HsvFilter";
|
const NAME: &'static str = "HsvFilter";
|
||||||
type Type = super::HsvFilter;
|
type Type = super::HsvFilter;
|
||||||
type ParentType = gst_base::BaseTransform;
|
type ParentType = gst_base::BaseTransform;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
// Boilerplate macro
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
// Creates a new instance.
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
settings: Mutex::new(Default::default()),
|
|
||||||
state: AtomicRefCell::new(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for HsvFilter {
|
impl ObjectImpl for HsvFilter {
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use gst::gst_debug;
|
use gst::gst_debug;
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
@ -191,6 +190,7 @@ struct State {
|
||||||
video_info: gst_video::VideoInfo,
|
video_info: gst_video::VideoInfo,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct Rav1Enc {
|
pub struct Rav1Enc {
|
||||||
state: Mutex<Option<State>>,
|
state: Mutex<Option<State>>,
|
||||||
settings: Mutex<Settings>,
|
settings: Mutex<Settings>,
|
||||||
|
@ -204,22 +204,12 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for Rav1Enc {
|
impl ObjectSubclass for Rav1Enc {
|
||||||
const NAME: &'static str = "Rav1Enc";
|
const NAME: &'static str = "Rav1Enc";
|
||||||
type Type = super::Rav1Enc;
|
type Type = super::Rav1Enc;
|
||||||
type ParentType = gst_video::VideoEncoder;
|
type ParentType = gst_video::VideoEncoder;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
state: Mutex::new(None),
|
|
||||||
settings: Mutex::new(Default::default()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for Rav1Enc {
|
impl ObjectImpl for Rav1Enc {
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
use std::{io, io::Write, sync::Arc};
|
use std::{io, io::Write, sync::Arc};
|
||||||
|
|
||||||
use glib::subclass;
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
|
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
@ -160,27 +159,18 @@ impl State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct PngEncoder {
|
pub struct PngEncoder {
|
||||||
state: Mutex<Option<State>>,
|
state: Mutex<Option<State>>,
|
||||||
settings: Mutex<Settings>,
|
settings: Mutex<Settings>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for PngEncoder {
|
impl ObjectSubclass for PngEncoder {
|
||||||
const NAME: &'static str = "PngEncoder";
|
const NAME: &'static str = "PngEncoder";
|
||||||
type Type = super::PngEncoder;
|
type Type = super::PngEncoder;
|
||||||
type ParentType = gst_video::VideoEncoder;
|
type ParentType = gst_video::VideoEncoder;
|
||||||
type Interfaces = ();
|
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
type Class = subclass::simple::ClassStruct<Self>;
|
|
||||||
|
|
||||||
glib::object_subclass!();
|
|
||||||
|
|
||||||
fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
state: Mutex::new(None),
|
|
||||||
settings: Mutex::new(Default::default()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for PngEncoder {
|
impl ObjectImpl for PngEncoder {
|
||||||
|
|
Loading…
Reference in a new issue