summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordknn <yoann.blein@free.fr>2012-06-21 18:06:42 (GMT)
committerdknn <yoann.blein@free.fr>2012-09-22 08:53:12 (GMT)
commitf374887e7a27831771304a09a74d6cd54f8ef4e4 (patch)
tree8490553468223483fee7418e420894260a37692c /Swiften/ScreenSharing/VideoEncoder.h
parent931b52184bf37f298f9c967883a3b71c912f834b (diff)
downloadswift-contrib-f374887e7a27831771304a09a74d6cd54f8ef4e4.zip
swift-contrib-f374887e7a27831771304a09a74d6cd54f8ef4e4.tar.bz2
Middle part of the outgoing media pipeline
Diffstat (limited to 'Swiften/ScreenSharing/VideoEncoder.h')
-rw-r--r--Swiften/ScreenSharing/VideoEncoder.h44
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