diff options
Diffstat (limited to 'Swiften/ScreenSharing/VideoEncoder.h')
-rw-r--r-- | Swiften/ScreenSharing/VideoEncoder.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Swiften/ScreenSharing/VideoEncoder.h b/Swiften/ScreenSharing/VideoEncoder.h new file mode 100644 index 0000000..d98b854 --- /dev/null +++ b/Swiften/ScreenSharing/VideoEncoder.h @@ -0,0 +1,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 |