diff options
Diffstat (limited to 'src/pq_format.c')
-rw-r--r-- | src/pq_format.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/pq_format.c b/src/pq_format.c index d6bc8af..2c4a2fd 100644 --- a/src/pq_format.c +++ b/src/pq_format.c @@ -20,15 +20,16 @@ #include <errno.h> #include <stdint.h> -#include <gapk/codecs.h> -#include <gapk/formats.h> -#include <gapk/procqueue.h> +#include <osmocom/gapk/logging.h> +#include <osmocom/gapk/codecs.h> +#include <osmocom/gapk/formats.h> +#include <osmocom/gapk/procqueue.h> static int pq_cb_fmt_convert(void *_state, uint8_t *out, const uint8_t *in, unsigned int in_len) { - fmt_conv_cb_t f = _state; + osmo_gapk_fmt_conv_cb_t f = _state; return f(out, in, in_len); } @@ -37,36 +38,44 @@ pq_cb_fmt_convert(void *_state, uint8_t *out, const uint8_t *in, unsigned int in * \param[in] fmt Format description for conversion * \param[in] to_from_n convert to (0) or from (1) specified format */ int -pq_queue_fmt_convert(struct pq *pq, const struct format_desc *fmt, int to_from_n) +osmo_gapk_pq_queue_fmt_convert(struct osmo_gapk_pq *pq, const struct osmo_gapk_format_desc *fmt, int to_from_n) { - struct pq_item *item; - const struct codec_desc *codec = codec_get_from_type(fmt->codec_type); + const struct osmo_gapk_codec_desc *codec; + struct osmo_gapk_pq_item *item; + codec = osmo_gapk_codec_get_from_type(fmt->codec_type); if (!codec) { - fprintf(stderr, "[!] Cannot determine codec from format %s\n", fmt->name); + LOGPGAPK(LOGL_ERROR, "Cannot determine codec from " + "format %s\n", fmt->name); return -EINVAL; } - item = pq_add_item(pq); + item = osmo_gapk_pq_add_item(pq); if (!item) return -ENOMEM; if (to_from_n) { - fprintf(stderr, "[+] PQ: Adding conversion from canon to %s (for codec %s)\n", - fmt->name, codec->name); + LOGPGAPK(LOGL_DEBUG, "PQ '%s': Adding conversion from canon " + "to %s (for codec %s)\n", pq->name, fmt->name, codec->name); item->len_in = codec->canon_frame_len; item->len_out = fmt->frame_len; item->state = fmt->conv_from_canon; } else { - fprintf(stderr, "[+] PQ: Adding conversion from %s to canon (for codec %s)\n", - fmt->name, codec->name); + LOGPGAPK(LOGL_DEBUG, "PQ '%s': Adding conversion from %s " + "to canon (for codec %s)\n", pq->name, fmt->name, codec->name); item->len_in = fmt->frame_len; item->len_out = codec->canon_frame_len; item->state = fmt->conv_to_canon; } + item->type = OSMO_GAPK_ITEM_TYPE_PROC; item->proc = pq_cb_fmt_convert; + item->wait = NULL; + + /* Meta information */ + item->cat_name = "format"; + item->sub_name = fmt->name; return 0; } |