LCOV - code coverage report
Current view: top level - media/client/main/include - AttachedSources.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 2 2
Test Date: 2025-02-18 13:13:53 Functions: 100.0 % 2 2

            Line data    Source code
       1              : /*
       2              :  * If not stated otherwise in this file or this component's LICENSE file the
       3              :  * following copyright and licenses apply:
       4              :  *
       5              :  * Copyright 2023 Sky UK
       6              :  *
       7              :  * Licensed under the Apache License, Version 2.0 (the "License");
       8              :  * you may not use this file except in compliance with the License.
       9              :  * You may obtain a copy of the License at
      10              :  *
      11              :  * http://www.apache.org/licenses/LICENSE-2.0
      12              :  *
      13              :  * Unless required by applicable law or agreed to in writing, software
      14              :  * distributed under the License is distributed on an "AS IS" BASIS,
      15              :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      16              :  * See the License for the specific language governing permissions and
      17              :  * limitations under the License.
      18              :  */
      19              : 
      20              : #ifndef FIREBOLT_RIALTO_CLIENT_ATTACHED_SOURCES_H_
      21              : #define FIREBOLT_RIALTO_CLIENT_ATTACHED_SOURCES_H_
      22              : 
      23              : #include "MediaCommon.h"
      24              : #include <cstdint>
      25              : #include <map>
      26              : #include <mutex>
      27              : 
      28              : namespace firebolt::rialto::client
      29              : {
      30              : class AttachedSources
      31              : {
      32              :     struct Source
      33              :     {
      34              :         MediaSourceType type{MediaSourceType::UNKNOWN};
      35              :         bool isFlushing{false};
      36              :     };
      37              : 
      38              : public:
      39          114 :     AttachedSources() = default;
      40          114 :     ~AttachedSources() = default;
      41              :     AttachedSources(const AttachedSources &) = delete;
      42              :     AttachedSources(AttachedSources &&) = delete;
      43              :     AttachedSources &operator=(const AttachedSources &) = delete;
      44              :     AttachedSources &operator=(AttachedSources &&) = delete;
      45              : 
      46              :     void add(std::uint32_t id, const MediaSourceType &mediaSourceType);
      47              :     void remove(std::uint32_t id);
      48              :     MediaSourceType getType(std::uint32_t id) const;
      49              :     bool isFlushing(std::uint32_t id) const;
      50              :     void setFlushing(std::uint32_t id, bool flushing);
      51              : 
      52              : private:
      53              :     mutable std::mutex m_mutex;
      54              :     std::map<std::uint32_t, Source> m_attachedSources;
      55              : };
      56              : } // namespace firebolt::rialto::client
      57              : 
      58              : #endif // FIREBOLT_RIALTO_CLIENT_ATTACHED_SOURCES_H_
        

Generated by: LCOV version 2.0-1