[X2Go-Commits] [x2gokdrive] 01/01: add command line option for initial JPEG quality.

git-admin at x2go.org git-admin at x2go.org
Tue Oct 11 16:47:51 CEST 2022


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2gokdrive.

commit 377462a272353540fdd8ac80fc2c7d6dcc5884be
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date:   Tue Oct 11 09:47:40 2022 -0500

    add command line option for initial JPEG quality.
---
 debian/changelog   |  1 +
 x2gokdriveinit.c   | 12 ++++++++++++
 x2gokdriveremote.c | 12 +++++++++++-
 x2gokdriveremote.h |  1 +
 4 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 64b8988..68ec143 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -37,6 +37,7 @@ x2gokdrive (0.0.0.1-0x2go1) UNRELEASED; urgency=medium
     - automatically decrease the jpeg quality when to many frames in queue.
     - update the screen with png frames when no data is transmitted.
     - make screen repaint faster.
+    - add command line option for initial JPEG quality.
 
   [ Mihai Moldovan ]
   * Initial release:
diff --git a/x2gokdriveinit.c b/x2gokdriveinit.c
index e66c4ac..a47241a 100644
--- a/x2gokdriveinit.c
+++ b/x2gokdriveinit.c
@@ -246,6 +246,18 @@ ddxProcessArgument(int argc, char **argv, int i)
         UseMsg();
         exit(1);
     }
+    else if (!strcmp(argv[i], "-quality"))
+    {
+        if ((i + 1) < argc)
+        {
+            /* compat with nxagent */
+            remote_set_jpeg_quality(argv[i+1]);
+            return 2;
+        }
+
+        UseMsg();
+        exit(1);
+    }
     else if (!strcmp(argv[i], "-name"))
     {
         if ((i + 1) < argc)
diff --git a/x2gokdriveremote.c b/x2gokdriveremote.c
index 0c78073..2790a66 100644
--- a/x2gokdriveremote.c
+++ b/x2gokdriveremote.c
@@ -3342,7 +3342,9 @@ remote_init(void)
 
     remoteVars.serversock=-1;
 
-    remoteVars.initialJpegQuality=remoteVars.jpegQuality=JPG_QUALITY;
+    if(!remoteVars.initialJpegQuality)
+        remoteVars.initialJpegQuality=remoteVars.jpegQuality=JPG_QUALITY;
+    EPHYR_DBG("JPEG quality is %d", remoteVars.initialJpegQuality);
     remoteVars.compression=DEFAULT_COMPRESSION;
     remoteVars.selstruct.selectionMode = CLIP_BOTH;
     if(!strlen(remote_get_init_geometry()))
@@ -4594,6 +4596,14 @@ void remote_set_init_geometry ( const char* geometry )
     strncpy(remoteVars.initGeometry,geometry,strlen(geometry));
 }
 
+void remote_set_jpeg_quality(const char* quality)
+{
+    sscanf(quality, "%d", &remoteVars.initialJpegQuality);
+    if(remoteVars.initialJpegQuality<10 || remoteVars.initialJpegQuality > 90)
+    {
+        remoteVars.initialJpegQuality=JPG_QUALITY;
+    }
+}
 
 void remote_set_display_name(const char* name)
 {
diff --git a/x2gokdriveremote.h b/x2gokdriveremote.h
index a5d4580..68675f8 100644
--- a/x2gokdriveremote.h
+++ b/x2gokdriveremote.h
@@ -571,6 +571,7 @@ void request_selection_from_client(enum SelectionType selection);
 void rebuild_caches(void);
 void remote_set_rootless(void);
 void remote_set_init_geometry(const char* geometry);
+void remote_set_jpeg_quality(const char* quality);
 const char*  remote_get_init_geometry(void);
 void remote_check_windowstree(WindowPtr root);
 void remote_check_window(WindowPtr win);

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git


More information about the x2go-commits mailing list