UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
split.c File Reference
#include "debug.h"
#include "lib_common.h"
#include "utils/vf_split.h"
#include "video.h"
#include "video_display.h"
#include "vo_postprocess.h"
#include <pthread.h>
#include <stdlib.h>
Include dependency graph for split.c:

Go to the source code of this file.

Classes

struct  state_split
 

Functions

 REGISTER_MODULE (split, &vo_pp_split_info, LIBRARY_CLASS_VIDEO_POSTPROCESS, VO_PP_ABI_VERSION)
 
static void split_done (void *state)
 
static void split_get_out_desc (void *state, struct video_desc *out, int *in_display_mode, int *out_frames)
 
static bool split_get_property (void *state, int property, void *val, size_t *len)
 
static struct video_frame * split_getf (void *state)
 
static void * split_init (const char *config)
 
static bool split_postprocess (void *state, struct video_frame *in, struct video_frame *out, int req_pitch)
 
static bool split_postprocess_reconfigure (void *state, struct video_desc desc)
 
static void usage ()
 

Variables

static const struct vo_postprocess_info vo_pp_split_info
 

Detailed Description

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

Definition in file split.c.

Function Documentation

◆ REGISTER_MODULE()

REGISTER_MODULE ( split ,
& vo_pp_split_info,
LIBRARY_CLASS_VIDEO_POSTPROCESS ,
VO_PP_ABI_VERSION  )

◆ split_done()

static void split_done ( void * state)
static

Definition at line 151 of file split.c.

152{
153 struct state_split *s = (struct state_split *) state;
154
155 free(vf_get_tile(s->in, 0)->data);
156 vf_free(s->in);
157 free(state);
158}
void ** state
void vf_free(struct video_frame *buf)
Frees video_frame structure.
struct video_frame * in
Definition split.c:54
char * data
Raw tile data. Pointer must be at least 4B aligned.
Definition types.h:287
struct tile * vf_get_tile(struct video_frame *buf, int pos)
Returns pointer to n-th tile from video frame Equivalent to &video_frame::tiles[pos].

References tile::data, state_split::in, state, vf_free(), and vf_get_tile().

Here is the call graph for this function:

◆ split_get_out_desc()

static void split_get_out_desc ( void * state,
struct video_desc * out,
int * in_display_mode,
int * out_frames )
static

Definition at line 160 of file split.c.

161{
162 struct state_split *s = (struct state_split *) state;
163
164 out->width = vf_get_tile(s->in, 0)->width / s->grid_width;
165 out->height = vf_get_tile(s->in, 0)->height / s->grid_height;
166 out->color_spec = s->in->color_spec;
167 out->interlacing = s->in->interlacing;
168 out->fps = s->in->fps;
169 out->tile_count = s->grid_width * s->grid_height;
170
171 *in_display_mode = DISPLAY_PROPERTY_VIDEO_MERGED;
172 *out_frames = 1;
173}
@ DISPLAY_PROPERTY_VIDEO_MERGED
monolithic framebuffer
int grid_width
Definition split.c:55
int grid_height
Definition split.c:55
unsigned int width
Definition types.h:280
unsigned int height
Definition types.h:281
unsigned int tile_count
Definition types.h:185
codec_t color_spec
Definition types.h:182
enum interlacing_t interlacing
Definition types.h:184
double fps
Definition types.h:183
unsigned int width
width of every tile (!)
Definition types.h:179
unsigned int height
height of every tile (!)
Definition types.h:180
enum interlacing_t interlacing
Definition types.h:307
double fps
Definition types.h:308
codec_t color_spec
Definition types.h:306

References video_desc::color_spec, video_frame::color_spec, DISPLAY_PROPERTY_VIDEO_MERGED, video_desc::fps, video_frame::fps, state_split::grid_height, state_split::grid_width, tile::height, video_desc::height, state_split::in, video_desc::interlacing, video_frame::interlacing, state, video_desc::tile_count, vf_get_tile(), tile::width, and video_desc::width.

Here is the call graph for this function:

◆ split_get_property()

static bool split_get_property ( void * state,
int property,
void * val,
size_t * len )
static

Definition at line 59 of file split.c.

