diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2022-02-28 19:32:36 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2022-02-28 19:56:58 +0300 |
commit | b38f6cc731b1b4bcec1e19f7e5b9767d1804d343 (patch) | |
tree | 55e3a6a616d0b1a4549b3553ca744f58beeb09e6 /video | |
parent | d9f3e8e9e7249c3a0c8c251c7e371079f6846ff7 (diff) |
Remove now unnecessary `Send+Sync` impls for element/etc subclasses
This is now automatically implemented.
Diffstat (limited to 'video')
26 files changed, 5 insertions, 121 deletions
diff --git a/video/cdg/src/cdgdec/mod.rs b/video/cdg/src/cdgdec/mod.rs index 71d51993b..0f824779c 100644 --- a/video/cdg/src/cdgdec/mod.rs +++ b/video/cdg/src/cdgdec/mod.rs @@ -17,11 +17,6 @@ glib::wrapper! { pub struct CdgDec(ObjectSubclass<imp::CdgDec>) @extends gst_video::VideoDecoder, gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for CdgDec {} -unsafe impl Sync for CdgDec {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/cdg/src/cdgparse/mod.rs b/video/cdg/src/cdgparse/mod.rs index b5cb26180..ec2b12540 100644 --- a/video/cdg/src/cdgparse/mod.rs +++ b/video/cdg/src/cdgparse/mod.rs @@ -17,11 +17,6 @@ glib::wrapper! { pub struct CdgParse(ObjectSubclass<imp::CdgParse>) @extends gst_base::BaseParse, gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for CdgParse {} -unsafe impl Sync for CdgParse {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/closedcaption/src/ccdetect/mod.rs b/video/closedcaption/src/ccdetect/mod.rs index 0aa65d0dc..c9fd1b74c 100644 --- a/video/closedcaption/src/ccdetect/mod.rs +++ b/video/closedcaption/src/ccdetect/mod.rs @@ -15,11 +15,6 @@ glib::wrapper! { pub struct CCDetect(ObjectSubclass<imp::CCDetect>) @extends gst_base::BaseTransform, gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for CCDetect {} -unsafe impl Sync for CCDetect {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/closedcaption/src/cea608overlay/imp.rs b/video/closedcaption/src/cea608overlay/imp.rs index 430bc5d6c..ead742e92 100644 --- a/video/closedcaption/src/cea608overlay/imp.rs +++ b/video/closedcaption/src/cea608overlay/imp.rs @@ -59,6 +59,11 @@ struct State { last_cc_pts: Option<gst::ClockTime>, } +// SAFETY: Required because `pango::Layout` is not `Send` but the whole `State` needs to be. +// We ensure that no additional references to the layout are ever created, which makes it safe +// to send it to other threads as long as only a single thread uses it concurrently. +unsafe impl Send for State {} + impl Default for State { fn default() -> Self { Self { @@ -74,8 +79,6 @@ impl Default for State { } } -unsafe impl Send for State {} - pub struct Cea608Overlay { srcpad: gst::Pad, sinkpad: gst::Pad, diff --git a/video/closedcaption/src/cea608overlay/mod.rs b/video/closedcaption/src/cea608overlay/mod.rs index bdc62cac2..739830ad0 100644 --- a/video/closedcaption/src/cea608overlay/mod.rs +++ b/video/closedcaption/src/cea608overlay/mod.rs @@ -21,11 +21,6 @@ glib::wrapper! { pub struct Cea608Overlay(ObjectSubclass<imp::Cea608Overlay>) @extends gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for Cea608Overlay {} -unsafe impl Sync for Cea608Overlay {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/closedcaption/src/cea608tojson/mod.rs b/video/closedcaption/src/cea608tojson/mod.rs index 02ffc7684..b684d990b 100644 --- a/video/closedcaption/src/cea608tojson/mod.rs +++ b/video/closedcaption/src/cea608tojson/mod.rs @@ -15,11 +15,6 @@ glib::wrapper! { pub struct Cea608ToJson(ObjectSubclass<imp::Cea608ToJson>) @extends gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for Cea608ToJson {} -unsafe impl Sync for Cea608ToJson {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/closedcaption/src/cea608tott/mod.rs b/video/closedcaption/src/cea608tott/mod.rs index 86f8b69d7..905ffe1d0 100644 --- a/video/closedcaption/src/cea608tott/mod.rs +++ b/video/closedcaption/src/cea608tott/mod.rs @@ -15,11 +15,6 @@ glib::wrapper! { pub struct Cea608ToTt(ObjectSubclass<imp::Cea608ToTt>) @extends gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for Cea608ToTt {} -unsafe impl Sync for Cea608ToTt {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/closedcaption/src/jsontovtt/mod.rs b/video/closedcaption/src/jsontovtt/mod.rs index 8e57133f8..b75cf9081 100644 --- a/video/closedcaption/src/jsontovtt/mod.rs +++ b/video/closedcaption/src/jsontovtt/mod.rs @@ -16,11 +16,6 @@ glib::wrapper! { pub struct JsonToVtt(ObjectSubclass<imp::JsonToVtt>) @extends gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for JsonToVtt {} -unsafe impl Sync for JsonToVtt {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/closedcaption/src/mcc_enc/mod.rs b/video/closedcaption/src/mcc_enc/mod.rs index 978bed90e..9ffa82497 100644 --- a/video/closedcaption/src/mcc_enc/mod.rs +++ b/video/closedcaption/src/mcc_enc/mod.rs @@ -16,11 +16,6 @@ glib::wrapper! { pub struct MccEnc(ObjectSubclass<imp::MccEnc>) @extends gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for MccEnc {} -unsafe impl Sync for MccEnc {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/closedcaption/src/mcc_parse/mod.rs b/video/closedcaption/src/mcc_parse/mod.rs index 15b9b4cf6..73ba24eff 100644 --- a/video/closedcaption/src/mcc_parse/mod.rs +++ b/video/closedcaption/src/mcc_parse/mod.rs @@ -16,11 +16,6 @@ glib::wrapper! { pub struct MccParse(ObjectSubclass<imp::MccParse>) @extends gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for MccParse {} -unsafe impl Sync for MccParse {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/closedcaption/src/scc_enc/mod.rs b/video/closedcaption/src/scc_enc/mod.rs index 44527fc70..d78406561 100644 --- a/video/closedcaption/src/scc_enc/mod.rs +++ b/video/closedcaption/src/scc_enc/mod.rs @@ -16,11 +16,6 @@ glib::wrapper! { pub struct SccEnc(ObjectSubclass<imp::SccEnc>) @extends gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for SccEnc {} -unsafe impl Sync for SccEnc {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/closedcaption/src/scc_parse/mod.rs b/video/closedcaption/src/scc_parse/mod.rs index 6d6714ff5..120ac5c72 100644 --- a/video/closedcaption/src/scc_parse/mod.rs +++ b/video/closedcaption/src/scc_parse/mod.rs @@ -17,11 +17,6 @@ glib::wrapper! { pub struct SccParse(ObjectSubclass<imp::SccParse>) @extends gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for SccParse {} -unsafe impl Sync for SccParse {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/closedcaption/src/transcriberbin/mod.rs b/video/closedcaption/src/transcriberbin/mod.rs index 8c7d194c0..ef2f7d8d6 100644 --- a/video/closedcaption/src/transcriberbin/mod.rs +++ b/video/closedcaption/src/transcriberbin/mod.rs @@ -15,9 +15,6 @@ glib::wrapper! { pub struct TranscriberBin(ObjectSubclass<imp::TranscriberBin>) @extends gst::Bin, gst::Element, gst::Object; } -unsafe impl Send for TranscriberBin {} -unsafe impl Sync for TranscriberBin {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/closedcaption/src/tttocea608/mod.rs b/video/closedcaption/src/tttocea608/mod.rs index 24279b01d..e0a2ca55b 100644 --- a/video/closedcaption/src/tttocea608/mod.rs +++ b/video/closedcaption/src/tttocea608/mod.rs @@ -15,11 +15,6 @@ glib::wrapper! { pub struct TtToCea608(ObjectSubclass<imp::TtToCea608>) @extends gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for TtToCea608 {} -unsafe impl Sync for TtToCea608 {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/closedcaption/src/tttojson/mod.rs b/video/closedcaption/src/tttojson/mod.rs index 60a2df9dc..8ca1632c6 100644 --- a/video/closedcaption/src/tttojson/mod.rs +++ b/video/closedcaption/src/tttojson/mod.rs @@ -15,9 +15,6 @@ glib::wrapper! { pub struct TtToJson(ObjectSubclass<imp::TtToJson>) @extends gst::Element, gst::Object; } -unsafe impl Send for TtToJson {} -unsafe impl Sync for TtToJson {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/dav1d/src/dav1ddec/mod.rs b/video/dav1d/src/dav1ddec/mod.rs index 83e115873..f714b0230 100644 --- a/video/dav1d/src/dav1ddec/mod.rs +++ b/video/dav1d/src/dav1ddec/mod.rs @@ -17,11 +17,6 @@ glib::wrapper! { pub struct Dav1dDec(ObjectSubclass<imp::Dav1dDec>) @extends gst_video::VideoDecoder, gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for Dav1dDec {} -unsafe impl Sync for Dav1dDec {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/ffv1/src/ffv1dec/mod.rs b/video/ffv1/src/ffv1dec/mod.rs index dfbc2dd89..4a941b1d9 100644 --- a/video/ffv1/src/ffv1dec/mod.rs +++ b/video/ffv1/src/ffv1dec/mod.rs @@ -17,11 +17,6 @@ glib::wrapper! { pub struct Ffv1Dec(ObjectSubclass<imp::Ffv1Dec>) @extends gst_video::VideoDecoder, gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for Ffv1Dec {} -unsafe impl Sync for Ffv1Dec {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/flavors/src/flvdemux/mod.rs b/video/flavors/src/flvdemux/mod.rs index f0415bcc2..9ee44eda5 100644 --- a/video/flavors/src/flvdemux/mod.rs +++ b/video/flavors/src/flvdemux/mod.rs @@ -17,11 +17,6 @@ glib::wrapper! { pub struct FlvDemux(ObjectSubclass<imp::FlvDemux>) @extends gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for FlvDemux {} -unsafe impl Sync for FlvDemux {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/gif/src/gifenc/mod.rs b/video/gif/src/gifenc/mod.rs index 87ebc62c2..3a5ed0ce0 100644 --- a/video/gif/src/gifenc/mod.rs +++ b/video/gif/src/gifenc/mod.rs @@ -17,11 +17,6 @@ glib::wrapper! { pub struct GifEnc(ObjectSubclass<imp::GifEnc>) @extends gst_video::VideoEncoder, gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for GifEnc {} -unsafe impl Sync for GifEnc {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/gtk4/src/sink/mod.rs b/video/gtk4/src/sink/mod.rs index 696579f7e..0a35baa4a 100644 --- a/video/gtk4/src/sink/mod.rs +++ b/video/gtk4/src/sink/mod.rs @@ -33,11 +33,6 @@ glib::wrapper! { @extends gst_video::VideoSink, gst_base::BaseSink, gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for PaintableSink {} -unsafe impl Sync for PaintableSink {} - impl PaintableSink { pub fn new(name: Option<&str>) -> Self { glib::Object::new(&[("name", &name)]).expect("Failed to create a GTK4Sink") diff --git a/video/hsv/src/hsvdetector/mod.rs b/video/hsv/src/hsvdetector/mod.rs index 661407076..cc1ff36d7 100644 --- a/video/hsv/src/hsvdetector/mod.rs +++ b/video/hsv/src/hsvdetector/mod.rs @@ -17,11 +17,6 @@ glib::wrapper! { pub struct HsvDetector(ObjectSubclass<imp::HsvDetector>) @extends gst_base::BaseTransform, gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for HsvDetector {} -unsafe impl Sync for HsvDetector {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/hsv/src/hsvfilter/mod.rs b/video/hsv/src/hsvfilter/mod.rs index 95f832021..8f054cdb6 100644 --- a/video/hsv/src/hsvfilter/mod.rs +++ b/video/hsv/src/hsvfilter/mod.rs @@ -17,11 +17,6 @@ glib::wrapper! { pub struct HsvFilter(ObjectSubclass<imp::HsvFilter>) @extends gst_base::BaseTransform, gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for HsvFilter {} -unsafe impl Sync for HsvFilter {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/rav1e/src/rav1enc/mod.rs b/video/rav1e/src/rav1enc/mod.rs index 09269cf7e..26a167984 100644 --- a/video/rav1e/src/rav1enc/mod.rs +++ b/video/rav1e/src/rav1enc/mod.rs @@ -17,11 +17,6 @@ glib::wrapper! { pub struct Rav1Enc(ObjectSubclass<imp::Rav1Enc>) @extends gst_video::VideoEncoder, gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for Rav1Enc {} -unsafe impl Sync for Rav1Enc {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/rspng/src/pngenc/mod.rs b/video/rspng/src/pngenc/mod.rs index ca7c62a37..1934e51dd 100644 --- a/video/rspng/src/pngenc/mod.rs +++ b/video/rspng/src/pngenc/mod.rs @@ -85,11 +85,6 @@ glib::wrapper! { pub struct PngEncoder(ObjectSubclass<imp::PngEncoder>) @extends gst_video::VideoEncoder, gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for PngEncoder {} -unsafe impl Sync for PngEncoder {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/videofx/src/border/mod.rs b/video/videofx/src/border/mod.rs index 794af19f9..6d612eda2 100644 --- a/video/videofx/src/border/mod.rs +++ b/video/videofx/src/border/mod.rs @@ -16,9 +16,6 @@ glib::wrapper! { pub struct RoundedCorners(ObjectSubclass<roundedcorners::RoundedCorners>) @extends gst_base::BaseTransform, gst::Element, gst::Object; } -unsafe impl Send for RoundedCorners {} -unsafe impl Sync for RoundedCorners {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), diff --git a/video/webp/src/dec/mod.rs b/video/webp/src/dec/mod.rs index 823520f0d..9bbd18305 100644 --- a/video/webp/src/dec/mod.rs +++ b/video/webp/src/dec/mod.rs @@ -19,11 +19,6 @@ glib::wrapper! { pub struct WebPDec(ObjectSubclass<imp::WebPDec>) @extends gst::Element, gst::Object; } -// GStreamer elements need to be thread-safe. For the private implementation this is automatically -// enforced but for the public wrapper type we need to specify this manually. -unsafe impl Send for WebPDec {} -unsafe impl Sync for WebPDec {} - pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { gst::Element::register( Some(plugin), |