diff -Nru kodi-audioencoder-wav-1.1.0/audioencoder.wav/addon.xml.in kodi-audioencoder-wav-2.0.0/audioencoder.wav/addon.xml.in
--- kodi-audioencoder-wav-1.1.0/audioencoder.wav/addon.xml.in 2016-05-30 20:44:53.000000000 +0000
+++ kodi-audioencoder-wav-2.0.0/audioencoder.wav/addon.xml.in 2017-06-20 04:38:16.000000000 +0000
@@ -1,19 +1,17 @@
-
-
-
+ @ADDON_DEPENDS@
Wav Audio Encoder
- Wav Audio Encoder
+ WAV (Waveform Audio Format) is an uncompressed sound format.
@PLATFORM@
diff -Nru kodi-audioencoder-wav-1.1.0/CMakeLists.txt kodi-audioencoder-wav-2.0.0/CMakeLists.txt
--- kodi-audioencoder-wav-1.1.0/CMakeLists.txt 2016-05-30 20:44:53.000000000 +0000
+++ kodi-audioencoder-wav-2.0.0/CMakeLists.txt 2017-06-20 04:38:16.000000000 +0000
@@ -8,7 +8,7 @@
find_package(Kodi REQUIRED)
-include_directories(${KODI_INCLUDE_DIR})
+include_directories(${KODI_INCLUDE_DIR}/..) # Hack way with "/..", need bigger Kodi cmake rework to match right include ways (becomes done in future)
set(WAV_SOURCES src/EncoderWav.cpp)
set(DEPLIBS)
diff -Nru kodi-audioencoder-wav-1.1.0/debian/changelog kodi-audioencoder-wav-2.0.0/debian/changelog
--- kodi-audioencoder-wav-1.1.0/debian/changelog 2018-04-30 15:07:19.000000000 +0000
+++ kodi-audioencoder-wav-2.0.0/debian/changelog 2018-03-12 17:01:14.000000000 +0000
@@ -1,4 +1,4 @@
-kodi-audioencoder-wav (1.1.0-1~bionic) bionic; urgency=low
+kodi-audioencoder-wav (2.0.0-1~bionic) bionic; urgency=low
[ xbmc ]
* autogenerated dummy changelog
@@ -6,4 +6,4 @@
[ wsnipex ]
* no upstream changelog available
- -- wsnipex Mon, 30 Apr 2018 17:07:19 +0200
+ -- wsnipex Mon, 12 Mar 2018 18:01:14 +0100
diff -Nru kodi-audioencoder-wav-1.1.0/debian/changelog.tmp kodi-audioencoder-wav-2.0.0/debian/changelog.tmp
--- kodi-audioencoder-wav-1.1.0/debian/changelog.tmp 2018-04-30 15:07:14.000000000 +0000
+++ kodi-audioencoder-wav-2.0.0/debian/changelog.tmp 2018-03-12 17:01:10.000000000 +0000
@@ -1,4 +1,4 @@
-kodi-audioencoder-wav (1.1.0-1~#DIST#) #DIST#; urgency=low
+kodi-audioencoder-wav (2.0.0-1~#DIST#) #DIST#; urgency=low
[ xbmc ]
* autogenerated dummy changelog
diff -Nru kodi-audioencoder-wav-1.1.0/debian/control kodi-audioencoder-wav-2.0.0/debian/control
--- kodi-audioencoder-wav-1.1.0/debian/control 2016-05-30 20:44:53.000000000 +0000
+++ kodi-audioencoder-wav-2.0.0/debian/control 2017-06-20 04:38:16.000000000 +0000
@@ -1,7 +1,7 @@
Source: kodi-audioencoder-wav
Priority: extra
Maintainer: wsnipex
-Build-Depends: debhelper (>= 8.0.0), cmake, kodi-addon-dev, kodi-audio-dev
+Build-Depends: debhelper (>= 8.0.0), cmake, kodi-addon-dev
Standards-Version: 3.9.6
Section: libs
Homepage: http://kodi.org
diff -Nru kodi-audioencoder-wav-1.1.0/src/EncoderWav.cpp kodi-audioencoder-wav-2.0.0/src/EncoderWav.cpp
--- kodi-audioencoder-wav-1.1.0/src/EncoderWav.cpp 2016-05-30 20:44:53.000000000 +0000
+++ kodi-audioencoder-wav-2.0.0/src/EncoderWav.cpp 2017-06-20 04:38:16.000000000 +0000
@@ -18,89 +18,10 @@
*
*/
-#include "xbmc_audioenc_dll.h"
+#include
#include
#include
-extern "C" {
-
-//-- Create -------------------------------------------------------------------
-// Called on load. Addon should fully initalize or return error status
-//-----------------------------------------------------------------------------
-ADDON_STATUS ADDON_Create(void* hdl, void* props)
-{
- return ADDON_STATUS_OK;
-}
-
-//-- Stop ---------------------------------------------------------------------
-// This dll must cease all runtime activities
-// !!! Add-on master function !!!
-//-----------------------------------------------------------------------------
-void ADDON_Stop()
-{
-}
-
-//-- Destroy ------------------------------------------------------------------
-// Do everything before unload of this add-on
-// !!! Add-on master function !!!
-//-----------------------------------------------------------------------------
-void ADDON_Destroy()
-{
-}
-
-//-- HasSettings --------------------------------------------------------------
-// Returns true if this add-on use settings
-// !!! Add-on master function !!!
-//-----------------------------------------------------------------------------
-bool ADDON_HasSettings()
-{
- return false;
-}
-
-//-- GetStatus ---------------------------------------------------------------
-// Returns the current Status of this visualisation
-// !!! Add-on master function !!!
-//-----------------------------------------------------------------------------
-ADDON_STATUS ADDON_GetStatus()
-{
- return ADDON_STATUS_OK;
-}
-
-//-- GetSettings --------------------------------------------------------------
-// Return the settings for XBMC to display
-// !!! Add-on master function !!!
-//-----------------------------------------------------------------------------
-extern "C" unsigned int ADDON_GetSettings(ADDON_StructSetting ***sSet)
-{
- return 0;
-}
-
-//-- FreeSettings --------------------------------------------------------------
-// Free the settings struct passed from XBMC
-// !!! Add-on master function !!!
-//-----------------------------------------------------------------------------
-
-void ADDON_FreeSettings()
-{
-}
-
-//-- SetSetting ---------------------------------------------------------------
-// Set a specific Setting value (called from XBMC)
-// !!! Add-on master function !!!
-//-----------------------------------------------------------------------------
-ADDON_STATUS ADDON_SetSetting(const char *strSetting, const void* value)
-{
- return ADDON_STATUS_OK;
-}
-
-//-- Announce -----------------------------------------------------------------
-// Receive announcements from XBMC
-// !!! Add-on master function !!!
-//-----------------------------------------------------------------------------
-void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
-{
-}
-
#define WAVE_FORMAT_PCM 0x0001
// structure for WAV
@@ -121,97 +42,98 @@
}
WAVHDR;
-// structure for holding our context
-class wav_context
+class CEncoderWav : public kodi::addon::CInstanceAudioEncoder
{
public:
- wav_context(audioenc_callbacks &cb) :
- callbacks(cb), audiosize(0)
- {
- memset(&wav, 0, sizeof(wav));
- };
+ CEncoderWav(KODI_HANDLE instance);
- audioenc_callbacks callbacks;
- WAVHDR wav;
- uint32_t audiosize;
+ virtual bool Start(int inChannels,
+ int inRate,
+ int inBits,
+ const std::string& title,
+ const std::string& artist,
+ const std::string& albumartist,
+ const std::string& album,
+ const std::string& year,
+ const std::string& track,
+ const std::string& genre,
+ const std::string& comment,
+ int trackLength) override;
+ int Encode(int numBytesRead, const uint8_t* stream) override;
+ virtual bool Finish() override;
+
+private:
+ WAVHDR m_wav;
+ uint32_t m_audiosize;
};
-void *Create(audioenc_callbacks *callbacks)
+CEncoderWav::CEncoderWav(KODI_HANDLE instance)
+ : CInstanceAudioEncoder(instance)
{
- if (callbacks && callbacks->write && callbacks->seek)
- {
- return new wav_context(*callbacks);
- }
- return NULL;
+ memset(&m_wav, 0, sizeof(m_wav));
}
-bool Start(void* ctx, int iInChannels, int iInRate, int iInBits,
- const char* title, const char* artist,
- const char* albumartist, const char* album,
- const char* year, const char* track, const char* genre,
- const char* comment, int iTrackLength)
+bool CEncoderWav::Start(int inChannels, int inRate, int inBits,
+ const std::string& title, const std::string& artist,
+ const std::string& albumartist, const std::string& album,
+ const std::string& year, const std::string& track, const std::string& genre,
+ const std::string& comment, int trackLength)
{
- wav_context *context = (wav_context*)ctx;
- if (!context)
- return false;
-
// we accept only 2ch / 16 bit atm
- if (iInChannels != 2 || iInBits != 16)
+ if (inChannels != 2 || inBits != 16)
return false;
// setup and write out our wav header
- memcpy(context->wav.riff, "RIFF", 4);
- memcpy(context->wav.cWavFmt, "WAVEfmt ", 8);
- context->wav.dwHdrLen = 16;
- context->wav.wFormat = WAVE_FORMAT_PCM;
- context->wav.wBlockAlign = 4;
- memcpy(context->wav.cData, "data", 4);
- context->wav.wNumChannels = iInChannels;
- context->wav.dwSampleRate = iInRate;
- context->wav.wBitsPerSample = iInBits;
- context->wav.dwBytesPerSec = iInRate * iInChannels * (iInBits >> 3);
-
- context->callbacks.write(context->callbacks.opaque, (uint8_t*)&context->wav, sizeof(context->wav));
+ memcpy(m_wav.riff, "RIFF", 4);
+ memcpy(m_wav.cWavFmt, "WAVEfmt ", 8);
+ m_wav.dwHdrLen = 16;
+ m_wav.wFormat = WAVE_FORMAT_PCM;
+ m_wav.wBlockAlign = 4;
+ memcpy(m_wav.cData, "data", 4);
+ m_wav.wNumChannels = inChannels;
+ m_wav.dwSampleRate = inRate;
+ m_wav.wBitsPerSample = inBits;
+ m_wav.dwBytesPerSec = inRate * inChannels * (inBits >> 3);
+ Write((uint8_t*)&m_wav, sizeof(m_wav));
return true;
}
-int Encode(void* ctx, int nNumBytesRead, uint8_t* pbtStream)
+int CEncoderWav::Encode(int numBytesRead, const uint8_t* stream)
{
- wav_context *context = (wav_context*)ctx;
- if (!context)
- return -1;
-
// write the audio directly out to the file is all we need do here
- context->callbacks.write(context->callbacks.opaque, pbtStream, nNumBytesRead);
- context->audiosize += nNumBytesRead;
-
- return nNumBytesRead;
+ Write(stream, numBytesRead);
+ m_audiosize += numBytesRead;
+ return numBytesRead;
}
-bool Finish(void* ctx)
+bool CEncoderWav::Finish()
{
- wav_context *context = (wav_context*)ctx;
- if (!context)
- return false;
-
// seek back and fill in the wav header size
- context->wav.len = context->audiosize + sizeof(context->wav) - 8;
- context->wav.dwDataLen = context->audiosize;
+ m_wav.len = m_audiosize + sizeof(m_wav) - 8;
+ m_wav.dwDataLen = m_audiosize;
- if (context->callbacks.seek(context->callbacks.opaque, 0, 0) == 0)
+ if (Seek(0, 0) == 0)
{
- context->callbacks.write(context->callbacks.opaque, (uint8_t*)&context->wav, sizeof(context->wav));
+ Write((uint8_t*)&m_wav, sizeof(m_wav));
return true;
}
-
return false;
}
-void Free(void *ctx)
+//------------------------------------------------------------------------------
+
+class CMyAddon : public kodi::addon::CAddonBase
{
- wav_context *context = (wav_context*)ctx;
- delete context;
-}
+public:
+ CMyAddon() { }
+ virtual ADDON_STATUS CreateInstance(int instanceType, std::string instanceID, KODI_HANDLE instance, KODI_HANDLE& addonInstance) override;
+};
+ADDON_STATUS CMyAddon::CreateInstance(int instanceType, std::string instanceID, KODI_HANDLE instance, KODI_HANDLE& addonInstance)
+{
+ addonInstance = new CEncoderWav(instance);
+ return ADDON_STATUS_OK;
}
+
+ADDONCREATOR(CMyAddon)
diff -Nru kodi-audioencoder-wav-1.1.0/.travis.yml kodi-audioencoder-wav-2.0.0/.travis.yml
--- kodi-audioencoder-wav-1.1.0/.travis.yml 2016-05-30 20:44:53.000000000 +0000
+++ kodi-audioencoder-wav-2.0.0/.travis.yml 2017-06-20 04:38:16.000000000 +0000
@@ -44,6 +44,6 @@
- cd ${APPID}
- mkdir build
- cd build
- - cmake -DADDONS_TO_BUILD=${APPID} -DADDON_SRC_PREFIX=../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../../xbmc/addons -DPACKAGE_ZIP=1 ../../xbmc/project/cmake/addons
+ - cmake -DADDONS_TO_BUILD=${APPID} -DADDON_SRC_PREFIX=$TRAVIS_BUILD_DIR/.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$TRAVIS_BUILD_DIR/../xbmc/addons -DPACKAGE_ZIP=1 $TRAVIS_BUILD_DIR/../xbmc/cmake/addons
script: make