60{
62
63 switch(property) {
65 if(*len >= sizeof(bool)) {
66 *(bool *) val = true;
67 *len = sizeof(bool);
68 } else {
69 *len = 0;
70 }
71 return true;
72 }
73 return false;
74}
#define UNUSED(x)
int void * val
int void size_t * len
int property
#define VO_PP_DOES_CHANGE_TILING_MODE

References len, property, state, UNUSED, val, and VO_PP_DOES_CHANGE_TILING_MODE.

◆ split_getf()

static struct video_frame * split_getf ( void * state)
static

Definition at line 134 of file split.c.

135{
136 struct state_split *s = (struct state_split *) state;
137
138 return s->in;
139}

References state_split::in, and state.

◆ split_init()

static void * split_init ( const char * config)
static

Definition at line 82 of file split.c.

82 {
83 char *save_ptr = NULL;
84 char *item;
85
86 if (strcmp(config, "help") == 0) {
87 usage();
88 return NULL;
89 }
90 struct state_split *s = (struct state_split *)
91 malloc(sizeof(struct state_split));
92
93 char *tmp = strdup(config);
94 assert(tmp != NULL);
95
96 item = strtok_r(tmp, ":", &save_ptr);
97 s->grid_width = atoi(item);
98 item = strtok_r(NULL, ":", &save_ptr);
99 if(!item) {
100 usage();
101 free(s);
102 free(tmp);
103 return NULL;
104 }
105
106 s->grid_height = atoi(item);
107 free(tmp);
108
109 s->in = vf_alloc(1);
110
111 return s;
112}
struct video_frame * vf_alloc(int count)
Allocates blank video frame.
static void usage()
Definition split.c:65
Definition hd-rum.c:27

References state_split::grid_height, state_split::grid_width, state_split::in, usage(), and vf_alloc().

Here is the call graph for this function:

◆ split_postprocess()

static bool split_postprocess ( void * state,
struct video_frame * in,
struct video_frame * out,
int req_pitch )
static

Definition at line 141 of file split.c.

142{
143 struct state_split *s = (struct state_split *) state;
144 UNUSED(req_pitch);
145
146 vf_split(out, in, s->grid_width, s->grid_height, FALSE);
147
148 return true;
149}
#define FALSE
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

References FALSE, state_split::grid_height, state_split::grid_width, state_split::in, state, UNUSED, and vf_split().

Here is the call graph for this function:

◆ split_postprocess_reconfigure()

static bool split_postprocess_reconfigure ( void * state,
struct video_desc desc )
static

Definition at line 115 of file split.c.

116{
117 struct state_split *s = (struct state_split *) state;
118 struct tile *in_tile = vf_get_tile(s->in, 0);
119
121 s->in->fps = desc.fps;
123
124 in_tile->width = desc.width;
125 in_tile->height = desc.height;
126
128 desc.height;
129 in_tile->data = malloc(in_tile->data_len);
130
131 return true;
132}
struct video_desc desc
int vc_get_linesize(unsigned int width, codec_t codec)
Struct tile is an area of video_frame.
Definition types.h:279
unsigned int data_len
length of the data
Definition types.h:288

References video_desc::color_spec, video_frame::color_spec, tile::data, tile::data_len, desc, video_desc::fps, video_frame::fps, tile::height, video_desc::height, state_split::in, video_desc::interlacing, video_frame::interlacing, state, vc_get_linesize(), vf_get_tile(), tile::width, and video_desc::width.

Here is the call graph for this function:

◆ usage()

static void usage ( void )
static

Definition at line 76 of file split.c.

77{
78 printf("-p split:<X>:<Y>\n");
79 printf("\tsplit to XxY tiles\n");
80}

Variable Documentation

◆ vo_pp_split_info

const struct vo_postprocess_info vo_pp_split_info
static
Initial value:
= {
}
static bool split_postprocess(void *state, struct video_frame *in, struct video_frame *out, int req_pitch)
Definition split.c:141
static void * split_init(const char *config)
Definition split.c:82
static struct video_frame * split_getf(void *state)
Definition split.c:134
static bool split_postprocess_reconfigure(void *state, struct video_desc desc)
Definition split.c:115
static bool split_get_property(void *state, int property, void *val, size_t *len)
Definition split.c:59
static void split_get_out_desc(void *state, struct video_desc *out, int *in_display_mode, int *out_frames)
Definition split.c:160
static void split_done(void *state)
Definition split.c:151

Definition at line 175 of file split.c.