Commit 2c2cd8c2 authored by Sanchayan Maity's avatar Sanchayan Maity 🤘🏿
Browse files

Implement rounded corners

This plugin takes I420/YUV and appends an alpha plane to give YUVA/A420
to round the corners analogous to the border-radius in CSS. Other video
formats like NV12 not supported yet. Support for other planar formats
will follow.

Not all ways of specifying border-radius as in CSS are implemented at
the moment. Currently, we only support specifying it in pixels and it
gets applied uniformly to all corners.
parent 86f42259
Pipeline #451414 passed with stages
in 16 minutes and 11 seconds
......@@ -18,6 +18,7 @@ members = [
"utils/togglerecord",
"video/cdg",
"video/closedcaption",
"video/videofx",
"video/dav1d",
"video/ffv1",
"video/flavors",
......
......@@ -57,6 +57,7 @@ plugins = {
# FIXME: libwebp-sys2 will build its bundled version on msvc and apple platforms
# https://github.com/qnighy/libwebp-sys2-rs/issues/4
'gst-plugin-webp': 'libgstrswebp',
'gst-plugin-videofx': 'libgstvideofx',
}
extra_env = {}
......
[package]
name = "gst-plugin-videofx"
version = "0.8.0"
authors = ["Sanchayan Maity <sanchayan@asymptotic.io>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MPL-2.0"
description = "Video Effects Plugin"
edition = "2021"
[dependencies]
cairo-rs = { git = "https://github.com/gtk-rs/gtk-rs-core", features=["use_glib"] }
atomic_refcell = "0.1"
once_cell = "1.0"
[dependencies.gst]
git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs"
features = ["v1_16"]
package = "gstreamer"
[dependencies.gst-base]
git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs"
features = ["v1_16"]
package = "gstreamer-base"
[dependencies.gst-video]
git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs"
features = ["v1_16"]
package = "gstreamer-video"
[dev-dependencies.gst-check]
git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs"
package = "gstreamer-check"
[lib]
name = "gstvideofx"
crate-type = ["cdylib", "rlib"]
path = "src/lib.rs"
[build-dependencies]
gst-plugin-version-helper = { path="../../version-helper" }
[features]
# GStreamer 1.14 is required for static linking
static = []
capi = []
[package.metadata.capi]
min_version = "0.8.0"
[package.metadata.capi.header]
enabled = false
[package.metadata.capi.library]
install_subdir = "gstreamer-1.0"
versioning = false
[package.metadata.capi.pkg_config]
requires_private = "gstreamer-1.0, gstreamer-base-1.0, gstreamer-video-1.0, gobject-2.0, glib-2.0, cairo-gobject"
../../LICENSE-MPL-2.0
\ No newline at end of file
fn main() {
gst_plugin_version_helper::info()
}
// Copyright (C) 2021 Asymptotic Inc.
// Author: Sanchayan Maity <sanchayan@asymptotic.io>
//
// This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
// If a copy of the MPL was not distributed with this file, You can obtain one at
// <https://mozilla.org/MPL/2.0/>.
//
// SPDX-License-Identifier: MPL-2.0
use gst::glib;
use gst::prelude::*;
pub mod roundedcorners;
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),
"roundedcorners",
gst::Rank::None,
RoundedCorners::static_type(),
)
}
This diff is collapsed.
// Copyright (C) 2021 Asymptotic Inc.
// Author: Sanchayan Maity <sanchayan@asymptotic.io>
//
// This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
// If a copy of the MPL was not distributed with this file, You can obtain one at
// <https://mozilla.org/MPL/2.0/>.
//
// SPDX-License-Identifier: MPL-2.0
mod border;
fn plugin_init(plugin: &gst::Plugin) -> Result<(), gst::glib::BoolError> {
border::register(plugin)
}
gst::plugin_define!(
videofx,
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,
concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")),
"MPL-2.0",
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_REPOSITORY"),
env!("BUILD_REL_DATE")
);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment