video_send_thread.h 2.44 KB
Newer Older
1
/*
2
 *  Copyright (C) 2011-2013 Savoir-Faire Linux Inc.
3
 *  Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
4
 *  Author: Guillaume Roguez <Guillaume.Roguez@savoirfairelinux.com>
5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 *  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
18
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
19 20 21 22 23 24 25 26 27 28 29 30 31
 *
 *  Additional permission under GNU GPL version 3 section 7:
 *
 *  If you modify this program, or any covered work, by linking or
 *  combining it with the OpenSSL project's OpenSSL library (or a
 *  modified version of that library), containing parts covered by the
 *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
 *  grants you additional permission to convey the resulting work.
 *  Corresponding Source for a non-source form of such a combination
 *  shall include the source code for the parts of OpenSSL used as well
 *  as that of the covered work.
 */

32 33
#ifndef __VIDEO_SEND_THREAD_H__
#define __VIDEO_SEND_THREAD_H__
34

35
#include "noncopyable.h"
36
#include "video_encoder.h"
37
#include "video_mixer.h"
38 39 40 41

#include <map>
#include <string>
#include <memory>
42 43 44

namespace sfl_video {

45
class SocketPair;
46

47 48
class VideoSendThread : public VideoFramePassiveReader
{
49 50
public:
    VideoSendThread(const std::string &id,
51
                    const std::map<std::string, std::string> &args,
52
                    SocketPair& socketPair);
53 54 55
    std::string getSDP() const { return sdp_; }
    void forceKeyFrame();

56 57
    // as VideoFramePassiveReader
    void update(Observable<VideoFrameSP>*, VideoFrameSP&);
58

59
private:
60
    NON_COPYABLE(VideoSendThread);
61

62 63
    bool setup();
    void encodeAndSendVideo(VideoFrame&);
64

65
    std::map<std::string, std::string> args_;
66
    const std::string &id_;
67

68
    VideoEncoder *videoEncoder_;
69

70 71 72
    int forceKeyFrame_;
    int frameNumber_;
    VideoIOHandle* muxContext_;
73
    std::string sdp_;
74
};
75

76 77
}

78
#endif // __VIDEO_SEND_THREAD_H__