LCOV - code coverage report
Current view: top level - src/media - recordable.h (source / functions) Hit Total Coverage
Test: jami-coverage-filtered.info Lines: 4 4 100.0 %
Date: 2024-04-25 08:05:53 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :  *  Copyright (C) 2004-2024 Savoir-faire Linux Inc.
       3             :  *
       4             :  *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
       5             :  *  Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
       6             :  *  Author: Philippe Gorley <philippe.gorley@savoirfairelinux.com>
       7             :  *
       8             :  *  This program is free software; you can redistribute it and/or modify
       9             :  *  it under the terms of the GNU General Public License as published by
      10             :  *  the Free Software Foundation; either version 3 of the License, or
      11             :  *  (at your option) any later version.
      12             :  *
      13             :  *  This program is distributed in the hope that it will be useful,
      14             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      16             :  *  GNU General Public License for more details.
      17             :  *
      18             :  *  You should have received a copy of the GNU General Public License
      19             :  *  along with this program; if not, write to the Free Software
      20             :  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
      21             :  */
      22             : 
      23             : #pragma once
      24             : 
      25             : #include "media_recorder.h"
      26             : 
      27             : #include <string>
      28             : #include <memory>
      29             : #include <mutex>
      30             : 
      31             : namespace jami {
      32             : 
      33             : class Recordable
      34             : {
      35             : public:
      36             :     Recordable();
      37             :     virtual ~Recordable();
      38             : 
      39             :     /**
      40             :      * Return recording state (true/false)
      41             :      */
      42         624 :     bool isRecording() const
      43             :     {
      44         624 :         std::lock_guard lk {apiMutex_};
      45         624 :         return recording_;
      46         624 :     }
      47             : 
      48             :     /**
      49             :      * This method must be implemented for this interface as calls and conferences
      50             :      * have different behavior.
      51             :      * Implementations must call the super method.
      52             :      */
      53             :     virtual bool toggleRecording();
      54             : 
      55             :     /**
      56             :      * Stop recording
      57             :      */
      58             :     virtual void stopRecording();
      59             : 
      60             :     /**
      61             :      * Start recording
      62             :      */
      63             :     virtual bool startRecording(const std::string& path);
      64             : 
      65             :     /**
      66             :      * Return the file path for this recording
      67             :      */
      68             :     virtual std::string getPath() const;
      69             : 
      70             :     bool isAudioOnly() const;
      71             : 
      72             : protected:
      73             :     mutable std::mutex apiMutex_;
      74             :     bool recording_ {false};
      75             :     std::shared_ptr<MediaRecorder> recorder_;
      76             :     bool isAudioOnly_ {false};
      77             : };
      78             : 
      79             : } // namespace jami

Generated by: LCOV version 1.14