summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrimio <vasi.vilvoiu@gmail.com>2019-01-03 01:48:50 +0200
committerrimio <vasi.vilvoiu@gmail.com>2019-01-03 01:48:50 +0200
commitdf66a60b90200b020c3e32a2a6302971b254bbd0 (patch)
tree0903e8868ed15867e76c33ba99eba8096136f9cf /src
parent85d1eac288e6f40e326b7d3b240588aac5f88e96 (diff)
Initial
Diffstat (limited to 'src')
-rw-r--r--src/encoder.c25
-rw-r--r--src/libsstv.template.h60
-rw-r--r--src/sstv.c20
-rw-r--r--src/sstv.h19
-rw-r--r--src/tools/sstv-encode.cpp13
5 files changed, 137 insertions, 0 deletions
diff --git a/src/encoder.c b/src/encoder.c
new file mode 100644
index 0000000..b45e3b9
--- /dev/null
+++ b/src/encoder.c
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2018 Vasile Vilvoiu (YO7JBP) <vasi.vilvoiu@gmail.com>
+ *
+ * libsstv is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#include "sstv.h"
+#include "libsstv.h"
+
+sstv_error_t
+sstv_create_encoder(sstv_mode_t mode, uint8_t *image, size_t sample_rate, void **out_ctx)
+{
+ /* Check input */
+}
+
+sstv_error_t
+sstv_delete_encoder(void *ctx)
+{
+}
+
+sstv_error_t
+sstv_encode(void *ctx, uint8_t *buffer, size_t buffer_size)
+{
+} \ No newline at end of file
diff --git a/src/libsstv.template.h b/src/libsstv.template.h
new file mode 100644
index 0000000..a977ff7
--- /dev/null
+++ b/src/libsstv.template.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2018 Vasile Vilvoiu (YO7JBP) <vasi.vilvoiu@gmail.com>
+ *
+ * libsstv is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#ifndef _LIBSSTV_H_
+#define _LIBSSTV_H_
+
+#include <stdint.h>
+#include <stddef.h>
+
+/*
+ * Version
+ */
+#define SSTV_VERSION_MAJOR @VERSION_MAJOR@
+#define SSTV_VERSION_MINOR @VERSION_MINOR@
+#define SSTV_VERSION_PATCH @VERSION_PATCH@
+#define SSTV_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@"
+
+/*
+ * Error codes
+ */
+typedef enum {
+ /* No error */
+ SSTV_OK = 0,
+
+ /* Unknown error - should not happen, fatal */
+ SSTV_UNKNOWN = 1,
+
+ /* Encoder return codes */
+ SSTV_ENCODE_SUCCESSFUL = 1000,
+ SSTV_ENCODE_END = 1001,
+ SSTV_ENCODE_FAIL = 1002,
+} sstv_error_t;
+
+/*
+ * SSTV modes
+ */
+typedef enum {
+ SSTV_MODE_WRAASE_SC_1_8 = 0,
+} sstv_mode_t;
+
+/*
+ * Memory management
+ */
+typedef void* (*sstv_malloc_t)(size_t);
+typedef void (*sstv_free_t)(void *);
+
+/*
+ * Routines
+ */
+extern sstv_error_t sstv_init(sstv_malloc_t alloc_func, sstv_free_t dealloc_func);
+
+extern sstv_error_t sstv_create_encoder(sstv_mode_t mode, uint8_t *image, size_t sample_rate, void **out_ctx);
+extern sstv_error_t sstv_delete_encoder(void *ctx);
+extern sstv_error_t sstv_encode(void *ctx, uint8_t *buffer, size_t buffer_size);
+
+#endif \ No newline at end of file
diff --git a/src/sstv.c b/src/sstv.c
new file mode 100644
index 0000000..a29acd3
--- /dev/null
+++ b/src/sstv.c
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2018 Vasile Vilvoiu (YO7JBP) <vasi.vilvoiu@gmail.com>
+ *
+ * libsstv is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#include "libsstv.h"
+
+sstv_malloc_t sstv_malloc_user = NULL;
+sstv_free_t sstv_free_user = NULL;
+
+sstv_error_t
+sstv_init(sstv_malloc_t alloc_func, sstv_free_t dealloc_func)
+{
+ /* Keep user functions for allocation/deallocation */
+ sstv_malloc_user = alloc_func;
+ sstv_free_user = dealloc_func;
+ return SSTV_OK;
+} \ No newline at end of file
diff --git a/src/sstv.h b/src/sstv.h
new file mode 100644
index 0000000..4b0279a
--- /dev/null
+++ b/src/sstv.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2018 Vasile Vilvoiu (YO7JBP) <vasi.vilvoiu@gmail.com>
+ *
+ * libsstv is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#ifndef _SSTV_H_
+#define _SSTV_H_
+
+#include "libsstv.h"
+
+/*
+ * Memory management functions
+ */
+extern sstv_malloc_t sstv_malloc_user;
+extern sstv_free_t sstv_free_user;
+
+#endif \ No newline at end of file
diff --git a/src/tools/sstv-encode.cpp b/src/tools/sstv-encode.cpp
new file mode 100644
index 0000000..fe925ed
--- /dev/null
+++ b/src/tools/sstv-encode.cpp
@@ -0,0 +1,13 @@
+/*
+ * Copyright (c) 2018 Vasile Vilvoiu (YO7JBP) <vasi.vilvoiu@gmail.com>
+ *
+ * libsstv is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+int a = 0;
+
+int main()
+{
+ return 0;
+} \ No newline at end of file