LCOV - code coverage report
Current view: top level - src/plugin - streamdata.h (source / functions) Hit Total Coverage
Test: jami-coverage-filtered.info Lines: 14 14 100.0 %
Date: 2024-12-21 08:56:24 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /*
       2             :  *  Copyright (C) 2004-2024 Savoir-faire Linux Inc.
       3             :  *
       4             :  *  This program is free software: you can redistribute it and/or modify
       5             :  *  it under the terms of the GNU General Public License as published by
       6             :  *  the Free Software Foundation, either version 3 of the License, or
       7             :  *  (at your option) any later version.
       8             :  *
       9             :  *  This program is distributed in the hope that it will be useful,
      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      12             :  *  GNU General Public License for more details.
      13             :  *
      14             :  *  You should have received a copy of the GNU General Public License
      15             :  *  along with this program. If not, see <https://www.gnu.org/licenses/>.
      16             :  */
      17             : #pragma once
      18             : #include <string>
      19             : #include <map>
      20             : 
      21             : enum class StreamType { audio, video };
      22             : 
      23             : /**
      24             :  * @struct StreamData
      25             :  * @brief Contains information about an AV subject.
      26             :  * It's used by CallServicesManager.
      27             :  */
      28             : struct StreamData
      29             : {
      30             :     /**
      31             :      * @param callId
      32             :      * @param isReceived False if local audio/video streams
      33             :      * @param mediaType
      34             :      * @param conversationId
      35             :      * @param accountId
      36             :      */
      37        1075 :     StreamData(const std::string& callId,
      38             :                bool isReceived,
      39             :                const StreamType& mediaType,
      40             :                const std::string& conversationId,
      41             :                const std::string& accountId)
      42        1075 :         : id {std::move(callId)}
      43        1075 :         , direction {isReceived}
      44        1075 :         , type {mediaType}
      45        1075 :         , source {std::move(accountId)}
      46        1075 :         , conversation {std::move(conversationId)}
      47        1075 :     {}
      48             :     // callId
      49             :     const std::string id;
      50             :     // False if local audio/video.
      51             :     const bool direction;
      52             :     // StreamType -> audio or video.
      53             :     const StreamType type;
      54             :     // accountId
      55             :     const std::string source;
      56             :     // conversationId
      57             :     const std::string conversation;
      58             : };
      59             : 
      60             : /**
      61             :  * @struct JamiMessage
      62             :  * @brief Contains information about an exchanged message.
      63             :  * It's used by ChatServicesManager.
      64             :  */
      65             : struct JamiMessage
      66             : {
      67             :     /**
      68             :      * @param accId AccountId
      69             :      * @param pId peerId
      70             :      * @param isReceived True if received message, False if sent
      71             :      * @param dataMap Message contents
      72             :      * @param pPlugin True if message is created/modified by plugin code
      73             :      */
      74           4 :     JamiMessage(const std::string& accId,
      75             :                 const std::string& pId,
      76             :                 bool isReceived,
      77             :                 const std::map<std::string, std::string>& dataMap,
      78             :                 bool pPlugin)
      79           4 :         : accountId {accId}
      80           4 :         , peerId {pId}
      81           4 :         , direction {isReceived}
      82           4 :         , data {dataMap}
      83           4 :         , fromPlugin {pPlugin}
      84           4 :     {}
      85             : 
      86             :     std::string accountId;
      87             :     std::string peerId;
      88             :     // True if it's a received message.
      89             :     const bool direction;
      90             :     std::map<std::string, std::string> data;
      91             :     // True if message is originated from Plugin code.
      92             :     bool fromPlugin;
      93             :     bool isSwarm {false};
      94             :     bool fromHistory {false};
      95             : };

Generated by: LCOV version 1.14