Skip to content

Commit

Permalink
Merge pull request #49 from clouds56-contrib/core
Browse files Browse the repository at this point in the history
refactor PtrWrapper and add SceneRef
  • Loading branch information
bennetthardwick authored Apr 15, 2024
2 parents 2602fb3 + 9f13699 commit 694466f
Show file tree
Hide file tree
Showing 24 changed files with 934 additions and 619 deletions.
9 changes: 5 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ obs-sys = { path = "./obs-sys", version = "0.3.0" }
paste = "0.1.7"
log = {version = "0.4.11", features = ["std"]}
num-traits = "0.2.14"
thiserror = "1.0.58"
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use obs_wrapper::{

// The module that will handle creating the source.
struct TestModule {
context: ModuleContext
context: ModuleRef
}

// The source that will be shown inside OBS.
Expand All @@ -62,7 +62,7 @@ impl Sourceable for TestSource {
}

fn get_type() -> SourceType {
SourceType::FILTER
SourceType::Filter
}

fn create(create: &mut CreatableSourceContext<Self>, source: SourceContext) -> Self {
Expand All @@ -80,11 +80,11 @@ impl GetNameSource for TestSource {
// Implement the Module trait for TestModule. This will handle the creation of the source and
// has some methods for telling OBS a bit about itself.
impl Module for TestModule {
fn new(context: ModuleContext) -> Self {
fn new(context: ModuleRef) -> Self {
Self { context }
}

fn get_ctx(&self) -> &ModuleContext {
fn get_ctx(&self) -> &ModuleRef {
&self.context
}

Expand Down
10 changes: 5 additions & 5 deletions plugins/rnnoise-denoiser-filter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ struct RnnoiseDenoiserFilter {
}

struct TheModule {
context: ModuleContext,
context: ModuleRef,
}

impl Sourceable for RnnoiseDenoiserFilter {
fn get_id() -> ObsString {
obs_string!("rnnoise_noise_suppression_filter")
}
fn get_type() -> SourceType {
SourceType::FILTER
SourceType::Filter
}
fn create(create: &mut CreatableSourceContext<Self>, _source: SourceContext) -> Self {
fn create(create: &mut CreatableSourceContext<Self>, _source: SourceRef) -> Self {
let (sample_rate, channels) =
create.with_audio(|audio| (audio.sample_rate(), audio.channels()));

Expand Down Expand Up @@ -172,10 +172,10 @@ impl FilterAudioSource for RnnoiseDenoiserFilter {
}

impl Module for TheModule {
fn new(context: ModuleContext) -> Self {
fn new(context: ModuleRef) -> Self {
Self { context }
}
fn get_ctx(&self) -> &ModuleContext {
fn get_ctx(&self) -> &ModuleRef {
&self.context
}

Expand Down
12 changes: 6 additions & 6 deletions plugins/scroll-focus-filter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enum ServerMessage {
}

struct ScrollFocusFilter {
source: SourceContext,
source: SourceRef,
effect: GraphicsEffect,

base_dimension: GraphicsEffectVec2Param,
Expand Down Expand Up @@ -60,17 +60,17 @@ impl Drop for ScrollFocusFilter {
}

struct TheModule {
context: ModuleContext,
context: ModuleRef,
}

impl Sourceable for ScrollFocusFilter {
fn get_id() -> ObsString {
obs_string!("scroll_focus_filter")
}
fn get_type() -> SourceType {
SourceType::FILTER
SourceType::Filter
}
fn create(create: &mut CreatableSourceContext<Self>, mut source: SourceContext) -> Self {
fn create(create: &mut CreatableSourceContext<Self>, mut source: SourceRef) -> Self {
let mut effect = GraphicsEffect::from_effect_string(
obs_string!(include_str!("./crop_filter.effect")),
obs_string!("crop_filter.effect"),
Expand Down Expand Up @@ -382,10 +382,10 @@ impl UpdateSource for ScrollFocusFilter {
}

impl Module for TheModule {
fn new(context: ModuleContext) -> Self {
fn new(context: ModuleRef) -> Self {
Self { context }
}
fn get_ctx(&self) -> &ModuleContext {
fn get_ctx(&self) -> &ModuleRef {
&self.context
}

Expand Down
Loading

0 comments on commit 694466f

Please sign in to comment.