1 /* 2 * Copyright (C) 2010-2018 Team Kodi 3 * This file is part of Kodi - https://kodi.tv 4 * 5 * SPDX-License-Identifier: GPL-2.0-or-later 6 * See LICENSES/README.md for more information. 7 */ 8 9 #pragma once 10 11 #include "AEChannelData.h" 12 13 #include <stdint.h> 14 #include <string> 15 #include <vector> 16 17 class CHelper_libKODI_audioengine; 18 19 class CAEChannelInfo { 20 friend class CHelper_libKODI_audioengine; 21 22 public: 23 CAEChannelInfo(); 24 explicit CAEChannelInfo(const enum AEChannel* rhs); 25 CAEChannelInfo(const enum AEStdChLayout rhs); 26 ~CAEChannelInfo() = default; 27 CAEChannelInfo& operator=(const CAEChannelInfo& rhs); 28 CAEChannelInfo& operator=(const enum AEChannel* rhs); 29 CAEChannelInfo& operator=(const enum AEStdChLayout rhs); 30 bool operator==(const CAEChannelInfo& rhs) const; 31 bool operator!=(const CAEChannelInfo& rhs) const; 32 CAEChannelInfo& operator+=(const enum AEChannel& rhs); 33 CAEChannelInfo& operator-=(const enum AEChannel& rhs); 34 enum AEChannel operator[](unsigned int i) const; 35 operator std::string() const; 36 37 /* remove any channels that dont exist in the provided info */ 38 void ResolveChannels(const CAEChannelInfo& rhs); 39 void Reset(); Count()40 inline unsigned int Count() const { return m_channelCount; } 41 static const char* GetChName(const enum AEChannel ch); 42 bool HasChannel(const enum AEChannel ch) const; 43 bool IsChannelValid(const unsigned int pos); 44 bool IsLayoutValid(); 45 bool ContainsChannels(const CAEChannelInfo& rhs) const; 46 void ReplaceChannel(const enum AEChannel from, const enum AEChannel to); 47 int BestMatch(const std::vector<CAEChannelInfo>& dsts, int* score = NULL) const; 48 void AddMissingChannels(const CAEChannelInfo& rhs); 49 50 private: 51 unsigned int m_channelCount; 52 enum AEChannel m_channels[AE_CH_MAX]; 53 }; 54 55