Skip to content

Commit

Permalink
Merge pull request #330 from JeromeMartinez/Conch
Browse files Browse the repository at this point in the history
Options --info and --conch disable encoding and decoding
  • Loading branch information
JeromeMartinez authored Jan 3, 2021
2 parents 602b054 + 43199b5 commit 811cbe5
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 50 deletions.
24 changes: 12 additions & 12 deletions Project/GNU/CLI/test/increasingdigitcount.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pushd "${files_path}" >/dev/null 2>&1
check_success "check failed on valid dpx sequence (1)" "check succeded on valid dpx sequence"
rm "${file}.mkv"
rm "${file}/10.dpx"
run_rawcooked -n --conch "${file}"
run_rawcooked -n --conch --encode "${file}"
check_failure "check failed due to incomplete dpx sequence" "check succeded despite incomplete dpx sequence (1)"

file=sequence2
Expand All @@ -27,7 +27,7 @@ pushd "${files_path}" >/dev/null 2>&1
rm "${file}/12.dpx"
rm "${file}/13.dpx"
cp "${file}/9.dpx" "${file}/100.dpx"
run_rawcooked -n --conch "${file}"
run_rawcooked -n --conch --encode "${file}"
check_failure "check failed due to incomplete dpx sequence" "check succeded despite incomplete dpx sequence (2)"

file=sequence3
Expand All @@ -39,7 +39,7 @@ pushd "${files_path}" >/dev/null 2>&1
run_rawcooked -n --check "${file}"
check_success "check failed on valid dpx sequence + 8/8-/8a files" "check succeded on valid dpx sequence"
rm "${file}.mkv"
run_rawcooked -n --conch "${file}"
run_rawcooked -n --conch --encode "${file}"
check_success "check failed on valid dpx sequence" "check succeded on valid dpx sequence + 8/8-/8a/9/9-/9a files"
rm "${file}.mkv"
cp "${file}/9.dpx" "${file}/9"
Expand All @@ -48,7 +48,7 @@ pushd "${files_path}" >/dev/null 2>&1
run_rawcooked -n --check "${file}"
check_success "check failed on valid dpx sequence + 8/8-/8a/9/9-/9a files" "check succeded on valid dpx sequence"
rm "${file}.mkv"
run_rawcooked -n --conch "${file}"
run_rawcooked -n --conch --encode "${file}"
check_success "check failed on valid dpx sequence" "check succeded on valid dpx sequence + 8/8-/8a/9/9-/9a files"
rm "${file}.mkv"
cp "${file}/10.dpx" "${file}/10"
Expand All @@ -57,29 +57,29 @@ pushd "${files_path}" >/dev/null 2>&1
run_rawcooked -n --check "${file}"
check_success "check failed on valid dpx sequence + 8/8-/8a/9/9-/9a/10/10-/10a files" "check succeded on valid dpx sequence"
rm "${file}.mkv"
run_rawcooked -n --conch "${file}"
run_rawcooked -n --conch --encode "${file}"
check_success "check failed on valid dpx sequence" "check succeded on valid dpx sequence + 8/8-/8a/9/9-/9a/10/10-/10a files"
rm "${file}.mkv"
rm "${file}/9.dpx"
run_rawcooked -n --conch "${file}"
run_rawcooked -n --conch --encode "${file}"
check_failure "check failed due to incomplete dpx sequence" "check succeded despite incomplete dpx sequence 9"
rm "${file}/10.dpx"
run_rawcooked -n --conch "${file}"
run_rawcooked -n --conch --encode "${file}"
check_failure "check failed due to incomplete dpx sequence" "check succeded despite incomplete dpx sequence 9/10 + 8/8-/8a/9/9-/9a/10/10-/10a files"
rm "${file}/10"
rm "${file}/10-"
rm "${file}/10a"
run_rawcooked -n --conch "${file}"
run_rawcooked -n --conch --encode "${file}"
check_failure "check failed due to incomplete dpx sequence" "check succeded despite incomplete dpx sequence 9/10 + 8/8-/8a/9/9-/9a files"
rm "${file}/9"
rm "${file}/9-"
rm "${file}/9a"
run_rawcooked -n --conch "${file}"
run_rawcooked -n --conch --encode "${file}"
check_failure "check failed due to incomplete dpx sequence" "check succeded despite incomplete dpx sequence 9/10 + 8/8-/8a files"
rm "${file}/8"
rm "${file}/8-"
rm "${file}/8a"
run_rawcooked -n --conch "${file}"
run_rawcooked -n --conch --encode "${file}"
check_failure "check failed due to incomplete dpx sequence" "check succeded despite incomplete dpx sequence 9/10"

