mirror of
https://github.com/gtxaspec/wz_mini_hacks.git
synced 2024-12-22 12:23:35 +00:00
update mp4write to exclude alarm clips so they upload to the cloud properly
This commit is contained in:
parent
4abbd21bab
commit
35988bec3b
Binary file not shown.
Binary file not shown.
@ -8,8 +8,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
static int (*original_mp4write_start_handler)(void *handler, char *file, void *config);
|
||||
|
||||
|
||||
static int mp4WriteEnable = 0;
|
||||
|
||||
char *mp4Write(int fd, char *tokenPtr) {
|
||||
@ -29,24 +31,41 @@ char *mp4Write(int fd, char *tokenPtr) {
|
||||
return "error in mp4write.c";
|
||||
}
|
||||
|
||||
int mp4write_start_handler(void *handler, char *file, void *config) {
|
||||
|
||||
int mp4write_start_handler(void *handler, char *file, void *config, char *tokenPtr) {
|
||||
|
||||
if(mp4WriteEnable) {
|
||||
|
||||
struct stat st = {0};
|
||||
const char* folder;
|
||||
folder = "/media/mmc/record/tmp";
|
||||
struct stat sb;
|
||||
|
||||
if(!strncmp(file, "/tmp/", 5)) {
|
||||
char buf[64];
|
||||
strncpy(buf, file + 5, 30);
|
||||
if (stat("/media/mmc/record/tmp", &st) == -1) {
|
||||
printf("[command] mp4write.c: checking for temporary record directory\n");
|
||||
|
||||
if (stat(folder, &sb) == 0 && S_ISDIR(sb.st_mode)) {
|
||||
printf("[command] mp4write.c: temporary directory exists.\n");
|
||||
} else {
|
||||
printf("[command] mp4write.c: directory missing, creating directory\n");
|
||||
mkdir("/media/mmc/record/tmp", 0700);
|
||||
}
|
||||
|
||||
printf("mp4write.c: filename: %s\n", file);
|
||||
|
||||
if(!strncmp(file, "/tmp/alarm_", 11)) {
|
||||
printf("mp4write.c: alarm, skipping\n", file);
|
||||
return (original_mp4write_start_handler)(handler, file, config);
|
||||
} else if(!strncmp(file, "/tmp/", 5)) {
|
||||
char buf[64];
|
||||
strncpy(buf, file + 5, 30);
|
||||
strcpy(file, "/media/mmc/record/tmp/");
|
||||
strcat(file, buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (original_mp4write_start_handler)(handler, file, config);
|
||||
}
|
||||
|
||||
|
||||
static void __attribute ((constructor)) mp4write_init(void) {
|
||||
|
||||
original_mp4write_start_handler = dlsym(dlopen("/system/lib/libmp4rw.so", RTLD_LAZY), "mp4write_start_handler");
|
||||
|
Loading…
Reference in New Issue
Block a user