diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2010-10-29 11:38:54 +0200 |
---|---|---|
committer | Sylvain Munaut <tnt@246tNt.com> | 2010-11-05 16:41:47 +0100 |
commit | 0f7e52dbb51a966742b820ff606eeb76163fd8e8 (patch) | |
tree | 20493b99017b985537e9938f9323836f9ed7209e | |
parent | 553b3b6002985b2614c97715e99e45310862b4aa (diff) |
format: Add initial format framework
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r-- | include/gapk/formats.h | 48 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/formats.c | 36 |
3 files changed, 85 insertions, 0 deletions
diff --git a/include/gapk/formats.h b/include/gapk/formats.h new file mode 100644 index 0000000..d98baca --- /dev/null +++ b/include/gapk/formats.h @@ -0,0 +1,48 @@ +/* Formats handling */ + +/* + * This file is part of gapk (GSM Audio Pocket Knife). + * + * gapk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * gapk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with gapk. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __GAPK_FORMATS_H__ +#define __GAPK_FORMATS_H__ + +#include <stdint.h> + +enum format_type { + FMT_INVALID = 0, + + _FMT_MAX, +}; + +#include <gapk/codecs.h> /* need to import here because or enum interdep */ + +typedef int (*fmt_conv_cb_t)(uint8_t *dst, const uint8_t *src); + +struct format_desc { + enum format_type type; + enum codec_type codec_type; + const char * name; + const char * description; + + unsigned int frame_len; + fmt_conv_cb_t conv_from_canon; + fmt_conv_cb_t conv_to_canon; +}; + +const struct format_desc *fmt_get_from_type(enum format_type type); + +#endif /* __GAPK_FORMATS_H__ */ diff --git a/src/Makefile.am b/src/Makefile.am index 842cbbe..c77be9e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,4 +4,5 @@ AM_LDFLAGS=$(LIBOSMOCODEC_LIBS) bin_PROGRAMS = gapk gapk_SOURCES = main.c \ + formats.c \ codecs.c codec_pcm.c codec_hr.c codec_fr.c codec_efr.c diff --git a/src/formats.c b/src/formats.c new file mode 100644 index 0000000..1f54c05 --- /dev/null +++ b/src/formats.c @@ -0,0 +1,36 @@ +/* Formats handling */ + +/* + * This file is part of gapk (GSM Audio Pocket Knife). + * + * gapk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * gapk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with gapk. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <stdio.h> /* for NULL */ + +#include <gapk/formats.h> + +/* Extern format descriptors */ +static const struct format_desc *supported_formats[_FMT_MAX] = { + [FMT_INVALID] = NULL, +}; + + +const struct format_desc * +fmt_get_from_type(enum format_type type) +{ + if (type <= FMT_INVALID || type >= _FMT_MAX) + return NULL; + return supported_formats[type]; +} |