#include <rdr/OutStream.h>
#include <rfb/Exception.h>
#include <rfb/encodings.h>
-#include <rfb/EncodeManager.h>
#include <rfb/ConnParams.h>
#include <rfb/util.h>
supportsSetDesktopSize(false), supportsFence(false),
supportsContinuousUpdates(false),
compressLevel(2), qualityLevel(-1), fineQualityLevel(-1),
- subsampling(subsampleUndefined), name_(0),
- preferredEncoding_(encodingRaw), verStrPos(0)
+ subsampling(subsampleUndefined), name_(0), verStrPos(0)
{
setName("");
}
qualityLevel = -1;
fineQualityLevel = -1;
subsampling = subsampleUndefined;
- preferredEncoding_ = encodingRaw;
encodings_.clear();
encodings_.insert(encodingRaw);
encodings[i] <= pseudoEncodingFineQualityLevel100)
fineQualityLevel = encodings[i] - pseudoEncodingFineQualityLevel0;
- if (EncodeManager::supported(encodings[i]))
- preferredEncoding_ = encodings[i];
-
if (encodings[i] > 0)
encodings_.insert(encodings[i]);
}
const Cursor& cursor() { return cursor_; }
void setCursor(const Cursor& cursor);
- rdr::S32 preferredEncoding() { return preferredEncoding_; }
bool supportsEncoding(rdr::S32 encoding);
void setEncodings(int nEncodings, const rdr::S32* encodings);
PixelFormat pf_;
char* name_;
Cursor cursor_;
- rdr::S32 preferredEncoding_;
std::set<rdr::S32> encodings_;
char verStr[13];
int verStrPos;
indexed = indexedRLE = fullColour = encoderRaw;
// Try to respect the client's wishes
- preferred = conn->cp.preferredEncoding();
+ preferred = conn->getPreferredEncoding();
switch (preferred) {
case encodingRRE:
// Horrible for anything high frequency and/or lots of colours
#include <rfb/SMsgWriter.h>
#include <rfb/SConnection.h>
#include <rfb/ServerCore.h>
+#include <rfb/encodings.h>
+#include <rfb/EncodeManager.h>
#include <rfb/LogWriter.h>
: readyForSetColourMapEntries(false),
is(0), os(0), reader_(0), writer_(0),
security(0), ssecurity(0), state_(RFBSTATE_UNINITIALISED),
- reverseConnection(reverseConnection_)
+ reverseConnection(reverseConnection_),
+ preferredEncoding(encodingRaw)
{
defaultMajorVersion = 3;
defaultMinorVersion = 8;
os->flush();
}
+void SConnection::setEncodings(int nEncodings, rdr::S32* encodings)
+{
+ int i;
+
+ preferredEncoding = encodingRaw;
+ for (i = 0;i < nEncodings;i++) {
+ if (EncodeManager::supported(encodings[i])) {
+ preferredEncoding = encodings[i];
+ break;
+ }
+ }
+
+ SMsgHandler::setEncodings(nEncodings, encodings);
+}
+
void SConnection::versionReceived()
{
}
void approveConnection(bool accept, const char* reason=0);
+ // Overridden from SMsgHandler
+
+ virtual void setEncodings(int nEncodings, rdr::S32* encodings);
+
+
// Methods to be overridden in a derived class
// versionReceived() indicates that the version number has just been read
stateEnum state() { return state_; }
+ rdr::S32 getPreferredEncoding() { return preferredEncoding; }
+
protected:
void setState(stateEnum s) { state_ = s; }
void writeFakeColourMap(void);
SSecurity* ssecurity;
stateEnum state_;
bool reverseConnection;
+ rdr::S32 preferredEncoding;
};
}
#endif