mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-16 03:23:19 +01:00
Make decoder init functions for G722.1/G719
This commit is contained in:
parent
4d0c8b54fd
commit
229783f5f0
@ -172,6 +172,7 @@ void mpeg_set_error_logging(mpeg_codec_data * data, int enable);
|
|||||||
|
|
||||||
#ifdef VGM_USE_G7221
|
#ifdef VGM_USE_G7221
|
||||||
/* g7221_decoder */
|
/* g7221_decoder */
|
||||||
|
g7221_codec_data *init_g7221(int channel_count, int frame_size);
|
||||||
void decode_g7221(VGMSTREAM *vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel);
|
void decode_g7221(VGMSTREAM *vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel);
|
||||||
void reset_g7221(VGMSTREAM *vgmstream);
|
void reset_g7221(VGMSTREAM *vgmstream);
|
||||||
void free_g7221(VGMSTREAM *vgmstream);
|
void free_g7221(VGMSTREAM *vgmstream);
|
||||||
@ -179,6 +180,7 @@ void free_g7221(VGMSTREAM *vgmstream);
|
|||||||
|
|
||||||
#ifdef VGM_USE_G719
|
#ifdef VGM_USE_G719
|
||||||
/* g719_decoder */
|
/* g719_decoder */
|
||||||
|
g719_codec_data *init_g719(int channel_count, int frame_size);
|
||||||
void decode_g719(VGMSTREAM *vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel);
|
void decode_g719(VGMSTREAM *vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel);
|
||||||
void reset_g719(VGMSTREAM *vgmstream);
|
void reset_g719(VGMSTREAM *vgmstream);
|
||||||
void free_g719(VGMSTREAM *vgmstream);
|
void free_g719(VGMSTREAM *vgmstream);
|
||||||
|
@ -4,6 +4,31 @@
|
|||||||
#ifdef VGM_USE_G719
|
#ifdef VGM_USE_G719
|
||||||
#include "../stack_alloc.h"
|
#include "../stack_alloc.h"
|
||||||
|
|
||||||
|
g719_codec_data *init_g719(int channel_count, int frame_size) {
|
||||||
|
int i;
|
||||||
|
g719_codec_data *data = NULL;
|
||||||
|
|
||||||
|
data = calloc(channel_count, sizeof(g719_codec_data)); /* one decoder per channel */
|
||||||
|
if (!data) goto fail;
|
||||||
|
|
||||||
|
for (i = 0; i < channel_count; i++) {
|
||||||
|
data[i].handle = g719_init(frame_size); /* Siren 22 == 22khz bandwidth */
|
||||||
|
if (!data[i].handle) goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
if (data) {
|
||||||
|
for (i = 0; i < channel_count; i++) {
|
||||||
|
g719_free(data[i].handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(data);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void decode_g719(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel) {
|
void decode_g719(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel) {
|
||||||
VGMSTREAMCHANNEL *ch = &vgmstream->ch[channel];
|
VGMSTREAMCHANNEL *ch = &vgmstream->ch[channel];
|
||||||
g719_codec_data *data = vgmstream->codec_data;
|
g719_codec_data *data = vgmstream->codec_data;
|
||||||
|
@ -3,6 +3,32 @@
|
|||||||
|
|
||||||
#ifdef VGM_USE_G7221
|
#ifdef VGM_USE_G7221
|
||||||
|
|
||||||
|
g7221_codec_data * init_g7221(int channel_count, int frame_size) {
|
||||||
|
int i;
|
||||||
|
g7221_codec_data *data = NULL;
|
||||||
|
|
||||||
|
data = calloc(channel_count, sizeof(g7221_codec_data)); /* one decoder per channel */
|
||||||
|
if (!data) goto fail;
|
||||||
|
|
||||||
|
for (i = 0; i < channel_count; i++) {
|
||||||
|
data[i].handle = g7221_init(frame_size, 14000); /* Siren 14 == 14khz bandwidth */
|
||||||
|
if (!data[i].handle) goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
if (data) {
|
||||||
|
for (i = 0; i < channel_count; i++) {
|
||||||
|
g7221_free(data[i].handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(data);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void decode_g7221(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel) {
|
void decode_g7221(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel) {
|
||||||
VGMSTREAMCHANNEL *ch = &vgmstream->ch[channel];
|
VGMSTREAMCHANNEL *ch = &vgmstream->ch[channel];
|
||||||
g7221_codec_data *data = vgmstream->codec_data;
|
g7221_codec_data *data = vgmstream->codec_data;
|
||||||
|
Loading…
Reference in New Issue
Block a user