From cf10ba98069ea11f34c820b5d27b2c640cbe645b Mon Sep 17 00:00:00 2001 From: Alwin Esch Date: Sat, 16 Oct 2021 23:17:08 +0200 Subject: [PATCH] audiodecoder API Version 4.0.0 udpate --- audiodecoder.2sf/addon.xml.in | 16 +++++++++++-- .../resource.language.en_gb/strings.po | 24 +++++++++++++++++++ src/2SFCodec.cpp | 12 +++++----- src/2SFCodec.h | 2 +- 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/audiodecoder.2sf/addon.xml.in b/audiodecoder.2sf/addon.xml.in index 02c0919..389085c 100644 --- a/audiodecoder.2sf/addon.xml.in +++ b/audiodecoder.2sf/addon.xml.in @@ -8,9 +8,21 @@ + library_@PLATFORM@="@LIBRARY_FILENAME@"> + + + 30100 + 30101 + icon.png + + + 30102 + 30103 + icon.png + + + @PLATFORM@ GPL-2.0-or-later diff --git a/audiodecoder.2sf/resources/language/resource.language.en_gb/strings.po b/audiodecoder.2sf/resources/language/resource.language.en_gb/strings.po index 8f2aa34..44dd2f8 100644 --- a/audiodecoder.2sf/resources/language/resource.language.en_gb/strings.po +++ b/audiodecoder.2sf/resources/language/resource.language.en_gb/strings.po @@ -123,3 +123,27 @@ msgstr "" msgctxt "#30022" msgid "Ainc" msgstr "" + +#. Supported file extension summary about ".2sf" +#: audiodecoder.2sf/addon.xml.in +msgctxt "#30100" +msgid "Nintendo DS Sound File" +msgstr "" + +#. Supported file extension description about ".2sf" +#: audiodecoder.2sf/addon.xml.in +msgctxt "#30101" +msgid "Nintendo DS Sound FileGame audio file used by some Nintendo DS games." +msgstr "" + +#. Supported file extension summary about ".mini2sf" +#: audiodecoder.2sf/addon.xml.in +msgctxt "#30102" +msgid "Nintendo DS Sound Information File" +msgstr "" + +#. Supported file extension description about ".mini2sf" +#: audiodecoder.2sf/addon.xml.in +msgctxt "#30103" +msgid "With their corresponding 2SFLIB file can be played." +msgstr "" diff --git a/src/2SFCodec.cpp b/src/2SFCodec.cpp index 9dfc047..6fa8db5 100644 --- a/src/2SFCodec.cpp +++ b/src/2SFCodec.cpp @@ -547,15 +547,15 @@ void C2SFCodec::Shutdown() } } -int C2SFCodec::ReadPCM(uint8_t* buffer, int size, int& actualsize) +int C2SFCodec::ReadPCM(uint8_t* buffer, size_t size, size_t& actualsize) { if (m_eof && !m_silenceTestBuffer.data_available()) - return 1; + return AUDIODECODER_READ_ERROR; if (m_noLoop && m_tagSongMs && (m_posDelta + mul_div(m_dataWritten, 1000, m_cfgDefaultSampleRate)) >= m_tagSongMs + m_tagFadeMs) - return -1; + return AUDIODECODER_READ_EOF; unsigned int written = 0; @@ -613,7 +613,7 @@ int C2SFCodec::ReadPCM(uint8_t* buffer, int size, int& actualsize) if (m_silenceTestBuffer.test_silence()) { m_eof = true; - return -1; + return AUDIODECODER_READ_EOF; } written = m_silenceTestBuffer.data_available() / 2; @@ -673,14 +673,14 @@ int C2SFCodec::ReadPCM(uint8_t* buffer, int size, int& actualsize) if (!written) { m_eof = true; - return -1; + return AUDIODECODER_READ_EOF; } actualsize = written * 2 * sizeof(int16_t); memcpy(buffer, ptr, actualsize); - return 0; + return AUDIODECODER_READ_SUCCESS; } int64_t C2SFCodec::Seek(int64_t time) diff --git a/src/2SFCodec.h b/src/2SFCodec.h index 2806e06..1036df7 100644 --- a/src/2SFCodec.h +++ b/src/2SFCodec.h @@ -78,7 +78,7 @@ class ATTRIBUTE_HIDDEN C2SFCodec : public kodi::addon::CInstanceAudioDecoder int& bitrate, AudioEngineDataFormat& format, std::vector& channellist) override; - int ReadPCM(uint8_t* buffer, int size, int& actualsize) override; + int ReadPCM(uint8_t* buffer, size_t size, size_t& actualsize) override; int64_t Seek(int64_t time) override; bool ReadTag(const std::string& file, kodi::addon::AudioDecoderInfoTag& tag) override;