Add V4L2_PIX_FMT_RGB24 pixel format support
This is the format used by the gxp v4l2 driver.
Change-Id: Ia78e39b95f1cdffa2df111d1f1af4cb9c290cc9f
Signed-off-by: charles kearney <charles.kearney@hpe.com>
diff --git a/ikvm_server.cpp b/ikvm_server.cpp
index 141f6c6..9274a9b 100644
--- a/ikvm_server.cpp
+++ b/ikvm_server.cpp
@@ -1,5 +1,6 @@
#include "ikvm_server.hpp"
+#include <linux/videodev2.h>
#include <rfb/rfbproto.h>
#include <boost/crc.hpp>
@@ -156,22 +157,33 @@
fu->nRects = Swap16IfLE(1);
}
- fu->type = rfbFramebufferUpdate;
- cl->ublen = sz_rfbFramebufferUpdateMsg;
- rfbSendUpdateBuf(cl);
-
- cl->tightEncoding = rfbEncodingTight;
- rfbSendTightHeader(cl, 0, 0, video.getWidth(), video.getHeight());
-
- cl->updateBuf[cl->ublen++] = (char)(rfbTightJpeg << 4);
- rfbSendCompressedDataTight(cl, data, video.getFrameSize());
-
- if (cl->enableLastRectEncoding)
+ switch (video.getPixelformat())
{
- rfbSendLastRectMarker(cl);
- }
+ case V4L2_PIX_FMT_RGB24:
+ framebuffer.assign(data, data + video.getFrameSize());
+ rfbMarkRectAsModified(server, 0, 0, video.getWidth(),
+ video.getHeight());
+ break;
- rfbSendUpdateBuf(cl);
+ case V4L2_PIX_FMT_JPEG:
+ fu->type = rfbFramebufferUpdate;
+ cl->ublen = sz_rfbFramebufferUpdateMsg;
+ rfbSendUpdateBuf(cl);
+ cl->tightEncoding = rfbEncodingTight;
+ rfbSendTightHeader(cl, 0, 0, video.getWidth(),
+ video.getHeight());
+ cl->updateBuf[cl->ublen++] = (char)(rfbTightJpeg << 4);
+ rfbSendCompressedDataTight(cl, data, video.getFrameSize());
+ if (cl->enableLastRectEncoding)
+ {
+ rfbSendLastRectMarker(cl);
+ }
+ rfbSendUpdateBuf(cl);
+ break;
+
+ default:
+ break;
+ }
}
rfbReleaseClientIterator(it);