Skip to content

Commit

Permalink
audiodecoder API Version 4.0.0 udpate
Browse files Browse the repository at this point in the history
  • Loading branch information
AlwinEsch committed Oct 16, 2021
1 parent 811ca6c commit cf10ba9
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 9 deletions.
16 changes: 14 additions & 2 deletions audiodecoder.2sf/addon.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,21 @@
<extension
point="kodi.audiodecoder"
name="2sf"
extension=".2sf|.mini2sf"
tags="true"
library_@PLATFORM@="@LIBRARY_FILENAME@"/>
library_@PLATFORM@="@LIBRARY_FILENAME@">
<support>
<extension name=".2sf">
<summary>30100</summary>
<description>30101</description>
<icon>icon.png</icon>
</extension>
<extension name=".mini2sf">
<summary>30102</summary>
<description>30103</description>
<icon>icon.png</icon>
</extension>
</support>
</extension>
<extension point="xbmc.addon.metadata">
<platform>@PLATFORM@</platform>
<license>GPL-2.0-or-later</license>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
12 changes: 6 additions & 6 deletions src/2SFCodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/2SFCodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ATTRIBUTE_HIDDEN C2SFCodec : public kodi::addon::CInstanceAudioDecoder
int& bitrate,
AudioEngineDataFormat& format,
std::vector<AudioEngineChannel>& 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;

Expand Down

0 comments on commit cf10ba9

Please sign in to comment.