diff options
| author | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2023-08-26 21:17:03 +0300 |
|---|---|---|
| committer | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2023-08-26 21:17:03 +0300 |
| commit | b4f2ff1afadc03f56beee5b694d89a2cbbd7f851 (patch) | |
| tree | f7d2e60d419327b343a00916e4093b4f5629a998 | |
| parent | 65507815d29f87ffc04a1d35bf7f1f2aa5b6360c (diff) | |
Fix issues in README examples.
| -rw-r--r-- | README.md | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -170,9 +170,15 @@ void *ctx; if (sstv_create_encoder(&ctx, image, SSTV_MODE_FAX480, SAMPLE_RATE) != SSTV_OK) { ... error handling ... } + +... encode the data ... + +if (sstv_delete_encoder(ctx) != SSTV_OK) { + ... error handling ... +} ``` -#### Encoding +#### Encoding of data The actual encoding is performed with multiple calls to `sstv_encode()`, until the whole output has been produced: @@ -183,12 +189,15 @@ void *ctx; sstv_signal_t signal; ... signal packing ... -sstv_error_t rc = SSTV_OK; -while (rc != SSTV_ENCODE_END) { - if (sstv_encode(ctx, &signal) != SSTV_ENCODE_SUCCESSFUL) { +sstv_error_t rc; +do { + rc = sstv_encode(ctx, &signal); + if (rc != SSTV_ENCODE_SUCCESSFUL && rc != SSTV_ENCODE_END) { ... error handling ... } -} +} while (rc != SSTV_ENCODE_END); + +... encoder context disposal ... ``` Note that `sstv_encode()` does not return `SSTV_OK` on success but `SSTV_ENCODE_SUCCESSFUL`. |
