mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-25 13:01:07 +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/588>
This commit is contained in:
parent
a84eeeb240
commit
ea6c59e5e9
4 changed files with 16 additions and 16 deletions
|
@ -11,7 +11,7 @@
|
|||
|
||||
use super::SinkEvent;
|
||||
use crate::sink::frame::Frame;
|
||||
use crate::sink::paintable::SinkPaintable;
|
||||
use crate::sink::paintable::Paintable;
|
||||
|
||||
use glib::prelude::*;
|
||||
use glib::Sender;
|
||||
|
@ -29,7 +29,7 @@ use fragile::Fragile;
|
|||
|
||||
pub(super) static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||
gst::DebugCategory::new(
|
||||
"gtk4paintablesink",
|
||||
"gstgtk4paintablesink",
|
||||
gst::DebugColorFlags::empty(),
|
||||
Some("GTK4 Paintable sink"),
|
||||
)
|
||||
|
@ -37,7 +37,7 @@ pub(super) static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
|||
|
||||
#[derive(Default)]
|
||||
pub struct PaintableSink {
|
||||
pub(super) paintable: Mutex<Option<Fragile<SinkPaintable>>>,
|
||||
pub(super) paintable: Mutex<Option<Fragile<Paintable>>>,
|
||||
info: Mutex<Option<gst_video::VideoInfo>>,
|
||||
pub(super) sender: Mutex<Option<Sender<SinkEvent>>>,
|
||||
pub(super) pending_frame: Mutex<Option<Frame>>,
|
||||
|
|
|
@ -22,7 +22,7 @@ mod imp;
|
|||
mod paintable;
|
||||
|
||||
use frame::Frame;
|
||||
use paintable::SinkPaintable;
|
||||
use paintable::Paintable;
|
||||
|
||||
enum SinkEvent {
|
||||
FrameChanged,
|
||||
|
|
|
@ -22,29 +22,29 @@ use once_cell::sync::Lazy;
|
|||
|
||||
pub(super) static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||
gst::DebugCategory::new(
|
||||
"gtk4paintablesink-paintable",
|
||||
"gstgtk4paintable",
|
||||
gst::DebugColorFlags::empty(),
|
||||
Some("GTK4 Paintable Sink Paintable"),
|
||||
)
|
||||
});
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct SinkPaintable {
|
||||
pub struct Paintable {
|
||||
paintables: RefCell<Vec<Texture>>,
|
||||
cached_textures: RefCell<HashMap<usize, gdk::Texture>>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for SinkPaintable {
|
||||
const NAME: &'static str = "GstGtk4PaintableSinkPaintable";
|
||||
type Type = super::SinkPaintable;
|
||||
impl ObjectSubclass for Paintable {
|
||||
const NAME: &'static str = "GstGtk4Paintable";
|
||||
type Type = super::Paintable;
|
||||
type ParentType = glib::Object;
|
||||
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 {
|
||||
if let Some(paintable) = self.paintables.borrow().first() {
|
||||
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>) {
|
||||
if let Some(frame) = frame {
|
||||
gst::trace!(CAT, imp: self, "Received new frame");
|
||||
|
|
|
@ -17,23 +17,23 @@ use gtk::{gdk, glib};
|
|||
mod imp;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct SinkPaintable(ObjectSubclass<imp::SinkPaintable>)
|
||||
pub struct Paintable(ObjectSubclass<imp::Paintable>)
|
||||
@implements gdk::Paintable;
|
||||
}
|
||||
|
||||
impl SinkPaintable {
|
||||
impl Paintable {
|
||||
pub fn new() -> Self {
|
||||
glib::Object::new(&[])
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for SinkPaintable {
|
||||
impl Default for Paintable {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl SinkPaintable {
|
||||
impl Paintable {
|
||||
pub(crate) fn handle_frame_changed(&self, frame: Option<Frame>) {
|
||||
let imp = self.imp();
|
||||
imp.handle_frame_changed(frame);
|
||||
|
|
Loading…
Reference in a new issue