mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-10 11:15:33 +00:00
video/gtk4: Rename Object types and struct to something simpler
Avoid the confusion caused by SinkPaintable and PaintableSink, and instead refer to the objects as Paintable for the GdkPaintable subclass or PaintalbeSink for the gst element. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1008>
This commit is contained in:
parent
b8d2d98027
commit
9fa3d88a63
4 changed files with 16 additions and 16 deletions
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
use super::SinkEvent;
|
use super::SinkEvent;
|
||||||
use crate::sink::frame::Frame;
|
use crate::sink::frame::Frame;
|
||||||
use crate::sink::paintable::SinkPaintable;
|
use crate::sink::paintable::Paintable;
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::Sender;
|
use glib::Sender;
|
||||||
|
@ -29,7 +29,7 @@ use fragile::Fragile;
|
||||||
|
|
||||||
pub(super) static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
pub(super) static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
gst::DebugCategory::new(
|
gst::DebugCategory::new(
|
||||||
"gtk4paintablesink",
|
"gstgtk4paintablesink",
|
||||||
gst::DebugColorFlags::empty(),
|
gst::DebugColorFlags::empty(),
|
||||||
Some("GTK4 Paintable sink"),
|
Some("GTK4 Paintable sink"),
|
||||||
)
|
)
|
||||||
|
@ -37,7 +37,7 @@ pub(super) static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct PaintableSink {
|
pub struct PaintableSink {
|
||||||
pub(super) paintable: Mutex<Option<Fragile<SinkPaintable>>>,
|
pub(super) paintable: Mutex<Option<Fragile<Paintable>>>,
|
||||||
info: Mutex<Option<gst_video::VideoInfo>>,
|
info: Mutex<Option<gst_video::VideoInfo>>,
|
||||||
pub(super) sender: Mutex<Option<Sender<SinkEvent>>>,
|
pub(super) sender: Mutex<Option<Sender<SinkEvent>>>,
|
||||||
pub(super) pending_frame: Mutex<Option<Frame>>,
|
pub(super) pending_frame: Mutex<Option<Frame>>,
|
||||||
|
|
|
@ -22,7 +22,7 @@ mod imp;
|
||||||
mod paintable;
|
mod paintable;
|
||||||
|
|
||||||
use frame::Frame;
|
use frame::Frame;
|
||||||
use paintable::SinkPaintable;
|
use paintable::Paintable;
|
||||||
|
|
||||||
enum SinkEvent {
|
enum SinkEvent {
|
||||||
FrameChanged,
|
FrameChanged,
|
||||||
|
|
|
@ -22,29 +22,29 @@ use once_cell::sync::Lazy;
|
||||||
|
|
||||||
pub(super) static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
pub(super) static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
gst::DebugCategory::new(
|
gst::DebugCategory::new(
|
||||||
"gtk4paintablesink-paintable",
|
"gstgtk4paintable",
|
||||||
gst::DebugColorFlags::empty(),
|
gst::DebugColorFlags::empty(),
|
||||||
Some("GTK4 Paintable Sink Paintable"),
|
Some("GTK4 Paintable Sink Paintable"),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct SinkPaintable {
|
pub struct Paintable {
|
||||||
paintables: RefCell<Vec<Texture>>,
|
paintables: RefCell<Vec<Texture>>,
|
||||||
cached_textures: RefCell<HashMap<usize, gdk::Texture>>,
|
cached_textures: RefCell<HashMap<usize, gdk::Texture>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[glib::object_subclass]
|
#[glib::object_subclass]
|
||||||
impl ObjectSubclass for SinkPaintable {
|
impl ObjectSubclass for Paintable {
|
||||||
const NAME: &'static str = "GstGtk4PaintableSinkPaintable";
|
const NAME: &'static str = "GstGtk4Paintable";
|
||||||
type Type = super::SinkPaintable;
|
type Type = super::Paintable;
|
||||||
type ParentType = glib::Object;
|
type ParentType = glib::Object;
|
||||||
type Interfaces = (gdk::Paintable,);
|
type Interfaces = (gdk::Paintable,);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ObjectImpl for SinkPaintable {}
|
impl ObjectImpl for Paintable {}
|
||||||
|
|
||||||
impl PaintableImpl for SinkPaintable {
|
impl PaintableImpl for Paintable {
|
||||||
fn intrinsic_height(&self) -> i32 {
|
fn intrinsic_height(&self) -> i32 {
|
||||||
if let Some(paintable) = self.paintables.borrow().first() {
|
if let Some(paintable) = self.paintables.borrow().first() {
|
||||||
f32::round(paintable.height) as i32
|
f32::round(paintable.height) as i32
|
||||||
|
@ -134,7 +134,7 @@ impl PaintableImpl for SinkPaintable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SinkPaintable {
|
impl Paintable {
|
||||||
pub(super) fn handle_frame_changed(&self, frame: Option<Frame>) {
|
pub(super) fn handle_frame_changed(&self, frame: Option<Frame>) {
|
||||||
if let Some(frame) = frame {
|
if let Some(frame) = frame {
|
||||||
gst::trace!(CAT, imp: self, "Received new frame");
|
gst::trace!(CAT, imp: self, "Received new frame");
|
||||||
|
|
|
@ -17,23 +17,23 @@ use gtk::{gdk, glib};
|
||||||
mod imp;
|
mod imp;
|
||||||
|
|
||||||
glib::wrapper! {
|
glib::wrapper! {
|
||||||
pub struct SinkPaintable(ObjectSubclass<imp::SinkPaintable>)
|
pub struct Paintable(ObjectSubclass<imp::Paintable>)
|
||||||
@implements gdk::Paintable;
|
@implements gdk::Paintable;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SinkPaintable {
|
impl Paintable {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
glib::Object::new(&[])
|
glib::Object::new(&[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for SinkPaintable {
|
impl Default for Paintable {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new()
|
Self::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SinkPaintable {
|
impl Paintable {
|
||||||
pub(crate) fn handle_frame_changed(&self, frame: Option<Frame>) {
|
pub(crate) fn handle_frame_changed(&self, frame: Option<Frame>) {
|
||||||
let imp = self.imp();
|
let imp = self.imp();
|
||||||
imp.handle_frame_changed(frame);
|
imp.handle_frame_changed(frame);
|
||||||
|
|
Loading…
Reference in a new issue