LCOV - code coverage report
Current view: top level - src/client - videomanager.h (source / functions) Hit Total Coverage
Test: jami-coverage-filtered.info Lines: 0 3 0.0 %
Date: 2024-11-15 09:04:49 Functions: 0 1 0.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             : 
      19             : #ifdef HAVE_CONFIG_H
      20             : #include "config.h"
      21             : #endif
      22             : 
      23             : #include <memory> // for weak/shared_ptr
      24             : #include <vector>
      25             : #include <map>
      26             : #include <mutex>
      27             : #include <string>
      28             : 
      29             : #include "media/audio/audio_input.h"
      30             : #ifdef ENABLE_VIDEO
      31             : #include "media/video/video_device_monitor.h"
      32             : #include "media/video/video_base.h"
      33             : #include "media/video/video_input.h"
      34             : #endif
      35             : #include "media/media_player.h"
      36             : 
      37             : namespace jami {
      38             : 
      39             : struct VideoManager
      40             : {
      41             : public:
      42             :     // Client-managed video inputs and players
      43             :     std::map<std::string, std::shared_ptr<MediaPlayer>> mediaPlayers;
      44             :     // Client-managed audio preview
      45             :     std::shared_ptr<AudioInput> audioPreview;
      46             : 
      47             : #ifdef ENABLE_VIDEO
      48             :     std::map<std::string, std::shared_ptr<video::VideoInput>> clientVideoInputs;
      49             :     void setDeviceOrientation(const std::string& deviceId, int angle);
      50             :     // device monitor
      51             :     video::VideoDeviceMonitor videoDeviceMonitor;
      52           0 :     std::shared_ptr<video::VideoInput> getVideoInput(std::string_view id) const
      53             :     {
      54           0 :         auto input = videoInputs.find(id);
      55           0 :         return input == videoInputs.end() ? nullptr : input->second.lock();
      56             :     }
      57             :     std::mutex videoMutex;
      58             :     std::map<std::string, std::weak_ptr<video::VideoInput>, std::less<>> videoInputs;
      59             : #endif
      60             : 
      61             :     /**
      62             :      * Cache of the active Audio/Video input(s).
      63             :      */
      64             :     std::map<std::string, std::weak_ptr<AudioInput>, std::less<>> audioInputs;
      65             :     std::mutex audioMutex;
      66             :     bool hasRunningPlayers();
      67             : };
      68             : 
      69             : #ifdef ENABLE_VIDEO
      70             : video::VideoDeviceMonitor& getVideoDeviceMonitor();
      71             : std::shared_ptr<video::VideoInput> getVideoInput(
      72             :     const std::string& resource,
      73             :     video::VideoInputMode inputMode = video::VideoInputMode::Undefined,
      74             :     const std::string& sink = "");
      75             : #endif
      76             : std::shared_ptr<AudioInput> getAudioInput(const std::string& device);
      77             : std::string createMediaPlayer(const std::string& path);
      78             : std::shared_ptr<MediaPlayer> getMediaPlayer(const std::string& id);
      79             : bool pausePlayer(const std::string& id, bool pause);
      80             : bool closeMediaPlayer(const std::string& id);
      81             : bool mutePlayerAudio(const std::string& id, bool mute);
      82             : bool playerSeekToTime(const std::string& id, int time);
      83             : int64_t getPlayerPosition(const std::string& id);
      84             : int64_t getPlayerDuration(const std::string& id);
      85             : void setAutoRestart(const std::string& id, bool restart);
      86             : 
      87             : } // namespace jami

Generated by: LCOV version 1.14