recordable.h 2 KB
Newer Older
1
/*
Sébastien Blin's avatar
Sébastien Blin committed
2
 *  Copyright (C) 2004-2019 Savoir-faire Linux Inc.
3 4 5
 *
 *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
 *  Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
6
 *  Author: Philippe Gorley <philippe.gorley@savoirfairelinux.com>
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
 */

#pragma once

25
#include "media_recorder.h"
26 27 28

#include <string>
#include <memory>
29
#include <mutex>
30

Adrien Béraud's avatar
Adrien Béraud committed
31
namespace jami {
32 33 34 35 36 37 38 39 40

class Recordable {
public:
    Recordable();
    virtual ~Recordable();

    /**
     * Return recording state (true/false)
     */
41 42 43 44
    bool isRecording() const {
        std::lock_guard<std::mutex> lk {apiMutex_};
        return recording_;
    }
45 46 47 48 49 50 51 52 53 54 55 56 57 58

    /**
     * This method must be implemented for this interface as calls and conferences
     * have different behavior.
     * Implementations must call the super method.
     */
    virtual bool toggleRecording();

    /**
     * Stop recording
     */
    void stopRecording();

    /**
59
     * Start recording
60
     */
61
    bool startRecording(const std::string& path);
62 63

    /**
64
     * Return the file path for this recording
65
     */
66
    virtual std::string getPath() const;
67

68
    bool isAudioOnly() const;
69 70

protected:
71 72
    mutable std::mutex apiMutex_;
    bool recording_ {false};
73 74
    std::shared_ptr<MediaRecorder> recorder_;
    bool isAudioOnly_{false};
75 76
};

Adrien Béraud's avatar
Adrien Béraud committed
77
} // namespace jami