mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 05:40:27 +00:00
Capture filter + vo_postprocess: updated APIs
This commit is contained in:
@@ -74,7 +74,7 @@ static int create_filter(struct capture_filter *s, char *cfg)
|
||||
const auto & capture_filters = get_libraries_for_class(LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION);
|
||||
for (auto && item : capture_filters) {
|
||||
auto capture_filter_info = static_cast<const struct capture_filter_info*>(item.second);
|
||||
if(strcasecmp(capture_filter_info->name, filter_name) == 0) {
|
||||
if(strcasecmp(item.first.c_str(), filter_name) == 0) {
|
||||
struct capture_filter_instance *instance = (struct capture_filter_instance *)
|
||||
malloc(sizeof(struct capture_filter_instance));
|
||||
instance->functions = capture_filter_info;
|
||||
@@ -119,8 +119,7 @@ int capture_filter_init(struct module *parent, const char *cfg, struct capture_f
|
||||
const auto & capture_filters = get_libraries_for_class(LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION);
|
||||
printf("Available capture filters:\n");
|
||||
for (auto && item : capture_filters) {
|
||||
auto cfi = static_cast<const struct capture_filter_info*>(item.second);
|
||||
printf("\t%s\n", cfi->name);
|
||||
printf("\t%s\n", item.first.c_str());
|
||||
}
|
||||
module_done(&s->mod);
|
||||
free(s);
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
#ifndef CAPTURE_FILTER_H_
|
||||
#define CAPTURE_FILTER_H_
|
||||
|
||||
#define CAPTURE_FILTER_ABI_VERSION 1
|
||||
#define CAPTURE_FILTER_ABI_VERSION 2
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -58,7 +58,6 @@ extern "C" {
|
||||
struct module;
|
||||
|
||||
struct capture_filter_info {
|
||||
const char *name;
|
||||
/// @brief Initializes capture filter
|
||||
/// @param parent parent module
|
||||
/// @param cfg configuration string from cmdline
|
||||
|
||||
@@ -290,7 +290,6 @@ static struct video_frame *filter(void *state, struct video_frame *in)
|
||||
}
|
||||
|
||||
static const struct capture_filter_info capture_filter_blank = {
|
||||
.name = "blank",
|
||||
.init = init,
|
||||
.done = done,
|
||||
.filter = filter,
|
||||
|
||||
@@ -141,7 +141,6 @@ static struct video_frame *filter(void *state, struct video_frame *in)
|
||||
}
|
||||
|
||||
static const struct capture_filter_info capture_filter_every = {
|
||||
.name = "every",
|
||||
.init = init,
|
||||
.done = done,
|
||||
.filter = filter,
|
||||
|
||||
@@ -254,7 +254,6 @@ static struct video_frame *filter(void *state, struct video_frame *in)
|
||||
}
|
||||
|
||||
static const struct capture_filter_info capture_filter_logo = {
|
||||
"logo",
|
||||
init,
|
||||
done,
|
||||
filter,
|
||||
|
||||
@@ -77,7 +77,6 @@ static struct video_frame *filter(void *state, struct video_frame *in)
|
||||
}
|
||||
|
||||
static const struct capture_filter_info capture_filter_none = {
|
||||
.name = "none",
|
||||
.init = init,
|
||||
.done = done,
|
||||
.filter = filter,
|
||||
|
||||
@@ -180,7 +180,6 @@ static struct video_frame *filter(void *state, struct video_frame *in)
|
||||
}
|
||||
|
||||
static struct capture_filter_info capture_filter_resize = {
|
||||
"resize",
|
||||
init,
|
||||
done,
|
||||
filter,
|
||||
|
||||
@@ -120,7 +120,6 @@ static struct video_frame *filter(void *state, struct video_frame *in_frame)
|
||||
}
|
||||
|
||||
static const struct capture_filter_info capture_filter_scale = {
|
||||
.name = "scale",
|
||||
.init = init,
|
||||
.done = done,
|
||||
.filter = filter,
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
extern char **uv_argv;
|
||||
|
||||
struct vo_postprocess_state {
|
||||
struct vo_postprocess_info *funcs;
|
||||
const struct vo_postprocess_info *funcs;
|
||||
void *state;
|
||||
};
|
||||
|
||||
@@ -69,7 +69,7 @@ void show_vo_postprocess_help()
|
||||
list_modules(LIBRARY_CLASS_VIDEO_POSTPROCESS, VO_PP_ABI_VERSION);
|
||||
}
|
||||
|
||||
struct vo_postprocess_state *vo_postprocess_init(char *config_string)
|
||||
struct vo_postprocess_state *vo_postprocess_init(const char *config_string)
|
||||
{
|
||||
struct vo_postprocess_state *s;
|
||||
char *vo_postprocess_options = NULL;
|
||||
|
||||
@@ -58,11 +58,11 @@ extern "C" {
|
||||
#define VO_PP_PROPERTY_CODECS 0 /* codec_t[] all uncompressed */
|
||||
#define VO_PP_DOES_CHANGE_TILING_MODE 1 /* bool false */
|
||||
|
||||
#define VO_PP_ABI_VERSION 4
|
||||
#define VO_PP_ABI_VERSION 5
|
||||
|
||||
struct vo_postprocess_state;
|
||||
|
||||
typedef void *(*vo_postprocess_init_t)(char *cfg);
|
||||
typedef void *(*vo_postprocess_init_t)(const char *cfg);
|
||||
|
||||
/**
|
||||
* Reconfigures postprocessor for frame
|
||||
@@ -135,7 +135,7 @@ struct vo_postprocess_info {
|
||||
/**
|
||||
* Semantic and parameters of following functions is same as their typedef counterparts
|
||||
*/
|
||||
struct vo_postprocess_state *vo_postprocess_init(char *config_string);
|
||||
struct vo_postprocess_state *vo_postprocess_init(const char *config_string);
|
||||
|
||||
int vo_postprocess_reconfigure(struct vo_postprocess_state *, struct video_desc);
|
||||
struct video_frame * vo_postprocess_getf(struct vo_postprocess_state *);
|
||||
|
||||
@@ -75,7 +75,7 @@ static bool interlaced_3d_get_property(void *state, int property, void *val, siz
|
||||
}
|
||||
|
||||
|
||||
static void * interlaced_3d_init(char *config) {
|
||||
static void * interlaced_3d_init(const char *config) {
|
||||
struct state_interlaced_3d *s;
|
||||
|
||||
if(config && strcmp(config, "help") == 0) {
|
||||
|
||||
@@ -59,7 +59,7 @@ static void usage()
|
||||
printf("\t-p deinterlace\n");
|
||||
}
|
||||
|
||||
static void * deinterlace_init(char *config) {
|
||||
static void * deinterlace_init(const char *config) {
|
||||
if(config && strcmp(config, "help") == 0) {
|
||||
usage();
|
||||
return NULL;
|
||||
|
||||
@@ -71,7 +71,7 @@ static void usage()
|
||||
printf("-p double_framerate\n");
|
||||
}
|
||||
|
||||
static void * df_init(char *config) {
|
||||
static void * df_init(const char *config) {
|
||||
struct state_df *s;
|
||||
|
||||
if(config && strcmp(config, "help") == 0) {
|
||||
|
||||
@@ -76,7 +76,7 @@ static void usage()
|
||||
printf("-p interlace\n");
|
||||
}
|
||||
|
||||
static void * interlace_init(char *config) {
|
||||
static void * interlace_init(const char *config) {
|
||||
struct state_interlace *s;
|
||||
|
||||
if(config && strcmp(config, "help") == 0) {
|
||||
|
||||
@@ -100,7 +100,7 @@ static void usage()
|
||||
printf("\t-p scale:width:height\n");
|
||||
}
|
||||
|
||||
static void * scale_init(char *config) {
|
||||
static void * scale_init(const char *config) {
|
||||
struct state_scale *s;
|
||||
char *save_ptr = NULL;
|
||||
char *ptr;
|
||||
@@ -114,18 +114,21 @@ static void * scale_init(char *config) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *tmp = strdup(config);
|
||||
|
||||
s = (struct state_scale *)
|
||||
malloc(sizeof(struct state_scale));
|
||||
assert(s != NULL);
|
||||
|
||||
|
||||
ptr = strtok_r(config, ":", &save_ptr);
|
||||
ptr = strtok_r(tmp, ":", &save_ptr);
|
||||
assert(ptr != NULL);
|
||||
s->scaled_width = atoi(ptr);
|
||||
assert(ptr != NULL);
|
||||
ptr = strtok_r(NULL, ":", &save_ptr);
|
||||
s->scaled_height = atoi(ptr);
|
||||
|
||||
assert(s != NULL);
|
||||
free(tmp);
|
||||
|
||||
s->in = NULL;
|
||||
|
||||
init_gl_context(&s->context, GL_CONTEXT_LEGACY);
|
||||
|
||||
@@ -95,7 +95,7 @@ static void usage()
|
||||
printf("\tsplit to XxY tiles\n");
|
||||
}
|
||||
|
||||
static void * split_init(char *config) {
|
||||
static void * split_init(const char *config) {
|
||||
struct state_split *s;
|
||||
char *save_ptr = NULL;
|
||||
char *item;
|
||||
@@ -106,17 +106,21 @@ static void * split_init(char *config) {
|
||||
}
|
||||
s = (struct state_split *)
|
||||
malloc(sizeof(struct state_split));
|
||||
|
||||
char *tmp = strdup(config);
|
||||
|
||||
item = strtok_r(config, ":", &save_ptr);
|
||||
item = strtok_r(tmp, ":", &save_ptr);
|
||||
s->grid_width = atoi(item);
|
||||
item = strtok_r(config, ":", &save_ptr);
|
||||
item = strtok_r(NULL, ":", &save_ptr);
|
||||
if(!item) {
|
||||
usage();
|
||||
free(s);
|
||||
free(tmp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s->grid_height = atoi(item);
|
||||
free(tmp);
|
||||
|
||||
s->in = vf_alloc(1);
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ static void init_text() {
|
||||
}
|
||||
|
||||
|
||||
static void * text_init(char *config) {
|
||||
static void * text_init(const char *config) {
|
||||
pthread_once(&vo_postprocess_text_initialized, init_text);
|
||||
|
||||
struct state_text *s;
|
||||
@@ -113,9 +113,7 @@ static void * text_init(char *config) {
|
||||
|
||||
static int cf_text_init(struct module * /* parent */, const char *cfg, void **state)
|
||||
{
|
||||
char *tmp = strdup(cfg);
|
||||
*state = text_init(tmp);
|
||||
free(tmp);
|
||||
*state = text_init(cfg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -314,7 +312,6 @@ static const struct vo_postprocess_info vo_pp_text_info = {
|
||||
};
|
||||
|
||||
static const struct capture_filter_info capture_filter_text_info = {
|
||||
"text",
|
||||
cf_text_init,
|
||||
text_done,
|
||||
cf_text_filter
|
||||
|
||||
Reference in New Issue
Block a user