@@ -138,6 +138,43 @@ public void setProperty(CaptureProperty property, int value) {
138138 }
139139 }
140140
141+ /**
142+ * Get the automatic flag of a camera/stream property (e.g. zoom, focus etc.).
143+ *
144+ * @param property the property to get the automatic flag for.
145+ * @return true if the property is set to automatic, false if it is set to manual.
146+ * @throws CaptureException if an error occurs while getting the auto property value.
147+ */
148+ public boolean getAutoProperty (CaptureProperty property ) {
149+ try (Arena arena = Arena .ofConfined ()) {
150+ MemorySegment valuePointer = arena .allocate (ValueLayout .JAVA_INT );
151+ int result = Cap_getAutoProperty (context .getSegment (), id , property .value (), valuePointer );
152+ CaptureResult captureResult = CaptureResult .values ()[result ];
153+ return switch (captureResult ) {
154+ case OK -> valuePointer .get (ValueLayout .JAVA_INT , 0 ) == 1 ;
155+ case PROPERTY_NOT_SUPPORTED -> throw new CaptureException ("Property " + property + " is not supported by this stream." );
156+ default -> throw new CaptureException ("Error getting auto property value for property " + property + ": context, stream are invalid." );
157+ };
158+ }
159+ }
160+
161+ /**
162+ * Set the automatic flag of a camera/stream property (e.g. zoom, focus etc.).
163+ *
164+ * @param property the property to set the automatic flag for.
165+ * @param enable true to set the property to automatic, false to set it to manual.
166+ * @throws CaptureException if an error occurs while setting the auto property value.
167+ */
168+ public void setAutoProperty (CaptureProperty property , boolean enable ) {
169+ int result = Cap_setAutoProperty (context .getSegment (), id , property .value (), enable ? 1 : 0 );
170+ CaptureResult captureResult = CaptureResult .values ()[result ];
171+ switch (captureResult ) {
172+ case OK -> {}
173+ case PROPERTY_NOT_SUPPORTED -> throw new CaptureException ("Property " + property + " is not supported by this stream." );
174+ default -> throw new CaptureException ("Error setting auto property value for property " + property + ": context, stream are invalid." );
175+ }
176+ }
177+
141178 /**
142179 * Check if a stream is open, i.e. is capturing data.
143180 *
0 commit comments