67 memcpy(s->
color, ((uint8_t []){ 0xff, 0xff, 0x00, 0xff }),
sizeof s->
color);
71 if (strcmp(config,
"help") == 0) {
72 printf(
"border video postprocess takes optional parameters: color to be the border drawn with and border width. Example:\n");
73 printf(
"\t-p border[:color=rrggbb][:width=<x>][:height=<y>]\n");
78 char *tmp = strdup(config);
79 char *config_copy = tmp;
80 char *
item, *save_ptr;
81 while ((
item = strtok_r(config_copy,
":", &save_ptr))) {
82 if (strncasecmp(
item,
"color=", strlen(
"color=")) == 0) {
83 const char *
color =
item + strlen(
"color=");
84 if (
color[0] ==
'#') {
87 if (strlen(
color) == 6) {
88 char color_str[3] =
"";
91 for (
int i = 0; i < 3; ++i) {
92 color_str[0] =
color[0];
93 color_str[1] =
color[1];
95 s->
color[i] = strtol(color_str, NULL, 16);
105 }
else if (strncasecmp(
item,
"width=", strlen(
"width=")) == 0) {
106 s->
width = atoi(
item + strlen(
"width="));
108 }
else if (strncasecmp(
item,
"height=", strlen(
"height=")) == 0) {
152 uint32_t rgba[2] = {0, 0};
154 memcpy(&rgba[0], s->
color, 4);
155 memcpy(&rgba[1], s->
color, 4);
159 for (
unsigned int i = 0; i < s->
height; ++i) {
160 char *line1 = out->
tiles[0].
data + i * req_pitch;
162 for (
unsigned int x = 0; x < out->
tiles[0].
width; x += 2) {
163 memcpy(line1 + x * 2, &uyvy, 4);
164 memcpy(line2 + x * 2, &uyvy, 4);
168 for (
unsigned int i = 0; i < s->
width; ++i) {
170 for (
unsigned int y = 0; y < out->
tiles[0].
height; y += 1) {
171 char *line = out->
tiles[0].
data + y * req_pitch;
172 char *line_end = out->
tiles[0].
data + y * req_pitch +
174 memcpy(line + i / 2 * 4, &uyvy, 4);
175 memcpy(line_end - i / 2 * 4, &uyvy, 4);
181 for (
unsigned int i = 0; i < s->
height; ++i) {
182 char *line1 = out->
tiles[0].
data + i * req_pitch;
184 for (
unsigned int x = 0; x < out->
tiles[0].
width; x += 1) {
185 memcpy(line1 + x * bpp, s->
color, bpp);
186 memcpy(line2 + x * bpp, s->
color, bpp);
191 for (
unsigned int i = 0; i < s->
width; ++i) {
192 for (
unsigned int y = 0; y < out->
tiles[0].
height; y += 1) {
193 char *line = out->
tiles[0].
data + y * req_pitch;
194 char *line_end = out->
tiles[0].
data + y * req_pitch +
196 memcpy(line + i * bpp, s->
color, bpp);
197 memcpy(line_end - i * bpp, s->
color, bpp);
void vf_free(struct video_frame *buf)
Frees video_frame structure.
int vc_get_linesize(unsigned int width, codec_t codec)
struct video_frame * vf_alloc_desc_data(struct video_desc desc)
static struct video_frame * border_getf(void *state)
static void * border_init(const char *config)
static bool border_postprocess_reconfigure(void *state, struct video_desc desc)
static void border_get_out_desc(void *state, struct video_desc *out, int *in_display_mode, int *out_frames)
static void border_done(void *state)
static bool border_postprocess(void *state, struct video_frame *in, struct video_frame *out, int req_pitch)
static bool border_get_property(void *state, int property, void *val, size_t *len)
static const struct vo_postprocess_info vo_pp_border_info
void log_msg(int level, const char *format,...)
#define LOG_LEVEL_ERROR
general errors
#define LOG_LEVEL_WARNING
less severe errors
@ DISPLAY_PROPERTY_VIDEO_MERGED
monolithic framebuffer
@ LIBRARY_CLASS_VIDEO_POSTPROCESS
#define REGISTER_MODULE(name, info, lclass, abi)
Registers module to global modules' registry.
static void vc_copylineRGBAtoUYVY(unsigned char *__restrict dst, const unsigned char *__restrict src, int dst_len, int rshift, int gshift, int bshift)
Converts RGBA to UYVY.
decoder_t get_decoder_from_to(codec_t in, codec_t out)
decoder_func_t * decoder_t
unsigned int width
border width in pixels (must be even)
struct video_desc saved_desc
uint8_t color[4]
border color in RGBA
unsigned int height
border height in pixels (must be even)
char * data
Raw tile data. Pointer must be at least 4B aligned.
unsigned int data_len
length of the data
Struct video_frame represents a video frame and contains video description.
struct tile tiles[FLEXIBLE_ARRAY_MEMBER]
@ RGB
RGB 8-bit (packed into 24-bit word)
@ UYVY
YCbCr 422 8-bit - Cb Y0 Cr Y1.
@ RGBA
RGBA 8-bit, big-endian.
This is an umbrella header for video functions.
double get_bpp(codec_t codec)
#define VO_PP_ABI_VERSION