summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/sstv-encode.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/tools/sstv-encode.cpp b/src/tools/sstv-encode.cpp
index 9c7c141..4daf370 100644
--- a/src/tools/sstv-encode.cpp
+++ b/src/tools/sstv-encode.cpp
@@ -54,6 +54,13 @@ int main(int argc, char **argv)
LOG(FATAL) << "sstv_pack_image() failed";
}
+ /* create a sample buffer for output */
+ int8_t samp_buffer[128 * 1024];
+ sstv_signal_t signal;
+ if (sstv_pack_signal(&signal, SSTV_SAMPLE_INT8, 128 * 1024, samp_buffer) != SSTV_OK) {
+ LOG(FATAL) << "sstv_pack_signal() failed";
+ }
+
/* initialize library */
LOG(INFO) << "Initializing libsstv";
if (sstv_init(malloc, free) != SSTV_OK) {
@@ -70,6 +77,26 @@ int main(int argc, char **argv)
LOG(FATAL) << "NULL encoder received";
}
+ /* encode */
+ while (true) {
+ /* encode block */
+ sstv_error_t rc = sstv_encode(ctx, &signal);
+ if (rc != SSTV_ENCODE_SUCCESSFUL && rc != SSTV_ENCODE_END) {
+ LOG(FATAL) << "sstv_encode() failed with rc " << rc;
+ }
+
+ /* DEBUG: print block as csv */
+ for (size_t i=0; i < signal.count; i ++) {
+ std::cout << (int)((int8_t *)signal.buffer)[i] << std::endl;
+ }
+ std::cout << std::endl << std::endl;
+
+ /* exit case */
+ if (rc == SSTV_ENCODE_END) {
+ break;
+ }
+ }
+
/* cleanup */
LOG(INFO) << "Cleaning up";
if (sstv_delete_encoder(ctx) != SSTV_OK) {