UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
split.c File Reference
#include "capture_filter.h"
#include "debug.h"
#include "lib_common.h"
#include "utils/color_out.h"
#include "utils/vf_split.h"
#include "video.h"
#include "video_codec.h"
Include dependency graph for split.c:

Go to the source code of this file.

Classes

struct  state_split
 

Macros

#define MAX_TILES   16
 

Functions

static void done (void *state)
 
static struct video_frame * filter (void *state, struct video_frame *in)
 
static int init (struct module *parent, const char *cfg, void **state)
 
 REGISTER_MODULE (split, &capture_filter_split, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION)
 
static void usage ()
 

Variables

static const struct capture_filter_info capture_filter_split
 

Detailed Description

Author
Martin Pulec pulec.nosp@m.@ces.nosp@m.net.c.nosp@m.z

Definition in file split.c.

Macro Definition Documentation

◆ MAX_TILES

#define MAX_TILES   16

Definition at line 53 of file split.c.

Function Documentation

◆ done()

static void done ( void * state)
static

Definition at line 98 of file split.c.

99{
100 free(state);
101}
void ** state

References state.

◆ filter()

static struct video_frame * filter ( void * state,
struct video_frame * in )
static

Definition at line 103 of file split.c.

104{
105 struct state_split *s = state;
106
108 desc.tile_count = s->x * s->y;
109 desc.width /= s->x;
110 desc.height /= s->y;
111 struct video_frame *out = vf_alloc_desc_data(desc);
112 vf_split(out, in, s->x, s->y, 0);
114
116 return out;
117}
struct video_desc desc
void vf_free(struct video_frame *buf)
Frees video_frame structure.
struct video_desc video_desc_from_frame(const struct video_frame *frame)
Returns struct video_desc from video frame.
struct video_frame * vf_alloc_desc_data(struct video_desc desc)
int x
Definition split.c:62
int y
Definition split.c:62
unsigned int tile_count
Definition types.h:185
unsigned int width
width of every tile (!)
Definition types.h:179
unsigned int height
height of every tile (!)
Definition types.h:180
void(* dispose)(struct video_frame *)
Definition types.h:245
Struct video_frame represents a video frame and contains video description.
Definition types.h:305
struct video_frame_callbacks callbacks
Definition types.h:324
void vf_split(struct video_frame *out, struct video_frame *src, unsigned int x_count, unsigned int y_count, int preallocate)
Definition vf_split.cpp:51
#define VIDEO_FRAME_DISPOSE(frame)
Definition video_frame.h:76

References video_frame::callbacks, desc, video_frame_callbacks::dispose, video_desc::height, state, video_desc::tile_count, vf_alloc_desc_data(), vf_free(), vf_split(), video_desc_from_frame(), VIDEO_FRAME_DISPOSE, video_desc::width, state_split::x, and state_split::y.

Here is the call graph for this function:

◆ init()

static int init ( struct module * parent,
const char * cfg,
void ** state )
static

Definition at line 71 of file split.c.

72{
74 int x, y;
75
76 if (!cfg || strchr(cfg, ':') == NULL) {
77 usage();
78 return -1;
79 }
80 if (strcasecmp(cfg, "help") == 0) {
81 usage();
82 return 1;
83 }
84
85 x = atoi(cfg);
86 y = atoi(strchr(cfg, ':') + 1);
87 assert(x > 0 && y > 0);
88
89
90 struct state_split *s = calloc(1, sizeof(struct state_split));
91 s->x = x;
92 s->y = y;
93
94 *state = s;
95 return 0;
96}
#define UNUSED(x)
static void usage()
Definition split.c:65
const char * parent
Definition settings.cpp:198

References parent, state, UNUSED, usage(), state_split::x, and state_split::y.

Here is the call graph for this function:

◆ REGISTER_MODULE()

REGISTER_MODULE ( split ,
& capture_filter_split,
LIBRARY_CLASS_CAPTURE_FILTER ,
CAPTURE_FILTER_ABI_VERSION  )

◆ usage()

static void usage ( void )
static

Definition at line 65 of file split.c.

65 {
66 printf("Splits frame to XxY tiles:\n\n");
67 printf("split usage:\n");
68 color_printf(TERM_BOLD "\tsplit:x:y\n\n" TERM_RESET);
69}
int color_printf(const char *format,...)
#define TERM_BOLD
Definition color_out.h:48
#define TERM_RESET
Definition color_out.h:47

References color_printf(), TERM_BOLD, and TERM_RESET.

Referenced by init(), and split_init().

Here is the call graph for this function:

Variable Documentation

◆ capture_filter_split

const struct capture_filter_info capture_filter_split
static
Initial value:
= {
.init = init,
.done = done,
.filter = filter,
}
static struct video_frame * filter(void *state, struct video_frame *in)
Definition split.c:103
static void done(void *state)
Definition split.c:98
static int init(struct module *parent, const char *cfg, void **state)
Definition split.c:71

Definition at line 119 of file split.c.

119 {
120 .init = init,
121 .done = done,
122 .filter = filter,
123};