mirror of
https://github.com/Harshit-Dhanwalkar/AsciiCam.git
synced 2026-07-06 11:22:10 +02:00
Add hot loading plugins system
This commit is contained in:
parent
509554ba1d
commit
4c7d32663e
12 changed files with 475 additions and 82 deletions
25
C/include/plugins.h
Normal file
25
C/include/plugins.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef PLUGINS_H
|
||||
#define PLUGINS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct {
|
||||
void (*process)(uint8_t *gray, int w, int h, void *ctx);
|
||||
const char *name;
|
||||
} filter_plugin_t;
|
||||
|
||||
typedef struct {
|
||||
void *dl_handle; // handle from dlopen
|
||||
filter_plugin_t *plugin; // resolved plugin vtable
|
||||
char path[256]; // absolute path to .so
|
||||
char tmp_path[280]; // temp copy path used for current dlopen // HACK:
|
||||
int inotify_fd; // inotify instance fd
|
||||
int inotify_wd; // watch descriptor
|
||||
} plugin_loader_t;
|
||||
|
||||
int plugin_load (plugin_loader_t *pl, const char *path);
|
||||
void plugin_watch_init (plugin_loader_t *pl, const char *path);
|
||||
void plugin_check_reload(plugin_loader_t *pl);
|
||||
void plugin_cleanup (plugin_loader_t *pl);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue