mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 06:40:15 +00:00
Matrix cap. f.: added vo pp wrapper
This commit is contained in:
@@ -47,12 +47,14 @@
|
||||
#include "utils/color_out.h"
|
||||
#include "video.h"
|
||||
#include "video_codec.h"
|
||||
#include "vo_postprocess/capture_filter_wrapper.h"
|
||||
|
||||
#define MOD_NAME "[matrix cap. f.] "
|
||||
|
||||
struct state_capture_filter_matrix {
|
||||
double transform_matrix[9];
|
||||
bool check_bounds;
|
||||
void *vo_pp_out_buffer; ///< buffer to write to if we use vo_pp wrapper (otherwise unused)
|
||||
};
|
||||
|
||||
static int init(struct module *parent, const char *cfg, void **state)
|
||||
@@ -118,7 +120,13 @@ static struct video_frame *filter(void *state, struct video_frame *in)
|
||||
if (in->color_spec == UYVY) {
|
||||
desc.color_spec = RGB;
|
||||
}
|
||||
struct video_frame *out = vf_alloc_desc_data(desc);
|
||||
struct video_frame *out = vf_alloc_desc(desc);
|
||||
if (s->vo_pp_out_buffer) {
|
||||
out->tiles[0].data = s->vo_pp_out_buffer;
|
||||
} else {
|
||||
out->tiles[0].data = malloc(out->tiles[0].data_len);
|
||||
out->callbacks.data_deleter = vf_data_deleter;
|
||||
}
|
||||
out->callbacks.dispose = vf_free;
|
||||
|
||||
if (s->check_bounds) {
|
||||
@@ -278,6 +286,12 @@ static struct video_frame *filter(void *state, struct video_frame *in)
|
||||
return out;
|
||||
}
|
||||
|
||||
static void vo_pp_set_out_buffer(void *state, char *buffer)
|
||||
{
|
||||
struct state_capture_filter_matrix *s = state;
|
||||
s->vo_pp_out_buffer = buffer;
|
||||
}
|
||||
|
||||
static const struct capture_filter_info capture_filter_matrix = {
|
||||
.init = init,
|
||||
.done = done,
|
||||
@@ -285,5 +299,7 @@ static const struct capture_filter_info capture_filter_matrix = {
|
||||
};
|
||||
|
||||
REGISTER_MODULE(matrix, &capture_filter_matrix, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION);
|
||||
ADD_VO_PP_CAPTURE_FILTER_WRAPPER(matrix, init, filter, done, vo_pp_set_out_buffer)
|
||||
|
||||
|
||||
/* vim: set expandtab sw=8: */
|
||||
|
||||
Reference in New Issue
Block a user