From 60e11e02e59583047800d12927b0af2b01fb933c Mon Sep 17 00:00:00 2001 From: codeanticode Date: Tue, 28 Aug 2012 21:15:11 +0000 Subject: [PATCH] use getNegotiatedCaps instead of getCaps in Capture --- .../video/src/processing/video/Capture.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/java/libraries/video/src/processing/video/Capture.java b/java/libraries/video/src/processing/video/Capture.java index 5ed3fc6e9..d7d79fb10 100644 --- a/java/libraries/video/src/processing/video/Capture.java +++ b/java/libraries/video/src/processing/video/Capture.java @@ -490,6 +490,7 @@ public class Capture extends PImage implements PConstants { static protected ArrayList listResolutions(String sourceName, String propertyName, Object propertyValue) { + PApplet.println("Getting resolutions for : " + propertyValue); // Creating temporary pipeline so that we can query // the resolutions supported by the device. Pipeline testPipeline = new Pipeline("test"); @@ -523,18 +524,24 @@ public class Capture extends PImage implements PConstants { } testPipeline.dispose(); - + PApplet.println("Done"); return resolutions; } static protected void addResFromSource(ArrayList res, Element src, String propertyName, Object propertyValue) { + for (Pad pad : src.getPads()) { - Caps caps = pad.getCaps(); + //Caps caps = pad.getCaps(); + //Caps caps = pad.getNegotiatedCaps(); + Caps caps = pad.getNegotiatedCaps(); + int n = caps.size(); for (int i = 0; i < n; i++) { Structure str = caps.getStructure(i); + PApplet.println(str); + if (propertyName != null && str.hasField(propertyName)) { Object value = str.getValue(propertyName); @@ -561,7 +568,8 @@ public class Capture extends PImage implements PConstants { addResFromString(res, str.toString(), w, h); } else { addResFromStructure(res, str, w, h); - } + } + } } }