Rename at3_decoder.c to at3plus_decoder.c and add init function

This commit is contained in:
bnnm 2017-12-27 01:02:24 +01:00
parent 002de7efe0
commit 8538aa1a75
5 changed files with 20 additions and 10 deletions

View File

@ -4,6 +4,20 @@
#ifdef VGM_USE_MAIATRAC3PLUS
#include "maiatrac3plus.h"
maiatrac3plus_codec_data *init_at3plus() {
maiatrac3plus_codec_data *data = malloc(sizeof(maiatrac3plus_codec_data));
data->buffer = 0;
data->samples_discard = 0;
data->handle = Atrac3plusDecoder_openContext();
if (!data->handle) goto fail;
return data;
fail:
return NULL;
}
void decode_at3plus(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel) {
VGMSTREAMCHANNEL *ch = &vgmstream->ch[0];
maiatrac3plus_codec_data *data = vgmstream->codec_data;
@ -25,8 +39,7 @@ void decode_at3plus(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing,
data->samples_discard = 0;
}
for (i = 0; i < samples_to_do; i++)
{
for (i = 0; i < samples_to_do; i++) {
outbuf[i*channelspacing] = data->buffer[(first_sample+i)*data->channels+channel];
}

View File

@ -205,7 +205,8 @@ void free_mp4_aac(mp4_aac_codec_data * data);
#endif
#ifdef VGM_USE_MAIATRAC3PLUS
/* at3_decoder */
/* at3plus_decoder */
maiatrac3plus_codec_data *init_at3plus();
void decode_at3plus(VGMSTREAM *vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel);
void reset_at3plus(VGMSTREAM *vgmstream);
void seek_at3plus(VGMSTREAM *vgmstream, int32_t num_sample);

View File

@ -133,7 +133,7 @@
<ClInclude Include="layout\layout.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="coding\at3_decoder.c" />
<ClCompile Include="coding\at3plus_decoder.c" />
<ClCompile Include="coding\coding_utils.c" />
<ClCompile Include="coding\ffmpeg_decoder.c" />
<ClCompile Include="coding\ffmpeg_decoder_utils_bgw_atrac3.c" />

View File

@ -1171,7 +1171,7 @@
<ClCompile Include="meta\akb.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="coding\at3_decoder.c">
<ClCompile Include="coding\at3plus_decoder.c">
<Filter>coding\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\bcstm.c">

View File

@ -445,11 +445,7 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
#endif
#ifdef VGM_USE_MAIATRAC3PLUS
case coding_AT3plus: {
maiatrac3plus_codec_data *data = malloc(sizeof(maiatrac3plus_codec_data));
data->buffer = 0;
data->samples_discard = 0;
data->handle = Atrac3plusDecoder_openContext();
vgmstream->codec_data = data;
vgmstream->codec_data = init_at3plus();
/* get rough total samples but favor fact_samples if available (skip isn't correctly handled for now) */
vgmstream->num_samples = atrac3plus_bytes_to_samples(data_size, fmt.block_size);