]> source.dussan.org Git - tigervnc.git/commitdiff
In SMsgWriter, added the ability to send a video rectangle via JpegEncoder.
authorConstantin Kaplinsky <const@tightvnc.com>
Fri, 31 Aug 2007 21:31:34 +0000 (21:31 +0000)
committerConstantin Kaplinsky <const@tightvnc.com>
Fri, 31 Aug 2007 21:31:34 +0000 (21:31 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2329 3789f03b-4d11-0410-bbf8-ca57d06f2519

common/rfb/SMsgWriter.cxx
common/rfb/SMsgWriter.h

index f3079eed9732edd6e39b237fcb3733906a6d795a..8a6ce66757b9c2ad8caf2e438a33222041771aa6 100644 (file)
@@ -24,6 +24,7 @@
 #include <rfb/UpdateTracker.h>
 #include <rfb/SMsgWriter.h>
 #include <rfb/LogWriter.h>
+#include <rfb/JpegEncoder.h>
 
 using namespace rfb;
 
@@ -39,6 +40,7 @@ SMsgWriter::SMsgWriter(ConnParams* cp_, rdr::OutStream* os_)
     bytesSent[i] = 0;
     rectsSent[i] = 0;
   }
+  jpegEncoder = new JpegEncoder(this);
 }
 
 SMsgWriter::~SMsgWriter()
@@ -56,6 +58,7 @@ SMsgWriter::~SMsgWriter()
   vlog.info("  raw bytes equivalent %d, compression ratio %f",
           rawBytesEquivalent, (double)rawBytesEquivalent / bytes);
   delete [] imageBuf;
+  delete jpegEncoder;
 }
 
 void SMsgWriter::writeSetColourMapEntries(int firstColour, int nColours,
@@ -169,6 +172,11 @@ bool SMsgWriter::writeRect(const Rect& r, unsigned int encoding,
   return encoders[encoding]->writeRect(r, ig, actual);
 }
 
+void SMsgWriter::writeVideoRect(PixelBuffer *pb, const Rect& r)
+{
+  jpegEncoder->writeRect(pb, r);
+}
+
 void SMsgWriter::writeCopyRect(const Rect& r, int srcX, int srcY)
 {
   startRect(r,encodingCopyRect);
index 17e3481ff178f215c6ad4b6934f69a2a56909bac..490d556c7128ec4029fbaac697e3b8a5c0bf637d 100644 (file)
@@ -25,6 +25,7 @@
 #include <rdr/types.h>
 #include <rfb/encodings.h>
 #include <rfb/Encoder.h>
+#include <rfb/PixelBuffer.h>
 
 namespace rdr { class OutStream; }
 
@@ -36,6 +37,7 @@ namespace rfb {
   class ColourMap;
   class Region;
   class UpdateInfo;
+  class JpegEncoder;
 
   class WriteSetCursorCallback {
   public:
@@ -129,6 +131,8 @@ namespace rfb {
 
     virtual void writeCopyRect(const Rect& r, int srcX, int srcY);
 
+    virtual void writeVideoRect(PixelBuffer *pb, const Rect& r);
+
     virtual void startRect(const Rect& r, unsigned int enc)=0;
     virtual void endRect()=0;
 
@@ -154,12 +158,14 @@ namespace rfb {
     rdr::OutStream* os;
 
     Encoder* encoders[encodingMax+1];
+    JpegEncoder* jpegEncoder;
     int lenBeforeRect;
     unsigned int currentEncoding;
     int updatesSent;
     int bytesSent[encodingMax+1];
     int rectsSent[encodingMax+1];
     int rawBytesEquivalent;
+    // FIXME: Gather statistics for JpegEncoder as well.
 
     rdr::U8* imageBuf;
     int imageBufSize;