From: Daniel Baluta Date: Thu, 7 Jan 2021 18:17:58 +0000 (+0200) Subject: crecord: Move wave data structures to their own header X-Git-Tag: v1.2.5~3^2~3 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=d67cdffeaba03b6aaf91c109e3cb46a52fc58b0a;p=tinycompress.git crecord: Move wave data structures to their own header This is in preparation for adding wave parsing routines to be used by tinycompress utilities. Signed-off-by: Daniel Baluta --- diff --git a/include/tinycompress/tinywave.h b/include/tinycompress/tinywave.h new file mode 100644 index 0000000..c7e98aa --- /dev/null +++ b/include/tinycompress/tinywave.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: (LGPL-2.1-only OR BSD-3-Clause) */ +/* + * wave header and parsing + * + * Copyright 2020 NXP + */ + +#ifndef __TINYWAVE_H +#define __TINYWAVE_H + +struct riff_chunk { + char desc[4]; + uint32_t size; +} __attribute__((__packed__)); + +struct wave_header { + struct { + struct riff_chunk chunk; + char format[4]; + } __attribute__((__packed__)) riff; + + struct { + struct riff_chunk chunk; + uint16_t type; + uint16_t channels; + uint32_t rate; + uint32_t byterate; + uint16_t blockalign; + uint16_t samplebits; + } __attribute__((__packed__)) fmt; + + struct { + struct riff_chunk chunk; + } __attribute__((__packed__)) data; +} __attribute__((__packed__)); + +#endif diff --git a/src/utils/crecord.c b/src/utils/crecord.c index 12ad961..41a90e0 100644 --- a/src/utils/crecord.c +++ b/src/utils/crecord.c @@ -77,6 +77,7 @@ #include "sound/compress_params.h" #include "sound/compress_offload.h" #include "tinycompress/tinycompress.h" +#include "tinycompress/tinywave.h" static int verbose; static int file; @@ -112,32 +113,6 @@ static const struct { }; #define CREC_NUM_CODEC_IDS (sizeof(codec_ids) / sizeof(codec_ids[0])) -struct riff_chunk { - char desc[4]; - uint32_t size; -} __attribute__((__packed__)); - -struct wave_header { - struct { - struct riff_chunk chunk; - char format[4]; - } __attribute__((__packed__)) riff; - - struct { - struct riff_chunk chunk; - uint16_t type; - uint16_t channels; - uint32_t rate; - uint32_t byterate; - uint16_t blockalign; - uint16_t samplebits; - } __attribute__((__packed__)) fmt; - - struct { - struct riff_chunk chunk; - } __attribute__((__packed__)) data; -} __attribute__((__packed__)); - static const struct wave_header blank_wave_header = { .riff = { .chunk = {