vo_postprocess_cf_wrapper: get_property callback

Allow setting the get_property callback that can be specified for
vo_postproess filters. This is optional for the wrapper - if set to
nullptr, false will be always returned as until now.
This commit is contained in:
Martin Pulec
2024-08-27 09:38:03 +02:00
parent fa93411f15
commit d65df35c8f
10 changed files with 17 additions and 15 deletions

View File

@@ -134,7 +134,7 @@ static const struct capture_filter_info capture_filter_change_pixfmt = {
};
// coverity[leaked_storage:SUPPRESS]
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(change_pixfmt, init, filter, done, vo_pp_set_out_buffer)
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(change_pixfmt, init, filter, done, vo_pp_set_out_buffer, NULL)
REGISTER_MODULE(change_pixfmt, &capture_filter_change_pixfmt, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION);

View File

@@ -123,6 +123,6 @@ static const struct capture_filter_info capture_filter_color = {
REGISTER_MODULE(color, &capture_filter_color, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION);
// coverity[leaked_storage:SUPPRESS]
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(color, init, filter, done, vo_pp_set_out_buffer)
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(color, init, filter, done, vo_pp_set_out_buffer, NULL)
/* vim: set expandtab sw=8: */

View File

@@ -112,5 +112,5 @@ static const struct capture_filter_info capture_filter_flip = {
REGISTER_MODULE(flip, &capture_filter_flip, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION);
// coverity[leaked_storage:SUPPRESS]
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(flip, init, filter, done, vo_pp_set_out_buffer)
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(flip, init, filter, done, vo_pp_set_out_buffer, NULL)

View File

@@ -240,6 +240,6 @@ static const struct capture_filter_info capture_filter_gamma = {
REGISTER_MODULE(gamma, &capture_filter_gamma, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION);
// coverity[leaked_storage:SUPPRESS]
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(gamma, init, filter, done, vo_pp_set_out_buffer)
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(gamma, init, filter, done, vo_pp_set_out_buffer, nullptr)
/* vim: set expandtab sw=8: */

View File

@@ -119,5 +119,5 @@ static const struct capture_filter_info capture_filter_grayscale = {
REGISTER_MODULE(grayscale, &capture_filter_grayscale, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION);
// coverity[leaked_storage:SUPPRESS]
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(grayscale, init, filter, done, vo_pp_set_out_buffer)
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(grayscale, init, filter, done, vo_pp_set_out_buffer, NULL)

View File

@@ -313,6 +313,6 @@ static const struct capture_filter_info capture_filter_matrix = {
REGISTER_MODULE(matrix, &capture_filter_matrix, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION);
// coverity[leaked_storage:SUPPRESS]
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(matrix, init, filter, done, vo_pp_set_out_buffer)
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(matrix, init, filter, done, vo_pp_set_out_buffer, NULL)
/* vim: set expandtab sw=8: */

View File

@@ -137,5 +137,5 @@ static const struct capture_filter_info capture_filter_mirror = {
REGISTER_MODULE(mirror, &capture_filter_mirror, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION);
// coverity[leaked_storage:SUPPRESS]
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(mirror, init, filter, done, vo_pp_set_out_buffer)
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(mirror, init, filter, done, vo_pp_set_out_buffer, NULL)

View File

@@ -175,4 +175,4 @@ static const struct capture_filter_info capture_filter_override_prop = {
REGISTER_MODULE(override_prop, &capture_filter_override_prop, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION);
// coverity[leaked_storage:SUPPRESS]
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(override_prop, init, filter, done, vo_pp_set_out_buffer)
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(override_prop, init, filter, done, vo_pp_set_out_buffer, NULL)

View File

@@ -283,6 +283,6 @@ static const struct capture_filter_info capture_filter_resize = {
REGISTER_MODULE(resize, &capture_filter_resize, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION);
// coverity[leaked_storage:SUPPRESS]
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(resize, init, filter, done, vo_pp_set_out_buffer)
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(resize, init, filter, done, vo_pp_set_out_buffer, NULL)
/* vim: set expandtab sw=4: */

View File

@@ -51,12 +51,13 @@
struct vo_pp_capture_filter_wrapper {
void *state; ///< capture filter state
vo_postprocess_get_property_t get_property;
struct video_frame *f;
};
#define CF_WRAPPER_MERGE(a,b) a##b
#define ADD_VO_PP_CAPTURE_FILTER_WRAPPER(name, init, filter, done, set_out_buf) \
#define ADD_VO_PP_CAPTURE_FILTER_WRAPPER(name, init, filter, done, set_out_buf, get_prop_callb) \
static void *CF_WRAPPER_MERGE(vo_pp_init_, name)(const char *cfg) {\
void *state;\
if (init(NULL, cfg, &state) != 0) {\
@@ -65,6 +66,7 @@ static void *CF_WRAPPER_MERGE(vo_pp_init_, name)(const char *cfg) {\
struct vo_pp_capture_filter_wrapper *s = (struct vo_pp_capture_filter_wrapper *) \
calloc(1, sizeof(struct vo_pp_capture_filter_wrapper));\
s->state = state;\
s->get_property = get_prop_callb;\
return s;\
}\
\
@@ -75,11 +77,11 @@ static bool CF_WRAPPER_MERGE(vo_pp_reconfigure_, name)(void *state, struct video
}\
\
static bool CF_WRAPPER_MERGE(vo_pp_get_property_, name)(void *state, int property, void *val, size_t *len) {\
UNUSED(state);\
UNUSED(property);\
UNUSED(val);\
UNUSED(len);\
return false;\
struct vo_pp_capture_filter_wrapper *s = (struct vo_pp_capture_filter_wrapper *) state;\
if (s->get_property == 0) {\
return false;\
}\
return s->get_property(s->state, property, val, len);\
}\
static struct video_frame *CF_WRAPPER_MERGE(vo_pp_getf_, name)(void *state) {\
struct vo_pp_capture_filter_wrapper *s = (struct vo_pp_capture_filter_wrapper *) state;\