53#define MOD_NAME "[crop] "
72 color_printf(
"This filter spatially crops video to given dimensions. If the video is smaller than the crop, no cropping is performed.\n\n");
76 TBOLD(
"yoff")
". Example:\n"
77 "\t" TBOLD(
TRED(
"%s crop")
"[:size=<w>x<h>][:xoff=<x>][:yoff=<y>]")
"\n\n",
83 if (strcmp(config,
"help") == 0) {
90 char *tmp = strdup(config);
91 char *config_copy = tmp;
92 char *
item, *save_ptr;
93 while ((
item = strtok_r(config_copy,
":", &save_ptr))) {
95 if (strchr(
item,
'x') == NULL) {
100 }
else if (strncasecmp(
item,
"width=", strlen(
"width=")) == 0) {
101 s->
width = atoi(
item + strlen(
"width="));
102 }
else if (strncasecmp(
item,
"height=", strlen(
"height=")) == 0) {
104 }
else if (strncasecmp(
item,
"xoff=", strlen(
"xoff=")) == 0) {
105 s->
xoff = atoi(
item + strlen(
"xoff="));
106 }
else if (strncasecmp(
item,
"yoff=", strlen(
"yoff=")) == 0) {
107 s->
yoff = atoi(
item + strlen(
"yoff="));
163 for (
int y = 0 ; y < (int) out->
tiles[0].
height; y++) {
164 memcpy(out->
tiles[0].
data + y * req_pitch,
191 if (strcmp(cfg,
"help") == 0) {
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.
int vc_get_linesize(unsigned int width, codec_t codec)
struct video_frame * vf_alloc_desc_data(struct video_desc desc)
#define CAPTURE_FILTER_ABI_VERSION
int color_printf(const char *format,...)
static bool crop_postprocess_reconfigure(void *state, struct video_desc desc)
static struct video_frame * crop_getf(void *state)
static void crop_get_out_desc(void *state, struct video_desc *out, int *in_display_mode, int *out_frames)
static void * crop_init(const char *config)
static void crop_done(void *state)
static const struct capture_filter_info capture_filter_crop_info
static int cf_crop_init(struct module *parent, const char *cfg, void **state)
static bool crop_postprocess(void *state, struct video_frame *in, struct video_frame *out, int req_pitch)
static struct video_frame * cf_crop_filter(void *state, struct video_frame *f)
static bool crop_get_property(void *state, int property, void *val, size_t *len)
static const struct vo_postprocess_info vo_pp_crop_info
void log_msg(int level, const char *format,...)
#define LOG_LEVEL_ERROR
general errors
@ DISPLAY_PROPERTY_VIDEO_MERGED
monolithic framebuffer
@ LIBRARY_CLASS_VIDEO_POSTPROCESS
@ LIBRARY_CLASS_CAPTURE_FILTER
#define REGISTER_MODULE(name, info, lclass, abi)
Registers module to global modules' registry.
struct video_desc out_desc
struct video_desc in_desc
char * data
Raw tile data. Pointer must be at least 4B aligned.
unsigned int width
width of every tile (!)
unsigned int height
height of every tile (!)
void(* dispose)(struct video_frame *)
Struct video_frame represents a video frame and contains video description.
struct tile tiles[FLEXIBLE_ARRAY_MEMBER]
struct video_frame_callbacks callbacks
This is an umbrella header for video functions.
int get_pf_block_bytes(codec_t codec)
returns codec_info_t::block_size_bytes
double get_bpp(codec_t codec)
bool video_desc_eq(struct video_desc a, struct video_desc b)
Compares two video descriptions.
#define VIDEO_FRAME_DISPOSE(frame)
#define VO_PP_ABI_VERSION