AfonsoCMSousa/vcomp#1 feat: Checked if files are valid Video files

This commit is contained in:
AfonsoCMSousa
2025-12-15 16:39:50 +00:00
parent bfcfad931c
commit 2ef15af49e
60 changed files with 7424 additions and 8 deletions
+68
View File
@@ -0,0 +1,68 @@
#ifndef FILE_TYPES_HPP
#define FILE_TYPES_HPP
#include <complex>
#include <cstring>
#include <string>
enum fileType { mp4, avi, mkv, mov, flv, webm, unknown };
bool isVideoFile(std::string filename, fileType &type);
class file {
private:
std::string filename;
fileType type;
public:
file() : filename(""), type(unknown) {}
file(const char *fname, fileType ftype) {
this->filename = std::string(fname);
this->type = ftype;
}
file(const char *fname) {
filename = std::string(fname);
if (!isVideoFile(fname, this->type)) {
type = unknown;
}
}
file(const std::string &fname, fileType ftype) {
this->filename = fname;
this->type = ftype;
}
fileType getType() const {
return type;
}
std::string getFilename() const {
return filename;
}
void setType(fileType ftype) {
this->type = ftype;
}
void setFilename(const std::string &fname) {
this->filename = fname;
if (!isVideoFile(fname.c_str(), this->type)) {
type = unknown;
}
}
void setFilename(const char *fname) {
this->filename = std::string(fname);
if (!isVideoFile(fname, this->type)) {
type = unknown;
}
}
bool operator==(const file &other) const {
return this->getType() == other.getType();
}
};
#endif // FILE_TYPES_HPP
+3
View File
@@ -9,6 +9,9 @@ class Logger {
public:
static void log(const char* format, ...);
static void err(const char* format, ...);
static void warn(const char* format, ...);
static void print(const char* format, ...);
static void println(const char* format, ...);
};
#endif // PRINT_HPP