video: Update to 2018 edition

This commit is contained in:
Sebastian Dröge 2020-11-22 19:21:45 +02:00
parent 767ed3afae
commit f81d7b61b5
52 changed files with 189 additions and 230 deletions

View file

@ -9,15 +9,17 @@ edition = "2018"
[dependencies]
glib = { git = "https://github.com/gtk-rs/gtk-rs" }
gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
gstreamer-video = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
gstreamer-app = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
cdg = "0.1"
cdg_renderer = "0.6"
image = { version = "0.23", default-features = false }
muldiv = "1.0"
lazy_static = "1.0"
once_cell = "1.0"
[dev-dependencies]
gst-app = { package = "gstreamer-app", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
[lib]
name = "gstcdg"

View file

@ -9,18 +9,19 @@
use glib::subclass;
use glib::subclass::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error};
use gst_video::prelude::VideoDecoderExtManual;
use gst_video::prelude::*;
use gst_video::subclass::prelude::*;
use image::GenericImageView;
use once_cell::sync::Lazy;
use std::sync::Mutex;
use crate::constants::{CDG_HEIGHT, CDG_WIDTH};
lazy_static! {
static ref CAT: gst::DebugCategory =
gst::DebugCategory::new("cdgdec", gst::DebugColorFlags::empty(), Some("CDG decoder"),);
}
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new("cdgdec", gst::DebugColorFlags::empty(), Some("CDG decoder"))
});
pub struct CdgDec {
cdg_inter: Mutex<Box<cdg_renderer::CdgInterpreter>>,
@ -34,7 +35,7 @@ impl ObjectSubclass for CdgDec {
type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!();
glib::glib_object_subclass!();
fn new() -> Self {
Self {

View file

@ -10,7 +10,7 @@ use glib::prelude::*;
mod imp;
glib_wrapper! {
glib::glib_wrapper! {
pub struct CdgDec(ObjectSubclass<imp::CdgDec>) @extends gst_video::VideoDecoder, gst::Element, gst::Object;
}

View file

@ -8,11 +8,13 @@
use glib::subclass;
use glib::subclass::prelude::*;
use gst::format::Bytes;
use gst::subclass::prelude::*;
use gst::SECOND_VAL;
use gst::{gst_debug, gst_element_error};
use gst_base::prelude::*;
use gst_base::subclass::prelude::*;
use gstreamer::format::Bytes;
use once_cell::sync::Lazy;
use std::convert::TryInto;
use crate::constants::{
@ -25,13 +27,13 @@ const CDG_CMD_MEMORY_LOAD_COLOR_TABLE_2: u8 = 31;
pub struct CdgParse;
lazy_static! {
static ref CAT: gst::DebugCategory = gst::DebugCategory::new(
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
"cdgparse",
gst::DebugColorFlags::empty(),
Some("CDG parser"),
);
}
)
});
impl ObjectSubclass for CdgParse {
const NAME: &'static str = "CdgParse";
@ -40,7 +42,7 @@ impl ObjectSubclass for CdgParse {
type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!();
glib::glib_object_subclass!();
fn new() -> Self {
Self

View file

@ -10,7 +10,7 @@ use glib::prelude::*;
mod imp;
glib_wrapper! {
glib::glib_wrapper! {
pub struct CdgParse(ObjectSubclass<imp::CdgParse>) @extends gst_base::BaseParse, gst::Element, gst::Object;
}

View file

@ -6,15 +6,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate glib;
#[macro_use]
extern crate gstreamer as gst;
extern crate gstreamer_base as gst_base;
extern crate gstreamer_video as gst_video;
#[macro_use]
extern crate lazy_static;
mod cdgdec;
mod cdgparse;
mod constants;
@ -27,7 +18,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
Ok(())
}
gst_plugin_define!(
gst::gst_plugin_define!(
cdg,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -6,9 +6,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate gstreamer as gst;
extern crate gstreamer_app as gst_app;
use gst::prelude::*;
use std::path::PathBuf;

View file

@ -13,10 +13,9 @@ nom = "6.0"
either = "1"
uuid = { version = "0.8", features = ["v4"] }
chrono = "0.4"
lazy_static = "1.2"
once_cell = "1.0"
atomic_refcell = "0.1"
cairo-rs = { git = "https://github.com/gtk-rs/gtk-rs", features=["use_glib"] }
cairo-sys-rs = { git = "https://github.com/gtk-rs/gtk-rs" }
pango = { git = "https://github.com/gtk-rs/gtk-rs" }
pangocairo = { git = "https://github.com/gtk-rs/gtk-rs" }
byteorder = "1"

View file

@ -19,21 +19,24 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_element_error, gst_element_warning, gst_loggable_error, gst_trace, gst_warning};
use gst_base::subclass::prelude::*;
use byteorder::{BigEndian, ByteOrder};
use once_cell::sync::Lazy;
use std::fmt;
use std::sync::Mutex;
use std::u64;
lazy_static! {
static ref CAT: gst::DebugCategory = gst::DebugCategory::new(
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
"ccdetect",
gst::DebugColorFlags::empty(),
Some("Closed Caption Detection"),
);
}
)
});
const DEFAULT_WINDOW: u64 = 10 * gst::SECOND_VAL;
const DEFAULT_CC608: bool = false;
@ -387,7 +390,7 @@ impl ObjectSubclass for CCDetect {
type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!();
glib::glib_object_subclass!();
fn new() -> Self {
Self {

View file

@ -19,7 +19,7 @@ use glib::prelude::*;
mod imp;
glib_wrapper! {
glib::glib_wrapper! {
pub struct CCDetect(ObjectSubclass<imp::CCDetect>) @extends gst_base::BaseTransform, gst::Element, gst::Object;
}

View file

@ -19,23 +19,24 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_element_error, gst_error, gst_log, gst_trace};
use gst_video::prelude::*;
use once_cell::sync::Lazy;
use std::sync::Mutex;
use pango::prelude::*;
use crate::caption_frame::{CaptionFrame, Status};
lazy_static! {
static ref CAT: gst::DebugCategory = {
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
"cea608overlay",
gst::DebugColorFlags::empty(),
Some("CEA 608 overlay element"),
)
};
}
});
struct State {
video_info: Option<gst_video::VideoInfo>,
@ -209,7 +210,7 @@ impl Cea608Overlay {
// anymore mutably.
unsafe {
assert_eq!(
cairo_sys::cairo_surface_get_reference_count(surface.to_raw_none()),
cairo::ffi::cairo_surface_get_reference_count(surface.to_raw_none()),
1
);
let buffer = glib::translate::from_glib_none(buffer_ptr);
@ -391,7 +392,7 @@ impl ObjectSubclass for Cea608Overlay {
type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!();
glib::glib_object_subclass!();
fn with_class(klass: &Self::Class) -> Self {
let templ = klass.get_pad_template("sink").unwrap();

View file

@ -25,7 +25,7 @@ use glib::prelude::*;
mod imp;
glib_wrapper! {
glib::glib_wrapper! {
pub struct Cea608Overlay(ObjectSubclass<imp::Cea608Overlay>) @extends gst::Element, gst::Object;
}

View file

@ -10,10 +10,13 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_error, gst_log, gst_trace};
use crate::caption_frame::{CaptionFrame, Status};
use atomic_refcell::AtomicRefCell;
use once_cell::sync::Lazy;
#[derive(Copy, Clone, Debug)]
enum Format {
Srt,
@ -48,13 +51,13 @@ pub struct Cea608ToTt {
state: AtomicRefCell<State>,
}
lazy_static! {
static ref CAT: gst::DebugCategory = gst::DebugCategory::new(
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
"cea608tott",
gst::DebugColorFlags::empty(),
Some("CEA-608 to TT Element"),
);
}
)
});
impl Cea608ToTt {
fn sink_chain(
@ -375,7 +378,7 @@ impl ObjectSubclass for Cea608ToTt {
type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!();
glib::glib_object_subclass!();
fn with_class(klass: &Self::Class) -> Self {
let templ = klass.get_pad_template("sink").unwrap();

View file

@ -10,7 +10,7 @@ use glib::prelude::*;
mod imp;
glib_wrapper! {
glib::glib_wrapper! {
pub struct Cea608ToTt(ObjectSubclass<imp::Cea608ToTt>) @extends gst::Element, gst::Object;
}

View file

@ -17,17 +17,6 @@
#![recursion_limit = "128"]
#[macro_use]
extern crate glib;
#[macro_use]
extern crate gst;
#[macro_use]
extern crate lazy_static;
#[cfg(test)]
#[macro_use]
extern crate pretty_assertions;
#[allow(non_camel_case_types, non_upper_case_globals, unused)]
#[allow(clippy::redundant_static_lifetimes, clippy::unreadable_literal)]
#[allow(clippy::useless_transmute, clippy::trivially_copy_pass_by_ref)]
@ -57,7 +46,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
Ok(())
}
gst_plugin_define!(
gst::gst_plugin_define!(
rsclosedcaption,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -21,10 +21,13 @@ use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::structure;
use gst::subclass::prelude::*;
use gst::{gst_element_error, gst_error, gst_log, gst_trace};
use chrono::prelude::*;
use uuid::Uuid;
use once_cell::sync::Lazy;
use std::io::Write;
use std::sync::Mutex;
@ -94,13 +97,13 @@ pub struct MccEnc {
settings: Mutex<Settings>,
}
lazy_static! {
static ref CAT: gst::DebugCategory = gst::DebugCategory::new(
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
"mccenc",
gst::DebugColorFlags::empty(),
Some("Mcc Encoder Element"),
);
}
)
});
impl MccEnc {
#[allow(clippy::write_with_newline)]
@ -470,7 +473,7 @@ impl ObjectSubclass for MccEnc {
type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!();
glib::glib_object_subclass!();
fn with_class(klass: &Self::Class) -> Self {
let templ = klass.get_pad_template("sink").unwrap();

View file

@ -20,7 +20,7 @@ use glib::prelude::*;
mod headers;
mod imp;
glib_wrapper! {
glib::glib_wrapper! {
pub struct MccEnc(ObjectSubclass<imp::MccEnc>) @extends gst::Element, gst::Object;
}

View file

@ -20,25 +20,29 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{
gst_debug, gst_element_error, gst_error, gst_fixme, gst_info, gst_log, gst_loggable_error,
gst_trace, gst_warning,
};
use gst_video::ValidVideoTimeCode;
use std::cmp;
use std::convert::TryInto;
use std::sync::{Mutex, MutexGuard};
use once_cell::sync::Lazy;
use super::parser::{MccLine, MccParser};
use crate::line_reader::LineReader;
use crate::parser_utils::TimeCode;
lazy_static! {
static ref CAT: gst::DebugCategory = {
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
"mccparse",
gst::DebugColorFlags::empty(),
Some("Mcc Parser Element"),
)
};
}
});
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum Format {
@ -1133,7 +1137,7 @@ impl ObjectSubclass for MccParse {
type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!();
glib::glib_object_subclass!();
fn with_class(klass: &Self::Class) -> Self {
let templ = klass.get_pad_template("sink").unwrap();

View file

@ -20,7 +20,7 @@ use glib::prelude::*;
mod imp;
mod parser;
glib_wrapper! {
glib::glib_wrapper! {
pub struct MccParse(ObjectSubclass<imp::MccParse>) @extends gst::Element, gst::Object;
}

View file

@ -21,20 +21,21 @@ use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::structure;
use gst::subclass::prelude::*;
use gst::{gst_element_error, gst_error, gst_log, gst_trace};
use gst_video::{self, ValidVideoTimeCode};
use once_cell::sync::Lazy;
use std::io::Write;
use std::sync::Mutex;
lazy_static! {
static ref CAT: gst::DebugCategory = {
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
"sccenc",
gst::DebugColorFlags::empty(),
Some("Scc Encoder Element"),
)
};
}
});
#[derive(Debug)]
struct State {
@ -339,7 +340,7 @@ impl ObjectSubclass for SccEnc {
type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!();
glib::glib_object_subclass!();
fn with_class(klass: &Self::Class) -> Self {
let templ = klass.get_pad_template("sink").unwrap();

View file

@ -20,7 +20,7 @@ use glib::prelude::*;
mod imp;
glib_wrapper! {
glib::glib_wrapper! {
pub struct SccEnc(ObjectSubclass<imp::SccEnc>) @extends gst::Element, gst::Object;
}

View file

@ -20,22 +20,23 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_fixme, gst_log, gst_trace, gst_warning};
use std::sync::{Mutex, MutexGuard};
use once_cell::sync::Lazy;
use super::parser::{SccLine, SccParser};
use crate::line_reader::LineReader;
use crate::parser_utils::TimeCode;
lazy_static! {
static ref CAT: gst::DebugCategory = {
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
"sccparse",
gst::DebugColorFlags::empty(),
Some("Scc Parser Element"),
)
};
}
});
#[derive(Debug)]
struct State {
@ -430,7 +431,7 @@ impl ObjectSubclass for SccParse {
type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!();
glib::glib_object_subclass!();
fn with_class(klass: &Self::Class) -> Self {
let templ = klass.get_pad_template("sink").unwrap();

View file

@ -21,7 +21,7 @@ use glib::prelude::*;
mod imp;
mod parser;
glib_wrapper! {
glib::glib_wrapper! {
pub struct SccParse(ObjectSubclass<imp::SccParse>) @extends gst::Element, gst::Object;
}

View file

@ -20,6 +20,9 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_log, gst_trace, gst_warning};
use once_cell::sync::Lazy;
use crate::ffi;
use std::sync::Mutex;
@ -263,14 +266,15 @@ pub struct TtToCea608 {
settings: Mutex<Settings>,
}
lazy_static! {
static ref CAT: gst::DebugCategory = gst::DebugCategory::new(
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
"tttocea608",
gst::DebugColorFlags::empty(),
Some("TT CEA 608 Element"),
);
static ref SPACE: u16 = eia608_from_utf8_1(&[0x20, 0, 0, 0, 0]);
}
)
});
static SPACE: Lazy<u16> = Lazy::new(|| eia608_from_utf8_1(&[0x20, 0, 0, 0, 0]));
impl TtToCea608 {
fn push_gap(&self, last_frame_no: u64, new_frame_no: u64) {
@ -786,7 +790,7 @@ impl ObjectSubclass for TtToCea608 {
type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!();
glib::glib_object_subclass!();
fn with_class(klass: &Self::Class) -> Self {
let templ = klass.get_pad_template("sink").unwrap();

View file

@ -16,11 +16,10 @@
// Boston, MA 02110-1335, USA.
use glib::prelude::*;
use glib::GEnum;
mod imp;
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, GEnum)]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::GEnum)]
#[repr(u32)]
#[genum(type_name = "GstTtToCea608Mode")]
enum Mode {
@ -30,7 +29,7 @@ enum Mode {
RollUp4,
}
glib_wrapper! {
glib::glib_wrapper! {
pub struct TtToCea608(ObjectSubclass<imp::TtToCea608>) @extends gst::Element, gst::Object;
}

View file

@ -15,13 +15,12 @@
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
// Boston, MA 02110-1335, USA.
#[macro_use]
extern crate pretty_assertions;
use gst::prelude::*;
use std::sync::{Arc, Mutex};
use pretty_assertions::assert_eq;
fn init() {
use std::sync::Once;
static INIT: Once = Once::new();

View file

@ -15,11 +15,10 @@
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
// Boston, MA 02110-1335, USA.
#[macro_use]
extern crate pretty_assertions;
use gst::prelude::*;
use pretty_assertions::assert_eq;
fn init() {
use std::sync::Once;
static INIT: Once = Once::new();

View file

@ -15,11 +15,10 @@
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
// Boston, MA 02110-1335, USA.
#[macro_use]
extern crate pretty_assertions;
use glib::prelude::*;
use pretty_assertions::assert_eq;
fn init() {
use std::sync::Once;
static INIT: Once = Once::new();

View file

@ -15,11 +15,9 @@
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
// Boston, MA 02110-1335, USA.
#[macro_use]
extern crate pretty_assertions;
use gst::prelude::*;
use gst::EventView;
use pretty_assertions::assert_eq;
use rand::{Rng, SeedableRng};
use std::path::PathBuf;

View file

@ -16,8 +16,7 @@
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
// Boston, MA 02110-1335, USA.
#[macro_use]
extern crate pretty_assertions;
use pretty_assertions::assert_eq;
fn init() {
use std::sync::Once;

View file

@ -16,11 +16,9 @@
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
// Boston, MA 02110-1335, USA.
#[macro_use]
extern crate pretty_assertions;
use gst::prelude::*;
use gst_video::{ValidVideoTimeCode, VideoTimeCode};
use pretty_assertions::assert_eq;
use rand::{Rng, SeedableRng};
use std::collections::VecDeque;

View file

@ -15,9 +15,8 @@
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
// Boston, MA 02110-1335, USA.
#[macro_use]
extern crate pretty_assertions;
use gst::EventView;
use pretty_assertions::assert_eq;
fn init() {
use std::sync::Once;

View file

@ -10,10 +10,10 @@ description = "Dav1d Plugin"
[dependencies]
dav1d = "0.5"
glib = { git = "https://github.com/gtk-rs/gtk-rs" }
gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gstreamer-video = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
lazy_static = "1.0"
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
once_cell = "1.0"
[lib]
name = "gstrsdav1d"

View file

@ -10,9 +10,12 @@ use glib::subclass;
use glib::subclass::prelude::*;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_error, gst_info, gst_trace, gst_warning};
use gst_video::prelude::*;
use gst_video::subclass::prelude::*;
use once_cell::sync::Lazy;
use std::convert::TryInto;
use std::i32;
use std::str::FromStr;
@ -30,13 +33,13 @@ pub struct Dav1dDec {
negotiation_infos: Mutex<NegotiationInfos>,
}
lazy_static! {
static ref CAT: gst::DebugCategory = gst::DebugCategory::new(
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
"dav1ddec",
gst::DebugColorFlags::empty(),
Some("Dav1d AV1 decoder"),
);
}
)
});
impl Dav1dDec {
pub fn gst_video_format_from_dav1d_picture(
@ -349,7 +352,7 @@ impl ObjectSubclass for Dav1dDec {
type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!();
glib::glib_object_subclass!();
fn new() -> Self {
Self {

View file

@ -10,7 +10,7 @@ use glib::prelude::*;
mod imp;
glib_wrapper! {
glib::glib_wrapper! {
pub struct Dav1dDec(ObjectSubclass<imp::Dav1dDec>) @extends gst_video::VideoDecoder, gst::Element, gst::Object;
}

View file

@ -6,16 +6,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate glib;
#[macro_use]
extern crate gstreamer as gst;
extern crate dav1d;
extern crate gstreamer_base as gst_base;
extern crate gstreamer_video as gst_video;
#[macro_use]
extern crate lazy_static;
mod dav1ddec;
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
@ -23,7 +13,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
Ok(())
}
gst_plugin_define!(
gst::gst_plugin_define!(
rsdav1d,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -9,14 +9,14 @@ description = "Rust FLV Plugin"
[dependencies]
glib = { git = "https://github.com/gtk-rs/gtk-rs" }
gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
num-rational = { version = "0.3", default-features = false, features = [] }
nom = "6"
flavors = { git = "https://github.com/rust-av/flavors" }
muldiv = "1.0"
byteorder = "1.0"
lazy_static = "1.0"
once_cell = "1.0"
smallvec = "1.0"
[lib]

View file

@ -16,20 +16,23 @@ use ::flavors::parser as flavors;
use glib::subclass;
use gst::prelude::*;
use gst::subclass::prelude::*;
use gst::{
gst_debug, gst_error, gst_error_msg, gst_log, gst_loggable_error, gst_trace, gst_warning,
};
use num_rational::Rational32;
use once_cell::sync::Lazy;
use smallvec::SmallVec;
lazy_static! {
static ref CAT: gst::DebugCategory = {
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
"rsflvdemux",
gst::DebugColorFlags::empty(),
Some("Rust FLV demuxer"),
)
};
}
});
pub struct FlvDemux {
sinkpad: gst::Pad,
@ -126,7 +129,7 @@ impl ObjectSubclass for FlvDemux {
type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!();
glib::glib_object_subclass!();
fn with_class(klass: &Self::Class) -> Self {
let templ = klass.get_pad_template("sink").unwrap();
@ -374,7 +377,7 @@ impl FlvDemux {
}
fn sink_event(&self, pad: &gst::Pad, element: &super::FlvDemux, event: gst::Event) -> bool {
use crate::gst::EventView;
use gst::EventView;
gst_log!(CAT, obj: pad, "Handling event {:?}", event);
match event.view() {
@ -404,7 +407,7 @@ impl FlvDemux {
element: &super::FlvDemux,
query: &mut gst::QueryRef,
) -> bool {
use crate::gst::QueryView;
use gst::QueryView;
match query.view_mut() {
QueryView::Position(ref mut q) => {
@ -452,7 +455,7 @@ impl FlvDemux {
}
fn src_event(&self, pad: &gst::Pad, element: &super::FlvDemux, event: gst::Event) -> bool {
use crate::gst::EventView;
use gst::EventView;
match event.view() {
EventView::Seek(..) => {

View file

@ -10,7 +10,7 @@ use glib::prelude::*;
mod imp;
glib_wrapper! {
glib::glib_wrapper! {
pub struct FlvDemux(ObjectSubclass<imp::FlvDemux>) @extends gst::Element, gst::Object;
}

View file

@ -6,15 +6,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate glib;
#[macro_use]
extern crate gstreamer as gst;
extern crate gstreamer_base as gst_base;
#[macro_use]
extern crate lazy_static;
mod bytes;
mod flvdemux;
@ -22,7 +13,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
flvdemux::register(plugin)
}
gst_plugin_define!(
gst::gst_plugin_define!(
rsflv,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -9,13 +9,15 @@ description = "GStreamer GIF plugin"
[dependencies]
glib = { git = "https://github.com/gtk-rs/gtk-rs" }
gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gstreamer-video = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gstreamer-check = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gif = "0.11"
atomic_refcell = "0.1"
once_cell = "1"
[dev-dependencies]
gst-check = { package = "gstreamer-check", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
[lib]
name = "gstgif"
crate-type = ["cdylib", "rlib", "staticlib"]

View file

@ -15,7 +15,6 @@
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
// Boston, MA 02110-1335, USA.
extern crate gstreamer as gst;
use gst::prelude::*;
const ENCODE_PIPELINE: &str = "videotestsrc is-live=false num-buffers=100 ! videoconvert ! gifenc ! filesink location=test.gif";

View file

@ -10,6 +10,7 @@ use atomic_refcell::AtomicRefCell;
use glib::subclass;
use glib::subclass::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_loggable_error};
use gst_video::prelude::*;
use gst_video::subclass::prelude::*;
use once_cell::sync::Lazy;
@ -148,7 +149,7 @@ impl ObjectSubclass for GifEnc {
type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!();
glib::glib_object_subclass!();
fn new() -> Self {
Self {

View file

@ -10,7 +10,7 @@ use glib::prelude::*;
mod imp;
glib_wrapper! {
glib::glib_wrapper! {
pub struct GifEnc(ObjectSubclass<imp::GifEnc>) @extends gst_video::VideoEncoder, gst::Element, gst::Object;
}

View file

@ -6,19 +6,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate glib;
#[macro_use]
extern crate gstreamer as gst;
extern crate gstreamer_video as gst_video;
mod gifenc;
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gifenc::register(plugin)
}
gst_plugin_define!(
gst::gst_plugin_define!(
gifenc,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -6,13 +6,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate glib;
extern crate gstreamer as gst;
extern crate gstreamer_check as gst_check;
extern crate gstreamer_video as gst_video;
extern crate gstgif;
fn init() {
use std::sync::Once;
static INIT: Once = Once::new();

View file

@ -9,12 +9,14 @@ edition = "2018"
[dependencies]
glib = { git = "https://github.com/gtk-rs/gtk-rs" }
gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gstreamer-video = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
gstreamer-check = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
rav1e = { version = "0.3", default-features = false }
atomic_refcell = "0.1"
lazy_static = "1.0"
once_cell = "1.0"
[dev-dependencies]
gst-check = { package = "gstreamer-check", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
[lib]
name = "gstrav1e"

View file

@ -6,21 +6,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate glib;
#[macro_use]
extern crate gstreamer as gst;
extern crate gstreamer_video as gst_video;
#[macro_use]
extern crate lazy_static;
mod rav1enc;
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
rav1enc::register(plugin)
}
gst_plugin_define!(
gst::gst_plugin_define!(
rav1e,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,

View file

@ -10,8 +10,10 @@ use atomic_refcell::AtomicRefCell;
use glib::subclass;
use glib::subclass::prelude::*;
use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_loggable_error};
use gst_video::prelude::*;
use gst_video::subclass::prelude::*;
use once_cell::sync::Lazy;
use rav1e::color;
use rav1e::config;
use rav1e::data;
@ -286,13 +288,13 @@ pub struct Rav1Enc {
settings: Mutex<Settings>,
}
lazy_static! {
static ref CAT: gst::DebugCategory = gst::DebugCategory::new(
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
"rav1enc",
gst::DebugColorFlags::empty(),
Some("rav1e AV1 encoder"),
);
}
)
});
impl ObjectSubclass for Rav1Enc {
const NAME: &'static str = "Rav1Enc";
@ -301,7 +303,7 @@ impl ObjectSubclass for Rav1Enc {
type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!();
glib::glib_object_subclass!();
fn new() -> Self {
Self {

View file

@ -10,7 +10,7 @@ use glib::prelude::*;
mod imp;
glib_wrapper! {
glib::glib_wrapper! {
pub struct Rav1Enc(ObjectSubclass<imp::Rav1Enc>) @extends gst_video::VideoEncoder, gst::Element, gst::Object;
}

View file

@ -6,13 +6,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate glib;
use glib::prelude::*;
extern crate gstreamer as gst;
extern crate gstreamer_check as gst_check;
extern crate gstreamer_video as gst_video;
extern crate gstrav1e;
fn init() {
use std::sync::Once;

View file

@ -11,12 +11,14 @@ description = "An PNG encoder/decoder written in pure Rust"
glib = { git = "https://github.com/gtk-rs/gtk-rs" }
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gst_video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gst_check = { package = "gstreamer-check", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
png = "0.16.3"
once_cell = "1"
parking_lot = "0.11"
atomic_refcell = "0.1"
[dev-dependencies]
gst_check = { package = "gstreamer-check", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
[lib]
name = "gstrspng"
crate-type = ["cdylib", "rlib", "staticlib"]