Skip to content

Commit

Permalink
bug fixed.
Browse files Browse the repository at this point in the history
Seng-Jik committed Jun 25, 2023
1 parent 61b41e7 commit b9cf889
Showing 3 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cpymo-tool/Makefile
Original file line number Diff line number Diff line change
@@ -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
18 changes: 6 additions & 12 deletions cpymo-tool/cpymo_tool_ffmpeg.c
Original file line number Diff line number Diff line change
@@ -3,27 +3,22 @@
#include <stdio.h>
#include <string.h>

#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,
2 changes: 1 addition & 1 deletion cpymo-tool/cpymo_tool_image.c
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit b9cf889

Please sign in to comment.