diff options
| author | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2023-08-26 21:08:04 +0300 |
|---|---|---|
| committer | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2023-08-26 21:08:04 +0300 |
| commit | 65507815d29f87ffc04a1d35bf7f1f2aa5b6360c (patch) | |
| tree | 03298ee790291bd07e77d29e0fd9712103a6c96e | |
| parent | a17660dee12f441933a5f2cdde834e6ddcfe0635 (diff) | |
Exit on failure in encoding tool.
| -rw-r--r-- | src/tools/sstv-encode.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tools/sstv-encode.cpp b/src/tools/sstv-encode.cpp index 3c6e391..1903a22 100644 --- a/src/tools/sstv-encode.cpp +++ b/src/tools/sstv-encode.cpp @@ -168,9 +168,11 @@ int main(int argc, char **argv) void *ctx = nullptr; if (sstv_create_encoder(&ctx, sstv_image, mode, args::get(sample_rate)) != SSTV_OK) { std::cerr << "Failed to create SSTV encoder" << std::endl; + exit(EXIT_FAILURE); } if (!ctx) { std::cerr << "NULL encoder received" << std::endl; + exit(EXIT_FAILURE); } /* open WAV file */ @@ -181,6 +183,7 @@ int main(int argc, char **argv) SNDFILE *wavfile = sf_open(args::get(output).c_str(), SFM_WRITE, &wavinfo); if (!wavfile) { std::cerr << "sf_open() failed: " << sf_strerror(NULL) << std::endl; + exit(EXIT_FAILURE); } /* encode */ @@ -189,6 +192,7 @@ int main(int argc, char **argv) sstv_error_t rc = sstv_encode(ctx, &signal); if (rc != SSTV_ENCODE_SUCCESSFUL && rc != SSTV_ENCODE_END) { std::cerr << "sstv_encode() failed with rc " << rc << std::endl; + exit(EXIT_FAILURE); } /* write to sound file */ @@ -208,6 +212,7 @@ int main(int argc, char **argv) std::cout << "Cleaning up" << std::endl; if (sstv_delete_encoder(ctx) != SSTV_OK) { std::cerr << "Failed to delete SSTV encoder" << std::endl; + exit(EXIT_FAILURE); } /* all ok */ |
