summaryrefslogtreecommitdiffstats
path: root/video/image_writer.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-04-20 23:02:20 +0200
committerwm4 <wm4@nowhere>2015-04-20 23:03:32 +0200
commit07678423fb737e7c12f1b513d68ab1c99b44d853 (patch)
tree3612a515ffd466239c1370484f9328c5c99289f5 /video/image_writer.c
parentf13266014f328fed9eda41047f0a1700348ba923 (diff)
downloadmpv-07678423fb737e7c12f1b513d68ab1c99b44d853.tar.bz2
mpv-07678423fb737e7c12f1b513d68ab1c99b44d853.tar.xz
image_writer: minor cleanup
Instead of using int like bool, use bool directly.
Diffstat (limited to 'video/image_writer.c')
-rw-r--r--video/image_writer.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/video/image_writer.c b/video/image_writer.c
index 491828aa22..88ffb7964c 100644
--- a/video/image_writer.c
+++ b/video/image_writer.c
@@ -78,14 +78,14 @@ struct image_writer_ctx {
struct img_writer {
const char *file_ext;
- int (*write)(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp);
+ bool (*write)(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp);
const int *pixfmts;
int lavc_codec;
};
-static int write_lavc(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp)
+static bool write_lavc(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp)
{
- int success = 0;
+ bool success = 0;
AVFrame *pic = NULL;
AVPacket pkt = {0};
int got_output = 0;
@@ -161,7 +161,7 @@ static void write_jpeg_error_exit(j_common_ptr cinfo)
longjmp(*(jmp_buf*)cinfo->client_data, 1);
}
-static int write_jpeg(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp)
+static bool write_jpeg(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp)
{
struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr;
@@ -173,7 +173,7 @@ static int write_jpeg(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp)
cinfo.client_data = &error_return_jmpbuf;
if (setjmp(cinfo.client_data)) {
jpeg_destroy_compress(&cinfo);
- return 0;
+ return false;
}
jpeg_create_compress(&cinfo);
@@ -209,7 +209,7 @@ static int write_jpeg(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp)
jpeg_destroy_compress(&cinfo);
- return 1;
+ return true;
}
#endif
@@ -279,8 +279,8 @@ const char *image_writer_file_ext(const struct image_writer_opts *opts)
return get_writer(opts)->file_ext;
}
-int write_image(struct mp_image *image, const struct image_writer_opts *opts,
- const char *filename, struct mp_log *log)
+bool write_image(struct mp_image *image, const struct image_writer_opts *opts,
+ const char *filename, struct mp_log *log)
{
struct mp_image *allocated_image = NULL;
struct image_writer_opts defs = image_writer_opts_defaults;
@@ -316,7 +316,7 @@ int write_image(struct mp_image *image, const struct image_writer_opts *opts,
}
FILE *fp = fopen(filename, "wb");
- int success = 0;
+ bool success = false;
if (fp == NULL) {
mp_err(log, "Error opening '%s' for writing!\n", filename);
} else {