mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-12-21 02:45:52 +01:00
de2e30bea3
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@227 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
23 lines
683 B
C
23 lines
683 B
C
#include "../vgmstream.h"
|
|
|
|
#ifdef VGM_USE_VORBIS
|
|
#include <vorbis/vorbisfile.h>
|
|
#include "coding.h"
|
|
#include "../util.h"
|
|
|
|
void decode_ogg_vorbis(ogg_vorbis_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels) {
|
|
int samples_done = 0;
|
|
OggVorbis_File *ogg_vorbis_file = &data->ogg_vorbis_file;
|
|
|
|
do {
|
|
long rc = ov_read(ogg_vorbis_file, (char *)(outbuf + samples_done*channels),
|
|
(samples_to_do - samples_done)*sizeof(sample)*channels, 0,
|
|
sizeof(sample), 1, &data->bitstream);
|
|
|
|
if (rc > 0) samples_done += rc/sizeof(sample)/channels;
|
|
else return;
|
|
} while (samples_done < samples_to_do);
|
|
}
|
|
|
|
#endif
|