file=sequence4
Expand All @@ -92,7 +92,7 @@ pushd "${files_path}" >/dev/null 2>&1
check_success "check failed on valid dpx sequence (4)" "check succeded on valid dpx sequence"
rm "${file}.mkv"
rm "${file}/10.dpx"
run_rawcooked -n --conch "${file}"
run_rawcooked -n --conch --encode "${file}"
check_failure "check failed due to incomplete dpx sequence" "check succeded despite incomplete dpx sequence (4)"

file=sequence5
Expand All @@ -105,7 +105,7 @@ pushd "${files_path}" >/dev/null 2>&1
check_success "check failed on valid dpx sequence (5)" "check succeded on valid dpx sequence"
rm "${file}.mkv"
mv "${file}/10.dpx" "${file}/10.dpx.bak"
run_rawcooked -n --conch "${file}"
run_rawcooked -n --conch --encode "${file}"
check_failure "check failed due to incomplete dpx sequence" "check succeded despite incomplete dpx sequence (5)"

file=sequence6
Expand Down
4 changes: 2 additions & 2 deletions Project/GNU/CLI/test/pcm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ pushd "${files_path}" >/dev/null 2>&1
ffmpeg -nostdin -f lavfi -i anoisesrc=duration=2 "${file}"/1.wav >/dev/null 2>&1 || fatal "internal" "ffmpeg command failed"

# encoding
run_rawcooked -c:a copy -y --conch "${file}"
run_rawcooked -c:a copy -y --conch --encode "${file}"
check_success "check failed with one pcm" "check succeded with one pcm"

# check decoding
run_rawcooked -y --conch "${file}.mkv"
run_rawcooked -y --conch --decode "${file}.mkv"
if ! check_success "mkv decoding failed" "mkv decoded" ; then
clean
continue
Expand Down
4 changes: 2 additions & 2 deletions Project/GNU/CLI/test/test1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ while read line ; do
fi

pushd "${files_path}/${path}" >/dev/null 2>&1
run_rawcooked -y --conch --file -d "${file}"
run_rawcooked -y --conch --encode --file -d "${file}"

# check expected result
if [ "${want}" == "fail" ] ; then
Expand Down Expand Up @@ -47,7 +47,7 @@ while read line ; do
fi

# check decoding
run_rawcooked -y --conch "${file}.mkv"
run_rawcooked -y --conch --decode "${file}.mkv"
if ! check_success "mkv decoding failed" "mkv decoded" ; then
clean
continue
Expand Down
4 changes: 2 additions & 2 deletions Project/GNU/CLI/test/test1b.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ while read line ; do
fi

pushd "${files_path}/${path}" >/dev/null 2>&1
run_rawcooked -y --conch --file --check-padding -slices 4 -d "${file}"
run_rawcooked -y --conch --encode --file --check-padding -slices 4 -d "${file}"

# check expected result
if [ "${want}" == "fail" ] ; then
Expand Down Expand Up @@ -49,7 +49,7 @@ while read line ; do
fi

# check decoding
run_rawcooked -y --conch "${file}.mkv"
run_rawcooked -y --conch --decode "${file}.mkv"
if ! check_success "mkv decoding failed" "mkv decoded" ; then
clean
continue
Expand Down
4 changes: 2 additions & 2 deletions Project/GNU/CLI/test/test2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ while read line ; do
fi

# run analysis
run_rawcooked -y --conch --check-padding --file ${file_input}
run_rawcooked -y --conch --encode --check-padding --file ${file_input}
check_success "file rejected at input" "file accepted at input" || continue

