summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vf_crop.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmpcodecs/vf_crop.c')
-rw-r--r--libmpcodecs/vf_crop.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/libmpcodecs/vf_crop.c b/libmpcodecs/vf_crop.c
index 58683e01b1..96a90f606b 100644
--- a/libmpcodecs/vf_crop.c
+++ b/libmpcodecs/vf_crop.c
@@ -23,6 +23,7 @@
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
+#include "options.h"
#include "img_format.h"
#include "mp_image.h"
@@ -39,14 +40,12 @@ static const struct vf_priv_s {
-1,-1
};
-extern int opt_screen_size_x;
-extern int opt_screen_size_y;
-
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
+ struct MPOpts *opts = vf->opts;
// calculate the missing parameters:
if(vf->priv->crop_w<=0 || vf->priv->crop_w>width) vf->priv->crop_w=width;
if(vf->priv->crop_h<=0 || vf->priv->crop_h>height) vf->priv->crop_h=height;
@@ -76,17 +75,17 @@ static int config(struct vf_instance_s* vf,
// check:
if(vf->priv->crop_w+vf->priv->crop_x>width ||
vf->priv->crop_h+vf->priv->crop_y>height){
- mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_CropBadPositionWidthHeight);
+ mp_tmsg(MSGT_VFILTER, MSGL_WARN, "[CROP] Bad position/width/height - cropped area outside of the original!\n");
return 0;
}
- if(!opt_screen_size_x && !opt_screen_size_y){
+ if(!opts->screen_size_x && !opts->screen_size_y){
d_width=d_width*vf->priv->crop_w/width;
d_height=d_height*vf->priv->crop_h/height;
}
return vf_next_config(vf,vf->priv->crop_w,vf->priv->crop_h,d_width,d_height,flags,outfmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)
return vf_next_put_image(vf,vf->dmpi, pts);
@@ -113,12 +112,12 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){
+static void start_slice(struct vf_instance* vf, mp_image_t *mpi){
vf->dmpi = vf_get_image(vf->next, mpi->imgfmt, mpi->type, mpi->flags,
vf->priv->crop_w, vf->priv->crop_h);
}
-static void draw_slice(struct vf_instance_s* vf,
+static void draw_slice(struct vf_instance* vf,
unsigned char** src, int* stride, int w,int h, int x, int y){
unsigned char *src2[3];
src2[0] = src[0];