diff --git a/cpymo-tool/Makefile b/cpymo-tool/Makefile index fb994374..7d4f609a 100644 --- a/cpymo-tool/Makefile +++ b/cpymo-tool/Makefile @@ -7,7 +7,7 @@ INC := $(wildcard *.h) $(wildcard ../cpymo/*.h) SRC_TOOL := $(wildcard *.c) OBJS := $(patsubst %.c, $(BUILD_DIR)/%.o, $(SRC_TOOL)) -CFLAGS := -g -DDEBUG -DLEAKCHECK +CFLAGS := -O3 -DNDEBUG -DLEAKCHECK CC = cc -c LD = cc diff --git a/cpymo-tool/cpymo_tool_ffmpeg.c b/cpymo-tool/cpymo_tool_ffmpeg.c index d95c7679..5a5d38d7 100644 --- a/cpymo-tool/cpymo_tool_ffmpeg.c +++ b/cpymo-tool/cpymo_tool_ffmpeg.c @@ -3,27 +3,22 @@ #include #include -#ifdef _WIN32 -#define NUL_DEVICE "nul" -#else -#define NUL_DEVICE "/dev/null" -#endif - error_t cpymo_tool_ffmpeg_search(const char **out_ffmpeg_command) { #define TRY(CMD) \ - if (system(CMD " -version > " NUL_DEVICE) == 0) { \ + if (system(CMD " -version") == 0) { \ *out_ffmpeg_command = CMD; \ return CPYMO_ERR_SUCC; \ } \ #ifdef _WIN32 + TRY("ffmpeg"); TRY("cmd /c ffmpeg"); + TRY("powershell ./ffmpeg"); #else TRY("./ffmpeg"); - #endif - TRY("ffmpeg"); + #endif #undef TRY @@ -45,12 +40,11 @@ error_t cpymo_tool_ffmpeg_call( + strlen(src) + strlen(dst) + strlen(fmt) - + strlen(NUL_DEVICE) + flags_len - + 32 + strlen(NUL_DEVICE)); + + 32); if (command == NULL) return CPYMO_ERR_OUT_OF_MEM; - sprintf(command, "%s -i \"%s\" -y -v quiet -f %s %s%s\"%s\" > " NUL_DEVICE, + sprintf(command, "%s -i \"%s\" -y -v quiet -f %s %s%s\"%s\"", ffmpeg_command, src, fmt, diff --git a/cpymo-tool/cpymo_tool_image.c b/cpymo-tool/cpymo_tool_image.c index 2db4cf7d..2ab0347c 100644 --- a/cpymo-tool/cpymo_tool_image.c +++ b/cpymo-tool/cpymo_tool_image.c @@ -86,7 +86,7 @@ error_t cpymo_tool_image_load_attach_mask_from_memory(cpymo_tool_image *img, voi error_t cpymo_tool_image_detach_mask(const cpymo_tool_image *img, cpymo_tool_image *out_mask) { - out_mask->pixels = (stbi_uc *)malloc(out_mask->width * out_mask->height); + out_mask->pixels = (stbi_uc *)malloc(img->width * img->height); if (out_mask->pixels == NULL) return CPYMO_ERR_OUT_OF_MEM; out_mask->channels = 1;