Skip to content

Commit

Permalink
#fixed: Fixed some error due to auto commenting
Browse files Browse the repository at this point in the history
  • Loading branch information
arpan404 committed Dec 17, 2024
1 parent 7517a97 commit af2df7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ void Generator::generate() {

std::cout << "Generating frames..." << std::endl;

// Create a thread pool to handle the frame processing in parallel
ThreadPool pool(std::thread::hardware_concurrency());

// Enqueue the frame generation task for the first frame
pool.enqueue([this, buffer = std::vector<char>(byteVector), bytes_read, frameName]() {
return convertToFrames(buffer, bytes_read, frameName);
Expand Down
17 changes: 9 additions & 8 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ void Parser::parse(int argc, char *argv[], bool &isRestoring, std::string &fileN
if (argc < 2) {
throw Error("No arguments passed.\nIf you need help running ziply, run 'ziply --help'", "par-ex1");
}

// If only the command is provided
if (argc == 2) {
std::string command = std::string(argv[1]);
Expand Down Expand Up @@ -37,7 +37,7 @@ void Parser::parse(int argc, char *argv[], bool &isRestoring, std::string &fileN

// Store all command line arguments in the params vector
for (int i = 0; i < argc; i++) { this->params.push_back(std::string(argv[i])); }

// Validate the parsed arguments
this->validateArguments(isRestoring, fileName, outputFileName, password, frameHeight, frameWidth);
}
Expand All @@ -61,15 +61,16 @@ void Parser::validateArguments(bool &isRestoring, std::string &fileName, std::st
}
// Prepare arguments based on the command
prepareArguments(isRestoring, fileName, outputFileName, password, frameHeight, frameWidth);
}
}

// Method to prepare and validate the arguments based on the command
void Parser::prepareArguments(bool &isRestoring, std::string &fileName, std::string &outputFileName,
std::string &password, int &frameHeight, int &frameWidth) {
int argumentsListLength = params.size(); // Total number of arguments
bool isInputFileProvided = false; // Flag to check if input file is provided
bool isResolutionProvided = false; // Flag to check if resolution is provided
bool isInputFileProvided = false; // Flag to check if input file is provided
bool isResolutionProvided = false; // Flag to check if resolution is provided

// If restoring, only certain arguments are valid
if (isRestoring) {
std::unordered_set<std::string> availableArguments = {"-f", "-o", "-p"};
Expand Down Expand Up @@ -209,8 +210,8 @@ void Parser::prepareArguments(bool &isRestoring, std::string &fileName, std::str
frameHeight = 2160;
isResolutionProvided = true; // Mark resolution as provided
} else {
frameWidth = 1920; // Default resolution
frameHeight = 1080; // Default resolution
frameWidth = 1920; // Default resolution
frameHeight = 1080; // Default resolution
isResolutionProvided = true; // Mark resolution as provided
}
}
Expand Down Expand Up @@ -243,7 +244,7 @@ void Parser::prepareArguments(bool &isRestoring, std::string &fileName, std::str
// Set default resolution if not provided
if (!isResolutionProvided) {
frameHeight = 1080; // Default height
frameWidth = 1920; // Default width
frameWidth = 1920; // Default width
}

// Check if an input file was provided
Expand Down

0 comments on commit af2df7d

Please sign in to comment.