Use the StreamConfiguration class for managing the characteristics of StreamFrame

This commit is contained in:
Cameron Gutman
2013-12-19 04:33:33 -05:00
parent 7f5a7a3fd3
commit bd488e14e3
2 changed files with 8 additions and 9 deletions
+4 -2
View File
@@ -16,6 +16,7 @@ import com.limelight.gui.StreamFrame;
import com.limelight.input.GamepadHandler; import com.limelight.input.GamepadHandler;
import com.limelight.nvstream.NvConnection; import com.limelight.nvstream.NvConnection;
import com.limelight.nvstream.NvConnectionListener; import com.limelight.nvstream.NvConnectionListener;
import com.limelight.nvstream.StreamConfiguration;
import com.limelight.nvstream.av.video.VideoDecoderRenderer; import com.limelight.nvstream.av.video.VideoDecoderRenderer;
public class Limelight implements NvConnectionListener { public class Limelight implements NvConnectionListener {
@@ -27,6 +28,7 @@ public class Limelight implements NvConnectionListener {
private boolean connectionFailed; private boolean connectionFailed;
private static JFrame limeFrame; private static JFrame limeFrame;
private Thread controllerListenerThread; private Thread controllerListenerThread;
private StreamConfiguration streamConfig = new StreamConfiguration(1280, 720, 30);
public Limelight(String host) { public Limelight(String host) {
this.host = host; this.host = host;
@@ -34,8 +36,8 @@ public class Limelight implements NvConnectionListener {
private void startUp(boolean fullscreen) { private void startUp(boolean fullscreen) {
streamFrame = new StreamFrame(); streamFrame = new StreamFrame();
conn = new NvConnection(host, this); conn = new NvConnection(host, this, streamConfig);
streamFrame.build(conn, fullscreen); streamFrame.build(conn, streamConfig, fullscreen);
conn.start(PlatformBinding.getDeviceName(), streamFrame, conn.start(PlatformBinding.getDeviceName(), streamFrame,
VideoDecoderRenderer.FLAG_PREFER_QUALITY, VideoDecoderRenderer.FLAG_PREFER_QUALITY,
PlatformBinding.getAudioRenderer(), PlatformBinding.getAudioRenderer(),
+4 -7
View File
@@ -26,6 +26,7 @@ import com.limelight.input.KeyboardHandler;
import com.limelight.input.MouseHandler; import com.limelight.input.MouseHandler;
import com.limelight.nvstream.NvConnection; import com.limelight.nvstream.NvConnection;
import com.limelight.nvstream.NvConnectionListener.Stage; import com.limelight.nvstream.NvConnectionListener.Stage;
import com.limelight.nvstream.StreamConfiguration;
public class StreamFrame extends JFrame { public class StreamFrame extends JFrame {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -37,10 +38,6 @@ public class StreamFrame extends JFrame {
private Cursor noCursor; private Cursor noCursor;
private NvConnection conn; private NvConnection conn;
private static final int WIDTH = 1280;
private static final int HEIGHT = 720;
public void freeMouse() { public void freeMouse() {
mouse.free(); mouse.free();
showCursor(); showCursor();
@@ -51,7 +48,7 @@ public class StreamFrame extends JFrame {
hideCursor(); hideCursor();
} }
public void build(NvConnection conn, boolean fullscreen) { public void build(NvConnection conn, StreamConfiguration streamConfig, boolean fullscreen) {
this.conn = conn; this.conn = conn;
keyboard = new KeyboardHandler(conn, this); keyboard = new KeyboardHandler(conn, this);
@@ -63,7 +60,7 @@ public class StreamFrame extends JFrame {
this.setFocusTraversalKeysEnabled(false); this.setFocusTraversalKeysEnabled(false);
this.setSize(WIDTH, HEIGHT); this.setSize(streamConfig.getWidth(), streamConfig.getHeight());
this.setBackground(Color.BLACK); this.setBackground(Color.BLACK);
this.getContentPane().setBackground(Color.BLACK); this.getContentPane().setBackground(Color.BLACK);
@@ -92,7 +89,7 @@ public class StreamFrame extends JFrame {
}); });
DisplayMode bestConfig = null; DisplayMode bestConfig = null;
for (DisplayMode config : configs) { for (DisplayMode config : configs) {
if (config.getWidth() >= 1280 && config.getHeight() >= 720) { if (config.getWidth() >= getSize().width && config.getHeight() >= getSize().height) {
bestConfig = config; bestConfig = config;
} }
} }