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/VP8Encoder.h
parent931b52184bf37f298f9c967883a3b71c912f834b (diff)
downloadswift-contrib-f374887e7a27831771304a09a74d6cd54f8ef4e4.zip
swift-contrib-f374887e7a27831771304a09a74d6cd54f8ef4e4.tar.bz2
Middle part of the outgoing media pipeline
Diffstat (limited to 'Swiften/ScreenSharing/VP8Encoder.h')
-rw-r--r--Swiften/ScreenSharing/VP8Encoder.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/Swiften/ScreenSharing/VP8Encoder.h b/Swiften/ScreenSharing/VP8Encoder.h
new file mode 100644
index 0000000..b512058
--- /dev/null
+++ b/Swiften/ScreenSharing/VP8Encoder.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012 Yoann Blein
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#ifndef VP8ENCODER_H
+#define VP8ENCODER_H
+
+#pragma once
+
+#include <Swiften/ScreenSharing/VideoEncoder.h>
+#include <Swiften/Base/boost_bsignals.h>
+
+
+#define VPX_CODEC_DISABLE_COMPAT 1 // Recomended
+#include "vpx/vpx_encoder.h"
+
+
+namespace Swift {
+ class VP8Encoder : public VideoEncoder {
+ public:
+ VP8Encoder(unsigned int width, unsigned int height);
+ virtual ~VP8Encoder();
+
+ void updateCodecConfig();
+
+ public:
+ boost::signal<void (const vpx_codec_cx_pkt_t *)> onNewFrameEncoded;
+
+ protected:
+ virtual void encodingLoop();
+
+ private:
+ bool convertRGB24toYV12inBuffer(const VideoFrame::ref frame);
+
+ private:
+ vpx_codec_iface_t* codecInterface;
+ vpx_codec_ctx_t codecContext;
+ vpx_codec_enc_cfg_t codecConfig;
+ vpx_image_t *imageBuffer;
+ vpx_codec_flags_t codecFlags;
+ vpx_enc_frame_flags_t frameFlags;
+ int frameNumber;
+ };
+
+}
+
+
+#endif // VP8ENCODER_H