fix: Log in FrameProcessorPluginRegistry
(#2012)
* fix: Log when adding Frame Processor Plugin * fix: Also log on Android * Add logs in get as well * fix: Fix string concat on Android
This commit is contained in:
parent
ce9a505776
commit
2af965d1ad
@ -1,5 +1,6 @@
|
|||||||
package com.mrousavy.camera.frameprocessor;
|
package com.mrousavy.camera.frameprocessor;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
import androidx.annotation.Keep;
|
import androidx.annotation.Keep;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import com.facebook.proguard.annotations.DoNotStrip;
|
import com.facebook.proguard.annotations.DoNotStrip;
|
||||||
@ -10,6 +11,7 @@ import java.util.HashMap;
|
|||||||
@Keep
|
@Keep
|
||||||
public class FrameProcessorPluginRegistry {
|
public class FrameProcessorPluginRegistry {
|
||||||
private static final Map<String, PluginInitializer> Plugins = new HashMap<>();
|
private static final Map<String, PluginInitializer> Plugins = new HashMap<>();
|
||||||
|
private static final String TAG = "FrameProcessorPluginRegistry";
|
||||||
|
|
||||||
@DoNotStrip
|
@DoNotStrip
|
||||||
@Keep
|
@Keep
|
||||||
@ -17,15 +19,19 @@ public class FrameProcessorPluginRegistry {
|
|||||||
assert !Plugins.containsKey(name) : "Tried to add a Frame Processor Plugin with a name that already exists! " +
|
assert !Plugins.containsKey(name) : "Tried to add a Frame Processor Plugin with a name that already exists! " +
|
||||||
"Either choose unique names, or remove the unused plugin. Name: " + name;
|
"Either choose unique names, or remove the unused plugin. Name: " + name;
|
||||||
Plugins.put(name, pluginInitializer);
|
Plugins.put(name, pluginInitializer);
|
||||||
|
Log.i(TAG, "Successfully registered Frame Processor Plugin \"" + name + "\"!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@DoNotStrip
|
@DoNotStrip
|
||||||
@Keep
|
@Keep
|
||||||
public static FrameProcessorPlugin getPlugin(String name, Map<String, Object> options) {
|
public static FrameProcessorPlugin getPlugin(String name, Map<String, Object> options) {
|
||||||
|
Log.i(TAG, "Looking up Frame Processor Plugin \"" + name + "\"...");
|
||||||
PluginInitializer initializer = Plugins.get(name);
|
PluginInitializer initializer = Plugins.get(name);
|
||||||
if (initializer == null) {
|
if (initializer == null) {
|
||||||
|
Log.i(TAG, "Frame Processor Plugin \"" + name + "\" does not exist!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Log.i(TAG, "Frame Processor Plugin \"" + name + "\" found! Initializing...");
|
||||||
return initializer.initializePlugin(options);
|
return initializer.initializePlugin(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,14 +28,18 @@
|
|||||||
name);
|
name);
|
||||||
|
|
||||||
[[FrameProcessorPluginRegistry frameProcessorPlugins] setValue:pluginInitializer forKey:name];
|
[[FrameProcessorPluginRegistry frameProcessorPlugins] setValue:pluginInitializer forKey:name];
|
||||||
|
NSLog(@"Successfully registered Frame Processor Plugin \"%@\"!", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (FrameProcessorPlugin*)getPlugin:(NSString* _Nonnull)name withOptions:(NSDictionary* _Nullable)options {
|
+ (FrameProcessorPlugin*)getPlugin:(NSString* _Nonnull)name withOptions:(NSDictionary* _Nullable)options {
|
||||||
|
NSLog(@"Looking up Frame Processor Plugin \"%@\"...", name);
|
||||||
PluginInitializerFunction initializer = [[FrameProcessorPluginRegistry frameProcessorPlugins] objectForKey:name];
|
PluginInitializerFunction initializer = [[FrameProcessorPluginRegistry frameProcessorPlugins] objectForKey:name];
|
||||||
if (initializer == nil) {
|
if (initializer == nil) {
|
||||||
|
NSLog(@"Frame Processor Plugin \"%@\" does not exist!", name);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSLog(@"Frame Processor Plugin \"%@\" found! Initializing...", name);
|
||||||
return initializer(options);
|
return initializer(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user