diff --git a/README.md b/README.md index 6d66cce0..b8c92c20 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The package can be installed by adding `membrane_video_compositor_plugin` to you ```elixir def deps do [ - {:membrane_video_compositor_plugin, "~> 0.2.2"} + {:membrane_video_compositor_plugin, "~> 0.3.0"} ] end ``` @@ -24,7 +24,9 @@ Since parts of this package are implemented in Rust, you need to have a Rust ins ## Usage -TODO +Before jumping into Livebook, check out this [installation guide](https://github.com/membraneframework/guide/tree/master/livebook_examples). + +[![Run in Livebook](https://livebook.dev/badge/v1/blue.svg)](https://livebook.dev/run?url=https%3A%2F%2Fgithub.com%2Fmembraneframework%2Fguide%2Fblob%2Fmaster%2Flivebook_examples%2Fvideo_compositor%2Fvideo_compositor.livemd) ## Copyright and License diff --git a/lib/membrane/video_compositor/examples/hard.ex b/lib/membrane/video_compositor/examples/hard.ex index 1cef50dd..34d1c453 100644 --- a/lib/membrane/video_compositor/examples/hard.ex +++ b/lib/membrane/video_compositor/examples/hard.ex @@ -9,7 +9,7 @@ defmodule Membrane.VideoCompositor.Examples.Hard do - The third video is turned into a ball and put in the middle bottom of the screen """ - alias Membrane.VideoCompositor.VideoTransformations.TextureTransformations.CornersRounding + alias Membrane.VideoCompositor.TextureTransformations.CornersRounding alias Membrane.VideoCompositor.Examples.Mock.Layouts.{Grid, Merging} alias Membrane.VideoCompositor.Examples.Mock.Transformations.{Rotate, ToBall} diff --git a/lib/membrane/video_compositor/video_transformations/texture_transformations.ex b/lib/membrane/video_compositor/texture_transformations.ex similarity index 76% rename from lib/membrane/video_compositor/video_transformations/texture_transformations.ex rename to lib/membrane/video_compositor/texture_transformations.ex index 362189b8..d20ad877 100644 --- a/lib/membrane/video_compositor/video_transformations/texture_transformations.ex +++ b/lib/membrane/video_compositor/texture_transformations.ex @@ -1,4 +1,4 @@ -defmodule Membrane.VideoCompositor.VideoTransformations.TextureTransformations do +defmodule Membrane.VideoCompositor.TextureTransformations do @moduledoc """ Describes all texture transformations applied to video. Texture transformations can change resolution of frame. @@ -10,7 +10,7 @@ defmodule Membrane.VideoCompositor.VideoTransformations.TextureTransformations d this type definition. """ - alias Membrane.VideoCompositor.VideoTransformations.TextureTransformations.{ + alias Membrane.VideoCompositor.TextureTransformations.{ CornersRounding, Cropping } diff --git a/lib/membrane/video_compositor/video_transformations/texture_transformations/corners_rounding.ex b/lib/membrane/video_compositor/texture_transformations/corners_rounding.ex similarity index 68% rename from lib/membrane/video_compositor/video_transformations/texture_transformations/corners_rounding.ex rename to lib/membrane/video_compositor/texture_transformations/corners_rounding.ex index 31f53127..b7ac3f8b 100644 --- a/lib/membrane/video_compositor/video_transformations/texture_transformations/corners_rounding.ex +++ b/lib/membrane/video_compositor/texture_transformations/corners_rounding.ex @@ -1,4 +1,4 @@ -defmodule Membrane.VideoCompositor.VideoTransformations.TextureTransformations.CornersRounding do +defmodule Membrane.VideoCompositor.TextureTransformations.CornersRounding do @moduledoc """ Describe corners rounding texture transformation parameter. Corner rounding transformation can be imagined as placing four circles with specified radius @@ -10,10 +10,10 @@ defmodule Membrane.VideoCompositor.VideoTransformations.TextureTransformations.C ## Examples Example struct describing transformation which rounds corners with 100 pixel radius: - iex> alias Membrane.VideoCompositor.VideoTransformations.TextureTransformations.CornersRounding - Membrane.VideoCompositor.VideoTransformations.TextureTransformations.CornersRounding + iex> alias Membrane.VideoCompositor.TextureTransformations.CornersRounding + Membrane.VideoCompositor.TextureTransformations.CornersRounding iex> %CornersRounding{ border_radius: 100 } - %Membrane.VideoCompositor.VideoTransformations.TextureTransformations.CornersRounding{ + %Membrane.VideoCompositor.TextureTransformations.CornersRounding{ border_radius: 100 } """ diff --git a/lib/membrane/video_compositor/video_transformations/texture_transformations/cropping.ex b/lib/membrane/video_compositor/texture_transformations/cropping.ex similarity index 96% rename from lib/membrane/video_compositor/video_transformations/texture_transformations/cropping.ex rename to lib/membrane/video_compositor/texture_transformations/cropping.ex index eeffeaa1..715471c6 100644 --- a/lib/membrane/video_compositor/video_transformations/texture_transformations/cropping.ex +++ b/lib/membrane/video_compositor/texture_transformations/cropping.ex @@ -1,4 +1,4 @@ -defmodule Membrane.VideoCompositor.VideoTransformations.TextureTransformations.Cropping do +defmodule Membrane.VideoCompositor.TextureTransformations.Cropping do @moduledoc """ Describe cropping texture transformation parameters. ## Values diff --git a/lib/membrane/video_compositor/video_transformations.ex b/lib/membrane/video_compositor/video_transformations.ex index 10ad9fcf..c7ba665a 100644 --- a/lib/membrane/video_compositor/video_transformations.ex +++ b/lib/membrane/video_compositor/video_transformations.ex @@ -5,8 +5,7 @@ defmodule Membrane.VideoCompositor.VideoTransformations do applied in the order in which they appear in the list. """ - alias Membrane.VideoCompositor.VideoTransformations - alias Membrane.VideoCompositor.VideoTransformations.TextureTransformations + alias Membrane.VideoCompositor.{TextureTransformations, VideoTransformations} @type t :: %__MODULE__{ texture_transformations: list(TextureTransformations.t()) diff --git a/mix.exs b/mix.exs index 5f5524a1..b352f5a0 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Membrane.VideoCompositor.Mixfile do use Mix.Project - @version "0.2.2" + @version "0.3.0" @github_url "https://github.com/membraneframework/membrane_video_compositor_plugin" def project do @@ -94,13 +94,15 @@ defmodule Membrane.VideoCompositor.Mixfile do extras: ["README.md", "LICENSE"], formatters: ["html"], source_ref: "v#{@version}", + filter_modules: + ~r/Membrane\.VideoCompositor(\.VideoTransformations$|\.TextureTransformations.*|\.RustStructs\.BaseVideoPlacement|$)/, nest_modules_by_prefix: [ Membrane.VideoCompositor, - Membrane.VideoCompositor.VideoTransformations + Membrane.VideoCompositor.TextureTransformations ], groups_for_modules: [ - "Video transformations": [ - ~r/^Membrane\.VideoCompositor\.VideoTransformations($|\.)/ + "Texture transformations": [ + ~r/^Membrane\.VideoCompositor\.TextureTransformations($|\.)/ ] ] ] diff --git a/native/membrane_videocompositor/src/elixir_bridge/elixir_structs.rs b/native/membrane_videocompositor/src/elixir_bridge/elixir_structs.rs index 8a1af888..02c97e03 100644 --- a/native/membrane_videocompositor/src/elixir_bridge/elixir_structs.rs +++ b/native/membrane_videocompositor/src/elixir_bridge/elixir_structs.rs @@ -87,7 +87,7 @@ impl Into> for ElixirTextureTransformations { /// Elixir struct wrapping parameters describing corner rounding texture transformation #[derive(Debug, rustler::NifStruct, Clone, Copy)] -#[module = "Membrane.VideoCompositor.VideoTransformations.TextureTransformations.CornersRounding"] +#[module = "Membrane.VideoCompositor.TextureTransformations.CornersRounding"] pub struct ElixirCornersRounding { pub border_radius: u32, } @@ -104,7 +104,7 @@ impl Into> for ElixirCornersRounding { /// Elixir struct wrapping parameters describing cropping texture transformation #[derive(Debug, rustler::NifStruct, Clone, Copy)] -#[module = "Membrane.VideoCompositor.VideoTransformations.TextureTransformations.Cropping"] +#[module = "Membrane.VideoCompositor.TextureTransformations.Cropping"] pub struct ElixirCropping { pub crop_top_left_corner: (f32, f32), pub crop_size: (f32, f32), diff --git a/test/texture_transformations_test.exs b/test/texture_transformations_test.exs index 014d4f9d..7abedb23 100644 --- a/test/texture_transformations_test.exs +++ b/test/texture_transformations_test.exs @@ -12,7 +12,7 @@ defmodule Membrane.VideoCompositor.Test.TextureTransformations do alias Membrane.VideoCompositor.Test.Support.Utils alias Membrane.VideoCompositor.VideoTransformations - alias Membrane.VideoCompositor.VideoTransformations.TextureTransformations.{ + alias Membrane.VideoCompositor.TextureTransformations.{ CornersRounding, Cropping }