@@ -73,6 +73,34 @@ public int getStreamFrameCount() {
7373 return Cap_getStreamFrameCount (context .getSegment (), id );
7474 }
7575
76+ /**
77+ * Get the min/max limits and the default value of a camera/stream property (e.g. zoom, exposure etc.).
78+ *
79+ * @param property the property to get the limits for.
80+ * @return a PropertyLimits object containing the min/max limits and the default value of the property.
81+ * @throws CaptureException if an error occurs while getting the property limits.
82+ */
83+ public PropertyLimits getPropertyLimits (CaptureProperty property ) {
84+ try (Arena arena = Arena .ofConfined ()) {
85+ MemorySegment minPointer = arena .allocate (ValueLayout .JAVA_INT );
86+ MemorySegment maxPointer = arena .allocate (ValueLayout .JAVA_INT );
87+ MemorySegment defaultValuePointer = arena .allocate (ValueLayout .JAVA_INT );
88+
89+ int result = Cap_getPropertyLimits (context .getSegment (), id , property .value (), minPointer , maxPointer , defaultValuePointer );
90+ CaptureResult captureResult = CaptureResult .values ()[result ];
91+ return switch (captureResult ) {
92+ case OK -> new PropertyLimits (
93+ minPointer .get (ValueLayout .JAVA_INT , 0 ),
94+ maxPointer .get (ValueLayout .JAVA_INT , 0 ),
95+ defaultValuePointer .get (ValueLayout .JAVA_INT , 0 )
96+ );
97+ case PROPERTY_NOT_SUPPORTED ->
98+ throw new CaptureException ("Property " + property + " is not supported by this stream." );
99+ default -> throw new CaptureException ("Error getting property limit for property " + property + ": context, stream are invalid." );
100+ };
101+ }
102+ }
103+
76104 /**
77105 * Check if a stream is open, i.e. is capturing data.
78106 *
0 commit comments