添加视频压缩代码

This commit is contained in:
zsyg
2025-06-28 16:10:13 +08:00
committed by GitHub
parent 3f88a5e5c7
commit 0137e43408
18 changed files with 1260 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
#include "file_utils.h"
#include <sys/stat.h>
#include <string.h>
#include <stdio.h>
bool file_exists(const char* path) {
if (path == NULL) {
return false;
}
struct stat buffer;
return stat(path, &buffer) == 0;
}
long file_size(const char* path) {
if (path == NULL) {
return -1;
}
struct stat buffer;
if (stat(path, &buffer) != 0) {
return -1;
}
return (long)buffer.st_size;
}
const char* file_extension(const char* path) {
if (path == NULL) {
return NULL;
}
const char* dot = strrchr(path, '.');
if (dot == NULL || dot == path) {
return NULL;
}
return dot;
}