source_warnings=$(echo "${cmd_stderr}" | grep "Warning: ")
Expand Down Expand Up @@ -73,7 +73,7 @@ while read line ; do
continue
fi

run_rawcooked -y --conch "${file}.mkv"
run_rawcooked -y --conch --decode "${file}.mkv"
check_success "mkv decoding failed" "mkv decoded"
if ! check_success "mkv decoding failed" "mkv decoded" ; then
clean
Expand Down
14 changes: 11 additions & 3 deletions Source/CLI/Global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ int global::SetCoherency(bool Value)
int global::SetConch(bool Value)
{
Actions.set(Action_Conch, Value);
if (Value)
{
SetDecode(false);
SetEncode(false);
}
return 0;
}

Expand All @@ -159,7 +164,10 @@ int global::SetInfo(bool Value)
{
Actions.set(Action_Info, Value);
if (Value)
return SetDecode(false);
{
SetDecode(false);
SetEncode(false);
}
return 0;
}

Expand Down Expand Up @@ -189,6 +197,8 @@ int global::SetAll(bool Value)
{
if (int ReturnValue = SetInfo(Value))
return ReturnValue;
if (int ReturnValue = SetConch(Value))
return ReturnValue;
if (int ReturnValue = (Value?SetCheck(true):SetQuickCheck())) // Never implicitely set no check
return ReturnValue;
if (int ReturnValue = (Value && SetCheckPadding(Value))) // Never implicitely set no check padding
Expand All @@ -197,8 +207,6 @@ int global::SetAll(bool Value)
return ReturnValue;
if (int ReturnValue = SetCoherency(Value))
return ReturnValue;
if (int ReturnValue = SetConch(Value))
return ReturnValue;
if (int ReturnValue = SetDecode(Value))
return ReturnValue;
if (int ReturnValue = SetEncode(Value))
Expand Down
9 changes: 5 additions & 4 deletions Source/CLI/Help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ ReturnValue Help(const char* Name)
cout << endl;
cout << "ACTIONS" << endl;
cout << " --all" << endl;
cout << " Same as --info --decode --encode --hash --conch" << endl;
cout << " Same as --info --conch --decode --encode --hash" << endl;
cout << " --coherency --check-padding --check"<< endl;
cout << " --none" << endl;
cout << " Same as --no-info --no-decode --no-encode --no-hash" << endl;
cout << " --no-conch --no-coherency --quick-check-padding --quick-check" << endl;
cout << " Same as --no-info --no-conch --no-decode --no-encode --no-hash" << endl;
cout << " --no-coherency --quick-check-padding --quick-check" << endl;
cout << endl;
cout << " --check" << endl;
cout << " Check that the encoded file can be correctly decoded." << endl;
Expand All @@ -135,7 +135,7 @@ ReturnValue Help(const char* Name)
cout << " --info" << endl;
cout << " Provide some extra information about the compresssed file," << endl;
cout << " for example the presence of hash of the raw data." << endl;
cout << " Disable decoding." << endl;
cout << " Disable encoding and decoding." << endl;
cout << " --no-info" << endl;
cout << " Don't provide some extra information (see above)." << endl;
cout << " Is default (it may change in the future)" << endl;
Expand Down Expand Up @@ -168,6 +168,7 @@ ReturnValue Help(const char* Name)
cout << " --conch" << endl;
cout << " Conformance check of the format, when supported." << endl;
cout << " Currently partially implemented for DPX." << endl;
cout << " Disable encoding and decoding." << endl;
cout << " --no-conch" << endl;
cout << " Don't do conformance check (see above)." << endl;
cout << " Is default (it may change in the future)" << endl;
Expand Down
24 changes: 24 additions & 0 deletions Source/CLI/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,30 @@ int main(int argc, const char* argv[])
// Progress indicator
Global.ProgressIndicator_Stop();

// Info
if (!Global.Quiet)
{
for (size_t i = 0; i < Output.Streams.size(); i++)
{
cerr << "Track " << i + 1 << ':' << endl;
if (Output.Streams[i].FileName_Template.empty())
{
cerr << " " << Output.Streams[i].FileName.substr(((Global.Inputs.size() == 1 && Global.Inputs[0].size() < Output.Streams[i].FileName.size()) ? Global.Inputs[0].size() : Output.Streams[i].FileName.find_last_of("/\\")) + 1) << endl;
}
else
{
cerr << " " << Output.Streams[i].FileName_Template.substr(((Global.Inputs.size() == 1 && Global.Inputs[0].size() < Output.Streams[i].FileName.size()) ? Global.Inputs[0].size() : Output.Streams[i].FileName.find_last_of("/\\")) + 1) << endl;
cerr << " (" << Output.Streams[i].FileName_StartNumber << " --> " << Output.Streams[i].FileName_EndNumber;
if (!Output.Streams[i].FileList.empty())
cerr << ", with gaps";
cerr << ')' << endl;
}
cerr << " " << Output.Streams[i].Flavor << endl;
if (Output.Streams[i].Problem)
cerr << " *** This input format flavor is not supported by the current license key. ***" << endl;
}
}

if (!Value && Global.Errors.HasWarnings())
{
cerr << Global.Errors.ErrorMessage() << endl;
Expand Down
20 changes: 0 additions & 20 deletions Source/CLI/Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,26 +102,6 @@ int output::FFmpeg_Command(const char* FileName, global& Global)
vector<intermediate_write*> FilesToRemove;
for (size_t i = 0; i < Streams.size(); i++)
{
// Info
if (!Global.Quiet)
{
cerr << "Track " << i + 1 << ':' << endl;
if (Streams[i].FileName_Template.empty())
{
cerr << " " << Streams[i].FileName.substr(((Global.Inputs.size() == 1 && Global.Inputs[0].size() < Streams[i].FileName.size()) ? Global.Inputs[0].size() : Streams[i].FileName.find_last_of("/\\")) + 1) << endl;
}
else
{
cerr << " " << Streams[i].FileName_Template.substr(((Global.Inputs.size() == 1 && Global.Inputs[0].size() < Streams[i].FileName.size()) ? Global.Inputs[0].size() : Streams[i].FileName.find_last_of("/\\")) + 1) << endl;
cerr << " (" << Streams[i].FileName_StartNumber << " --> " << Streams[i].FileName_EndNumber;
if (!Streams[i].FileList.empty())
cerr << ", with gaps";
cerr << ')' << endl;
}
cerr << " " << Streams[i].Flavor << endl;
if (Streams[i].Problem)
cerr << " *** This input format flavor is not supported by the current license key. ***" << endl;
}
if (Streams[i].Problem)
Problem = true;

Expand Down
8 changes: 5 additions & 3 deletions Source/CLI/rawcooked.1
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ Assume \fIno\fR as answer to all prompts, and run non-interactively.
.SS ACTIONS
.TP
.B --all
Same as --info --decode --encode --hash --conch --coherency --check-padding --check (see below)
Same as --info --conch --decode --encode --hash --coherency --check-padding --check (see below)
.TP
.B --none
Same as --no-info --no-decode --no-encode --no-hash --no-conch --no-coherency --quick-check-padding --quick-check (see below)
Same as --no-info --no-conch --no-decode --no-encode --no-hash --no-coherency --quick-check-padding --quick-check (see below)
.TP
.B --check
Check that the encoded file can be correctly decoded.
Expand All @@ -104,7 +104,7 @@ If input is raw content, encode then check that output would be same as the inpu
.br
If input is compressed content, check that output would be same as the original content.
.br
Disable decoding.
Disable encoding and decoding.
.TP
.B --quick-check
Do quick coherency checks of the encoded file. It permits to check that the file seems healthy without the time and processor usage of the full check.
Expand Down Expand Up @@ -159,6 +159,8 @@ Do not carry out coherency check (see above).
Conformance check of the format, effective only when format is supported.
.br
This is currently partially implemented for DPX.
.br
Disable encoding and decoding.
.TP
.B --no-conch
Do not carry out conformance check (see above).
Expand Down

0 comments on commit 811cbe5

Please sign in to comment.