mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-29 19:37:30 +01:00
Prepare ATRAC9 decoder hooks (disabled, not usable at the moment)
This commit is contained in:
parent
f525b891ee
commit
8789c5918e
@ -213,6 +213,16 @@ void seek_at3plus(VGMSTREAM *vgmstream, int32_t num_sample);
|
|||||||
void free_at3plus(maiatrac3plus_codec_data *data);
|
void free_at3plus(maiatrac3plus_codec_data *data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef VGM_USE_ATRAC9
|
||||||
|
/* atrac9_decoder */
|
||||||
|
atrac9_codec_data *init_atrac9(atrac9_config *cfg);
|
||||||
|
void decode_atrac9(VGMSTREAM *vgmstream, sample * outbuf, int32_t samples_to_do, int channels);
|
||||||
|
void reset_atrac9(VGMSTREAM *vgmstream);
|
||||||
|
void seek_atrac9(VGMSTREAM *vgmstream, int32_t num_sample);
|
||||||
|
void free_atrac9(atrac9_codec_data *data);
|
||||||
|
size_t atrac9_bytes_to_samples(size_t bytes, atrac9_codec_data *data);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef VGM_USE_FFMPEG
|
#ifdef VGM_USE_FFMPEG
|
||||||
/* ffmpeg_decoder */
|
/* ffmpeg_decoder */
|
||||||
ffmpeg_codec_data * init_ffmpeg_offset(STREAMFILE *streamFile, uint64_t start, uint64_t size);
|
ffmpeg_codec_data * init_ffmpeg_offset(STREAMFILE *streamFile, uint64_t start, uint64_t size);
|
||||||
|
@ -522,6 +522,9 @@ static const coding_info coding_info_list[] = {
|
|||||||
#ifdef VGM_USE_MAIATRAC3PLUS
|
#ifdef VGM_USE_MAIATRAC3PLUS
|
||||||
{coding_AT3plus, "ATRAC3plus"},
|
{coding_AT3plus, "ATRAC3plus"},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef VGM_USE_ATRAC9
|
||||||
|
{coding_ATRAC9, "ATRAC9"},
|
||||||
|
#endif
|
||||||
#ifdef VGM_USE_FFMPEG
|
#ifdef VGM_USE_FFMPEG
|
||||||
{coding_FFmpeg, "FFmpeg"},
|
{coding_FFmpeg, "FFmpeg"},
|
||||||
#endif
|
#endif
|
||||||
|
@ -545,7 +545,13 @@ void reset_vgmstream(VGMSTREAM * vgmstream) {
|
|||||||
reset_at3plus(vgmstream);
|
reset_at3plus(vgmstream);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef VGM_USE_ATRAC9
|
||||||
|
if (vgmstream->coding_type==coding_ATRAC9) {
|
||||||
|
reset_atrac9(vgmstream);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef VGM_USE_FFMPEG
|
#ifdef VGM_USE_FFMPEG
|
||||||
if (vgmstream->coding_type==coding_FFmpeg) {
|
if (vgmstream->coding_type==coding_FFmpeg) {
|
||||||
reset_ffmpeg(vgmstream);
|
reset_ffmpeg(vgmstream);
|
||||||
@ -740,6 +746,13 @@ void close_vgmstream(VGMSTREAM * vgmstream) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef VGM_USE_ATRAC9
|
||||||
|
if (vgmstream->coding_type == coding_ATRAC9) {
|
||||||
|
free_atrac9(vgmstream->codec_data);
|
||||||
|
vgmstream->codec_data = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (vgmstream->coding_type==coding_ACM) {
|
if (vgmstream->coding_type==coding_ACM) {
|
||||||
mus_acm_codec_data *data = (mus_acm_codec_data *) vgmstream->codec_data;
|
mus_acm_codec_data *data = (mus_acm_codec_data *) vgmstream->codec_data;
|
||||||
|
|
||||||
@ -1126,6 +1139,10 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
|
|||||||
#ifdef VGM_USE_MAIATRAC3PLUS
|
#ifdef VGM_USE_MAIATRAC3PLUS
|
||||||
case coding_AT3plus:
|
case coding_AT3plus:
|
||||||
return 2048 - ((maiatrac3plus_codec_data*)vgmstream->codec_data)->samples_discard;
|
return 2048 - ((maiatrac3plus_codec_data*)vgmstream->codec_data)->samples_discard;
|
||||||
|
#endif
|
||||||
|
#ifdef VGM_USE_ATRAC9
|
||||||
|
case coding_ATRAC9:
|
||||||
|
return 0; /* varies with config data, usually 256 or 1024 */
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
@ -1255,6 +1272,10 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
|
|||||||
return 0x04;
|
return 0x04;
|
||||||
case coding_EA_MT:
|
case coding_EA_MT:
|
||||||
return 0; /* variable (frames of bit counts or PCM frames) */
|
return 0; /* variable (frames of bit counts or PCM frames) */
|
||||||
|
#ifdef VGM_USE_ATRAC9
|
||||||
|
case coding_ATRAC9:
|
||||||
|
return 0; /* varies with config data, usually 0x100-200 */
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1770,6 +1791,14 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
|
|||||||
chan);
|
chan);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef VGM_USE_ATRAC9
|
||||||
|
case coding_ATRAC9:
|
||||||
|
decode_atrac9(vgmstream,
|
||||||
|
buffer+samples_written*vgmstream->channels,
|
||||||
|
samples_to_do,
|
||||||
|
vgmstream->channels);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case coding_ACM:
|
case coding_ACM:
|
||||||
/* handled in its own layout, here to quiet compiler */
|
/* handled in its own layout, here to quiet compiler */
|
||||||
@ -1973,6 +2002,12 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef VGM_USE_ATRAC9
|
||||||
|
if (vgmstream->coding_type==coding_ATRAC9) {
|
||||||
|
seek_atrac9(vgmstream, vgmstream->loop_sample);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef VGM_USE_MPEG
|
#ifdef VGM_USE_MPEG
|
||||||
if (vgmstream->coding_type==coding_MPEG_custom ||
|
if (vgmstream->coding_type==coding_MPEG_custom ||
|
||||||
vgmstream->coding_type==coding_MPEG_ealayer3 ||
|
vgmstream->coding_type==coding_MPEG_ealayer3 ||
|
||||||
|
@ -22,6 +22,11 @@ enum { STREAM_NAME_SIZE = 255 }; /* reasonable max */
|
|||||||
#define VGM_USE_MPEG
|
#define VGM_USE_MPEG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef VGM_DISABLE_ATRAC9
|
||||||
|
//#define VGM_USE_ATRAC9
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* disabled by default, defined on compile-time for builds that support it*/
|
/* disabled by default, defined on compile-time for builds that support it*/
|
||||||
//#define VGM_USE_G7221
|
//#define VGM_USE_G7221
|
||||||
//#define VGM_USE_G719
|
//#define VGM_USE_G719
|
||||||
@ -197,6 +202,10 @@ typedef enum {
|
|||||||
coding_AT3plus, /* Sony ATRAC3plus (MDCT-based) */
|
coding_AT3plus, /* Sony ATRAC3plus (MDCT-based) */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef VGM_USE_ATRAC9
|
||||||
|
coding_ATRAC9, /* Sony ATRAC9 (MDCT-based) */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef VGM_USE_FFMPEG
|
#ifdef VGM_USE_FFMPEG
|
||||||
coding_FFmpeg, /* Formats handled by FFmpeg (ATRAC3, XMA, AC3, etc) */
|
coding_FFmpeg, /* Formats handled by FFmpeg (ATRAC3, XMA, AC3, etc) */
|
||||||
#endif
|
#endif
|
||||||
@ -980,6 +989,32 @@ typedef struct {
|
|||||||
} maiatrac3plus_codec_data;
|
} maiatrac3plus_codec_data;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef VGM_USE_ATRAC9
|
||||||
|
typedef struct {
|
||||||
|
int channels; /* to detect weird multichannel */
|
||||||
|
uint32_t config_data; /* ATRAC9 config header */
|
||||||
|
int encoder_delay; /* initial samples to discard */
|
||||||
|
|
||||||
|
size_t interleave_skip; /* XVAG */
|
||||||
|
size_t subsong_skip; /* XVAG */
|
||||||
|
} atrac9_config;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint8_t *data_buffer;
|
||||||
|
size_t data_buffer_size;
|
||||||
|
|
||||||
|
sample *sample_buffer;
|
||||||
|
size_t samples_filled; /* number of samples in the buffer */
|
||||||
|
size_t samples_used; /* number of samples extracted from the buffer */
|
||||||
|
|
||||||
|
int samples_to_discard;
|
||||||
|
|
||||||
|
atrac9_config config;
|
||||||
|
|
||||||
|
void *handle; /* decoder handle */
|
||||||
|
} atrac9_codec_data;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* with one file this is also used for just ACM */
|
/* with one file this is also used for just ACM */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int file_count;
|
int file_count;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user