You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2020/05/08 04:48:42 UTC
[openmeetings] branch master updated: [OPENMEETINGS-2276] basic
clean-up, required to clean-up string labels
This is an automated email from the ASF dual-hosted git repository.
solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git
The following commit(s) were added to refs/heads/master by this push:
new a43c73c [OPENMEETINGS-2276] basic clean-up, required to clean-up string labels
a43c73c is described below
commit a43c73ccc127b67034b508e64fbe8c265382e675
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Fri May 8 11:48:29 2020 +0700
[OPENMEETINGS-2276] basic clean-up, required to clean-up string labels
---
LICENSE | 61 +-
README.md | 2 +-
openmeetings-screenshare/pom.xml | 14 +-
.../src/main/assembly/assembly.xml | 13 +-
.../apache/openmeetings/screenshare/AudioTone.java | 47 --
.../screenshare/BaseScreenEncoder.java | 42 --
.../openmeetings/screenshare/CaptureScreen.java | 230 ------
.../org/apache/openmeetings/screenshare/Core.java | 600 +--------------
.../openmeetings/screenshare/IScreenEncoder.java | 33 -
.../openmeetings/screenshare/IScreenShare.java | 40 -
.../screenshare/RTMPClientPublish.java | 93 ---
.../openmeetings/screenshare/RTMPSScreenShare.java | 67 --
.../openmeetings/screenshare/RTMPScreenShare.java | 67 --
.../screenshare/RTMPTSScreenShare.java | 67 --
.../openmeetings/screenshare/RTMPTScreenShare.java | 67 --
.../openmeetings/screenshare/ScreenV1Encoder.java | 194 -----
.../openmeetings/screenshare/gui/BlankArea.java | 42 --
.../screenshare/gui/MouseListenerable.java | 32 -
.../screenshare/gui/NumberSpinner.java | 35 -
.../screenshare/gui/ScreenDimensions.java | 153 ----
.../screenshare/gui/ScreenKeyListener.java | 44 --
.../screenshare/gui/ScreenSharerFrame.java | 839 ---------------------
.../gui/listener/OmMouseInputAdapter.java | 59 --
.../gui/listener/ScreenHeightMouseListener.java | 53 --
.../gui/listener/ScreenMouseListener.java | 57 --
.../gui/listener/ScreenWidthMouseListener.java | 53 --
.../gui/listener/ScreenXMouseListener.java | 54 --
.../gui/listener/ScreenYMouseListener.java | 55 --
.../openmeetings/screenshare/job/CursorJob.java | 40 -
.../openmeetings/screenshare/job/EncodeJob.java | 86 ---
.../openmeetings/screenshare/job/OmKeyEvent.java | 186 -----
.../openmeetings/screenshare/job/RemoteJob.java | 198 -----
.../openmeetings/screenshare/job/SendJob.java | 64 --
.../apache/openmeetings/screenshare/util/Util.java | 51 --
.../src/main/jnlp/templates/template.jnlp | 1 -
.../src/main/resources/logback.xml | 1 -
.../apache/openmeetings/screenshare/gui/down.png | Bin 411 -> 0 bytes
.../apache/openmeetings/screenshare/gui/next.png | Bin 395 -> 0 bytes
.../apache/openmeetings/screenshare/gui/play.png | Bin 498 -> 0 bytes
.../openmeetings/screenshare/gui/previous.png | Bin 389 -> 0 bytes
.../apache/openmeetings/screenshare/gui/stop.png | Bin 200 -> 0 bytes
.../org/apache/openmeetings/screenshare/gui/up.png | Bin 402 -> 0 bytes
.../src/main/resources/quartz.properties | 13 -
openmeetings-server/src/site/xdoc/index.xml | 2 +-
pom.xml | 7 -
45 files changed, 8 insertions(+), 3754 deletions(-)
diff --git a/LICENSE b/LICENSE
index 5c14eaa..6088799 100644
--- a/LICENSE
+++ b/LICENSE
@@ -222,8 +222,6 @@ webapps/openmeetings/streams/*
webapps/openmeetings/upload/*
webapps/openmeetings/WEB-INF/classes/**
-webapps/openmeetings/WEB-INF/red5-web.properties
-webapps/openmeetings/WEB-INF/red5-web.xml
webapps/openmeetings/WEB-INF/web.xml
webapps/openmeetings/WEB-INF/lib/openmeetings-*.jar
@@ -237,26 +235,8 @@ projects licensed under the Apache License 2.0:
======================================================================================================================
-red5-*.jar
-commons-daemon-*.jar
-install-service.bat
-red5*.bat
-red5*.sh
-red5.service
-uninstall-service.bat
conf/*
-webapps/red5-default.xml
-webapps/root/biglogo.png
-webapps/root/crossdomain.xml
-webapps/root/favicon.ico
-webapps/root/favicon.png
-webapps/root/flvdemo.html
-webapps/root/gc.jsp
-webapps/root/index.html
-webapps/root/logo.png
-webapps/root/WEB-INF/red5-web.properties
-webapps/root/WEB-INF/red5-web.xml
-webapps/root/WEB-INF/web.xml
+webapps/ROOT/index.html
webapps/openmeetings/WEB-INF/lib/animal-sniffer-annotations-1.14.jar
webapps/openmeetings/WEB-INF/lib/api-all-*.jar
@@ -1125,45 +1105,6 @@ DAMAGE.
======================================================================================================================
-For Red5 Components:
-
- RED5 Open Source Flash Server - http://code.google.com/p/red5/
-
-Copyright 2006-2012 by respective authors (see below). All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-The Red5 Project (red5@osflash.org)
-Luke Hubbard (luke@codegent.com)
-Dominick Accattato (daccattato@gmail.com)
-Chris Allen (mrchrisallen@gmail.com)
-Joachim Bauch (jojo@struktur.de)
-Mick Herres (mickherres@hotmail.com)
-John Grden (johng@acmewebworks.com)
-Grant Davies (grant@bluetube.com)
-Steven Elliott (steven.s.elliott@gmail.com)
-Jokul Tian (tianxuefeng@gmail.com)
-Steven Gong (steven.gong@gmail.com)
-Paul Gregoire (mondain@gmail.com)
-Michael Klishin (michael.s.klishin@gmail.com)
-Thijs Triemstra (info@collab.nl)
-Dan Rossi (electroteque@gmail.com)
-Anton Lebedevich (mabrek@gmail.com)
-Art Clarke (aclarke@xuggle.com)
-
-
-======================================================================================================================
-
For JDOM
Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin.
All rights reserved.
diff --git a/README.md b/README.md
index af79c7e..e232e0d 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
- [x] **collaborative document editing**
- [x] **other groupware tools**
-It uses API functions of Media Server for Remoting and Streaming ([Red5](http://red5.org/) or [Kurento](https://www.kurento.org)).
+It uses API functions of Media Server for Remoting and Streaming [Kurento](https://www.kurento.org)).
Getting Started
===============
diff --git a/openmeetings-screenshare/pom.xml b/openmeetings-screenshare/pom.xml
index 4ca8964..0f592a2 100644
--- a/openmeetings-screenshare/pom.xml
+++ b/openmeetings-screenshare/pom.xml
@@ -41,18 +41,8 @@
</properties>
<dependencies>
<dependency>
- <groupId>org.red5</groupId>
- <artifactId>red5-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.mina</groupId>
- <artifactId>mina-core</artifactId>
- <version>${mina.version}</version>
- </dependency>
- <dependency>
- <groupId>org.quartz-scheduler</groupId>
- <artifactId>quartz</artifactId>
- <version>${quartz.version}</version>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
diff --git a/openmeetings-screenshare/src/main/assembly/assembly.xml b/openmeetings-screenshare/src/main/assembly/assembly.xml
index fb93325..b0034fe 100644
--- a/openmeetings-screenshare/src/main/assembly/assembly.xml
+++ b/openmeetings-screenshare/src/main/assembly/assembly.xml
@@ -29,25 +29,14 @@
<dependencySet>
<outputDirectory></outputDirectory>
<includes>
- <include>commons-codec:commons-codec</include>
- <include>commons-beanutils:commons-beanutils</include>
- <include>commons-collections:commons-collections</include>
- <include>org.apache.commons:commons-lang3</include>
- <include>org.apache.httpcomponents:httpclient</include>
- <include>org.apache.httpcomponents:httpcore</include>
- <include>net.sf.ehcache:ehcache-core</include>
+ <!-- FIXME TODO this list need to be investigated -->
<include>org.slf4j:slf4j-api</include>
<include>org.slf4j:jcl-over-slf4j</include>
<include>ch.qos.logback:logback-core</include>
<include>ch.qos.logback:logback-classic</include>
- <include>org.apache.mina:mina-core</include>
- <include>org.red5:red5-io</include>
- <include>org.red5:red5-server-common</include>
- <include>org.red5:red5-client</include>
<include>org.springframework:spring-context</include>
<include>org.springframework:spring-core</include>
<include>org.springframework:spring-beans</include>
- <include>org.quartz-scheduler:quartz</include>
</includes>
<unpack>true</unpack>
<scope>runtime</scope>
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/AudioTone.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/AudioTone.java
deleted file mode 100644
index e5e9018..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/AudioTone.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare;
-
-import javax.sound.sampled.AudioFormat;
-import javax.sound.sampled.AudioSystem;
-import javax.sound.sampled.LineUnavailableException;
-import javax.sound.sampled.SourceDataLine;
-
-public class AudioTone {
- public static final float SAMPLE_RATE = 44100F;
-
- private AudioTone() {}
-
- public static void play() {
- byte[] buf = new byte[1];
-
- AudioFormat af = new AudioFormat(SAMPLE_RATE, 8, 1, true, false);
- try (SourceDataLine sdl = AudioSystem.getSourceDataLine(af)) {
- sdl.open(af);
- sdl.start();
- for (int i = 0; i < (int)SAMPLE_RATE; ++i) {
- double angle = i / (SAMPLE_RATE / 440) * 2.0 * Math.PI;
- buf[0] = (byte) (Math.sin(angle) * 128);
- sdl.write(buf, 0, 1);
- }
- } catch (LineUnavailableException e) {
- //no-op
- }
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/BaseScreenEncoder.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/BaseScreenEncoder.java
deleted file mode 100644
index e1723aa..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/BaseScreenEncoder.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare;
-
-import java.awt.Graphics2D;
-import java.awt.Rectangle;
-import java.awt.RenderingHints;
-import java.awt.image.BufferedImage;
-
-public abstract class BaseScreenEncoder implements IScreenEncoder {
-
- public static BufferedImage resize(BufferedImage _img, Rectangle size) {
- BufferedImage img = _img;
- if (img.getWidth() != size.width || img.getHeight() != size.height) {
- img = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB);
-
- Graphics2D graphics2D = img.createGraphics();
- graphics2D.setRenderingHint(
- RenderingHints.KEY_INTERPOLATION,
- RenderingHints.VALUE_INTERPOLATION_BICUBIC);
- graphics2D.drawImage(_img, 0, 0, size.width, size.height, null);
- graphics2D.dispose();
- }
- return img;
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/CaptureScreen.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/CaptureScreen.java
deleted file mode 100644
index bb168b3..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/CaptureScreen.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare;
-
-import static org.apache.openmeetings.screenshare.Core.QUARTZ_GROUP_NAME;
-import static org.apache.openmeetings.screenshare.util.Util.getQurtzProps;
-import static org.quartz.SimpleScheduleBuilder.simpleSchedule;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.Queue;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.openmeetings.screenshare.gui.ScreenDimensions;
-import org.apache.openmeetings.screenshare.job.CursorJob;
-import org.apache.openmeetings.screenshare.job.EncodeJob;
-import org.apache.openmeetings.screenshare.job.SendJob;
-import org.quartz.JobBuilder;
-import org.quartz.JobDetail;
-import org.quartz.JobKey;
-import org.quartz.Scheduler;
-import org.quartz.SchedulerException;
-import org.quartz.SchedulerFactory;
-import org.quartz.Trigger;
-import org.quartz.TriggerBuilder;
-import org.quartz.impl.StdSchedulerFactory;
-import org.red5.server.api.Red5;
-import org.red5.server.net.rtmp.event.VideoData;
-import org.red5.server.stream.message.RTMPMessage;
-import org.slf4j.Logger;
-
-public class CaptureScreen extends Thread {
- private static final Logger log = getLogger(CaptureScreen.class);
- private static final String QUARTZ_CURSOR_TRIGGER_NAME = "CursorTrigger";
- private static final String QUARTZ_CURSOR_JOB_NAME = "CursorJob";
- private final Core core;
- private int timestampDelta;
- private AtomicInteger timestamp = new AtomicInteger(0);
- private AtomicBoolean sendFrameGuard = new AtomicBoolean(false);
- private long startTime = 0;
- private volatile boolean active = true;
- private IScreenEncoder se;
- private IScreenShare client;
- private Queue<VideoData> frames = new ArrayBlockingQueue<>(2);
- private String host = null;
- private String app = null;
- private int port = -1;
- private Number streamId;
- private boolean startPublish = false;
- private Scheduler _scheduler;
- private final JobDetail cursorJob;
- private final Trigger cursorTrigger;
-
- public CaptureScreen(Core coreScreenShare, IScreenShare client, String host, String app, int port) {
- core = coreScreenShare;
- this.client = client;
- this.host = host;
- this.app = app;
- this.port = port;
- cursorJob = JobBuilder.newJob(CursorJob.class).withIdentity(QUARTZ_CURSOR_JOB_NAME, QUARTZ_GROUP_NAME).build();
- cursorTrigger = TriggerBuilder.newTrigger()
- .withIdentity(QUARTZ_CURSOR_TRIGGER_NAME, QUARTZ_GROUP_NAME)
- .withSchedule(simpleSchedule().withIntervalInMilliseconds(1000 / Math.min(5, core.getDim().getFps())).repeatForever())
- .build();
- cursorJob.getJobDataMap().put(CursorJob.CAPTURE_KEY, this);
- }
-
- private Scheduler getScheduler() {
- if (_scheduler == null) {
- try {
- SchedulerFactory schdlrFactory = new StdSchedulerFactory(getQurtzProps("CaptureScreen"));
- _scheduler = schdlrFactory.getScheduler();
- } catch (SchedulerException e) {
- log.error("Unexpected error while creating scheduler", e);
- }
- }
- return _scheduler;
- }
-
- public void release() {
- try {
- if (_scheduler != null) {
- _scheduler.shutdown(true);
- _scheduler = null;
- }
- } catch (Exception e) {
- log.error("Unexpected error while shutting down scheduler", e);
- }
- active = false;
- timestamp = new AtomicInteger(0);
- startTime = 0;
- }
-
- @Override
- public void run() {
- try {
- while (active && !core.isReadyToRecord()) {
- Thread.sleep(60);
- }
-
- timestampDelta = 1000 / core.getDim().getFps();
- se = new ScreenV1Encoder(core.getDim()); //send keyframe every 3 seconds
- startTime = System.currentTimeMillis();
-
- JobDetail encodeJob = JobBuilder.newJob(EncodeJob.class).withIdentity("EncodeJob", QUARTZ_GROUP_NAME).build();
- encodeJob.getJobDataMap().put(EncodeJob.CAPTURE_KEY, this);
- Trigger encodeTrigger = TriggerBuilder.newTrigger()
- .withIdentity("EncodeTrigger", QUARTZ_GROUP_NAME)
- .withSchedule(simpleSchedule().withIntervalInMilliseconds(timestampDelta).repeatForever())
- .build();
- JobDetail sendJob = JobBuilder.newJob(SendJob.class).withIdentity("SendJob", QUARTZ_GROUP_NAME).build();
- Trigger sendTrigger = TriggerBuilder.newTrigger()
- .withIdentity("SendTrigger", QUARTZ_GROUP_NAME)
- .withSchedule(simpleSchedule().withIntervalInMilliseconds(timestampDelta).repeatForever())
- .build();
- sendJob.getJobDataMap().put(SendJob.CAPTURE_KEY, this);
-
- Scheduler s = getScheduler();
- s.scheduleJob(encodeJob, encodeTrigger);
- s.scheduleJob(sendJob, sendTrigger);
- s.start();
- } catch (Exception e) {
- log.error("Error while running: ", e);
- }
- }
-
- public void pushVideo(VideoData data, int ts) {
- if (startPublish) {
- if (Red5.getConnectionLocal() == null) {
- Red5.setConnectionLocal(client.getConnection());
- }
- RTMPMessage rtmpMsg = RTMPMessage.build(data, ts);
- client.publishStreamData(streamId, rtmpMsg);
- }
- }
-
- public String getHost() {
- return host;
- }
-
- public String getApp() {
- return app;
- }
-
- public int getPort() {
- return port;
- }
-
- public Number getStreamId() {
- return streamId;
- }
-
- public void setStreamId(Number streamId) {
- this.streamId = streamId;
- }
-
- public void setStartPublish(boolean startPublish) {
- this.startPublish = startPublish;
- }
-
- public IScreenEncoder getEncoder() {
- return se;
- }
-
- public Queue<VideoData> getFrames() {
- return frames;
- }
-
- public void setSendFrameGuard(boolean b) {
- sendFrameGuard.set(b);
- }
-
- public boolean getSendFrameGuard() {
- return sendFrameGuard.get();
- }
-
- public AtomicInteger getTimestamp() {
- return timestamp;
- }
-
- public long getStartTime() {
- return startTime;
- }
-
- public int getTimestampDelta() {
- return timestampDelta;
- }
-
- public void sendCursorStatus() {
- core.sendCursorStatus();
- }
-
- public boolean isStarted() throws SchedulerException {
- return active && _scheduler != null && _scheduler.isStarted() && !_scheduler.isShutdown();
- }
-
- public void setSendCursor(boolean sendCursor) {
- try {
- Scheduler s = getScheduler();
- if (sendCursor) {
- s.scheduleJob(cursorJob, cursorTrigger);
- } else {
- s.deleteJob(JobKey.jobKey(QUARTZ_CURSOR_JOB_NAME, QUARTZ_GROUP_NAME));
- }
- } catch (SchedulerException e) {
- log.error("Unexpected Error schedule/unschedule cursor job", e);
- }
- }
-
- public ScreenDimensions getDim() {
- return core.getDim();
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/Core.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/Core.java
index de6d59c..16591bf 100644
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/Core.java
+++ b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/Core.java
@@ -18,614 +18,18 @@
*/
package org.apache.openmeetings.screenshare;
-import static java.lang.Boolean.TRUE;
-import static java.util.UUID.randomUUID;
-import static org.apache.openmeetings.screenshare.util.Util.getQurtzProps;
-import static org.quartz.SimpleScheduleBuilder.simpleSchedule;
import static org.slf4j.LoggerFactory.getLogger;
-import java.awt.MouseInfo;
-import java.awt.Point;
-import java.net.ConnectException;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import org.apache.openmeetings.screenshare.gui.ScreenDimensions;
-import org.apache.openmeetings.screenshare.gui.ScreenSharerFrame;
-import org.apache.openmeetings.screenshare.job.RemoteJob;
-import org.quartz.JobBuilder;
-import org.quartz.JobDetail;
-import org.quartz.Scheduler;
-import org.quartz.SchedulerException;
-import org.quartz.SchedulerFactory;
-import org.quartz.Trigger;
-import org.quartz.TriggerBuilder;
-import org.quartz.impl.StdSchedulerFactory;
-import org.red5.client.net.rtmp.INetStreamEventHandler;
-import org.red5.io.utils.ObjectMap;
-import org.red5.server.api.Red5;
-import org.red5.server.api.event.IEvent;
-import org.red5.server.api.service.IPendingServiceCall;
-import org.red5.server.api.service.IPendingServiceCallback;
-import org.red5.server.net.ICommand;
-import org.red5.server.net.rtmp.RTMPConnection;
-import org.red5.server.net.rtmp.event.Notify;
-import org.red5.server.net.rtmp.status.StatusCodes;
import org.slf4j.Logger;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
-public class Core implements IPendingServiceCallback, INetStreamEventHandler {
+public class Core {
private static final Logger log = getLogger(Core.class);
- private static final String STATUS_EXC = "Exception: ";
- private static final String METH_SHARE_ACTION = "screenSharerAction";
- static final String QUARTZ_GROUP_NAME = "ScreenShare";
- static final String QUARTZ_REMOTE_JOB_NAME = "RemoteJob";
- static final String QUARTZ_REMOTE_TRIGGER_NAME = "RemoteTrigger";
- private static final String CONNECT_REJECTED = "NetConnection.Connect.Rejected";
- private static final String CONNECT_FAILED = "NetConnection.Connect.Failed";
-
- enum Protocol {
- rtmp, rtmpt, rtmpe, rtmps
- }
- private IScreenShare instance = null;
- private URI url;
- private URI fallback;
- private boolean fallbackUsed = false;
- private String host;
- private String app;
- private int port;
-
- private String sid;
- private CaptureScreen _capture = null;
- private RTMPClientPublish publishClient = null;
-
- private ScreenSharerFrame frame;
-
- private int defaultQuality = 1;
- private int defaultFps = 10;
- private boolean showFps = true;
-
- private boolean allowRecording = true;
- private boolean allowPublishing = true;
-
- private boolean startSharing = false;
- private boolean startRecording = false;
- private boolean startPublishing = false;
- private boolean connected = false;
- private boolean readyToRecord = false;
- private boolean audioNotify = false;
- private boolean remoteEnabled = true;
- private boolean nativeSsl = false;
- private SchedulerFactory schdlrFactory;
- private Scheduler schdlr;
- private LinkedBlockingQueue<Map<String, Object>> remoteEvents = new LinkedBlockingQueue<>();
- private final ScreenDimensions dim;
public Core(String[] args) {
- dim = new ScreenDimensions();
- try {
- System.setProperty("org.terracotta.quartz.skipUpdateCheck", "true");
- for (String arg : args) {
- log.debug("arg: {}", arg);
- }
- String[] textArray = null;
- if (args.length > 8) {
- url = new URI(args[0]);
- fallback = new URI(args[1]);
- sid = args[2];
- String labelTexts = args[3];
- defaultQuality = Integer.parseInt(args[4]);
- defaultFps = Integer.parseInt(args[5]);
- showFps = bool(args[6]);
- remoteEnabled = bool(args[7]);
- allowRecording = bool(args[8]);
- allowPublishing = bool(args[9]);
- nativeSsl = bool(args[10]);
-
- if (labelTexts.length() > 0) {
- textArray = labelTexts.split(";");
-
- if (log.isDebugEnabled()) {
- log.debug("labelTexts :: {}", labelTexts);
- log.debug("textArray Length {}", textArray.length);
- for (int i = 0; i < textArray.length; i++) {
- log.debug("{} :: {}", i, textArray[i]);
- }
- }
- }
- } else {
- System.exit(0);
- }
- schdlrFactory = new StdSchedulerFactory(getQurtzProps("CoreScreenShare"));
- schdlr = schdlrFactory.getScheduler();
- JobDetail remoteJob = JobBuilder.newJob(RemoteJob.class).withIdentity(QUARTZ_REMOTE_JOB_NAME, QUARTZ_GROUP_NAME).build();
- Trigger cursorTrigger = TriggerBuilder.newTrigger()
- .withIdentity(QUARTZ_REMOTE_TRIGGER_NAME, QUARTZ_GROUP_NAME)
- .withSchedule(simpleSchedule().withIntervalInMilliseconds(50).repeatForever())
- .build();
- remoteJob.getJobDataMap().put(RemoteJob.CORE_KEY, this);
- schdlr.scheduleJob(remoteJob, cursorTrigger);
-
- createWindow(textArray);
- } catch (Exception err) {
- log.error("", err);
- }
+ log.debug("Core constructor");
}
- private CaptureScreen getCapture() {
- if (_capture == null) {
- _capture = new CaptureScreen(this, instance, host, app, port);
- }
- return _capture;
- }
-
- private void setInstance(URI uri) {
- Protocol protocol = Protocol.valueOf(uri.getScheme());
- host = uri.getHost();
- port = uri.getPort();
- app = uri.getPath().substring(1);
-
- switch (protocol) {
- case rtmp:
- instance = new RTMPScreenShare(this);
- break;
- case rtmpt:
- instance = new RTMPTScreenShare(this);
- break;
- case rtmps:
- if (nativeSsl) {
- instance = new RTMPSScreenShare(this);
- } else {
- instance = new RTMPTSScreenShare(this);
- }
- break;
- case rtmpe:
- default:
- throw new RuntimeException("Unsupported protocol");
- }
- instance.setServiceProvider(this);
- log.debug(String.format("host: %s, port: %s, app: %s, publish: %s", host, port, app, sid));
- }
-
- // ------------------------------------------------------------------------
- //
- // Main
- //
- // ------------------------------------------------------------------------
public static void main(String[] args) {
new Core(args);
}
-
- // ------------------------------------------------------------------------
- //
- // GUI
- //
- // ------------------------------------------------------------------------
- public void createWindow(String[] textArray) {
- try {
- frame = new ScreenSharerFrame(this, textArray);
- frame.setVisible(true);
- frame.setRecordingTabEnabled(allowRecording);
- frame.setPublishingTabEnabled(allowPublishing);
- log.debug("initialized");
- } catch (Exception err) {
- log.error("createWindow Exception: ", err);
- }
- }
-
- public void sendCursorStatus() {
- try {
- Point mouseP = MouseInfo.getPointerInfo().getLocation();
-
- float scaleFactor = (1.0f * dim.getResizeX()) / dim.getSpinnerWidth();
-
- // Real size: Real mouse position = Resize : X
- int x = (int)((mouseP.getX() - dim.getSpinnerX()) * scaleFactor);
- int y = (int)((mouseP.getY() - dim.getSpinnerY()) * scaleFactor);
-
- if (instance.getConnection() != null) {
- if (Red5.getConnectionLocal() == null) {
- Red5.setConnectionLocal(instance.getConnection());
- }
- instance.invoke("setNewCursorPosition", new Object[] { x, y }, this);
- }
- } catch (NullPointerException npe) {
- //noop
- } catch (Exception err) {
- frame.setStatus(STATUS_EXC + err);
- log.error("[sendCursorStatus]", err);
- }
- }
-
- /**
- * @param id The streamid sent by server
- */
- public void setId(String id) {
- //no-op
- }
-
- public void setConnectionAsSharingClient() {
- log.debug("########## setConnectionAsSharingClient");
- try {
- if (Red5.getConnectionLocal() == null) {
- Red5.setConnectionLocal(instance.getConnection());
- }
- Map<String, Object> map = new HashMap<>();
-
- int scaledWidth = dim.getResizeX();
- int scaledHeight = dim.getResizeY();
-
- map.put("screenWidth", scaledWidth);
- map.put("screenHeight", scaledHeight);
- map.put("startRecording", startRecording);
- map.put("startStreaming", startSharing);
- map.put("startPublishing", startPublishing);
- map.put("publishingHost", frame.getPublishHost());
- map.put("publishingApp", frame.getPublishApp());
- map.put("publishingId", frame.getPublishId());
- if (Red5.getConnectionLocal() == null) {
- Red5.setConnectionLocal(instance.getConnection());
- }
- instance.invoke("setConnectionAsSharingClient", new Object[] { map }, this);
- } catch (Exception err) {
- frame.setStatus("Error: " + err.getLocalizedMessage());
- log.error("[setConnectionAsSharingClient]", err);
- }
- }
-
- public void sharingStart() {
- try {
- schdlr.start();
- } catch (SchedulerException e) {
- log.error("[schdlr.start]", e);
- }
- startSharing = true;
- captureScreenStart();
- }
-
- public void recordingStart() {
- startRecording= true;
- captureScreenStart();
- }
-
- public void publishingStart() {
- startPublishing = true;
- captureScreenStart();
- }
-
- private void connect(String sid) {
- setInstance(fallbackUsed ? fallback : url);
- Map<String, Object> map = instance.makeDefaultConnectionParams(host, port, app);
- map.put("screenClient", true);
- Map<String, Object> params = new HashMap<>();
- params.put("sid", sid);
- instance.connect(host, port, map, this, new Object[]{params});
- }
-
- void handleException(Throwable e) {
- frame.setStatus(STATUS_EXC + e);
- if (e instanceof ConnectException) {
- fallbackUsed = true;
- connect(sid);
- }
- }
-
- private void captureScreenStart() {
- try {
- log.debug("captureScreenStart");
-
- if (!connected) {
- connect(sid);
- } else {
- setConnectionAsSharingClient();
- }
- } catch (Exception err) {
- log.error("captureScreenStart Exception: ", err);
- frame.setStatus(STATUS_EXC + err);
- }
- }
-
- public void sharingStop() {
- startSharing = false;
- captureScreenStop("stopStreaming");
- }
-
- public void recordingStop() {
- startRecording = false;
- captureScreenStop("stopRecording");
- }
-
- public void publishingStop() {
- startPublishing = false;
- captureScreenStop("stopPublishing");
- }
-
- private void captureScreenStop(String action) {
- try {
- log.debug("INVOKE screenSharerAction" );
-
- Map<String, Object> map = new HashMap<>();
- map.put(action, true);
-
- if (Red5.getConnectionLocal() == null) {
- Red5.setConnectionLocal(instance.getConnection());
- }
- instance.invoke(METH_SHARE_ACTION, new Object[] { map }, this);
- } catch (Exception err) {
- log.error("captureScreenStop Exception: ", err);
- frame.setStatus(STATUS_EXC + err);
- }
- }
-
- public void stopSharing() {
- try {
- schdlr.standby();
- } catch (SchedulerException e) {
- log.error("[schdlr.standby]", e);
- }
- frame.setSharingStatus(false, !startPublishing && !startRecording && !startSharing);
- startSharing = false;
- }
-
- public void stopRecording() {
- frame.setRecordingStatus(false, !startPublishing && !startRecording && !startSharing);
- startRecording = false;
- }
-
- public void stopPublishing() {
- frame.setPublishingStatus(false, !startPublishing && !startRecording && !startSharing);
- startPublishing = false;
- if (publishClient != null) {
- publishClient.disconnect();
- publishClient = null;
- }
- }
-
- public synchronized boolean isReadyToRecord() {
- return readyToRecord;
- }
-
- private synchronized void setReadyToRecord(boolean readyToRecord) {
- this.readyToRecord = readyToRecord;
- }
-
- /**
- * @param command - command to be processed
- */
- protected void onCommand(ICommand command) {
- if (!(command instanceof Notify)) {
- return;
- }
- Notify invoke = (Notify)command;
- if (invoke.getType() == IEvent.Type.STREAM_DATA) {
- return;
- }
-
- String method = invoke.getCall().getServiceMethodName();
- if (METH_SHARE_ACTION.equals(method)) {
- Object[] args = invoke.getCall().getArguments();
- if (args != null && args.length > 0) {
- @SuppressWarnings("unchecked")
- Map<String, Object> params = (Map<String, Object>)args[0];
- if (bool(params.get("stopPublishing"))) {
- stopPublishing();
- }
- if (params.containsKey("error")) {
- frame.setStatus("" + params.get("error"));
- }
- }
- }
- }
-
- /**
- * Will stop any activity and disconnect
- *
- * @param obj - dummy unused param to perform the call
- */
- public void stopStream(Object obj) {
- try {
- log.debug("ScreenShare stopStream");
-
- stopSharing();
- stopRecording();
- stopPublishing();
- connected = false;
-
- if (instance != null) {
- instance.disconnect();
- }
- setReadyToRecord(false);
- getCapture().setStartPublish(false);
- getCapture().release();
- _capture = null;
- } catch (Exception e) {
- log.error("ScreenShare stopStream exception ", e);
- }
- }
-
- @Override
- public void onStreamEvent(Notify notify) {
- log.debug("onStreamEvent {}", notify);
-
- @SuppressWarnings("rawtypes")
- ObjectMap map = (ObjectMap) notify.getCall().getArguments()[0];
- String code = (String) map.get("code");
-
- if (StatusCodes.NS_PUBLISH_START.equals(code)) {
- log.debug("onStreamEvent Publish start");
- getCapture().setStartPublish(true);
- setReadyToRecord(true);
- }
- }
-
- private static boolean bool(Object b) {
- return TRUE.equals(Boolean.valueOf("" + b));
- }
-
- public void sendRemoteCursorEvent(Map<String, Object> obj) {
- if (!remoteEnabled) {
- return;
- }
- log.trace("#### sendRemoteCursorEvent ");
- log.trace("Result Map Type {}", obj);
-
- if (obj != null) {
- remoteEvents.offer(obj);
- log.trace("Action offered:: {}, count: {}", obj, remoteEvents.size());
- }
- }
-
- @Override
- public void resultReceived(IPendingServiceCall call) {
- try {
- log.trace("service call result: {}", call);
- if (call == null) {
- return;
- }
-
- String method = call.getServiceMethodName();
- Object o = call.getResult();
- if (log.isTraceEnabled()) {
- log.trace("Result Map Type {}", (o == null ? null : o.getClass().getName()));
- log.trace("{}", o);
- }
- @SuppressWarnings("unchecked")
- Map<String, Object> returnMap = (o != null && o instanceof Map) ? (Map<String, Object>) o : new HashMap<>();
- log.trace("call ### get Method Name {}", method);
- if ("connect".equals(method)) {
- Object code = returnMap.get("code");
- if (CONNECT_FAILED.equals(code) && !fallbackUsed) {
- fallbackUsed = true;
- connect(sid);
- frame.setStatus("Re-connecting using fallback");
- return;
- }
- if (CONNECT_FAILED.equals(code) || CONNECT_REJECTED.equals(code)) {
- frame.setStatus(String.format("Error: %s %s", code, returnMap.get("description")));
- return;
- }
- connected = true;
- setConnectionAsSharingClient();
- } else if ("setConnectionAsSharingClient".equals(method)) {
- if (!bool(returnMap.get("alreadyPublished"))) {
- log.trace("Stream not yet started - do it ");
-
- instance.createStream(this);
- } else {
- log.trace("The Stream was already started ");
- }
- if (o != null) {
- Object modus = returnMap.get("modus");
- if ("startStreaming".equals(modus)) {
- frame.setSharingStatus(true, false);
- } else if ("startRecording".equals(modus)) {
- frame.setRecordingStatus(true, false);
- } else if ("startPublishing".equals(modus)) {
- frame.setPublishingStatus(true, false);
- publishClient = new RTMPClientPublish(
- this
- , frame.getPublishHost()
- , frame.getPublishApp()
- , frame.getPublishId());
- publishClient.connect();
- }
- } else {
- String err = "Could not aquire modus for event setConnectionAsSharingClient";
- frame.setStatus(String.format("Error: %s", err));
- return;
- }
- } else if ("createStream".equals(method)) {
- if (startRecording || startSharing) {
- CaptureScreen capture = getCapture();
- if (o != null && o instanceof Number) {
- if (capture.getStreamId() != null) {
- instance.unpublish(capture.getStreamId());
- }
- capture.setStreamId((Number)o);
- }
- final String broadcastId = randomUUID().toString();
- log.debug("createPublishStream result stream id: {}; name: {}", capture.getStreamId(), broadcastId);
- instance.publish(capture.getStreamId(), broadcastId, "live", this);
-
- log.debug("setup capture thread spinnerWidth = {}; spinnerHeight = {};", dim.getSpinnerWidth(), dim.getSpinnerHeight());
-
- if (!capture.isStarted()) {
- capture.setSendCursor(startSharing);
- capture.start();
- }
- }
- } else if (METH_SHARE_ACTION.equals(method)) {
- Object result = returnMap.get("result");
- if ("stopAll".equals(result)) {
- log.trace("Stopping to stream, there is neither a Desktop Sharing nor Recording anymore");
- stopStream(null);
- } else if ("stopSharingOnly".equals(result)) {
- stopSharing();
- } else if ("stopRecordingOnly".equals(result)) {
- stopRecording();
- } else if ("stopPublishingOnly".equals(result)) {
- stopPublishing();
- }
- } else if ("setNewCursorPosition".equals(method)) {
- // Do not do anything
- } else {
- log.debug("Unknown method {}", method);
- }
-
- } catch (Exception err) {
- log.error("[resultReceived]", err);
- }
- }
-
- public boolean isAudioNotify() {
- return audioNotify;
- }
-
- public void setAudioNotify(boolean audioNotify) {
- this.audioNotify = audioNotify;
- }
-
- public boolean isRemoteEnabled() {
- return remoteEnabled;
- }
-
- public void setRemoteEnabled(boolean remoteEnabled) {
- this.remoteEnabled = remoteEnabled;
- }
-
- public void setDeadlockGuard(RTMPConnection conn) {
- ThreadPoolTaskScheduler deadlockGuard = new ThreadPoolTaskScheduler();
- deadlockGuard.setPoolSize(16);
- deadlockGuard.setDaemon(false);
- deadlockGuard.setWaitForTasksToCompleteOnShutdown(true);
- deadlockGuard.setThreadNamePrefix("DeadlockGuardScheduler-");
- deadlockGuard.afterPropertiesSet();
- conn.setDeadlockGuardScheduler(deadlockGuard);
- }
-
- public IScreenShare getInstance() {
- return instance;
- }
-
- public LinkedBlockingQueue<Map<String, Object>> getRemoteEvents() {
- return remoteEvents;
- }
-
- public ScreenDimensions getDim() {
- return dim;
- }
-
- public int getDefaultQuality() {
- return defaultQuality;
- }
-
- public int getDefaultFps() {
- return defaultFps;
- }
-
- public boolean isShowFps() {
- return showFps;
- }
}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/IScreenEncoder.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/IScreenEncoder.java
deleted file mode 100644
index 8ce61cf..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/IScreenEncoder.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare;
-
-import java.io.IOException;
-
-import org.red5.server.net.rtmp.event.VideoData;
-
-public interface IScreenEncoder {
- void createUnalteredFrame() throws IOException;
-
- VideoData getUnalteredFrame();
-
- VideoData encode(int[][] img) throws IOException;
-
- void reset();
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/IScreenShare.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/IScreenShare.java
deleted file mode 100644
index 2dedc04..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/IScreenShare.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare;
-
-import java.util.Map;
-
-import org.red5.client.net.rtmp.ClientExceptionHandler;
-import org.red5.client.net.rtmp.INetStreamEventHandler;
-import org.red5.server.api.service.IPendingServiceCallback;
-import org.red5.server.messaging.IMessage;
-import org.red5.server.net.rtmp.RTMPConnection;
-
-public interface IScreenShare extends ClientExceptionHandler {
- RTMPConnection getConnection();
- void invoke(String method, Object[] params, IPendingServiceCallback callback);
- Map<String, Object> makeDefaultConnectionParams(String server, int port, String application);
- void connect(String server, int port, Map<String, Object> connectionParams, IPendingServiceCallback connectCallback, Object[] connectCallArguments);
- void setServiceProvider(Object serviceProvider);
- void disconnect();
- void createStream(IPendingServiceCallback callback);
- void publish(Number streamId, String name, String mode, INetStreamEventHandler handler);
- void unpublish(Number streamId);
- void publishStreamData(Number streamId, IMessage message);
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPClientPublish.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPClientPublish.java
deleted file mode 100644
index 4a29b78..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPClientPublish.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare;
-
-import org.red5.client.net.rtmp.INetStreamEventHandler;
-import org.red5.client.net.rtmp.RTMPClient;
-import org.red5.server.api.service.IPendingServiceCall;
-import org.red5.server.api.service.IPendingServiceCallback;
-import org.red5.server.net.rtmp.RTMPConnection;
-import org.red5.server.net.rtmp.event.Notify;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-class RTMPClientPublish extends RTMPClient implements IPendingServiceCallback, INetStreamEventHandler, IScreenShare {
- private static final Logger logger = LoggerFactory.getLogger(RTMPClientPublish.class);
- private final CaptureScreen publishScreen;
- private String id;
- private Core core;
-
- RTMPClientPublish(Core core, String host, String app, String id) {
- this.id = id;
- this.core = core;
- publishScreen = new CaptureScreen(core, this, host, app, 1935);
- }
-
- public void setCore(Core core) {
- this.core = core;
- }
-
- public void connect() {
- super.connect(publishScreen.getHost(), 1935, publishScreen.getApp(), this);
- }
-
- @Override
- public void handleException(Throwable throwable) {
- logger.error("ERROR", throwable);
- }
-
- @Override
- public void connectionOpened(RTMPConnection conn) {
- super.connectionOpened(conn);
- createStream(this);
- }
-
- @Override
- public void connectionClosed(RTMPConnection conn) {
- super.connectionClosed(conn);
- connectionClosed();
- }
-
- private void connectionClosed() {
- publishScreen.setStartPublish(false);
- publishScreen.release();
- core.publishingStop();
- }
-
- @Override
- public void resultReceived(IPendingServiceCall call) {
- String method = call == null ? null : call.getServiceMethodName();
- logger.trace("call ### get Method Name {}", method);
- if ("createStream".equals(method)) {
- if (call.getResult() != null) {
- publishScreen.setStreamId((Integer)call.getResult());
- publish(publishScreen.getStreamId(), id, "live", this);
- publishScreen.setStartPublish(true);
- publishScreen.start();
- } else {
- connectionClosed();
- }
- }
- }
-
- @Override
- public void onStreamEvent(Notify notify) {
- //no-op
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPSScreenShare.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPSScreenShare.java
deleted file mode 100644
index ddbc84f..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPSScreenShare.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare;
-
-import org.red5.client.net.rtmps.RTMPSClient;
-import org.red5.server.net.ICommand;
-import org.red5.server.net.rtmp.Channel;
-import org.red5.server.net.rtmp.RTMPConnection;
-import org.red5.server.net.rtmp.message.Header;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RTMPSScreenShare extends RTMPSClient implements IScreenShare {
- private static final Logger log = LoggerFactory.getLogger(RTMPSScreenShare.class);
-
- private final Core core;
-
- public RTMPSScreenShare(Core core) {
- this.core = core;
- }
-
- @Override
- public void connectionOpened(RTMPConnection conn) {
- log.debug("connection opened");
- super.connectionOpened(conn);
- core.setDeadlockGuard(conn);
- }
-
- @Override
- public void connectionClosed(RTMPConnection conn) {
- log.debug("connection closed");
- super.connectionClosed(conn);
- if (core.isAudioNotify()) {
- AudioTone.play();
- }
- core.stopStream(null);
- }
-
- @Override
- protected void onCommand(RTMPConnection conn, Channel channel, Header source, ICommand command) {
- super.onCommand(conn, channel, source, command);
- core.onCommand(command);
- }
-
- @Override
- public void handleException(Throwable throwable) {
- Throwable cause = throwable.getCause();
- log.error("Error", cause);
- core.handleException(cause);
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPScreenShare.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPScreenShare.java
deleted file mode 100644
index 7aa7ccb..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPScreenShare.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare;
-
-import org.red5.client.net.rtmp.RTMPClient;
-import org.red5.server.net.ICommand;
-import org.red5.server.net.rtmp.Channel;
-import org.red5.server.net.rtmp.RTMPConnection;
-import org.red5.server.net.rtmp.message.Header;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RTMPScreenShare extends RTMPClient implements IScreenShare {
- private static final Logger log = LoggerFactory.getLogger(RTMPScreenShare.class);
-
- private final Core core;
-
- public RTMPScreenShare(Core core) {
- this.core = core;
- }
-
- @Override
- public void connectionOpened(RTMPConnection conn) {
- log.debug("connection opened");
- super.connectionOpened(conn);
- core.setDeadlockGuard(conn);
- }
-
- @Override
- public void connectionClosed(RTMPConnection conn) {
- log.debug("connection closed");
- super.connectionClosed(conn);
- if (core.isAudioNotify()) {
- AudioTone.play();
- }
- core.stopStream(null);
- }
-
- @Override
- protected void onCommand(RTMPConnection conn, Channel channel, Header source, ICommand command) {
- super.onCommand(conn, channel, source, command);
- core.onCommand(command);
- }
-
- @Override
- public void handleException(Throwable throwable) {
- Throwable cause = throwable.getCause();
- log.error("Error", cause);
- core.handleException(cause);
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPTSScreenShare.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPTSScreenShare.java
deleted file mode 100644
index bcda9a9..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPTSScreenShare.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare;
-
-import org.red5.client.net.rtmps.RTMPTSClient;
-import org.red5.server.net.ICommand;
-import org.red5.server.net.rtmp.Channel;
-import org.red5.server.net.rtmp.RTMPConnection;
-import org.red5.server.net.rtmp.message.Header;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RTMPTSScreenShare extends RTMPTSClient implements IScreenShare {
- private static final Logger log = LoggerFactory.getLogger(RTMPTSScreenShare.class);
-
- private final Core core;
-
- public RTMPTSScreenShare(Core core) {
- this.core = core;
- }
-
- @Override
- public void connectionOpened(RTMPConnection conn) {
- log.debug("connection opened");
- super.connectionOpened(conn);
- core.setDeadlockGuard(conn);
- }
-
- @Override
- public void connectionClosed(RTMPConnection conn) {
- log.debug("connection closed");
- super.connectionClosed(conn);
- if (core.isAudioNotify()) {
- AudioTone.play();
- }
- core.stopStream(null);
- }
-
- @Override
- protected void onCommand(RTMPConnection conn, Channel channel, Header source, ICommand command) {
- super.onCommand(conn, channel, source, command);
- core.onCommand(command);
- }
-
- @Override
- public void handleException(Throwable throwable) {
- Throwable cause = throwable.getCause();
- log.error("Error", cause);
- core.handleException(cause);
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPTScreenShare.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPTScreenShare.java
deleted file mode 100644
index 04453c3..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/RTMPTScreenShare.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare;
-
-import org.red5.client.net.rtmpt.RTMPTClient;
-import org.red5.server.net.ICommand;
-import org.red5.server.net.rtmp.Channel;
-import org.red5.server.net.rtmp.RTMPConnection;
-import org.red5.server.net.rtmp.message.Header;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RTMPTScreenShare extends RTMPTClient implements IScreenShare {
- private static final Logger log = LoggerFactory.getLogger(RTMPTScreenShare.class);
-
- private final Core core;
-
- public RTMPTScreenShare(Core core) {
- this.core = core;
- }
-
- @Override
- public void connectionOpened(RTMPConnection conn) {
- log.debug("connection opened");
- super.connectionOpened(conn);
- core.setDeadlockGuard(conn);
- }
-
- @Override
- public void connectionClosed(RTMPConnection conn) {
- log.debug("connection closed");
- super.connectionClosed(conn);
- if (core.isAudioNotify()) {
- AudioTone.play();
- }
- core.stopStream(null);
- }
-
- @Override
- protected void onCommand(RTMPConnection conn, Channel channel, Header source, ICommand command) {
- super.onCommand(conn, channel, source, command);
- core.onCommand(command);
- }
-
- @Override
- public void handleException(Throwable throwable) {
- Throwable cause = throwable.getCause();
- log.error("Error", cause);
- core.handleException(cause);
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/ScreenV1Encoder.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/ScreenV1Encoder.java
deleted file mode 100644
index 19ec8bf..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/ScreenV1Encoder.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare;
-
-import static org.red5.io.IoConstants.FLAG_CODEC_SCREEN;
-import static org.red5.io.IoConstants.FLAG_FRAMETYPE_INTERFRAME;
-import static org.red5.io.IoConstants.FLAG_FRAMETYPE_KEYFRAME;
-
-import java.awt.Rectangle;
-import java.awt.Robot;
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.zip.Deflater;
-
-import org.apache.mina.core.buffer.IoBuffer;
-import org.apache.openmeetings.screenshare.gui.ScreenDimensions;
-import org.red5.server.net.rtmp.event.VideoData;
-
-public class ScreenV1Encoder extends BaseScreenEncoder {
- private int[][] last = null;
- private static final int DEFAULT_BLOCK_SIZE = 32;
- private static final int DEFAULT_SCREEN_WIDTH = 1920;
- private static final int DEFAULT_SCREEN_HEIGHT = 1080;
- private int keyFrameIndex;
- private int frameCount = 0;
- private int blockSize = DEFAULT_BLOCK_SIZE;
- private ByteArrayOutputStream ba = new ByteArrayOutputStream(50 + 3 * DEFAULT_SCREEN_WIDTH * DEFAULT_SCREEN_HEIGHT);
- private byte[] areaBuf = null;
- private Deflater d = new Deflater(Deflater.DEFAULT_COMPRESSION);
- private byte[] zipBuf = null;
- private VideoData unalteredFrame = null;
- private final ScreenDimensions dim;
-
- public ScreenV1Encoder(ScreenDimensions dim) {
- this.dim = dim;
- this.keyFrameIndex = 3 * dim.getFps();
- if (blockSize < 16 || blockSize > 256 || blockSize % 16 != 0) {
- throw new RuntimeException("Invalid block size passed: " + blockSize + " should be: 'from 16 to 256 in multiples of 16'");
- }
-
- areaBuf = new byte[3 * blockSize * blockSize];
- zipBuf = new byte[3 * blockSize * blockSize];
- }
-
- private static VideoData getData(byte[] data) {
- IoBuffer buf = IoBuffer.allocate(data.length);
- buf.clear();
- buf.put(data);
- buf.flip();
- return new VideoData(buf);
- }
-
- @Override
- public void createUnalteredFrame() throws IOException {
- if (last == null) {
- return;
- }
- if (unalteredFrame == null) {
- ByteArrayOutputStream arr = new ByteArrayOutputStream(200);
-
- Rectangle _area = new Rectangle(dim.getResizeX(), dim.getResizeY());
- //header
- arr.write(getTag(FLAG_FRAMETYPE_INTERFRAME, FLAG_CODEC_SCREEN));
- writeShort(arr, _area.width + ((blockSize / 16 - 1) << 12));
- writeShort(arr, _area.height + ((blockSize / 16 - 1) << 12));
- Rectangle area = getNextBlock(_area, null);
- while (area.width > 0 && area.height > 0) {
- writeShort(arr, 0);
- area = getNextBlock(_area, area);
- }
- unalteredFrame = getData(arr.toByteArray());
- }
- }
-
- @Override
- public VideoData getUnalteredFrame() {
- if (unalteredFrame != null && (frameCount % keyFrameIndex) != 0) {
- frameCount++;
- }
- return unalteredFrame;
- }
-
- @Override
- public synchronized VideoData encode(int[][] img) throws IOException {
- ba.reset();
- Rectangle imgArea = new Rectangle(img.length, img[0].length);
- Rectangle area = getNextBlock(imgArea, null);
- boolean isKeyFrame = (frameCount++ % keyFrameIndex) == 0 || last == null;
-
- //header
- ba.write(getTag(isKeyFrame ? FLAG_FRAMETYPE_KEYFRAME : FLAG_FRAMETYPE_INTERFRAME, FLAG_CODEC_SCREEN));
- writeShort(ba, imgArea.width + ((blockSize / 16 - 1) << 12));
- writeShort(ba, imgArea.height + ((blockSize / 16 - 1) << 12));
-
- while (area.width > 0 && area.height > 0) {
- writeBytesIfChanged(ba, isKeyFrame, img, area);
- area = getNextBlock(imgArea, area);
- }
- last = img;
- return getData(ba.toByteArray());
- }
-
- @Override
- public void reset() {
- last = null;
- unalteredFrame = null;
- }
-
- private Rectangle getNextBlock(Rectangle img, Rectangle _prev) {
- Rectangle prev;
- if (_prev == null) {
- prev = new Rectangle(0, Math.max(0, img.height - blockSize), blockSize, blockSize);
- } else {
- prev = new Rectangle(_prev);
- if (Double.compare(0. + prev.x + prev.width, img.getWidth()) == 0) {
- if (prev.y == 0) {
- return new Rectangle(); //the end of the image
- }
- //next row
- prev.x = 0; //reset position
- prev.width = blockSize; //reset width
- prev.height = prev.y > blockSize ? blockSize : prev.y;
- prev.y -= prev.height;
- } else {
- prev.x += blockSize;
- }
- }
- return img.intersection(prev);
- }
-
- private void writeBytesIfChanged(ByteArrayOutputStream inBstream, boolean isKeyFrame, int[][] img, Rectangle area) throws IOException {
- boolean changed = isKeyFrame;
- int count = 0;
- for (int y = area.y + area.height - 1; y >= area.y; --y) {
- for (int x = area.x; x < area.x + area.width; ++x) {
- int pixel = img[x][y];
- if (!changed && (last == null || pixel != last[x][y])) {
- changed = true;
- }
- areaBuf[count++] = (byte)(pixel & 0xFF); // Blue component
- areaBuf[count++] = (byte)((pixel >> 8) & 0xFF); // Green component
- areaBuf[count++] = (byte)((pixel >> 16) & 0xFF); // Red component
- }
- }
- if (changed) {
- d.reset();
- d.setInput(areaBuf, 0, count);
- d.finish();
- int written = d.deflate(zipBuf);
- writeShort(inBstream, written);
- inBstream.write(zipBuf, 0, written);
- } else {
- writeShort(inBstream, 0);
- }
- }
-
- public int getTag(final int frame, final int codec) {
- return ((frame & 0x0F) << 4) + (codec & 0x0F);
- }
-
- private static void writeShort(OutputStream os, final int n) throws IOException {
- os.write((n >> 8) & 0xFF);
- os.write( n & 0xFF);
- }
-
- public static int[][] getImage(ScreenDimensions dim, Rectangle screen, Robot robot) {
- int[][] buffer = new int[dim.getResizeX()][dim.getResizeY()];
- BufferedImage image = resize(robot.createScreenCapture(screen), new Rectangle(dim.getResizeX(), dim.getResizeY()));
- for (int x = 0; x < image.getWidth(); ++x) {
- for (int y = 0; y < image.getHeight(); ++y) {
- buffer[x][y] = image.getRGB(x, y);
- }
- }
- return buffer;
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/BlankArea.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/BlankArea.java
deleted file mode 100644
index d083f24..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/BlankArea.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.gui;
-
-import java.awt.Color;
-import java.awt.Dimension;
-
-import javax.swing.BorderFactory;
-import javax.swing.SwingConstants;
-
-public class BlankArea extends MouseListenerable {
- private static final long serialVersionUID = 1L;
- private static final Dimension MIN_SIZE = new Dimension(100, 50);
-
- public BlankArea(Color color) {
- setBackground(color);
- setOpaque(false);
- setHorizontalAlignment(SwingConstants.LEFT);
- setVerticalAlignment(SwingConstants.TOP);
- setHorizontalTextPosition(0);
- setVerticalTextPosition(0);
- setBorder(BorderFactory.createLineBorder(Color.black));
- setMinimumSize(MIN_SIZE);
- setPreferredSize(MIN_SIZE);
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/MouseListenerable.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/MouseListenerable.java
deleted file mode 100644
index 5f9c742..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/MouseListenerable.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.gui;
-
-import java.awt.event.MouseAdapter;
-
-import javax.swing.JLabel;
-
-public class MouseListenerable extends JLabel {
- private static final long serialVersionUID = 1L;
-
- public void addListener(MouseAdapter listner) {
- addMouseListener(listner);
- addMouseMotionListener(listner);
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/NumberSpinner.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/NumberSpinner.java
deleted file mode 100644
index e261d38..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/NumberSpinner.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.gui;
-
-import javax.swing.JSpinner;
-import javax.swing.SpinnerNumberModel;
-
-public class NumberSpinner extends JSpinner {
- private static final long serialVersionUID = 1L;
-
- public NumberSpinner(int value, int min, int max, int step) {
- super(new SpinnerNumberModel(value, min, max, step));
- }
-
- @Override
- public Integer getValue() {
- return (Integer)super.getValue();
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/ScreenDimensions.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/ScreenDimensions.java
deleted file mode 100644
index 03fc7a6..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/ScreenDimensions.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.gui;
-
-import java.awt.Dimension;
-import java.awt.Toolkit;
-
-public class ScreenDimensions {
- public static final int ROUND_VALUE = 16;
-
- public enum ScreenQuality {
- VeryHigh
- , High
- , Medium
- , Low
- }
- /**
- * image recalcing value's from the virtual Screen drawer
- */
- private int width = 200;
- private int height = 0;
-
- /**
- * Values calced by the original Screen
- */
- private double ratio;
- private final int widthMax;
- private final int heightMax;
-
- /**
- * Values set by the virtualScreen
- */
- private int spinnerWidth;
- private int spinnerHeight;
- private int spinnerX;
- private int spinnerY;
-
- private ScreenQuality quality = ScreenQuality.Medium;
- private int fps = 10;
-
- private int resizeX;
- private int resizeY;
-
- public ScreenDimensions() {
- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- ratio = screenSize.getHeight() / screenSize.getWidth();
- widthMax = (int)screenSize.getWidth();
- heightMax = (int)screenSize.getHeight();
- height = (int)(width * ratio);
- spinnerX = 0;
- spinnerY = 0;
- spinnerWidth = widthMax;
- spinnerHeight = heightMax;
- resizeX = 640;
- resizeY = 400;
- }
-
- public int getResizeX() {
- return resizeX;
- }
-
- public void setResizeX(int resizeX) {
- this.resizeX = resizeX;
- }
-
- public int getResizeY() {
- return resizeY;
- }
-
- public void setResizeY(int resizeY) {
- this.resizeY = resizeY;
- }
-
- public int getSpinnerWidth() {
- return spinnerWidth;
- }
-
- public void setSpinnerWidth(int spinnerWidth) {
- this.spinnerWidth = spinnerWidth;
- }
-
- public int getSpinnerHeight() {
- return spinnerHeight;
- }
-
- public void setSpinnerHeight(int spinnerHeight) {
- this.spinnerHeight = spinnerHeight;
- }
-
- public int getSpinnerX() {
- return spinnerX;
- }
-
- public void setSpinnerX(int spinnerX) {
- this.spinnerX = spinnerX;
- }
-
- public int getSpinnerY() {
- return spinnerY;
- }
-
- public void setSpinnerY(int spinnerY) {
- this.spinnerY = spinnerY;
- }
-
- public int getWidth() {
- return width;
- }
-
- public int getWidthMax() {
- return widthMax;
- }
-
- public int getHeight() {
- return height;
- }
-
- public int getHeightMax() {
- return heightMax;
- }
-
- public ScreenQuality getQuality() {
- return quality;
- }
-
- public void setQuality(ScreenQuality quality) {
- this.quality = quality;
- }
-
- public int getFps() {
- return fps;
- }
-
- public void setFps(int fps) {
- this.fps = fps;
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/ScreenKeyListener.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/ScreenKeyListener.java
deleted file mode 100644
index 6f9d019..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/ScreenKeyListener.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.gui;
-
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ScreenKeyListener implements KeyListener {
- private static final Logger logger = LoggerFactory.getLogger(ScreenKeyListener.class);
-
- @Override
- public void keyPressed(KeyEvent kEvent) {
- logger.debug("keyPressed :Code: {}", kEvent.getKeyCode());
- }
-
- @Override
- public void keyReleased(KeyEvent kEvent) {
- logger.debug("keyReleased :Code: {}", kEvent.getKeyCode());
- }
-
- @Override
- public void keyTyped(KeyEvent arg0) {
- //no-op
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/ScreenSharerFrame.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/ScreenSharerFrame.java
deleted file mode 100644
index a7343b6..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/ScreenSharerFrame.java
+++ /dev/null
@@ -1,839 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.gui;
-
-import static org.apache.openmeetings.screenshare.gui.ScreenDimensions.ROUND_VALUE;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.awt.AWTException;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Image;
-import java.awt.Rectangle;
-import java.awt.Robot;
-import java.awt.SystemColor;
-import java.awt.Toolkit;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-import javax.swing.BorderFactory;
-import javax.swing.GroupLayout;
-import javax.swing.GroupLayout.Alignment;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTabbedPane;
-import javax.swing.JTextField;
-import javax.swing.SwingConstants;
-import javax.swing.WindowConstants;
-import javax.swing.border.EmptyBorder;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-
-import org.apache.openmeetings.screenshare.Core;
-import org.apache.openmeetings.screenshare.gui.ScreenDimensions.ScreenQuality;
-import org.apache.openmeetings.screenshare.gui.listener.ScreenHeightMouseListener;
-import org.apache.openmeetings.screenshare.gui.listener.ScreenMouseListener;
-import org.apache.openmeetings.screenshare.gui.listener.ScreenWidthMouseListener;
-import org.apache.openmeetings.screenshare.gui.listener.ScreenXMouseListener;
-import org.apache.openmeetings.screenshare.gui.listener.ScreenYMouseListener;
-import org.slf4j.Logger;
-
-public class ScreenSharerFrame extends JFrame {
- private static final long serialVersionUID = 1L;
- private static final Logger logger = getLogger(ScreenSharerFrame.class);
-
- private JPanel contentPane;
- private JPanel panelScreen = new DisabledPanel();
- private JPanel panelRecording = new DisabledPanel();
- private JPanel panelPublish = new DisabledPanel();
- private JLabel lblStatus = new JLabel();
- private int vScreenX = 20;
- private int vScreenY = 20;
- private VerticalSlider upSlider = new VerticalSlider();
- private VerticalSlider downSlider = new VerticalSlider();
- private HorizontalSlider leftSlider = new HorizontalSlider();
- private HorizontalSlider rightSlider = new HorizontalSlider();
- private BlankArea virtualScreen = new BlankArea(new Color(255, 255, 255, 100));
- private JTabbedPane tabbedPane = new JTabbedPane(SwingConstants.TOP);
- private boolean doUpdateBounds = true;
- private boolean showWarning = true;
- private JButton btnStartStopSharing;
- private JButton btnStartStopRecording;
- private JButton btnStartStopPublish;
- private NumberSpinner spinnerX;
- private NumberSpinner spinnerY;
- private NumberSpinner spinnerWidth;
- private NumberSpinner spinnerHeight;
- private JComboBox<KeyValue<ScreenQuality>> comboQuality;
- private JComboBox<KeyValue<Integer>> comboFPS;
- private JTextField textPublishHost;
- private JTextField textPublishApp;
- private JTextField textPublishId;
- private JLabel lblPublishURL;
- private boolean sharingStarted = false;
- private boolean recordingStarted = false;
- private boolean publishStarted = false;
- private boolean recordingActionRequested = false;
- private boolean publishingActionRequested = false;
- private boolean sharingActionRequested = false;
- private ImageIcon startIcon;
- private ImageIcon stopIcon;
- private String startSharingLabel;
- private String stopSharingLabel;
- private String startRecordingLabel;
- private String stopRecordingLabel;
- private String startPublishLabel;
- private String stopPublishLabel;
- private String reduceWidthLabel;
- private String reduceHeightLabel;
- private String reduceXLabel;
- private String reduceYLabel;
- private String recordingTipLabel;
- private String publishingTipLabel;
- private JCheckBox audioNotify;
- private final transient Core core;
-
- private class PublishTextField extends JTextField {
- private static final long serialVersionUID = 1L;
-
- PublishTextField() {
- getDocument().addDocumentListener(
- new DocumentListener() {
- @Override
- public void changedUpdate(DocumentEvent e) {
- updatePublishURL();
- }
-
- @Override
- public void removeUpdate(DocumentEvent e) {
- updatePublishURL();
- }
-
- @Override
- public void insertUpdate(DocumentEvent e) {
- updatePublishURL();
- }
- });
-
- setColumns(10);
- }
-
- private void updatePublishURL() {
- lblPublishURL.setText("rtmp://" + textPublishHost.getText() + ":1935/"
- + textPublishApp.getText() + "/" + textPublishId.getText());
- }
- }
-
- private static class KeyValue<T> {
- private String key;
- private T value;
-
- public KeyValue(String key, T value) {
- this.key = key;
- this.value = value;
- }
-
- @SuppressWarnings("unused")
- public String getKey() { return key; }
- public T getValue() { return value; }
-
- @Override
- public String toString() { return key; }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof KeyValue) {
- @SuppressWarnings("unchecked")
- KeyValue<T> kv = (KeyValue<T>) obj;
- return kv.value.equals(this.value);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- int hash = 7;
- hash = 97 * hash + (this.value != null ? this.value.hashCode() : 0);
- return hash;
- }
- }
-
- //this implementation will not allow to Enable Panel in runtime
- private static class DisabledPanel extends JPanel {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void setEnabled(boolean enabled) {
- for (Component c : getComponents()) {
- c.setEnabled(enabled);
- }
- super.setEnabled(enabled);
- }
- }
-
- private static class VerticalSlider extends MouseListenerable {
- private static final long serialVersionUID = 1L;
-
- public VerticalSlider() {
- ImageIcon iUp = new ImageIcon(ScreenSharerFrame.class.getResource("up.png"));
- ImageIcon iDown = new ImageIcon(ScreenSharerFrame.class.getResource("down.png"));
- setSize(16, 32);
- JLabel jUp = new JLabel(iUp);
- jUp.setBounds(0, 0, 16, 16);
- add(jUp);
- JLabel jDown = new JLabel(iDown);
- jDown.setBounds(0, 16, 16, 16);
- add(jDown);
- }
- }
-
- private static class HorizontalSlider extends MouseListenerable {
- private static final long serialVersionUID = 1L;
-
- public HorizontalSlider() {
- ImageIcon iLeft = new ImageIcon(ScreenSharerFrame.class.getResource("previous.png"));
- ImageIcon iRight = new ImageIcon(ScreenSharerFrame.class.getResource("next.png"));
- setSize(32, 16);
- JLabel jLeft = new JLabel(iLeft);
- jLeft.setBounds(0, 0, 16, 16);
- add(jLeft);
- JLabel jRight = new JLabel(iRight);
- jRight.setBounds(16, 0, 16, 16);
- add(jRight);
- }
- }
-
- /**
- * Create the frame.
- *
- * @param core - core object
- * @param textLabels - translated labels
- * @throws AWTException - in case of AWT exception
- */
- public ScreenSharerFrame(final Core core, String[] textLabels) throws AWTException {
- this.core = core;
- setTitle(getTextLabel(textLabels, 0)); //#id 730
- setBackground(Color.WHITE);
- setResizable(false);
- setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
- addWindowListener(new WindowAdapter() {
- @Override
- public void windowClosing(WindowEvent e) {
- core.stopStream(null);
- ScreenSharerFrame.this.setVisible(false);
- System.exit(0);
- }
- });
- setBounds(30, 30, 500, 505);
- contentPane = new JPanel();
- contentPane.setBackground(Color.WHITE);
- contentPane.setBorder(new EmptyBorder(5, 0, 5, 5));
- setContentPane(contentPane);
-
- JLabel lblStartSharing = new JLabel(getTextLabel(textLabels, 1)); //#id 731
-
- startSharingLabel = getTextLabel(textLabels, 2); //#id 732
- stopSharingLabel = getTextLabel(textLabels, 3); //#id 733
- startRecordingLabel = getTextLabel(textLabels, 15); //#id 871
- stopRecordingLabel = getTextLabel(textLabels, 16); //#id 872
- startPublishLabel = getTextLabel(textLabels, 24); //#id 1466
- stopPublishLabel = getTextLabel(textLabels, 25); //#id 1467
- reduceWidthLabel = getTextLabel(textLabels, 29); //#id 1471
- reduceHeightLabel = getTextLabel(textLabels, 30); //#id 1472
- reduceXLabel = getTextLabel(textLabels, 31); //#id 1473
- reduceYLabel = getTextLabel(textLabels, 32); //#id 1474
- recordingTipLabel = getTextLabel(textLabels, 35); //#id 1477
- publishingTipLabel = getTextLabel(textLabels, 34); //#id 1476
- startIcon = new ImageIcon(getClass().getResource("play.png"));
- stopIcon = new ImageIcon(getClass().getResource("stop.png"));
- btnStartStopSharing = new JButton(startSharingLabel);
- btnStartStopSharing.setToolTipText(startSharingLabel);
- btnStartStopSharing.setIcon(startIcon);
- btnStartStopSharing.setSize(200, 32);
- btnStartStopSharing.addActionListener(evt -> {
- if (sharingStarted) {
- if (!sharingActionRequested) {
- sharingActionRequested = true;
- core.sharingStop();
- } else {
- logger.warn("Sharing action is already requested");
- }
- } else {
- if (!sharingActionRequested) {
- sharingActionRequested = true;
- core.sharingStart();
- } else {
- logger.warn("Sharing action is already requested");
- }
- }
- });
-
- JLabel lblSelectArea = new JLabel(getTextLabel(textLabels, 4)); //#id 734
- JPanel panelStatus = new JPanel();
- audioNotify = new JCheckBox(getTextLabel(textLabels, 36)); //#id 1589
- audioNotify.setBackground(Color.WHITE);
- audioNotify.setSelected(core.isAudioNotify());
- audioNotify.addActionListener(e -> core.setAudioNotify(audioNotify.isSelected()));
-
- GroupLayout glContentPane = new GroupLayout(contentPane);
- glContentPane.setHorizontalGroup(
- glContentPane.createParallelGroup(Alignment.LEADING)
- .addGroup(glContentPane.createSequentialGroup()
- .addGroup(glContentPane.createParallelGroup(Alignment.LEADING)
- .addGroup(glContentPane.createSequentialGroup()
- .addGap(7)
- .addComponent(lblStartSharing)
- .addGap(15)
- .addComponent(audioNotify))
- .addGroup(glContentPane.createSequentialGroup()
- .addGap(21)
- .addComponent(btnStartStopSharing, 200, 200, 200)
- .addGap(52)
- )
- .addGroup(glContentPane.createSequentialGroup()
- .addGap(7)
- .addComponent(lblSelectArea, GroupLayout.PREFERRED_SIZE, 470, GroupLayout.PREFERRED_SIZE))
- .addGroup(glContentPane.createSequentialGroup()
- .addContainerGap()
- .addComponent(panelScreen, GroupLayout.PREFERRED_SIZE, 472, GroupLayout.PREFERRED_SIZE))
- .addGroup(glContentPane.createSequentialGroup()
- .addContainerGap()
- .addComponent(tabbedPane, GroupLayout.PREFERRED_SIZE, 472, GroupLayout.PREFERRED_SIZE))
- .addGroup(glContentPane.createSequentialGroup()
- .addComponent(panelStatus, 494, 494, 494)))
- .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- );
- glContentPane.setVerticalGroup(
- glContentPane.createParallelGroup(Alignment.LEADING)
- .addGroup(glContentPane.createSequentialGroup()
- .addGap(7)
- .addComponent(lblStartSharing)
- .addGap(4)
- .addGroup(glContentPane.createParallelGroup(Alignment.LEADING)
- .addComponent(btnStartStopSharing, 32, 32, 32).addComponent(audioNotify, 32, 32, 32)
- )
- .addGap(4)
- .addComponent(lblSelectArea)
- .addGap(4)
- .addComponent(panelScreen, 210, 210, 210)
- .addGap(4)
- .addComponent(tabbedPane, 150, 150, 150)
- .addGap(5)
- .addComponent(panelStatus, 20, 20, 20)
- )
- );
- panelScreen.setLayout(null);
- panelScreen.setBackground(Color.WHITE);
-
- int width = getDim().getWidth();
- int height = getDim().getHeight();
-
- //Sliders
- upSlider.addListener(new ScreenYMouseListener(this));
- upSlider.setToolTipText(getTextLabel(textLabels, 6)); //#id 737
- panelScreen.add(upSlider);
- downSlider.addListener(new ScreenHeightMouseListener(this));
- downSlider.setToolTipText(getTextLabel(textLabels, 6)); //#id 737
- panelScreen.add(downSlider);
-
- leftSlider.addListener(new ScreenXMouseListener(this));
- leftSlider.setToolTipText(getTextLabel(textLabels, 5)); //#id 735
- panelScreen.add(leftSlider);
- rightSlider.addListener(new ScreenWidthMouseListener(this));
- rightSlider.setToolTipText(getTextLabel(textLabels, 5)); //#id 735
- panelScreen.add(rightSlider);
-
- //Virtual Screen
- virtualScreen.addListener(new ScreenMouseListener(this));
- virtualScreen.setBounds(vScreenX, vScreenY, width, height);
- panelScreen.add(virtualScreen);
-
- ImageIcon imgBgScreen = new ImageIcon(
- new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()))
- .getScaledInstance(width, height, Image.SCALE_SMOOTH));
- JLabel bgScreen = new JLabel(imgBgScreen);
- bgScreen.setBounds(vScreenX, vScreenY, width, height);
- panelScreen.add(bgScreen);
-
- //Spinner Width
- JLabel vscreenWidthLabel = new JLabel();
- vscreenWidthLabel.setText(getTextLabel(textLabels, 9)); //#id 740
- vscreenWidthLabel.setBounds(250, 20, 150, 24);
- panelScreen.add(vscreenWidthLabel);
-
- spinnerWidth = new NumberSpinner(getDim().getSpinnerWidth(), 0, getDim().getWidthMax(), 1);
- spinnerWidth.setBounds(400, 20, 60, 24);
- spinnerWidth.addChangeListener(e -> calcNewValueWidthSpin());
- panelScreen.add(spinnerWidth);
-
- //Spinner Height
- JLabel labelHeight = new JLabel();
- labelHeight.setText(getTextLabel(textLabels, 10)); //#id 741
- labelHeight.setBounds(250, 50, 150, 24);
- panelScreen.add(labelHeight);
-
- spinnerHeight = new NumberSpinner(getDim().getSpinnerHeight(), 0, getDim().getHeightMax(), 1);
- spinnerHeight.setBounds(400, 50, 60, 24);
- spinnerHeight.addChangeListener(e -> calcNewValueHeightSpin());
- panelScreen.add(spinnerHeight);
-
- //Spinner X
- JLabel labelX = new JLabel();
- labelX.setText(getTextLabel(textLabels, 7)); //#id 738
- labelX.setBounds(250, 80, 150, 24);
- panelScreen.add(labelX);
-
- spinnerX = new NumberSpinner(getDim().getSpinnerX(), 0, getDim().getWidthMax(), 1);
- spinnerX.setBounds(400, 80, 60, 24);
- spinnerX.addChangeListener(e -> calcNewValueXSpin());
- panelScreen.add(spinnerX);
-
- //Spinner Y
- JLabel labelY = new JLabel();
- labelY.setText(getTextLabel(textLabels, 8)); //#id 739
- labelY.setBounds(250, 110, 150, 24);
- panelScreen.add(labelY);
-
- spinnerY = new NumberSpinner(getDim().getSpinnerY(), 0, getDim().getHeightMax(), 1);
- spinnerY.setBounds(400, 110, 60, 24);
- spinnerY.addChangeListener(e -> calcNewValueYSpin());
- panelScreen.add(spinnerY);
-
- //Quality
- JLabel labelQuality = new JLabel();
- labelQuality.setText(getTextLabel(textLabels, 18)); //#id 1089
- labelQuality.setBounds(250, 140, 200, 24);
- panelScreen.add(labelQuality);
-
- comboQuality = new JComboBox<>();
- comboQuality.addItem(new KeyValue<>(getTextLabel(textLabels, 19), ScreenQuality.VeryHigh)); //#id 1090
- comboQuality.addItem(new KeyValue<>(getTextLabel(textLabels, 20), ScreenQuality.High)); //#id 1091
- comboQuality.addItem(new KeyValue<>(getTextLabel(textLabels, 21), ScreenQuality.Medium)); //#id 1092
- comboQuality.addItem(new KeyValue<>(getTextLabel(textLabels, 22), ScreenQuality.Low)); //#id 1093
- comboQuality.setBounds(250, 170, 130, 24);
- comboQuality.addActionListener(e -> {
- @SuppressWarnings("unchecked")
- ScreenQuality q = ((KeyValue<ScreenQuality>)comboQuality.getSelectedItem()).getValue();
- getDim().setQuality(q);
- calcRescaleFactors();
- });
- comboQuality.setSelectedIndex(core.getDefaultQuality());
- panelScreen.add(comboQuality);
- comboFPS = new JComboBox<>();
- comboFPS.addItem(new KeyValue<>("2 FPS", 2));
- comboFPS.addItem(new KeyValue<>("5 FPS", 5));
- comboFPS.addItem(new KeyValue<>("10 FPS", 10));
- comboFPS.addItem(new KeyValue<>("15 FPS", 15));
- comboFPS.addItem(new KeyValue<>("20 FPS", 20));
- comboFPS.addItem(new KeyValue<>("25 FPS", 25));
- comboFPS.addItem(new KeyValue<>("30 FPS", 30));
- comboFPS.addActionListener(e -> {
- @SuppressWarnings("unchecked")
- Integer v = ((KeyValue<Integer>)comboFPS.getSelectedItem()).getValue();
- getDim().setFps(v);
- calcRescaleFactors();
- });
- boolean fpsSelected = false;
- for (int i = 0; i < comboFPS.getItemCount(); ++i) {
- KeyValue<Integer> v = comboFPS.getItemAt(i);
- if (core.getDefaultFps() == v.value) {
- comboFPS.setSelectedIndex(i);
- fpsSelected = true;
- break;
- }
- }
- if (!fpsSelected) {
- comboFPS.addItem(new KeyValue<>(core.getDefaultFps() + " FPS", core.getDefaultFps()));
- comboFPS.setSelectedIndex(comboFPS.getItemCount() - 1);
- }
- comboFPS.setBounds(390, 170, 70, 24);
- comboFPS.setVisible(core.isShowFps());
- panelScreen.add(comboFPS);
-
- panelRecording.setBackground(Color.WHITE);
- tabbedPane.addTab(getTextLabel(textLabels, 13), null, panelRecording, null); //#id 869
- tabbedPane.setEnabledAt(0, true);
- panelRecording.setLayout(null);
- panelRecording.setEnabled(false);
-
- JLabel lblRecordingDesc = new JLabel("<html>" + getTextLabel(textLabels, 14) + "</html>"); //#id 870
- lblRecordingDesc.setVerticalAlignment(SwingConstants.TOP);
- lblRecordingDesc.setBounds(10, 10, 447, 60);
- panelRecording.add(lblRecordingDesc);
-
- btnStartStopRecording = new JButton(getTextLabel(textLabels, 15)); //#id 871
- btnStartStopRecording.setToolTipText(getTextLabel(textLabels, 15)); //#id 871
- btnStartStopRecording.setIcon(startIcon);
- btnStartStopRecording.setBounds(10, 82, 200, 32);
- btnStartStopRecording.addActionListener(e -> {
- if (recordingStarted) {
- if (!recordingActionRequested) {
- recordingActionRequested = true;
- core.recordingStop();
- } else {
- logger.warn("Recording action is already requested");
- }
- } else {
- if (!recordingActionRequested) {
- recordingActionRequested = true;
- core.recordingStart();
- } else {
- logger.warn("Recording action is already requested");
- }
- }
- });
- panelRecording.add(btnStartStopRecording);
-
- panelPublish.setBackground(Color.WHITE);
- tabbedPane.addTab(getTextLabel(textLabels, 23), null, panelPublish, null); //#id 1465
- tabbedPane.setEnabledAt(1, true);
- panelPublish.setEnabled(false);
- panelPublish.setLayout(null);
-
- JLabel lblPublishDesc = new JLabel(getTextLabel(textLabels, 33)); //#id 1475
- lblPublishDesc.setVerticalAlignment(SwingConstants.TOP);
- lblPublishDesc.setBounds(10, 5, 450, 20);
- panelPublish.add(lblPublishDesc);
-
- JLabel lblPublishHost = new JLabel(getTextLabel(textLabels, 26)); //#id 1468
- lblPublishHost.setVerticalAlignment(SwingConstants.TOP);
- lblPublishHost.setBounds(10, 27, 140, 20);
- panelPublish.add(lblPublishHost);
-
- JLabel lblPublishApp = new JLabel(getTextLabel(textLabels, 27)); //#id 1469
- lblPublishApp.setVerticalAlignment(SwingConstants.TOP);
- lblPublishApp.setBounds(160, 27, 140, 20);
- panelPublish.add(lblPublishApp);
-
- JLabel lblPublishId = new JLabel(getTextLabel(textLabels, 28)); //#id 1470
- lblPublishId.setVerticalAlignment(SwingConstants.TOP);
- lblPublishId.setBounds(310, 27, 140, 20);
- panelPublish.add(lblPublishId);
-
- textPublishHost = new PublishTextField();
- textPublishHost.setBounds(10, 45, 140, 20);
- panelPublish.add(textPublishHost);
-
- textPublishApp = new PublishTextField();
- textPublishApp.setBounds(160, 45, 140, 20);
- panelPublish.add(textPublishApp);
-
- textPublishId = new PublishTextField();
- textPublishId.setBounds(310, 45, 140, 20);
- panelPublish.add(textPublishId);
-
- lblPublishURL = new JLabel("");
- lblPublishURL.setBounds(10, 69, 447, 14);
- panelPublish.add(lblPublishURL);
-
- btnStartStopPublish = new JButton(getTextLabel(textLabels, 24)); //#id 1466
- btnStartStopPublish.setToolTipText(getTextLabel(textLabels, 24)); //#id 1466
- btnStartStopPublish.setIcon(startIcon);
- btnStartStopPublish.setBounds(10, 86, 200, 32);
- btnStartStopPublish.addActionListener(e -> {
- if (publishStarted) {
- if (!publishingActionRequested) {
- publishingActionRequested = true;
- core.publishingStop();
- } else {
- logger.warn("Publishing action is already requested");
- }
- } else {
- if (!publishingActionRequested) {
- publishingActionRequested = true;
- core.publishingStart();
- } else {
- logger.warn("Publishing action is already requested");
- }
- }
- });
- panelPublish.add(btnStartStopPublish);
-
- JPanel panelSecurity = new JPanel();
- panelSecurity.setLayout(null);
- panelSecurity.setBackground(Color.WHITE);
- tabbedPane.addTab(getTextLabel(textLabels, 37), null, panelSecurity, null); //#id 1598
-
- final JCheckBox remoteEnabled = new JCheckBox(getTextLabel(textLabels, 38)); //#id 1078
- remoteEnabled.setBackground(Color.WHITE);
- remoteEnabled.setSelected(core.isRemoteEnabled());
- remoteEnabled.setBounds(10, 10, 450, 24);
- remoteEnabled.setEnabled(core.isRemoteEnabled());
- remoteEnabled.addActionListener(e -> core.setRemoteEnabled(remoteEnabled.isSelected()));
- panelSecurity.add(remoteEnabled);
-
- panelStatus.setBackground(SystemColor.control);
- panelStatus.setLayout(null);
- lblStatus.setHorizontalAlignment(SwingConstants.LEFT);
- lblStatus.setBounds(0, 0, 494, 20);
- lblStatus.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createLineBorder(Color.LIGHT_GRAY),
- BorderFactory.createEmptyBorder(0, 5, 0, 0)));
- panelStatus.add(lblStatus);
-
- contentPane.setLayout(glContentPane);
-
- // Background Image
- //We have no logo, that is why we need no background, sebawagner 29.04.2012
- }
-
- private static String getTextLabel(String[] textLabels, int idx) {
- return textLabels != null && idx < textLabels.length ? textLabels[idx] : "#STAB#";
- }
-
- public void setSharingStatus(boolean status, boolean unlockScreen) {
- panelScreen.setEnabled(unlockScreen);
- if (status != sharingStarted) {
- sharingActionRequested = false;
- }
- logger.debug("sharingActionRequested={}", sharingActionRequested);
- sharingStarted = status;
- btnStartStopSharing.setIcon(status ? stopIcon : startIcon);
- btnStartStopSharing.setText(status ? stopSharingLabel : startSharingLabel);
- btnStartStopSharing.setToolTipText(status ? stopSharingLabel : startSharingLabel);
- }
-
- public void setRecordingStatus(boolean status, boolean unlockScreen) {
- panelScreen.setEnabled(unlockScreen);
- if (status != recordingStarted) {
- recordingActionRequested = false;
- }
- logger.debug("recordingActionRequested={}", recordingActionRequested);
- recordingStarted = status;
- btnStartStopRecording.setIcon(status ? stopIcon : startIcon);
- btnStartStopRecording.setText(status ? stopRecordingLabel : startRecordingLabel);
- btnStartStopRecording.setToolTipText(status ? stopRecordingLabel : startRecordingLabel);
- }
-
- public void setPublishingStatus(boolean status, boolean unlockScreen) {
- panelScreen.setEnabled(unlockScreen);
- if (status != publishStarted) {
- publishingActionRequested = false;
- }
- publishStarted = status;
- btnStartStopPublish.setIcon(status ? stopIcon : startIcon);
- btnStartStopPublish.setText(status ? stopPublishLabel : startPublishLabel);
- btnStartStopPublish.setToolTipText(status ? stopPublishLabel : startPublishLabel);
- }
-
- public void setRecordingTabEnabled(boolean enabled) {
- panelRecording.setEnabled(enabled);
- tabbedPane.setEnabledAt(0, enabled);
- tabbedPane.setToolTipTextAt(0, enabled ? null : recordingTipLabel);
- }
-
- public void setPublishingTabEnabled(boolean enabled) {
- panelPublish.setEnabled(enabled);
- tabbedPane.setEnabledAt(1, enabled);
- tabbedPane.setToolTipTextAt(1, enabled ? null : publishingTipLabel);
- }
-
- public String getPublishHost() {
- return textPublishHost.getText();
- }
-
- public String getPublishApp() {
- return textPublishApp.getText();
- }
-
- public String getPublishId() {
- return textPublishId.getText();
- }
-
- public void setShowWarning(boolean showWarning) {
- this.showWarning = showWarning;
- }
-
- public void setDoUpdateBounds(boolean doUpdateBounds) {
- this.doUpdateBounds = doUpdateBounds;
- }
-
- public void setStatus(String status) {
- lblStatus.setText(status);
- }
-
- public void setSpinnerX(int val) {
- spinnerX.setValue(val);
- }
-
- public void setSpinnerY(int val) {
- spinnerY.setValue(val);
- }
-
- public void setSpinnerWidth(int val) {
- spinnerWidth.setValue(val);
- }
-
- public void setSpinnerHeight(int val) {
- spinnerHeight.setValue(val);
- }
-
- void calcNewValueXSpin() {
- if (doUpdateBounds) {
- int newX = spinnerX.getValue();
- int val = getDim().getWidthMax() - getDim().getSpinnerWidth();
- if (newX > val) {
- newX = val;
- spinnerX.setValue(newX);
- if (showWarning) {
- setStatus(reduceWidthLabel);
- }
- } else {
- getDim().setSpinnerX(newX);
- updateVScreenBounds();
- }
- } else {
- getDim().setSpinnerX(spinnerX.getValue());
- }
-
- calcRescaleFactors();
- }
-
- void calcNewValueYSpin() {
- if (doUpdateBounds) {
- int newY = spinnerY.getValue();
- int val = getDim().getHeightMax() - getDim().getSpinnerHeight();
- if (newY > val) {
- newY = val;
- spinnerY.setValue(newY);
- if (showWarning) {
- setStatus(reduceHeightLabel);
- }
- } else {
- getDim().setSpinnerY(newY);
- updateVScreenBounds();
- }
- } else {
- getDim().setSpinnerY(spinnerY.getValue());
- }
-
- calcRescaleFactors();
- }
-
- void calcNewValueWidthSpin() {
- if (doUpdateBounds) {
- int newWidth = spinnerWidth.getValue();
- int val = getDim().getWidthMax() - getDim().getSpinnerX();
- if (newWidth > val) {
- newWidth = val;
- spinnerWidth.setValue(newWidth);
- if (showWarning) {
- setStatus(reduceXLabel);
- }
- } else {
- getDim().setSpinnerWidth(newWidth);
- updateVScreenBounds();
- }
- } else {
- getDim().setSpinnerWidth(spinnerWidth.getValue());
- }
-
- calcRescaleFactors();
- }
-
- void calcNewValueHeightSpin() {
- if (doUpdateBounds) {
- int newHeight = spinnerHeight.getValue();
- int val = getDim().getHeightMax() - getDim().getSpinnerY();
- if (newHeight > val) {
- newHeight = val;
- spinnerHeight.setValue(newHeight);
- if (showWarning) {
- setStatus(reduceYLabel);
- }
- } else {
- getDim().setSpinnerHeight(newHeight);
- updateVScreenBounds();
- }
- } else {
- getDim().setSpinnerHeight(spinnerHeight.getValue());
- }
-
- calcRescaleFactors();
- }
-
- /**
- * Needs to be always invoked after every re-scaling
- */
- public void calcRescaleFactors() {
- logger.trace("calcRescaleFactors -- ");
- int resizeX = spinnerWidth.getValue();
- int resizeY = spinnerHeight.getValue();
- switch (getDim().getQuality()) {
- case Low:
- resizeX = (int)(2.0 * resizeX / 8);
- resizeY = (int)(2.0 * resizeY / 8);
- break;
- case Medium:
- resizeX = (int)(4.0 * resizeX / 8);
- resizeY = (int)(4.0 * resizeY / 8);
- break;
- case High:
- resizeX = (int)(6.0 * resizeX / 8);
- resizeY = (int)(6.0 * resizeY / 8);
- break;
- case VeryHigh:
- default:
- break;
- }
- int dX = resizeX % ROUND_VALUE;
- int dY = resizeY % ROUND_VALUE;
- resizeX += dX == 0 ? 0 : ROUND_VALUE - dX;
- resizeY += dY == 0 ? 0 : ROUND_VALUE - dY;
- logger.trace("resize: X: {} Y: {}", resizeX, resizeY);
- getDim().setResizeX(resizeX);
- getDim().setResizeY(resizeY);
- updateVScreenBounds();
- }
-
- private void setVScreenBounds(int x, int y, int width, int height) {
- leftSlider.setBounds(x + vScreenX - 16, y + vScreenY - 8 + (height / 2), 32, 16);
- rightSlider.setBounds(x + vScreenX + width - 16, y + vScreenY - 8 + (height / 2), 32, 16);
- upSlider.setBounds(x + vScreenX + (width / 2) - 8, y + vScreenY - 16, 16, 32);
- downSlider.setBounds(x + vScreenX + (width / 2) - 8, y + vScreenY - 16 + height, 16, 32);
-
- virtualScreen.setText(String.format("%s:%s", getDim().getSpinnerWidth(), getDim().getSpinnerHeight()));
- virtualScreen.setBounds(x + vScreenX, y + vScreenY, width, height);
- }
-
- /**
- * update the bounds of the vScreen
- * by using the vars from the Spinners
- *
- */
- public void updateVScreenBounds() {
- double ratio = ((double)getDim().getWidth()) / getDim().getWidthMax();
- int newWidth = (int)(getDim().getSpinnerWidth() * ratio);
- int newX = (int)(getDim().getSpinnerX() * ratio);
-
- int newHeight = (int)(getDim().getSpinnerHeight() * ratio);
- int newY = (int)(getDim().getSpinnerY() * ratio);
-
- setVScreenBounds(newX, newY, newWidth, newHeight);
- }
-
- public ScreenDimensions getDim() {
- return core.getDim();
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/OmMouseInputAdapter.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/OmMouseInputAdapter.java
deleted file mode 100644
index c2d0856..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/OmMouseInputAdapter.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.gui.listener;
-
-import java.awt.Cursor;
-import java.awt.event.MouseEvent;
-import java.util.function.Consumer;
-
-import javax.swing.event.MouseInputAdapter;
-
-import org.apache.openmeetings.screenshare.gui.ScreenSharerFrame;
-
-public abstract class OmMouseInputAdapter extends MouseInputAdapter {
- private final int enterCursor;
- protected Consumer<MouseEvent> cons;
- protected final ScreenSharerFrame frame;
-
- public OmMouseInputAdapter(ScreenSharerFrame frame, int enterCursor) {
- this.frame = frame;
- this.enterCursor = enterCursor;
- }
-
- @Override
- public void mouseEntered(MouseEvent e) {
- frame.setCursor(Cursor.getPredefinedCursor(enterCursor));
- }
-
- @Override
- public void mouseExited(MouseEvent e) {
- frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
- }
-
- @Override
- public void mousePressed(MouseEvent e) {
- frame.setShowWarning(false);
- cons.accept(e);
- }
-
- @Override
- public void mouseReleased(MouseEvent e) {
- frame.setShowWarning(true);
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/ScreenHeightMouseListener.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/ScreenHeightMouseListener.java
deleted file mode 100644
index 640c788..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/ScreenHeightMouseListener.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.gui.listener;
-
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.event.MouseEvent;
-
-import org.apache.openmeetings.screenshare.gui.ScreenSharerFrame;
-
-public class ScreenHeightMouseListener extends OmMouseInputAdapter {
- private double y = 0;
-
- public ScreenHeightMouseListener(ScreenSharerFrame frame) {
- super(frame, Cursor.N_RESIZE_CURSOR);
- cons = e -> y = e.getY();
- }
-
- @Override
- public void mouseDragged(MouseEvent e) {
- if (!((Component)e.getSource()).isEnabled()) {
- return;
- }
- double newY = e.getY();
-
- int newHeight = frame.getDim().getSpinnerHeight() - (int)(y - newY);
- int newSpinnerY = frame.getDim().getSpinnerY() + newHeight;
-
- if (newSpinnerY >= 0 && newSpinnerY <= frame.getDim().getHeightMax()) {
- frame.setDoUpdateBounds(false);
- frame.setSpinnerHeight(newHeight);
- frame.setDoUpdateBounds(true);
- frame.updateVScreenBounds();
- frame.calcRescaleFactors();
- }
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/ScreenMouseListener.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/ScreenMouseListener.java
deleted file mode 100644
index 263e3d9..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/ScreenMouseListener.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.gui.listener;
-
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.event.MouseEvent;
-
-import org.apache.openmeetings.screenshare.gui.ScreenSharerFrame;
-
-public class ScreenMouseListener extends OmMouseInputAdapter {
- private int x = 0;
- private int y = 0;
-
- public ScreenMouseListener(ScreenSharerFrame frame) {
- super(frame, Cursor.HAND_CURSOR);
- cons = e -> {
- this.x = e.getX();
- this.y = e.getY();
- };
- }
-
- @Override
- public void mouseDragged(MouseEvent e) {
- if (!((Component)e.getSource()).isEnabled()) {
- return;
- }
- int newX = e.getX();
- int newY = e.getY();
-
- int newXPosition = frame.getDim().getSpinnerX() - (this.x - newX);
- int newYPosition = frame.getDim().getSpinnerY() - (this.y - newY);
- if (newXPosition >= 0) {
- frame.setSpinnerX(newXPosition);
- }
- if (newYPosition >= 0) {
- frame.setSpinnerY(newYPosition);
- }
- frame.calcRescaleFactors();
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/ScreenWidthMouseListener.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/ScreenWidthMouseListener.java
deleted file mode 100644
index 0acc50a..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/ScreenWidthMouseListener.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.gui.listener;
-
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.event.MouseEvent;
-
-import org.apache.openmeetings.screenshare.gui.ScreenSharerFrame;
-
-public class ScreenWidthMouseListener extends OmMouseInputAdapter {
- private double x = 0;
-
- public ScreenWidthMouseListener(ScreenSharerFrame frame) {
- super(frame, Cursor.W_RESIZE_CURSOR);
- cons = e -> x = e.getX();
- }
-
- @Override
- public void mouseDragged(MouseEvent e) {
- if (!((Component)e.getSource()).isEnabled()) {
- return;
- }
- double newX = e.getX();
-
- int newWidth = frame.getDim().getSpinnerWidth() - (int)(x - newX);
- int newSpinnerX = frame.getDim().getSpinnerX() + newWidth;
-
- if (0 <= newSpinnerX && newSpinnerX <= frame.getDim().getWidthMax()) {
- frame.setDoUpdateBounds(false);
- frame.setSpinnerWidth(newWidth);
- frame.setDoUpdateBounds(true);
- frame.updateVScreenBounds();
- frame.calcRescaleFactors();
- }
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/ScreenXMouseListener.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/ScreenXMouseListener.java
deleted file mode 100644
index 5438370..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/ScreenXMouseListener.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.gui.listener;
-
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.event.MouseEvent;
-
-import org.apache.openmeetings.screenshare.gui.ScreenSharerFrame;
-
-public class ScreenXMouseListener extends OmMouseInputAdapter {
- private double x = 0;
-
- public ScreenXMouseListener(ScreenSharerFrame frame) {
- super(frame, Cursor.W_RESIZE_CURSOR);
- cons = e -> x = e.getX();
- }
-
- @Override
- public void mouseDragged(MouseEvent e) {
- if (!((Component)e.getSource()).isEnabled()) {
- return;
- }
- double newX = e.getX();
- int delta = (int) (x - newX);
- int newXPosition = frame.getDim().getSpinnerX() - delta;
- int newWidth = frame.getDim().getSpinnerWidth() + delta;
-
- if (newXPosition >= 0 && newWidth >= 0) {
- frame.setDoUpdateBounds(false);
- frame.setSpinnerX(newXPosition);
- frame.setSpinnerWidth(newWidth);
- frame.setDoUpdateBounds(true);
- frame.updateVScreenBounds();
- frame.calcRescaleFactors();
- }
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/ScreenYMouseListener.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/ScreenYMouseListener.java
deleted file mode 100644
index 648fce3..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/gui/listener/ScreenYMouseListener.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.gui.listener;
-
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.event.MouseEvent;
-
-import org.apache.openmeetings.screenshare.gui.ScreenSharerFrame;
-
-public class ScreenYMouseListener extends OmMouseInputAdapter {
- private double y = 0;
-
- public ScreenYMouseListener(ScreenSharerFrame frame) {
- super(frame, Cursor.N_RESIZE_CURSOR);
- cons = e -> y = e.getY();
- }
-
- @Override
- public void mouseDragged(MouseEvent e) {
- if (!((Component)e.getSource()).isEnabled()) {
- return;
- }
- double newY = e.getY();
-
- int delta = (int) (y - newY);
- int newYPosition = frame.getDim().getSpinnerY() - delta;
- int newHeight = frame.getDim().getSpinnerHeight() + delta;
-
- if (newYPosition >= 0 && newHeight >= 0) {
- frame.setDoUpdateBounds(false);
- frame.setSpinnerY(newYPosition);
- frame.setSpinnerHeight(newHeight);
- frame.setDoUpdateBounds(true);
- frame.updateVScreenBounds();
- frame.calcRescaleFactors();
- }
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/CursorJob.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/CursorJob.java
deleted file mode 100644
index 457cb50..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/CursorJob.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.job;
-
-import org.apache.openmeetings.screenshare.CaptureScreen;
-import org.quartz.DisallowConcurrentExecution;
-import org.quartz.Job;
-import org.quartz.JobDataMap;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-
-@DisallowConcurrentExecution
-public class CursorJob implements Job {
- public static final String CAPTURE_KEY = "capture";
-
- @Override
- public void execute(JobExecutionContext context) throws JobExecutionException {
- JobDataMap data = context.getJobDetail().getJobDataMap();
- CaptureScreen capture = (CaptureScreen)data.get(CAPTURE_KEY);
- if (!capture.getSendFrameGuard()) {
- capture.sendCursorStatus();
- }
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/EncodeJob.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/EncodeJob.java
deleted file mode 100644
index 84c44ff..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/EncodeJob.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.job;
-
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.awt.AWTException;
-import java.awt.Rectangle;
-import java.awt.Robot;
-
-import org.apache.openmeetings.screenshare.CaptureScreen;
-import org.apache.openmeetings.screenshare.ScreenV1Encoder;
-import org.apache.openmeetings.screenshare.gui.ScreenDimensions;
-import org.quartz.DisallowConcurrentExecution;
-import org.quartz.Job;
-import org.quartz.JobDataMap;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-import org.red5.server.net.rtmp.event.VideoData;
-import org.slf4j.Logger;
-
-@DisallowConcurrentExecution
-public class EncodeJob implements Job {
- private static final Logger log = getLogger(EncodeJob.class);
- public static final String CAPTURE_KEY = "capture";
- private Robot robot;
- private ScreenDimensions dim;
- private Rectangle screen = null;
- private int[][] image = null;
-
- public EncodeJob() {
- try {
- robot = new Robot();
- } catch (AWTException e) {
- log.error("encode: Unexpected Error while creating robot", e);
- }
- }
-
- @Override
- public void execute(JobExecutionContext context) throws JobExecutionException {
- JobDataMap data = context.getJobDetail().getJobDataMap();
- CaptureScreen capture = (CaptureScreen)data.get(CAPTURE_KEY);
- if (screen == null) {
- dim = capture.getDim();
- screen = new Rectangle(dim.getSpinnerX(), dim.getSpinnerY()
- , dim.getSpinnerWidth(), dim.getSpinnerHeight());
- }
-
- long start = 0;
- if (log.isTraceEnabled()) {
- start = System.currentTimeMillis();
- }
- image = ScreenV1Encoder.getImage(dim, screen, robot);
- if (log.isTraceEnabled()) {
- log.trace(String.format("encode: Image was captured in %s ms, size %sk", System.currentTimeMillis() - start, 4 * image.length * image[0].length / 1024));
- start = System.currentTimeMillis();
- }
- try {
- VideoData vData = capture.getEncoder().encode(image);
- if (log.isTraceEnabled()) {
- long now = System.currentTimeMillis();
- log.trace(String.format("encode: Image was encoded in %s ms, timestamp is %s", now - start, now - capture.getStartTime()));
- }
- capture.getFrames().offer(vData);
- capture.getEncoder().createUnalteredFrame();
- } catch (Exception e) {
- log.error("Error while encoding: ", e);
- }
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/OmKeyEvent.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/OmKeyEvent.java
deleted file mode 100644
index 92de537..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/OmKeyEvent.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.job;
-
-import static java.lang.Boolean.TRUE;
-import static java.lang.Character.isUpperCase;
-import static java.lang.Character.toUpperCase;
-import static javax.swing.KeyStroke.getKeyStroke;
-import static org.apache.openmeetings.screenshare.util.Util.getInt;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.awt.event.KeyEvent;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import javax.swing.KeyStroke;
-
-import org.apache.commons.lang3.CharUtils;
-import org.apache.commons.lang3.SystemUtils;
-import org.slf4j.Logger;
-
-public class OmKeyEvent {
- private static final Logger log = getLogger(OmKeyEvent.class);
- private static final Map<Integer, Integer> KEY_MAP = new HashMap<>();
- private static final Map<Character, Integer> CHAR_MAP = new HashMap<>();
- private static final List<Character> UMLAUT_LIST = List.of('ß', 'ö', 'Ö', 'ä', 'Ä', 'ü', 'Ü');
- private static final Set<Character> UMLAUTS = Collections.unmodifiableSet(UMLAUT_LIST.stream().collect(Collectors.toSet()));
- private static final Set<Character> UNPRINTABLE = Collections.unmodifiableSet(Stream.concat(UMLAUT_LIST.stream(), Stream.of('§')).collect(Collectors.toSet()));
- static {
- KEY_MAP.put(13, KeyEvent.VK_ENTER);
- KEY_MAP.put(16, 0);
- KEY_MAP.put(20, KeyEvent.VK_CAPS_LOCK);
- KEY_MAP.put(43, KeyEvent.VK_ADD); //normal + -> numpad + ????
- KEY_MAP.put(46, KeyEvent.VK_DELETE);
- KEY_MAP.put(110, KeyEvent.VK_DECIMAL);
- KEY_MAP.put(186, KeyEvent.VK_SEMICOLON);
- KEY_MAP.put(187, KeyEvent.VK_EQUALS);
- KEY_MAP.put(188, KeyEvent.VK_COMMA);
- KEY_MAP.put(189, KeyEvent.VK_MINUS);
- KEY_MAP.put(190, KeyEvent.VK_PERIOD);
- KEY_MAP.put(191, KeyEvent.VK_SLASH);
- KEY_MAP.put(219, KeyEvent.VK_OPEN_BRACKET);
- KEY_MAP.put(220, KeyEvent.VK_BACK_SLASH);
- KEY_MAP.put(221, KeyEvent.VK_CLOSE_BRACKET);
- KEY_MAP.put(222, KeyEvent.VK_QUOTE);
-
- CHAR_MAP.put(Character.valueOf('#'), KeyEvent.VK_NUMBER_SIGN);
- CHAR_MAP.put(Character.valueOf('<'), KeyEvent.VK_LESS);
- CHAR_MAP.put(Character.valueOf('.'), KeyEvent.VK_PERIOD);
- CHAR_MAP.put(Character.valueOf(','), KeyEvent.VK_COMMA);
- CHAR_MAP.put(Character.valueOf('-'), KeyEvent.VK_MINUS);
- CHAR_MAP.put(Character.valueOf('='), KeyEvent.VK_EQUALS);
- CHAR_MAP.put(Character.valueOf('['), KeyEvent.VK_OPEN_BRACKET);
- CHAR_MAP.put(Character.valueOf(']'), KeyEvent.VK_CLOSE_BRACKET);
- CHAR_MAP.put(Character.valueOf(';'), KeyEvent.VK_SEMICOLON);
- CHAR_MAP.put(Character.valueOf('\''), KeyEvent.VK_QUOTE);
- CHAR_MAP.put(Character.valueOf('\\'), KeyEvent.VK_BACK_SLASH);
- CHAR_MAP.put(Character.valueOf('`'), KeyEvent.VK_BACK_QUOTE);
- CHAR_MAP.put(Character.valueOf('/'), KeyEvent.VK_SLASH);
- }
- private boolean alt = false;
- private boolean ctrl = false;
- private boolean shift = false;
- private int inKey = 0;
- private int key = 0;
- private char ch = 0;
-
- public OmKeyEvent(Map<String, Object> obj) {
- alt = TRUE.equals(obj.get("alt"));
- ctrl = TRUE.equals(obj.get("ctrl"));
- shift = TRUE.equals(obj.get("shift")) || isUpperCase(ch);
- ch = (char)getInt(obj, "char");
- key = inKey = getInt(obj, "key");
- Integer _key = null;
- if (CharUtils.isAsciiPrintable(ch)) {
- boolean alpha = Character.isAlphabetic(ch);
- if (alpha) { // can't be combined due to different types
- key = getKeyStroke(toUpperCase(ch), 0).getKeyCode();
- } else {
- key = getKeyStroke(Character.valueOf(ch), 0).getKeyCode();
- }
- if (key == 0) {
- _key = CHAR_MAP.get(ch);
- if (_key == null) {
- // fallback
- key = inKey;
- }
- }
- if (!alpha && _key == null) {
- _key = KEY_MAP.get(key);
- }
- } else {
- _key = KEY_MAP.get(key);
- }
- this.key = _key == null ? key : _key;
- log.debug("sequence:: shift {}, ch {}, orig {} -> key {}({}), map {}", shift, ch == 0 ? ' ' : ch, inKey, key, Integer.toHexString(key), _key);
- }
-
- private static int getVowel(char ch) {
- int vowel = ch;
- switch(toUpperCase(ch)) {
- case 'Ö':
- vowel = KeyEvent.VK_O;
- break;
- case 'Ä':
- vowel = KeyEvent.VK_A;
- break;
- case 'Ü':
- vowel = KeyEvent.VK_U;
- break;
- }
- return vowel;
- }
-
- public void press(RemoteJob r) {
- List<Integer> list = new ArrayList<>();
- if (UNPRINTABLE.contains(ch)) {
- if (SystemUtils.IS_OS_LINUX) {
- r.press(KeyEvent.VK_CONTROL, KeyEvent.VK_SHIFT, KeyEvent.VK_U);
- String hex = Integer.toHexString(ch);
- log.debug("sequence:: hex {}", hex);
- for (int i = 0; i < hex.length(); ++i) {
- r.press(KeyStroke.getKeyStroke(toUpperCase(hex.charAt(i)), 0).getKeyCode());
- }
- r.press(KeyEvent.VK_ENTER);
- } else if (SystemUtils.IS_OS_MAC) {
- if (ch == 'ß') {
- r.press(KeyEvent.VK_ALT, KeyEvent.VK_S);
- } else {
- if (UMLAUTS.contains(ch)) {
- r.press(KeyEvent.VK_ALT, KeyEvent.VK_U);
- if (shift) {
- list.add(KeyEvent.VK_SHIFT);
- }
- list.add(getVowel(ch));
- r.press(list);
- }
- }
- } else if (SystemUtils.IS_OS_WINDOWS && UMLAUTS.contains(ch)) {
- list.add(KeyEvent.VK_ALT);
- list.add(KeyEvent.VK_ADD);
- String code = String.format("%04d", (int)ch);
- for (int i = 0; i < code.length(); ++i) {
- list.add(KeyEvent.VK_NUMPAD0 + code.charAt(i));
- }
- r.press(list);
- }
- } else {
- if (shift) {
- list.add(KeyEvent.VK_SHIFT);
- }
- if (alt) {
- list.add(KeyEvent.VK_ALT);
- }
- if (ctrl) {
- list.add(KeyEvent.VK_CONTROL);
- }
- if (key != 0) {
- list.add(key);
- }
- r.press(list);
- }
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/RemoteJob.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/RemoteJob.java
deleted file mode 100644
index 4a6a213..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/RemoteJob.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.job;
-
-import static java.awt.Toolkit.getDefaultToolkit;
-import static java.awt.datatransfer.DataFlavor.stringFlavor;
-import static org.apache.openmeetings.screenshare.util.Util.getFloat;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.awt.AWTException;
-import java.awt.Point;
-import java.awt.Robot;
-import java.awt.datatransfer.Clipboard;
-import java.awt.datatransfer.StringSelection;
-import java.awt.datatransfer.Transferable;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyEvent;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.commons.lang3.SystemUtils;
-import org.apache.openmeetings.screenshare.Core;
-import org.apache.openmeetings.screenshare.gui.ScreenDimensions;
-import org.quartz.DisallowConcurrentExecution;
-import org.quartz.Job;
-import org.quartz.JobDataMap;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-import org.slf4j.Logger;
-
-@DisallowConcurrentExecution
-public class RemoteJob implements Job {
- private static final Logger log = getLogger(RemoteJob.class);
- public static final String CORE_KEY = "core";
- private Robot robot = null;
- private ScreenDimensions dim = null;
-
- public RemoteJob() {
- try {
- robot = new Robot();
- robot.setAutoDelay(5);
- } catch (AWTException e) {
- log.error("Unexpected error while creating Robot", e);
- }
- }
-
- @Override
- public void execute(JobExecutionContext context) throws JobExecutionException {
- JobDataMap data = context.getJobDetail().getJobDataMap();
- Core core = (Core)data.get(CORE_KEY);
- if (dim == null) {
- dim = core.getDim();
- }
- try {
- Map<String, Object> obj;
- while ((obj = core.getRemoteEvents().poll(1, TimeUnit.MILLISECONDS)) != null) {
- String action = String.valueOf(obj.get("action"));
- log.trace("Action polled:: {}, count: {}", action, core.getRemoteEvents().size());
-
- switch (action) {
- case "mouseUp":
- {
- Point p = getCoordinates(obj);
- robot.mouseMove(p.x, p.y);
- robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
- }
- break;
- case "mouseDown":
- {
- Point p = getCoordinates(obj);
- robot.mouseMove(p.x, p.y);
- robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
- }
- break;
- case "mousePos":
- {
- Point p = getCoordinates(obj);
- robot.mouseMove(p.x, p.y);
- }
- break;
- case "keyDown":
- new OmKeyEvent(obj).press(this);
- break;
- case "paste":
- paste(String.valueOf(obj.get("paste")));
- break;
- case "copy":
- {
- String paste = getHighlightedText();
-
- Map<Integer, String> map = new HashMap<>();
- map.put(0, "copiedText");
- map.put(1, paste);
-
- String uid = String.valueOf(obj.get("uid"));
-
- core.getInstance().invoke("sendMessageToClient", new Object[]{uid, map}, core);
- }
- break;
- }
- }
- } catch (Exception err) {
- log.error("[sendRemoteCursorEvent]", err);
- }
- }
-
- public void press(List<Integer> codes) {
- log.debug("sequence:: codes {}", codes);
- press(codes.stream().mapToInt(Integer::intValue).toArray());
- }
-
- public void press(int... codes) {
- for (int i = 0; i < codes.length; ++i) {
- robot.keyPress(codes[i]);
- }
- for (int i = codes.length - 1; i > -1; --i) {
- robot.keyRelease(codes[i]);
- }
- }
-
- private String getHighlightedText() {
- try {
- if (SystemUtils.IS_OS_MAC) {
- // Macintosh simulate Copy
- press(157, 67);
- } else {
- // pressing CTRL+C == copy
- press(KeyEvent.VK_CONTROL, KeyEvent.VK_C);
- }
- return getClipboardText();
- } catch (Exception e) {
- log.error("Unexpected exception while getting highlighted text", e);
- }
- return "";
- }
-
- public String getClipboardText() {
- try {
- // get the contents on the clipboard in a transferable object
- Transferable data = getDefaultToolkit().getSystemClipboard().getContents(null);
- // check if clipboard is empty
- if (data == null) {
- // Clipboard is empty!!!
- } else if (data.isDataFlavorSupported(stringFlavor)) {
- // see if DataFlavor of DataFlavor.stringFlavor is supported return text content
- return (String) data.getTransferData(stringFlavor);
- }
- } catch (Exception e) {
- log.error("Unexpected exception while getting clipboard text", e);
- }
- return "";
- }
-
- private void paste(String charValue) {
- Clipboard clippy = getDefaultToolkit().getSystemClipboard();
- try {
- Transferable transferableText = new StringSelection(charValue);
- clippy.setContents(transferableText, null);
-
- if (SystemUtils.IS_OS_MAC) {
- // Macintosh simulate Insert
- press(157, 86);
- } else {
- // pressing CTRL+V == insert-mode
- press(KeyEvent.VK_CONTROL, KeyEvent.VK_V);
- }
- } catch (Exception e) {
- log.error("Unexpected exception while pressSpecialSign", e);
- }
- }
-
- private Point getCoordinates(Map<String, Object> obj) {
- float scaleFactorX = ((float)dim.getSpinnerWidth()) / dim.getResizeX();
- float scaleFactorY = ((float)dim.getSpinnerHeight()) / dim.getResizeY();
-
- int x = Math.round(scaleFactorX * getFloat(obj, "x") + dim.getSpinnerX());
- int y = Math.round(scaleFactorY * getFloat(obj, "y") + dim.getSpinnerY());
- return new Point(x, y);
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/SendJob.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/SendJob.java
deleted file mode 100644
index 1beb182..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/SendJob.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.job;
-
-import static org.slf4j.LoggerFactory.getLogger;
-
-import org.apache.openmeetings.screenshare.CaptureScreen;
-import org.quartz.Job;
-import org.quartz.JobDataMap;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-import org.red5.server.net.rtmp.event.VideoData;
-import org.slf4j.Logger;
-
-public class SendJob implements Job {
- private static final Logger log = getLogger(SendJob.class);
- public static final String CAPTURE_KEY = "capture";
-
- @Override
- public void execute(JobExecutionContext context) throws JobExecutionException {
- JobDataMap data = context.getJobDetail().getJobDataMap();
- CaptureScreen capture = (CaptureScreen)data.get(CAPTURE_KEY);
- capture.setSendFrameGuard(true);
- if (log.isTraceEnabled()) {
- long real = System.currentTimeMillis() - capture.getStartTime();
- log.trace(String.format("send: Enter method, timestamp: %s, real: %s, diff: %s", capture.getTimestamp(), real, real - capture.getTimestamp().get()));
- }
- VideoData f = capture.getFrames().poll();
- if (log.isTraceEnabled()) {
- log.trace(String.format("send: Getting %s image", f == null ? "DUMMY" : "CAPTURED"));
- }
- f = f == null ? capture.getEncoder().getUnalteredFrame() : f;
- if (f != null) {
- capture.pushVideo(f, capture.getTimestamp().get());
- if (log.isTraceEnabled()) {
- long real = System.currentTimeMillis() - capture.getStartTime();
- log.trace(String.format("send: Sending video %sk, timestamp: %s, real: %s, diff: %s", f.getData().capacity() / 1024, capture.getTimestamp(), real, real - capture.getTimestamp().get()));
- }
- capture.getTimestamp().addAndGet(capture.getTimestampDelta());
- if (log.isTraceEnabled()) {
- log.trace(String.format("send: new timestamp: %s", capture.getTimestamp()));
- }
- } else if (log.isTraceEnabled()) {
- log.trace("send: nothing to send");
- }
- capture.setSendFrameGuard(false);
- }
-}
diff --git a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/util/Util.java b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/util/Util.java
deleted file mode 100644
index 17f810b..0000000
--- a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/util/Util.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.screenshare.util;
-
-import static org.quartz.impl.StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME;
-
-import java.util.Map;
-import java.util.Properties;
-
-public class Util {
- private Util() {}
-
- public static Properties getQurtzProps(String name) {
- final Properties p = new Properties();
- p.put(PROP_SCHED_INSTANCE_NAME, name);
- p.put("org.quartz.threadPool.threadCount", "10");
- return p;
- }
-
- public static String getString(Map<String, Object> map, String key) {
- return String.valueOf(map.get(key));
- }
-
- public static Double getDouble(Map<String, Object> map, String key) {
- return Double.valueOf(getString(map, key));
- }
-
- public static int getInt(Map<String, Object> map, String key) {
- return getDouble(map, key).intValue();
- }
-
- public static float getFloat(Map<String, Object> map, String key) {
- return getDouble(map, key).floatValue();
- }
-}
diff --git a/openmeetings-screenshare/src/main/jnlp/templates/template.jnlp b/openmeetings-screenshare/src/main/jnlp/templates/template.jnlp
index 893dc5b..c60b84b 100644
--- a/openmeetings-screenshare/src/main/jnlp/templates/template.jnlp
+++ b/openmeetings-screenshare/src/main/jnlp/templates/template.jnlp
@@ -33,7 +33,6 @@
</security>
<resources>
<j2se version='1.8+'/>
- <jar href="bcprov-jdk15on-1.65.jar" main="true"/>
<jar href="openmeetings-screenshare-${project.version}-full.jar" main="true"/>
</resources>
<application-desc main-class='org.apache.openmeetings.screenshare.Core'>
diff --git a/openmeetings-screenshare/src/main/resources/logback.xml b/openmeetings-screenshare/src/main/resources/logback.xml
index 1325dc6..dec1a2c 100644
--- a/openmeetings-screenshare/src/main/resources/logback.xml
+++ b/openmeetings-screenshare/src/main/resources/logback.xml
@@ -39,7 +39,6 @@
</encoder>
</appender>
<logger name="org.apache.openmeetings" level="DEBUG"/>
- <logger name="org.red5.server.net.rtmp.codec.RTMPProtocolDecoder" level="OFF"/>
<root level="INFO">
<appender-ref ref="FILE" />
<appender-ref ref="CONSOLE" />
diff --git a/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/down.png b/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/down.png
deleted file mode 100644
index d10b8c6..0000000
Binary files a/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/down.png and /dev/null differ
diff --git a/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/next.png b/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/next.png
deleted file mode 100644
index e252606..0000000
Binary files a/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/next.png and /dev/null differ
diff --git a/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/play.png b/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/play.png
deleted file mode 100644
index 6d13683..0000000
Binary files a/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/play.png and /dev/null differ
diff --git a/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/previous.png b/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/previous.png
deleted file mode 100644
index 18f9cc1..0000000
Binary files a/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/previous.png and /dev/null differ
diff --git a/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/stop.png b/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/stop.png
deleted file mode 100644
index 8389bf3..0000000
Binary files a/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/stop.png and /dev/null differ
diff --git a/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/up.png b/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/up.png
deleted file mode 100644
index c03ab0a..0000000
Binary files a/openmeetings-screenshare/src/main/resources/org/apache/openmeetings/screenshare/gui/up.png and /dev/null differ
diff --git a/openmeetings-screenshare/src/main/resources/quartz.properties b/openmeetings-screenshare/src/main/resources/quartz.properties
deleted file mode 100644
index 6762b90..0000000
--- a/openmeetings-screenshare/src/main/resources/quartz.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-org.quartz.scheduler.instanceName=ScreenSharingScheduler
-org.quartz.threadPool.threadCount=30
\ No newline at end of file
diff --git a/openmeetings-server/src/site/xdoc/index.xml b/openmeetings-server/src/site/xdoc/index.xml
index 2e94c2f..7e112c8 100644
--- a/openmeetings-server/src/site/xdoc/index.xml
+++ b/openmeetings-server/src/site/xdoc/index.xml
@@ -59,7 +59,7 @@
<p>Openmeetings provides video conferencing, instant messaging,
white board, collaborative document editing and other groupware
tools. It uses API functions of Media Server for Remoting
- and Streaming (Red5 or Kurento).
+ and Streaming Kurento.
</p>
<p>
OpenMeetings is a project of the Apache, the old project
diff --git a/pom.xml b/pom.xml
index 4255a95..a02bb53 100644
--- a/pom.xml
+++ b/pom.xml
@@ -80,9 +80,7 @@
<wicketju.version>9.0.0-M5.1</wicketju.version>
<wickets.version>9.0.0-M5.1</wickets.version>
<wicket-bootstrap.version>5.0.0-M2</wicket-bootstrap.version>
- <red5-client.version>1.2.3</red5-client.version>
<spring.version>5.2.6.RELEASE</spring.version>
- <mina.version>2.1.3</mina.version>
<tomcat.version>9.0.34</tomcat.version>
<ical4j.version>3.0.14</ical4j.version>
<cxf.version>3.3.6</cxf.version>
@@ -440,11 +438,6 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.red5</groupId>
- <artifactId>red5-client</artifactId>
- <version>${red5-client.version}</version>
- </dependency>
- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>