aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-08-31 17:22:56 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2017-12-31 12:20:59 +0100
commita8d46571cebb7f14501fa7bcf3c2eb86c473d8b2 (patch)
tree8e8dfb392f9a13026ff521e85f2b5babd1ce4c12 /include
parent9cba760ba2ca5fd73e34f91bf388fc255dbcd335 (diff)
Add an 'osmo_gapk' prefix to the exposed symbols
To avoid a naming conflict between libosmogapk and other projects during linkage, all the exposed symbols should have an unique prefix. Let's use 'osmo_gapk' for that.
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/gapk/benchmark.h9
-rw-r--r--include/osmocom/gapk/codecs.h47
-rw-r--r--include/osmocom/gapk/formats.h48
-rw-r--r--include/osmocom/gapk/procqueue.h40
4 files changed, 82 insertions, 62 deletions
diff --git a/include/osmocom/gapk/benchmark.h b/include/osmocom/gapk/benchmark.h
index c18d85e..a404168 100644
--- a/include/osmocom/gapk/benchmark.h
+++ b/include/osmocom/gapk/benchmark.h
@@ -24,18 +24,19 @@
#define NUM_AVG 102400
-struct benchmark_cycles {
+struct osmo_gapk_bench_cycles {
cycles_t enc[NUM_AVG];
unsigned int enc_used;
cycles_t dec[NUM_AVG];
unsigned int dec_used;
};
-extern struct benchmark_cycles codec_cycles[_CODEC_MAX];
+extern struct osmo_gapk_bench_cycles osmo_gapk_bench_codec[_CODEC_MAX];
-static inline void benchmark_stop(enum codec_type codec, int encode, unsigned long cycles)
+static inline void benchmark_stop(enum osmo_gapk_codec_type codec,
+ int encode, unsigned long cycles)
{
- struct benchmark_cycles *bc = &codec_cycles[codec];
+ struct osmo_gapk_bench_cycles *bc = &osmo_gapk_bench_codec[codec];
if (encode) {
bc->enc_used = (bc->enc_used + 1) % NUM_AVG;
diff --git a/include/osmocom/gapk/codecs.h b/include/osmocom/gapk/codecs.h
index f680460..253fb14 100644
--- a/include/osmocom/gapk/codecs.h
+++ b/include/osmocom/gapk/codecs.h
@@ -28,7 +28,7 @@
#define HR_REF_ENC_LEN (20 * sizeof(uint16_t))
#define HR_REF_DEC_LEN (22 * sizeof(uint16_t))
-enum codec_type {
+enum osmo_gapk_codec_type {
CODEC_INVALID = 0,
CODEC_PCM, /* 16 bits PCM samples */
CODEC_HR, /* GSM Half Rate codec GSM 06.20 */
@@ -38,7 +38,8 @@ enum codec_type {
_CODEC_MAX,
};
-#include <osmocom/gapk/formats.h> /* need to import here because or enum interdep */
+/* Need to import here because of enum interdep */
+#include <osmocom/gapk/formats.h>
/*! call-back for actual codec conversion function
* \param[in] state opaque state pointer (returned by codec->init)
@@ -46,23 +47,33 @@ enum codec_type {
* \param[in] src input data
* \param[in] src_len length of input data \a src
* \returns number of output bytes written to \a dst; negative on error */
-typedef int (*codec_conv_cb_t)(void *state, uint8_t *dst, const uint8_t *src, unsigned int src_len);
+typedef int (*osmo_gapk_codec_conv_cb_t)(void *state, uint8_t *dst,
+ const uint8_t *src, unsigned int src_len);
-struct codec_desc {
- enum codec_type type;
- const char * name;
- const char * description;
- /*! canonical frame size (in bytes); 0 in case of variable length */
- unsigned int canon_frame_len;
+struct osmo_gapk_codec_desc {
+ enum osmo_gapk_codec_type type;
+ const char *description;
+ const char *name;
- enum format_type codec_enc_format_type; /* what the encoder provides */
- enum format_type codec_dec_format_type; /* what to give the decoder */
- /*! codec initialization function pointer, returns opaque state */
- void * (*codec_init)(void);
- /*! codec exit function pointer, gets passed opaque state */
- void (*codec_exit)(void *state);
- codec_conv_cb_t codec_encode;
- codec_conv_cb_t codec_decode;
+ /*!
+ * Canonical frame size (in bytes);
+ * 0 in case of variable length
+ */
+ unsigned int canon_frame_len;
+
+ /*! What the encoder provides */
+ enum osmo_gapk_format_type codec_enc_format_type;
+ /*! What to give the decoder */
+ enum osmo_gapk_format_type codec_dec_format_type;
+
+ /* (De)initialization function pointers */
+ void *(*codec_init)(void);
+ void (*codec_exit)(void *state);
+
+ /* Encoding / decoding function pointers */
+ osmo_gapk_codec_conv_cb_t codec_encode;
+ osmo_gapk_codec_conv_cb_t codec_decode;
};
-const struct codec_desc *codec_get_from_type(enum codec_type type);
+const struct osmo_gapk_codec_desc *
+osmo_gapk_codec_get_from_type(enum osmo_gapk_codec_type type);
diff --git a/include/osmocom/gapk/formats.h b/include/osmocom/gapk/formats.h
index 4a3cb67..d1521d0 100644
--- a/include/osmocom/gapk/formats.h
+++ b/include/osmocom/gapk/formats.h
@@ -21,7 +21,7 @@
#include <stdint.h>
-enum format_type {
+enum osmo_gapk_format_type {
FMT_INVALID = 0,
/* Classic .amr container */
@@ -61,31 +61,37 @@ enum format_type {
_FMT_MAX,
};
-#include <osmocom/gapk/codecs.h> /* need to import here because or enum interdep */
+/* Need to import here because of enum interdep */
+#include <osmocom/gapk/codecs.h>
/*! call-back for actual format conversion function
* \param[out] dst caller-allocated buffer for output data
* \param[in] src input data
* \param[in] src_len length of input data \a src
* \returns number of output bytes written to \a dst; negative on error */
-typedef int (*fmt_conv_cb_t)(uint8_t *dst, const uint8_t *src, unsigned int src_len);
-
-struct format_desc {
- enum format_type type;
- enum codec_type codec_type;
- const char * name;
- const char * description;
-
- /*! length of frames in this format (as opposed to canonical) */
- unsigned int frame_len;
- fmt_conv_cb_t conv_from_canon;
- fmt_conv_cb_t conv_to_canon;
-
- /*! length of a (global) header at start of file */
- unsigned int header_len;
- /*! exact match for (global) header at start of file */
- const uint8_t * header;
+typedef int (*osmo_gapk_fmt_conv_cb_t)(uint8_t *dst,
+ const uint8_t *src, unsigned int src_len);
+
+struct osmo_gapk_format_desc {
+ enum osmo_gapk_format_type type;
+ enum osmo_gapk_codec_type codec_type;
+ const char *description;
+ const char *name;
+
+ /*! Length of frames in this format (as opposed to canonical) */
+ unsigned int frame_len;
+
+ /* Format conversation function pointers */
+ osmo_gapk_fmt_conv_cb_t conv_from_canon;
+ osmo_gapk_fmt_conv_cb_t conv_to_canon;
+
+ /*! Length of a (global) header at start of file */
+ unsigned int header_len;
+ /*! Exact match for (global) header at start of file */
+ const uint8_t *header;
};
-const struct format_desc *fmt_get_from_type(enum format_type type);
-const struct format_desc *fmt_get_from_name(const char *name);
+const struct osmo_gapk_format_desc *
+osmo_gapk_fmt_get_from_type(enum osmo_gapk_format_type type);
+const struct osmo_gapk_format_desc *
+osmo_gapk_fmt_get_from_name(const char *name);
diff --git a/include/osmocom/gapk/procqueue.h b/include/osmocom/gapk/procqueue.h
index b07970d..50e6eb6 100644
--- a/include/osmocom/gapk/procqueue.h
+++ b/include/osmocom/gapk/procqueue.h
@@ -22,7 +22,7 @@
#include <stdint.h>
#include <stdio.h> /* for FILE */
-struct pq_item {
+struct osmo_gapk_pq_item {
/*! input frame size (in bytes). '0' in case of variable frames */
int len_in;
/*! output frame size (in bytes). '0' in case of variable frames */
@@ -42,35 +42,37 @@ struct pq_item {
#define VAR_BUF_SIZE 320
#define MAX_PQ_ITEMS 8
-struct pq {
+struct osmo_gapk_pq {
unsigned n_items;
- struct pq_item *items[MAX_PQ_ITEMS];
+ struct osmo_gapk_pq_item *items[MAX_PQ_ITEMS];
void *buffers[MAX_PQ_ITEMS + 1];
};
-/* Management */
-struct pq * pq_create(void);
-void pq_destroy(struct pq *pq);
-struct pq_item * pq_add_item(struct pq *pq);
-int pq_prepare(struct pq *pq);
-int pq_execute(struct pq *pq);
+/* Processing queue management */
+struct osmo_gapk_pq *osmo_gapk_pq_create(void);
+int osmo_gapk_pq_prepare(struct osmo_gapk_pq *pq);
+int osmo_gapk_pq_execute(struct osmo_gapk_pq *pq);
+void osmo_gapk_pq_destroy(struct osmo_gapk_pq *pq);
+
+/* Processing queue item management */
+struct osmo_gapk_pq_item *osmo_gapk_pq_add_item(struct osmo_gapk_pq *pq);
/* File */
-int pq_queue_file_input(struct pq *pq, FILE *src, unsigned int block_len);
-int pq_queue_file_output(struct pq *pq, FILE *dst, unsigned int block_len);
+int osmo_gapk_pq_queue_file_input(struct osmo_gapk_pq *pq, FILE *src, unsigned int block_len);
+int osmo_gapk_pq_queue_file_output(struct osmo_gapk_pq *pq, FILE *dst, unsigned int block_len);
/* RTP */
-int pq_queue_rtp_input(struct pq *pq, int rtp_fd, unsigned int block_len);
-int pq_queue_rtp_output(struct pq *pq, int rtp_fd, unsigned int block_len);
+int osmo_gapk_pq_queue_rtp_input(struct osmo_gapk_pq *pq, int rtp_fd, unsigned int block_len);
+int osmo_gapk_pq_queue_rtp_output(struct osmo_gapk_pq *pq, int rtp_fd, unsigned int block_len);
/* ALSA */
-int pq_queue_alsa_input(struct pq *pq, const char *hwdev, unsigned int blk_len);
-int pq_queue_alsa_output(struct pq *pq, const char *hwdev, unsigned int blk_len);
+int osmo_gapk_pq_queue_alsa_input(struct osmo_gapk_pq *pq, const char *hwdev, unsigned int blk_len);
+int osmo_gapk_pq_queue_alsa_output(struct osmo_gapk_pq *pq, const char *hwdev, unsigned int blk_len);
/* Format */
-struct format_desc;
-int pq_queue_fmt_convert(struct pq *pq, const struct format_desc *fmt, int to_from_n);
+struct osmo_gapk_format_desc;
+int osmo_gapk_pq_queue_fmt_convert(struct osmo_gapk_pq *pq, const struct osmo_gapk_format_desc *fmt, int to_from_n);
/* Codec */
-struct codec_desc;
-int pq_queue_codec(struct pq *pq, const struct codec_desc *codec, int encode);
+struct osmo_gapk_codec_desc;
+int osmo_gapk_pq_queue_codec(struct osmo_gapk_pq *pq, const struct osmo_gapk_codec_desc *codec, int encode);