@@ -56,10 +56,14 @@ std::tuple<u32, u32> AjmAt9Decoder::ProcessData(std::span<u8>& in_buf, SparseOut
56
56
AjmInstanceGapless& gapless) {
57
57
int ret = 0 ;
58
58
int bytes_used = 0 ;
59
+ Frame* frame = &static_cast <Atrac9Handle*>(m_handle)->Frame ;
60
+
59
61
switch (m_format) {
60
62
case AjmFormatEncoding::S16:
61
- ret = Atrac9Decode (m_handle, in_buf.data (), reinterpret_cast <s16*>(m_pcm_buffer.data ()),
62
- &bytes_used, True (m_flags & AjmAt9CodecFlags::NonInterleavedOutput));
63
+ if (frame->Config != NULL ) {
64
+ ret = Atrac9Decode (m_handle, in_buf.data (), reinterpret_cast <s16*>(m_pcm_buffer.data ()),
65
+ &bytes_used, True (m_flags & AjmAt9CodecFlags::NonInterleavedOutput));
66
+ }
63
67
break ;
64
68
case AjmFormatEncoding::S32:
65
69
ret = Atrac9DecodeS32 (m_handle, in_buf.data (), reinterpret_cast <s32*>(m_pcm_buffer.data ()),
@@ -103,6 +107,14 @@ std::tuple<u32, u32> AjmAt9Decoder::ProcessData(std::span<u8>& in_buf, SparseOut
103
107
UNREACHABLE ();
104
108
}
105
109
110
+ if (m_codec_info.framesInSuperframe == 0 ) {
111
+ m_codec_info.framesInSuperframe = 1 ;
112
+ }
113
+
114
+ if (m_codec_info.channels == 0 ) {
115
+ m_codec_info.channels = 1 ;
116
+ }
117
+
106
118
const auto samples_written = pcm_written / m_codec_info.channels ;
107
119
gapless.current .skipped_samples += m_codec_info.frameSamples - samples_written;
108
120
if (gapless.init .total_samples != 0 ) {
0 commit comments