mirror of
https://github.com/Motion-Project/motion.git
synced 2026-02-05 12:31:43 -05:00
Elminate picture_type as separate variable
This commit is contained in:
@@ -304,12 +304,8 @@ static void event_vlp_putpipe(struct ctx_cam *cam, motion_event evnt
|
||||
|
||||
const char *imageext(struct ctx_cam *cam) {
|
||||
|
||||
if (cam->imgs.picture_type == IMAGE_TYPE_PPM)
|
||||
return "ppm";
|
||||
|
||||
if (cam->imgs.picture_type == IMAGE_TYPE_WEBP)
|
||||
return "webp";
|
||||
|
||||
if (mystreq(cam->conf.picture_type, "ppm")) return "ppm";
|
||||
if (mystreq(cam->conf.picture_type, "webp")) return "webp";
|
||||
return "jpg";
|
||||
}
|
||||
|
||||
|
||||
@@ -101,11 +101,6 @@ int nls_enabled;
|
||||
|
||||
#define DEF_TIMELAPSE_MODE "daily"
|
||||
|
||||
/* OUTPUT Image types */
|
||||
#define IMAGE_TYPE_JPEG 0
|
||||
#define IMAGE_TYPE_PPM 1
|
||||
#define IMAGE_TYPE_WEBP 2
|
||||
|
||||
/* Filetype defines */
|
||||
#define FTYPE_IMAGE 1
|
||||
#define FTYPE_IMAGE_SNAPSHOT 2
|
||||
@@ -262,7 +257,7 @@ struct ctx_images {
|
||||
int labels_above;
|
||||
int labelsize_max;
|
||||
int largest_label;
|
||||
int picture_type;
|
||||
|
||||
};
|
||||
|
||||
struct ctx_stream_data {
|
||||
|
||||
@@ -573,22 +573,6 @@ static int mlp_init(struct ctx_cam *cam) {
|
||||
|
||||
webu_stream_init(cam);
|
||||
|
||||
/* Set output picture type */
|
||||
if (mystreq(cam->conf.picture_type, "ppm"))
|
||||
cam->imgs.picture_type = IMAGE_TYPE_PPM;
|
||||
else if (mystreq(cam->conf.picture_type, "webp")) {
|
||||
#ifdef HAVE_WEBP
|
||||
cam->imgs.picture_type = IMAGE_TYPE_WEBP;
|
||||
#else
|
||||
/* Fallback to jpeg if webp was selected in the config file, but the support for it was not compiled in */
|
||||
MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO
|
||||
,_("webp image format is not available, failing back to jpeg"));
|
||||
cam->imgs.picture_type = IMAGE_TYPE_JPEG;
|
||||
#endif /* HAVE_WEBP */
|
||||
}
|
||||
else
|
||||
cam->imgs.picture_type = IMAGE_TYPE_JPEG;
|
||||
|
||||
rotate_init(cam);
|
||||
|
||||
draw_init_scale(cam);
|
||||
|
||||
@@ -266,14 +266,14 @@ static void pic_write(struct ctx_cam *cam, FILE *picture, unsigned char *image,
|
||||
height = cam->imgs.height;
|
||||
}
|
||||
|
||||
if (cam->imgs.picture_type == IMAGE_TYPE_PPM) {
|
||||
if (mystreq(cam->conf.picture_type, "ppm")) {
|
||||
pic_save_ppm(picture, image, width, height);
|
||||
} else if (cam->imgs.picture_type == IMAGE_TYPE_WEBP) {
|
||||
} else if (mystreq(cam->conf.picture_type, "webp")) {
|
||||
pic_save_webp(picture, image, width, height, quality, cam, &(cam->current_image->imgts), &(cam->current_image->location));
|
||||
} else if (cam->imgs.picture_type == IMAGE_TYPE_JPEG) {
|
||||
pic_save_yuv420p(picture, image, width, height, quality, cam, &(cam->current_image->imgts), &(cam->current_image->location));
|
||||
} else {
|
||||
} else if (mystreq(cam->conf.picture_type, "grey")) {
|
||||
pic_save_grey(picture, image, width, height, quality, cam, &(cam->current_image->imgts), &(cam->current_image->location));
|
||||
} else {
|
||||
pic_save_yuv420p(picture, image, width, height, quality, cam, &(cam->current_image->imgts), &(cam->current_image->location));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user