Skip to content

Commit 0d7eaac

Browse files
Add --log option
1 parent fce3a36 commit 0d7eaac

File tree

6 files changed

+287
-32
lines changed

6 files changed

+287
-32
lines changed

Source/CLI/Global.cpp

+27
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,13 @@ int global::SetHash(bool Value)
242242
return 0;
243243
}
244244

245+
//---------------------------------------------------------------------------
246+
int global::SetLogFileName(const char* FileName)
247+
{
248+
LogFileName = FileName;
249+
return 0;
250+
}
251+
245252
//---------------------------------------------------------------------------
246253
int global::SetAll(bool Value)
247254
{
@@ -582,6 +589,16 @@ int global::ManageCommandLine(const char* argv[], int argc)
582589
if (Value)
583590
return Value;
584591
}
592+
else if (strcmp(argv[i], "--log-name") == 0)
593+
{
594+
LogFile_IgnorePos.insert(i);
595+
if (i + 1 == argc)
596+
return Error_Missing(argv[i]);
597+
int Value = SetLogFileName(argv[++i]);
598+
LogFile_IgnorePos.insert(i);
599+
if (Value)
600+
return Value;
601+
}
585602
else if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0)
586603
{
587604
int Value = Help(argv[0]);
@@ -780,6 +797,7 @@ int global::ManageCommandLine(const char* argv[], int argc)
780797
OutputOptions["n"] = string();
781798
OutputOptions.erase("y");
782799
Mode = AlwaysNo; // Also RAWcooked itself
800+
LogFile_IgnorePos.insert(i);
783801
}
784802
else if (!strcmp(argv[i], "-threads"))
785803
{
@@ -793,6 +811,7 @@ int global::ManageCommandLine(const char* argv[], int argc)
793811
OutputOptions["y"] = string();
794812
OutputOptions.erase("n");
795813
Mode = AlwaysYes; // Also RAWcooked itself
814+
LogFile_IgnorePos.insert(i);
796815
}
797816
else if (OptionsForOtherFiles)
798817
{
@@ -815,9 +834,15 @@ int global::ManageCommandLine(const char* argv[], int argc)
815834
return Value;
816835
}
817836
else
837+
{
818838
Inputs.push_back(argv[i]);
839+
LogFile_IgnorePos.insert(i);
840+
}
819841
}
820842

843+
if (BinName.empty())
844+
BinName = "ffmpeg";
845+
821846
// License
822847
if (License.LoadLicense(LicenseKey, StoreLicenseKey))
823848
return true;
@@ -834,6 +859,8 @@ int global::ManageCommandLine(const char* argv[], int argc)
834859
if (Inputs.empty() && (ShowLicenseKey || SubLicenseId))
835860
return 0;
836861

862+
if (!LogFileName.empty())
863+
Log = new string;
837864
return 0;
838865
}
839866

Source/CLI/Global.h

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "Lib/Uncompressed/HashSum/HashSum.h"
1616
#include "Lib/License/License.h"
1717
#include <map>
18+
#include <set>
1819
#include <vector>
1920
#include <string>
2021
#include <thread>
@@ -34,6 +35,7 @@ class global
3435
string rawcooked_reversibility_FileName;
3536
string OutputFileName;
3637
string FrameMd5FileName;
38+
string LogFileName;
3739
string BinName;
3840
string LicenseKey;
3941
uint64_t SubLicenseId;
@@ -52,11 +54,13 @@ class global
5254
// Intermediate info
5355
size_t Path_Pos_Global;
5456
vector<string> Inputs;
57+
set<int> LogFile_IgnorePos;
5558
license License;
5659
user_mode Mode = Ask;
5760
hashes Hashes;
5861
errors Errors;
5962
ask_callback Ask_Callback = nullptr;
63+
string* Log = nullptr;
6064

6165
// Conformance check intermediary info
6266
vector<double> Durations;
@@ -100,6 +104,7 @@ class global
100104
int SetFrameMd5An(bool Value);
101105
int SetFrameMd5FileName(const char* FileName);
102106
int SetHash(bool Value);
107+
int SetLogFileName(const char* FileName);
103108
int SetAll(bool Value);
104109

105110
private:

Source/CLI/Help.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ ReturnValue Help(const char* Name)
138138
" -n Automatic no to prompts.\n"
139139
" Assume no as answer to all prompts, and run non-interactively.\n"
140140
"\n"
141+
" --log-name value\n"
142+
" Set the name of the RAWcooked log file writtent after\""
143+
" successful processing.\n"
144+
"\n"
141145
" ACTIONS\n"
142146
" --all Same as --info --conch --decode --encode --hash --coherency\n"
143147
" --check-padding --check --accept-gaps (see below)\n"
@@ -385,3 +389,15 @@ ReturnValue Version()
385389

386390
return ReturnValue_OK;
387391
}
392+
393+
//---------------------------------------------------------------------------
394+
const char* GetLibraryName()
395+
{
396+
return LibraryName;
397+
}
398+
399+
//---------------------------------------------------------------------------
400+
const char* GetLibraryVersion()
401+
{
402+
return LibraryVersion;
403+
}

Source/CLI/Help.h

+2
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@
1717
ReturnValue Help(const char* Name);
1818
ReturnValue Usage(const char* Name);
1919
ReturnValue Version();
20+
const char* GetLibraryVersion();
21+
const char* GetLibraryName();
2022

2123
#endif

0 commit comments

Comments
 (0)