[XAudio2] avoid leak + fix voice creation for closest match
[xbmc.git] / xbmc / cdrip / EncoderAddon.h
blob6721d281afb1cf7a85d2bd11200e53321547f944
1 /*
2 * Copyright (C) 2013 Arne Morten Kvarving
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 * See LICENSES/README.md for more information.
6 */
8 #pragma once
10 #include "Encoder.h"
11 #include "addons/binary-addons/AddonInstanceHandler.h"
12 #include "addons/kodi-dev-kit/include/kodi/addon-instance/AudioEncoder.h"
14 namespace KODI
16 namespace CDRIP
19 class CEncoderAddon : public CEncoder, public ADDON::IAddonInstanceHandler
21 public:
22 explicit CEncoderAddon(const ADDON::AddonInfoPtr& addonInfo);
23 ~CEncoderAddon() override;
25 // Child functions related to IEncoder within CEncoder
26 bool Init() override;
27 ssize_t Encode(uint8_t* pbtStream, size_t nNumBytesRead) override;
28 bool Close() override;
30 // Addon callback functions
31 ssize_t Write(const uint8_t* data, size_t len) override;
32 ssize_t Seek(ssize_t pos, int whence) override;
34 private:
35 // Currently needed addon interface parts
36 //@{
37 static ssize_t cb_write(KODI_HANDLE kodiInstance, const uint8_t* data, size_t len);
38 static ssize_t cb_seek(KODI_HANDLE kodiInstance, ssize_t pos, int whence);
39 //@}
42 } /* namespace CDRIP */
43 } /* namespace KODI */