diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2010-02-03 23:42:55 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2010-02-03 23:42:55 +0000 |
commit | cf2d181f71ed1e66e6bc121c8576df5ba660f6f6 (patch) | |
tree | 453675d88e70c4f45f42153a09d95cca97469544 /src/net/java/sip/communicator/service/neomedia | |
parent | 45316afd6b1bff8dae162f6b6c1a7c09d848cece (diff) | |
download | jitsi-cf2d181f71ed1e66e6bc121c8576df5ba660f6f6.zip jitsi-cf2d181f71ed1e66e6bc121c8576df5ba660f6f6.tar.gz jitsi-cf2d181f71ed1e66e6bc121c8576df5ba660f6f6.tar.bz2 |
Attempts to set the size of the CallDialog so that it displays the remote video in its actual size in order to avoid quality loss due to scaling.
Diffstat (limited to 'src/net/java/sip/communicator/service/neomedia')
3 files changed, 128 insertions, 1 deletions
diff --git a/src/net/java/sip/communicator/service/neomedia/event/SizeChangeVideoEvent.java b/src/net/java/sip/communicator/service/neomedia/event/SizeChangeVideoEvent.java new file mode 100644 index 0000000..0130d6f --- /dev/null +++ b/src/net/java/sip/communicator/service/neomedia/event/SizeChangeVideoEvent.java @@ -0,0 +1,81 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.service.neomedia.event; + +import java.awt.*; + +/** + * Represents a <tt>VideoEvent</tt> which notifies about an update to the size + * of a specific visual <tt>Component</tt> depicting video. + * + * @author Lubomir Marinov + */ +public class SizeChangeVideoEvent + extends VideoEvent +{ + /** + * The type of a <tt>VideoEvent</tt> which notifies about an update to the + * size of a specific visual <tt>Component</tt> depicting video. + */ + public static final int VIDEO_SIZE_CHANGE = 3; + + /** + * The new height of the associated visual <tt>Component</tt>. + */ + private final int height; + + /** + * The new width of the associated visual <tt>Component</tt>. + */ + private final int width; + + /** + * Initializes a new <tt>SizeChangeVideoEvent</tt> which is to notify about + * an update to the size of a specific visual <tt>Component</tt> depicting + * video. + * + * @param source the source of the new <tt>SizeChangeVideoEvent</tt> + * @param visualComponent the visual <tt>Component</tt> depicting video + * with the updated size + * @param origin the origin of the video the new + * <tt>SizeChangeVideoEvent</tt> is to notify about + * @param width the new width of <tt>visualComponent</tt> + * @param height the new height of <tt>visualComponent</tt> + */ + public SizeChangeVideoEvent( + Object source, + Component visualComponent, + int origin, + int width, + int height) + { + super(source, VIDEO_SIZE_CHANGE, visualComponent, origin); + + this.width = width; + this.height = height; + } + + /** + * Gets the new height of the associated visual <tt>Component</tt>. + * + * @return the new height of the associated visual <tt>Component</tt> + */ + public int getHeight() + { + return height; + } + + /** + * Gets the new width of the associated visual <tt>Component</tt>. + * + * @return the new width of the associated visual <tt>Component</tt> + */ + public int getWidth() + { + return width; + } +} diff --git a/src/net/java/sip/communicator/service/neomedia/event/VideoListener.java b/src/net/java/sip/communicator/service/neomedia/event/VideoListener.java index d085627..d2b2cc0 100644 --- a/src/net/java/sip/communicator/service/neomedia/event/VideoListener.java +++ b/src/net/java/sip/communicator/service/neomedia/event/VideoListener.java @@ -10,7 +10,8 @@ import java.util.*; /** * Defines the notification support informing about changes in the availability - * of visual <tt>Components</tt> representing video such as adding and removing. + * of visual <tt>Component</tt>s representing video such as adding and + * removing. * * @author Lubomir Marinov */ @@ -36,4 +37,14 @@ public interface VideoListener * from */ void videoRemoved(VideoEvent event); + + /** + * Notifies about an update to a visual <tt>Component</tt> representing + * video. + * + * @param event a <tt>VideoEvent</tt> describing the visual + * <tt>Component</tt> related to the update and the details of the specific + * update + */ + void videoUpdate(VideoEvent event); } diff --git a/src/net/java/sip/communicator/service/neomedia/event/VideoNotifierSupport.java b/src/net/java/sip/communicator/service/neomedia/event/VideoNotifierSupport.java index c3e2886..4dffb14 100644 --- a/src/net/java/sip/communicator/service/neomedia/event/VideoNotifierSupport.java +++ b/src/net/java/sip/communicator/service/neomedia/event/VideoNotifierSupport.java @@ -119,6 +119,8 @@ public class VideoNotifierSupport case VideoEvent.VIDEO_REMOVED: listener.videoRemoved(event); break; + default: + throw new IllegalArgumentException("type"); } consumed = event.isConsumed(); @@ -129,6 +131,39 @@ public class VideoNotifierSupport } /** + * Notifies the <tt>VideoListener</tt>s registered with this instance about + * a specific <tt>VideoEvent</tt>. + * + * @param event the <tt>VideoEvent</tt> to be fired to the + * <tt>VideoListener</tt>s registered with this instance + */ + public void fireVideoEvent(VideoEvent event) + { + VideoListener[] listeners; + + synchronized (this.listeners) + { + listeners + = this.listeners + .toArray(new VideoListener[this.listeners.size()]); + } + + for (VideoListener listener : listeners) + switch (event.getType()) + { + case VideoEvent.VIDEO_ADDED: + listener.videoAdded(event); + break; + case VideoEvent.VIDEO_REMOVED: + listener.videoRemoved(event); + break; + default: + listener.videoUpdate(event); + break; + } + } + + /** * Removes a specific <tt>VideoListener</tt> from this * <tt>VideoNotifierSupport</tt> in order to have to no longer receive * notifications when visual/video <tt>Component</tt>s are being added and |