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-04-19 19:18:04 Functions: 2 2 100.0 %

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

Generated by: LCOV version 1.14