vgmstream/src/coding/nwa_decoder.h

74 lines
2.5 KiB
C
Raw Normal View History

2020-07-17 19:15:35 +02:00
/* derived from nwatowav.cc 2007.7.28 version, which read: */
/*
* Copyright 2001-2007 jagarl / Kazunori Ueno <jagarl@creator.club.ne.jp>
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted.
*
* jagarl
*
*
*
* Copyright
*
*
* 使
*
* THIS SOFTWARE IS PROVIDED BY KAZUNORI 'jagarl' UENO ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KAZUNORI UENO BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*/
#ifndef _NWA_DECODER_H
#define _NWA_DECODER_H
#include "../streamfile.h"
2020-07-17 19:15:35 +02:00
typedef struct NWAData_s {
int channels;
2020-07-17 19:15:35 +02:00
int bps; /* bits per sample */
int freq; /* samples per second */
int complevel; /* compression level */
int dummy; /* ? : 0x00 */
int blocks; /* block count */
int datasize; /* all data size */
int compdatasize; /* compressed data size */
int samplecount; /* all samples */
int blocksize; /* samples per block */
int restsize; /* samples of the last block */
int dummy2; /* ? : 0x89 */
int curblock;
2020-07-17 19:15:35 +02:00
off_t* offsets;
int filesize;
2020-07-17 19:15:35 +02:00
int use_runlength; //extra
2020-07-17 19:15:35 +02:00
uint8_t *tmpdata;
int16_t *outdata;
int16_t *outdata_readpos;
int samples_in_buffer;
} NWAData;
2020-07-17 19:15:35 +02:00
NWAData* nwalib_open(STREAMFILE* sf);
void nwalib_close(NWAData* nwa);
int nwalib_decode(STREAMFILE* sf, NWAData* nwa);
void nwalib_seek(STREAMFILE* sf, NWAData* nwa, int32_t seekpos);
void nwalib_reset(NWAData* nwa);
#endif