blob: d98b8544462149df5019a0547ff3db1b80f725ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
/*
* Copyright (c) 2012 Yoann Blein
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
#ifndef VIDEOENCODER_H
#define VIDEOENCODER_H
#include <Swiften/ScreenSharing/VideoFrame.h>
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
#include <stdint.h>
#include <queue>
namespace Swift {
class VideoEncoder {
public:
VideoEncoder() {}
virtual ~VideoEncoder() {}
void addFrame(VideoFrame::ref frame);
void startEncoding();
void stopEncoding();
protected:
virtual void encodingLoop() = 0;
VideoFrame::ref popWhenFrameIsAvailable();
protected:
bool stop;
private:
std::queue<VideoFrame::ref> frames;
boost::mutex queueMutex;
boost::condition_variable queueCondVar;
boost::thread encodingThread;
};
}
#endif // VIDEOENCODER_H
|