From ab9fd6b4d5060cd02bfad7846fa5164353f5c277 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 20 Sep 2018 10:51:00 +0200 Subject: [PATCH] Add method to get compression settings from encoder --- common/rfb/Encoder.h | 3 +++ common/rfb/TightJPEGEncoder.cxx | 5 +++++ common/rfb/TightJPEGEncoder.h | 2 ++ 3 files changed, 10 insertions(+) diff --git a/common/rfb/Encoder.h b/common/rfb/Encoder.h index 1e57fda5..e135ec0e 100644 --- a/common/rfb/Encoder.h +++ b/common/rfb/Encoder.h @@ -54,6 +54,9 @@ namespace rfb { virtual void setQualityLevel(int level) {}; virtual void setFineQualityLevel(int quality, int subsampling) {}; + virtual int getCompressLevel() { return -1; }; + virtual int getQualityLevel() { return -1; }; + // writeRect() is the main interface that encodes the given rectangle // with data from the PixelBuffer onto the SConnection given at // encoder creation. diff --git a/common/rfb/TightJPEGEncoder.cxx b/common/rfb/TightJPEGEncoder.cxx index 5d39b62c..bbe4f8fa 100644 --- a/common/rfb/TightJPEGEncoder.cxx +++ b/common/rfb/TightJPEGEncoder.cxx @@ -101,6 +101,11 @@ void TightJPEGEncoder::setFineQualityLevel(int quality, int subsampling) fineSubsampling = subsampling; } +int TightJPEGEncoder::getQualityLevel() +{ + return qualityLevel; +} + void TightJPEGEncoder::writeRect(const PixelBuffer* pb, const Palette& palette) { const rdr::U8* buffer; diff --git a/common/rfb/TightJPEGEncoder.h b/common/rfb/TightJPEGEncoder.h index 458c3831..3d8fa8c1 100644 --- a/common/rfb/TightJPEGEncoder.h +++ b/common/rfb/TightJPEGEncoder.h @@ -35,6 +35,8 @@ namespace rfb { virtual void setQualityLevel(int level); virtual void setFineQualityLevel(int quality, int subsampling); + virtual int getQualityLevel(); + virtual void writeRect(const PixelBuffer* pb, const Palette& palette); virtual void writeSolidRect(int width, int height, const PixelFormat& pf, -- 2.39.5