Skip to content

Commit

Permalink
vo_postprocess_cf_wrapper: get_property callback
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MartinPulec committed Aug 27, 2024
1 parent fa93411 commit d65df35
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/capture_filter/change_pixfmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);


Expand Down
2 changes: 1 addition & 1 deletion src/capture_filter/color.c
Original file line number Diff line number Diff line change
Expand Up @@ -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: */
2 changes: 1 addition & 1 deletion src/capture_filter/flip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

2 changes: 1 addition & 1 deletion src/capture_filter/gamma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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: */
2 changes: 1 addition & 1 deletion src/capture_filter/grayscale.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

2 changes: 1 addition & 1 deletion src/capture_filter/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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: */
2 changes: 1 addition & 1 deletion src/capture_filter/mirror.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

2 changes: 1 addition & 1 deletion src/capture_filter/override_prop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion src/capture_filter/resize.c
Original file line number Diff line number Diff line change
Expand Up @@ -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: */
14 changes: 8 additions & 6 deletions src/vo_postprocess/capture_filter_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {\
Expand All @@ -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;\
}\
\
Expand All @@ -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;\
Expand Down

0 comments on commit d65df35

Please sign in to comment.