name) {
super(MemorySegment.class, order, byteSize, byteAlignment, name);
this.targetLayout = targetLayout;
}
diff --git a/src/java.base/share/classes/jdk/internal/javac/PreviewFeature.java b/src/java.base/share/classes/jdk/internal/javac/PreviewFeature.java
index 9f4cb9f370e1..aca7c68d837a 100644
--- a/src/java.base/share/classes/jdk/internal/javac/PreviewFeature.java
+++ b/src/java.base/share/classes/jdk/internal/javac/PreviewFeature.java
@@ -74,7 +74,7 @@ public enum Feature {
@JEP(number=401, title="Value Classes and Objects", status = "Preview")
VALUE_OBJECTS,
STRUCTURED_CONCURRENCY,
- @JEP(number = 531, title = "Lazy Constants", status = "Third Preview")
+ @JEP(number = 547, title = "Lazy Constants", status = "Fourth Preview")
LAZY_CONSTANTS,
/**
* Indicates a preview API exists to allow access to the environment
diff --git a/src/java.base/share/classes/jdk/internal/misc/ThreadFlock.java b/src/java.base/share/classes/jdk/internal/misc/ThreadFlock.java
index 32f6d5d4905d..0e0796b8509b 100644
--- a/src/java.base/share/classes/jdk/internal/misc/ThreadFlock.java
+++ b/src/java.base/share/classes/jdk/internal/misc/ThreadFlock.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -49,8 +49,8 @@
* ThreadFlock defines the {@link #open(String) open} method to open a new flock,
* the {@link #start(Thread) start} method to start a thread in the flock, and the
* {@link #close() close} method to close the flock. The {@code close} waits for all
- * threads in the flock to finish. The {@link #awaitAll() awaitAll} method may be used
- * to wait for all threads to finish without closing the flock. The {@link #wakeup()}
+ * threads in the flock to finish. The {@link #awaitAll(Object) awaitAll} method may be
+ * used to wait for all threads to finish without closing the flock. The {@link #wakeup()}
* method will cause {@code awaitAll} method to complete early, which can be used to
* support cancellation in higher-level APIs. ThreadFlock also defines the {@link
* #shutdown() shutdown} method to prevent new threads from starting while allowing
@@ -290,19 +290,20 @@ public void shutdown() {
*
This method clears the effect of any previous invocations of the
* {@code wakeup} method.
*
+ * @param blocker the synchronization object responsible for this thread waiting
* @return true if there are no threads in the flock, false if wakeup was invoked
* and there are unfinished threads
* @throws InterruptedException if interrupted while waiting
* @throws WrongThreadException if invoked by a thread that is not the owner
*/
- public boolean awaitAll() throws InterruptedException {
+ public boolean awaitAll(Object blocker) throws InterruptedException {
ensureOwner();
if (getAndSetPermit(false))
return (threadCount == 0);
while (threadCount > 0 && !permit) {
- LockSupport.park();
+ LockSupport.park(blocker);
if (Thread.interrupted())
throw new InterruptedException();
}
@@ -322,6 +323,7 @@ public boolean awaitAll() throws InterruptedException {
*
This method clears the effect of any previous invocations of the {@code wakeup}
* method.
*
+ * @param blocker the synchronization object responsible for this thread waiting
* @param timeout the maximum duration to wait
* @return true if there are no threads in the flock, false if wakeup was invoked
* and there are unfinished threads
@@ -329,7 +331,7 @@ public boolean awaitAll() throws InterruptedException {
* @throws TimeoutException if the wait timed out
* @throws WrongThreadException if invoked by a thread that is not the owner
*/
- public boolean awaitAll(Duration timeout)
+ public boolean awaitAll(Object blocker, Duration timeout)
throws InterruptedException, TimeoutException {
Objects.requireNonNull(timeout);
ensureOwner();
@@ -341,7 +343,7 @@ public boolean awaitAll(Duration timeout)
long nanos = NANOSECONDS.convert(timeout);
long remainingNanos = nanos;
while (threadCount > 0 && remainingNanos > 0 && !permit) {
- LockSupport.parkNanos(remainingNanos);
+ LockSupport.parkNanos(blocker, remainingNanos);
if (Thread.interrupted())
throw new InterruptedException();
remainingNanos = nanos - (System.nanoTime() - startNanos);
@@ -357,8 +359,8 @@ public boolean awaitAll(Duration timeout)
}
/**
- * Causes the call to {@link #awaitAll()} or {@link #awaitAll(Duration)} by the
- * {@linkplain #owner() owner} to return immediately.
+ * Causes the call to {@link #awaitAll(Object)} or {@link #awaitAll(Object, Duration)}
+ * by the {@linkplain #owner() owner} to return immediately.
*
*
If the owner is blocked in {@code awaitAll} then it will return immediately.
* If the owner is not blocked in {@code awaitAll} then its next call to wait
@@ -475,12 +477,7 @@ public boolean containsThread(Thread thread) {
@Override
public String toString() {
- String id = Objects.toIdentityString(this);
- if (name != null) {
- return name + "/" + id;
- } else {
- return id;
- }
+ return name;
}
/**
diff --git a/src/java.base/share/classes/jdk/internal/vm/ThreadDumper.java b/src/java.base/share/classes/jdk/internal/vm/ThreadDumper.java
index 63d2d300421f..a4935856bf3e 100644
--- a/src/java.base/share/classes/jdk/internal/vm/ThreadDumper.java
+++ b/src/java.base/share/classes/jdk/internal/vm/ThreadDumper.java
@@ -184,9 +184,12 @@ private static boolean dumpThread(Thread thread, TextWriter writer) {
}
Instant now = Instant.now();
Thread.State state = snapshot.threadState();
- writer.println("#" + thread.threadId() + " \"" + snapshot.threadName()
- + "\" " + (thread.isVirtual() ? "virtual " : "") + state + " " + now);
-
+ writer.println("#" + thread.threadId() + " \"" + escape(snapshot.threadName())
+ + "\" " + (thread.isVirtual() ? "virtual " : "")
+ + decorateObject(thread)
+ + " " + state
+ + " cpuTime=" + snapshot.cpuTime()
+ + " " + now);
StackTraceElement[] stackTrace = snapshot.stackTrace();
int depth = 0;
while (depth < stackTrace.length) {
@@ -359,7 +362,11 @@ private static boolean dumpThread(Thread thread, JsonWriter jsonWriter) {
jsonWriter.writeProperty("virtual", Boolean.TRUE);
}
jsonWriter.writeProperty("name", snapshot.threadName());
+ jsonWriter.writeProperty("threadObj", Objects.toIdentityString(thread));
jsonWriter.writeProperty("state", state);
+ if (snapshot.cpuTime() != -1L) {
+ jsonWriter.writeLongProperty("cpuTime", snapshot.cpuTime());
+ }
// park blocker
Object parkBlocker = snapshot.parkBlocker();
@@ -562,34 +569,33 @@ void startArray(String name) {
void endArray() {
endObject(true);
}
+ }
- /**
- * Escape any characters that need to be escape in the JSON output.
- */
- private static String escape(String value) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < value.length(); i++) {
- char c = value.charAt(i);
- switch (c) {
- case '"' -> sb.append("\\\"");
- case '\\' -> sb.append("\\\\");
- case '/' -> sb.append("\\/");
- case '\b' -> sb.append("\\b");
- case '\f' -> sb.append("\\f");
- case '\n' -> sb.append("\\n");
- case '\r' -> sb.append("\\r");
- case '\t' -> sb.append("\\t");
- default -> {
- if (c <= 0x1f) {
- sb.append(String.format("\\u%04x", c));
- } else {
- sb.append(c);
- }
+ /**
+ * Escapes characters for JSON strings and quoted thread names in plain text dumps.
+ */
+ private static String escape(String value) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < value.length(); i++) {
+ char c = value.charAt(i);
+ switch (c) {
+ case '"' -> sb.append("\\\"");
+ case '\\' -> sb.append("\\\\");
+ case '\b' -> sb.append("\\b");
+ case '\f' -> sb.append("\\f");
+ case '\n' -> sb.append("\\n");
+ case '\r' -> sb.append("\\r");
+ case '\t' -> sb.append("\\t");
+ default -> {
+ if (c <= 0x1f) {
+ sb.append(String.format("\\u%04x", (int) c));
+ } else {
+ sb.append(c);
}
}
}
- return sb.toString();
}
+ return sb.toString();
}
/**
diff --git a/src/java.base/share/classes/jdk/internal/vm/ThreadSnapshot.java b/src/java.base/share/classes/jdk/internal/vm/ThreadSnapshot.java
index 69370891688f..42d3c11ebf46 100644
--- a/src/java.base/share/classes/jdk/internal/vm/ThreadSnapshot.java
+++ b/src/java.base/share/classes/jdk/internal/vm/ThreadSnapshot.java
@@ -40,6 +40,7 @@ public class ThreadSnapshot {
// filled by VM
private String name;
private int threadStatus;
+ private long cpuTime;
private Thread carrierThread;
private StackTraceElement[] stackTrace;
// owned monitors
@@ -98,6 +99,13 @@ Thread.State threadState() {
return jdk.internal.misc.VM.toThreadState(threadStatus);
}
+ /**
+ * Returns CPU time in nanoseconds or -1L if not available.
+ */
+ long cpuTime() {
+ return cpuTime;
+ }
+
/**
* Returns the thread stack trace.
*/
diff --git a/src/java.base/share/classes/sun/nio/cs/StreamDecoder.java b/src/java.base/share/classes/sun/nio/cs/StreamDecoder.java
index 124e41b77c9f..6afa9c3aa7d8 100644
--- a/src/java.base/share/classes/sun/nio/cs/StreamDecoder.java
+++ b/src/java.base/share/classes/sun/nio/cs/StreamDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,7 @@ public class StreamDecoder extends Reader {
private static final int MIN_BYTE_BUFFER_SIZE = 32;
private static final int DEFAULT_BYTE_BUFFER_SIZE = 8192;
+ private boolean readCalled;
private volatile boolean closed;
private void ensureOpen() throws IOException {
@@ -122,6 +123,8 @@ public int read() throws IOException {
@SuppressWarnings("fallthrough")
private int read0() throws IOException {
synchronized (lock) {
+ readCalled = true;
+
// Return the leftover char, if there is one
if (haveLeftoverChar) {
haveLeftoverChar = false;
@@ -149,6 +152,7 @@ private int read0() throws IOException {
public int read(char[] cbuf, int offset, int length) throws IOException {
synchronized (lock) {
+ readCalled = true;
int off = offset;
int len = length;
@@ -232,19 +236,28 @@ public void fillZeroToPosition() throws IOException {
private final InputStream in;
private final ReadableByteChannel ch;
+ // true if decoder was created from cs, false if decoder was provided externally
+ private final boolean decoderFromCharset;
+
StreamDecoder(InputStream in, Object lock, Charset cs) {
- this(in, lock,
+ this(in, lock, cs,
cs.newDecoder()
.onMalformedInput(CodingErrorAction.REPLACE)
- .onUnmappableCharacter(CodingErrorAction.REPLACE));
+ .onUnmappableCharacter(CodingErrorAction.REPLACE),
+ true);
}
StreamDecoder(InputStream in, Object lock, CharsetDecoder dec) {
+ this(in, lock, dec.charset(), dec, false);
+ }
+
+ private StreamDecoder(InputStream in, Object lock, Charset cs, CharsetDecoder dec, boolean decoderFromCharset) {
super(lock);
- this.cs = dec.charset();
+ this.cs = cs;
this.decoder = dec;
this.in = in;
this.ch = null;
+ this.decoderFromCharset = decoderFromCharset;
this.bb = ByteBuffer.allocate(DEFAULT_BYTE_BUFFER_SIZE);
bb.flip(); // So that bb is initially empty
}
@@ -254,6 +267,7 @@ public void fillZeroToPosition() throws IOException {
this.ch = ch;
this.decoder = dec;
this.cs = dec.charset();
+ this.decoderFromCharset = false;
this.bb = ByteBuffer.allocate(mbc < 0
? DEFAULT_BYTE_BUFFER_SIZE
: (mbc < MIN_BYTE_BUFFER_SIZE
@@ -295,8 +309,7 @@ private int readBytes() throws IOException {
return rem;
}
- int implRead(char[] cbuf, int off, int end) throws IOException {
-
+ private int implRead(char[] cbuf, int off, int end) throws IOException {
// In order to handle surrogate pairs, this method requires that
// the invoker attempt to read at least two characters. Saving the
// extra character, if any, at a higher level is easier than trying
@@ -374,4 +387,17 @@ void implClose() throws IOException {
in.close();
}
}
+
+ public String tryReadAllAsString() throws IOException {
+ if (in == null || !decoderFromCharset) {
+ return null;
+ }
+ synchronized (lock) {
+ ensureOpen();
+ if (!readCalled) {
+ return new String(in.readAllBytes(), cs);
+ }
+ }
+ return null;
+ }
}
diff --git a/src/java.base/share/native/libfallbackLinker/fallbackLinker.c b/src/java.base/share/native/libfallbackLinker/fallbackLinker.c
index 7519efd93bbb..e5ad7ef30cbd 100644
--- a/src/java.base/share/native/libfallbackLinker/fallbackLinker.c
+++ b/src/java.base/share/native/libfallbackLinker/fallbackLinker.c
@@ -321,3 +321,20 @@ JNIEXPORT jint JNICALL
Java_jdk_internal_foreign_abi_fallback_LibFallback_alignof_1double(JNIEnv* env, jclass cls) {
return alignof(double);
}
+
+JNIEXPORT jint JNICALL
+Java_jdk_internal_foreign_abi_fallback_LibFallback_alignof_1int64(JNIEnv* env, jclass cls) {
+ return alignof(int64_t);
+}
+
+#define IS_UNSIGNED(T) ((T)0 < (T)-1)
+
+JNIEXPORT jboolean JNICALL
+Java_jdk_internal_foreign_abi_fallback_LibFallback_ffi_1wchar_1is_1unsigned(JNIEnv* env, jclass cls) {
+ return IS_UNSIGNED(wchar_t);
+}
+
+JNIEXPORT jboolean JNICALL
+Java_jdk_internal_foreign_abi_fallback_LibFallback_ffi_1char_1is_1unsigned(JNIEnv* env, jclass cls) {
+ return IS_UNSIGNED(char);
+}
diff --git a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
index ed8ca73a6136..1fc4f34456b3 100644
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
@@ -243,7 +243,18 @@ public ToolkitThreadBlockedHandler getToolkitThreadBlockedHandler() {
}
@Override
- protected byte[] imageToPlatformBytes(Image image, long format) {
+ protected byte[] imageToPlatformBytes(Image image, long format) throws IOException {
+ if (format == CF_PNG) {
+ return imageToStandardBytes(image, "image/png");
+ }
+ if (format == CF_JPEG) {
+ // JPEG doesn't support transparency, convert to opaque
+ Image opaque = CImage.getCreator().getOpaqueImage(image);
+ if (opaque == null) {
+ return null;
+ }
+ return imageToStandardBytes(opaque, "image/jpeg");
+ }
return CImage.getCreator().getPlatformImageBytes(image);
}
diff --git a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CImage.java b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CImage.java
index 6cf49b5b9ff9..4d6cbe050db0 100644
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CImage.java
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CImage.java
@@ -130,23 +130,37 @@ public Image createImageFromName(final String name) {
return createImageUsingNativeSize(nativeCreateNSImageFromImageName(name));
}
- private static BufferedImage getAsBufferedImage(Image image, boolean prepareImage, CTrayIcon.IconObserver observer) {
- if (image == null) return null;
+ private static boolean waitUntilImageLoaded(Image image) {
+ if (image instanceof BufferedImage) {
+ return true;
+ }
- if (prepareImage && !(image instanceof BufferedImage)) {
- final MediaTracker mt = new MediaTracker(new Label());
- final int id = 0;
- mt.addImage(image, id);
+ final MediaTracker mt = new MediaTracker(new Label());
+ final int id = 0;
+ mt.addImage(image, id);
- try {
- mt.waitForID(id);
- } catch (InterruptedException e) {
- return null;
- }
+ try {
+ mt.waitForID(id);
+ } catch (InterruptedException e) {
+ return false;
+ }
- if (mt.isErrorID(id)) {
- return null;
- }
+ if (mt.isErrorID(id)) {
+ return false;
+ }
+
+ if (image.getWidth(null) < 0 || image.getHeight(null) < 0) {
+ return false;
+ }
+
+ return true;
+ }
+
+ private static BufferedImage getAsBufferedImage(Image image, boolean prepareImage, CTrayIcon.IconObserver observer) {
+ if (image == null) return null;
+
+ if (prepareImage && !waitUntilImageLoaded(image)) {
+ return null;
}
int w = image.getWidth(null);
@@ -165,6 +179,30 @@ private static BufferedImage getAsBufferedImage(Image image, boolean prepareImag
return bimg;
}
+ public Image getOpaqueImage(Image image) {
+ if (image instanceof BufferedImage bufferedImage) {
+ if (!bufferedImage.getColorModel().hasAlpha()) {
+ return bufferedImage;
+ }
+ }
+
+ if (!waitUntilImageLoaded(image)) {
+ return null;
+ }
+
+ int w = image.getWidth(null);
+ int h = image.getHeight(null);
+
+ BufferedImage bimg = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
+ Graphics2D g2 = bimg.createGraphics();
+ g2.setColor(Color.WHITE);
+ g2.fillRect(0, 0, w, h);
+ g2.drawImage(image, 0, 0, null);
+ g2.dispose();
+
+ return bimg;
+ }
+
public byte[] getPlatformImageBytes(final Image image) {
BufferedImage bimg = getAsBufferedImage(image, false, null);
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m
index d6dde548c0a3..e8e32627cc3e 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -905,7 +905,7 @@ - (void)draggingEnded:(id )sender
/******************************** BEGIN NSTextInputClient Protocol ********************************/
-static jclass jc_CInputMethod = NULL;
+DECLARE_CLASS_ONLY(jc_CInputMethod);
#define GET_CIM_CLASS() \
GET_CLASS(jc_CInputMethod, "sun/lwawt/macosx/CInputMethod");
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m
index 36fb5dcb6663..89d2cc803d70 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m
@@ -42,7 +42,7 @@
#define IS(BITS, KEY) \
((BITS & MASK(KEY)) != 0)
-static jclass jc_CPlatformWindow = NULL;
+DECLARE_CLASS_ONLY(jc_CPlatformWindow);
#define GET_CPLATFORM_WINDOW_CLASS() \
GET_CLASS(jc_CPlatformWindow, "sun/lwawt/macosx/CPlatformWindow");
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.m
index d84fe9afa4a3..cbe267913d40 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -293,7 +293,8 @@ - (void)dealloc {
#pragma mark Callbacks from AppKit
-static jclass sjc_AppEventHandler = NULL;
+DECLARE_CLASS_ONLY(sjc_AppEventHandler);
+
#define GET_APPEVENTHANDLER_CLASS() \
GET_CLASS(sjc_AppEventHandler, "com/apple/eawt/_AppEventHandler");
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m
index ddb8630fb67b..ee28fef21ab3 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -69,8 +69,8 @@ + (void)javaDraggingEnd
}
@end
-static jclass DataTransfererClass = NULL;
-static jclass CDragSourceContextPeerClass = NULL;
+DECLARE_CLASS_ONLY(DataTransfererClass);
+DECLARE_CLASS_ONLY(CDragSourceContextPeerClass);
#define GET_DT_CLASS() \
GET_CLASS(DataTransfererClass, "sun/awt/datatransfer/DataTransferer");
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTarget.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTarget.m
index 2777dc1e2610..2eb167449f26 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTarget.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTarget.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,8 @@
static CDropTarget* sCurrentDropTarget;
-extern jclass jc_CDropTargetContextPeer;
+DECLARE_CLASS_ONLY(jc_CDropTargetContextPeer);
+
#define GET_DTCP_CLASS() \
GET_CLASS(jc_CDropTargetContextPeer, "sun/lwawt/macosx/CDropTargetContextPeer");
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTargetContextPeer.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTargetContextPeer.m
index b29e7283ef44..eb7536e0853b 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTargetContextPeer.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTargetContextPeer.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,8 @@
#import "ThreadUtilities.h"
#import "JNIUtilities.h"
-jclass jc_CDropTargetContextPeer = NULL;
+DECLARE_CLASS_ONLY(jc_CDropTargetContextPeer);
+
#define GET_DTCP_CLASS() \
GET_CLASS(jc_CDropTargetContextPeer, "sun/lwawt/macosx/CDropTargetContextPeer");
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m
index 555a2746f439..d26bc6c41abf 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m
@@ -41,12 +41,12 @@
#define TWO_SIDED_LONG_EDGE 1
#define TWO_SIDED_SHORT_EDGE 2
-static jclass sjc_Paper = NULL;
-static jclass sjc_PageFormat = NULL;
-static jclass sjc_CPrinterJob = NULL;
-static jclass sjc_CPrinterDialog = NULL;
-static jmethodID sjm_getNSPrintInfo = NULL;
-static jmethodID sjm_printerJob = NULL;
+DECLARE_CLASS_ONLY(sjc_Paper)
+DECLARE_CLASS_ONLY(sjc_PageFormat)
+DECLARE_CLASS_ONLY(sjc_CPrinterJob)
+DECLARE_CLASS_ONLY(sjc_CPrinterDialog)
+DECLARE_METHOD_ONLY(sjm_getNSPrintInfo)
+DECLARE_FIELD_ONLY(sjm_printerJob)
#define GET_PAPER_CLASS() GET_CLASS(sjc_Paper, "java/awt/print/Paper");
#define GET_PAGEFORMAT_CLASS() GET_CLASS(sjc_PageFormat, "java/awt/print/PageFormat");
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/CTextPipe.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/CTextPipe.m
index f1c12585728e..c353bd2f1e82 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CTextPipe.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CTextPipe.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -321,7 +321,7 @@ render using the right font (see bug 7183516) when attribString is not
-----------------------------------*/
-static jclass jc_StandardGlyphVector = NULL;
+DECLARE_CLASS_ONLY(jc_StandardGlyphVector);
#define GET_SGV_CLASS() GET_CLASS(jc_StandardGlyphVector, "sun/font/StandardGlyphVector");
// Checks the GlyphVector Java object for any transforms that were applied to individual characters. If none are present,
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/ImageSurfaceData.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/ImageSurfaceData.m
index ec2bbf48b8c2..3216f3877c37 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/ImageSurfaceData.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/ImageSurfaceData.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -102,7 +102,7 @@
static jfieldID mapSizeID;
static jfieldID allGrayID;
-static jclass jc_OSXOffScreenSurfaceData = NULL;
+DECLARE_CLASS_ONLY(jc_OSXOffScreenSurfaceData);
#define GET_OSXOSD_CLASS() \
GET_CLASS(jc_OSXOffScreenSurfaceData, "sun/java2d/OSXOffScreenSurfaceData");
@@ -1620,8 +1620,9 @@ JNIEXPORT void JNICALL Java_sun_java2d_OSXOffScreenSurfaceData_initIDs(JNIEnv *e
//fprintf(stderr, "gColorspaceRGB=%p, gColorspaceGray=%p\n", gColorspaceRGB, gColorspaceGray);
}
-static jclass jc_BufferedImage = NULL;
-static jfieldID jm_SurfaceData = NULL;
+DECLARE_CLASS_ONLY(jc_BufferedImage);
+
+DECLARE_FIELD_ONLY(jm_SurfaceData);
JNIEXPORT jobject JNICALL Java_sun_java2d_OSXOffScreenSurfaceData_getSurfaceData
(JNIEnv *env, jclass bisd, jobject bufImg)
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityUtilities.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityUtilities.m
index c35122cb331c..c735b4a535b7 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityUtilities.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityUtilities.m
@@ -43,11 +43,11 @@
void initializeRoles();
// Unique
-static jclass sjc_AccessibleState = NULL;
+DECLARE_CLASS_ONLY(sjc_AccessibleState);
#define GET_ACCESSIBLESTATE_CLASS_RETURN(ret) \
GET_CLASS_RETURN(sjc_AccessibleState, "javax/accessibility/AccessibleState", ret);
-static jclass sjc_CAccessibility = NULL;
+DECLARE_CLASS_ONLY(sjc_CAccessibility);
NSSize getAxComponentSize(JNIEnv *env, jobject axComponent, jobject component)
{
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m
index da83387a58da..9565ce190027 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -51,33 +51,34 @@
// If the value is >=0, it's an index
// GET* macros defined in JavaAccessibilityUtilities.h, so they can be shared.
-static jclass sjc_CAccessibility = NULL;
+DECLARE_CLASS_ONLY(sjc_CAccessibility);
-static jmethodID sjm_getAccessibleName = NULL;
+DECLARE_METHOD_ONLY(sjm_getAccessibleName);
#define GET_ACCESSIBLENAME_METHOD_RETURN(ret) \
GET_CACCESSIBILITY_CLASS_RETURN(ret); \
GET_STATIC_METHOD_RETURN(sjm_getAccessibleName, sjc_CAccessibility, "getAccessibleName", \
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;)Ljava/lang/String;", ret);
-static jmethodID jm_getChildrenAndRoles = NULL;
+DECLARE_METHOD_ONLY(jm_getChildrenAndRoles);
+
#define GET_CHILDRENANDROLES_METHOD_RETURN(ret) \
GET_CACCESSIBILITY_CLASS_RETURN(ret); \
GET_STATIC_METHOD_RETURN(jm_getChildrenAndRoles, sjc_CAccessibility, "getChildrenAndRoles",\
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;IZ)[Ljava/lang/Object;", ret);
-static jmethodID sjm_getAccessibleComponent = NULL;
+DECLARE_METHOD_ONLY(sjm_getAccessibleComponent);
#define GET_ACCESSIBLECOMPONENT_STATIC_METHOD_RETURN(ret) \
GET_CACCESSIBILITY_CLASS_RETURN(ret); \
GET_STATIC_METHOD_RETURN(sjm_getAccessibleComponent, sjc_CAccessibility, "getAccessibleComponent", \
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;)Ljavax/accessibility/AccessibleComponent;", ret);
-static jmethodID sjm_getAccessibleIndexInParent = NULL;
+DECLARE_METHOD_ONLY(sjm_getAccessibleIndexInParent);
#define GET_ACCESSIBLEINDEXINPARENT_STATIC_METHOD_RETURN(ret) \
GET_CACCESSIBILITY_CLASS_RETURN(ret); \
GET_STATIC_METHOD_RETURN(sjm_getAccessibleIndexInParent, sjc_CAccessibility, "getAccessibleIndexInParent", \
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;)I", ret);
-static jclass sjc_CAccessible = NULL;
+DECLARE_CLASS_ONLY(sjc_CAccessible);
#define GET_CACCESSIBLE_CLASS_RETURN(ret) \
GET_CLASS_RETURN(sjc_CAccessible, "sun/lwawt/macosx/CAccessible", ret);
@@ -1062,7 +1063,7 @@ - (NSString *)accessibilityRoleDescriptionAttribute
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;)Ljava/lang/String;", nil);
- jobject axRole = (*env)->CallStaticObjectMethod(env, jm_getAccessibleRoleDisplayString, fAccessible, fComponent);
+ jobject axRole = (*env)->CallStaticObjectMethod(env, sjc_CAccessibility, jm_getAccessibleRoleDisplayString, fAccessible, fComponent);
CHECK_EXCEPTION();
if (axRole != NULL) {
value = JavaStringToNSString(env, axRole);
@@ -1252,6 +1253,7 @@ - (id)accessibilityValueAttribute
GET_ACCESSIBLENAME_METHOD_RETURN(nil);
jobject itemValue =
(*env)->CallStaticObjectMethod( env,
+ sjc_CAccessibility,
sjm_getAccessibleName,
selectedMenuItem->fAccessible,
selectedMenuItem->fComponent );
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaTextAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaTextAccessibility.m
index 424d44d94cbd..0fc5a232a44a 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaTextAccessibility.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaTextAccessibility.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,25 +29,26 @@
#import "ThreadUtilities.h"
#import "JNIUtilities.h"
-static jclass sjc_CAccessibility = NULL;
+DECLARE_CLASS_ONLY(sjc_CAccessibility);
+
#define GET_CACCESSIBLITY_CLASS() \
GET_CLASS(sjc_CAccessibility, "sun/lwawt/macosx/CAccessibility");
#define GET_CACCESSIBLITY_CLASS_RETURN(ret) \
GET_CLASS_RETURN(sjc_CAccessibility, "sun/lwawt/macosx/CAccessibility", ret);
-static jmethodID sjm_getAccessibleText = NULL;
+DECLARE_METHOD_ONLY(sjm_getAccessibleText);
#define GET_ACCESSIBLETEXT_METHOD_RETURN(ret) \
GET_CACCESSIBLITY_CLASS_RETURN(ret); \
GET_STATIC_METHOD_RETURN(sjm_getAccessibleText, sjc_CAccessibility, "getAccessibleText", \
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;)Ljavax/accessibility/AccessibleText;", ret);
-static jclass sjc_CAccessibleText = NULL;
+DECLARE_CLASS_ONLY(sjc_CAccessibleText);
#define GET_CACCESSIBLETEXT_CLASS() \
GET_CLASS(sjc_CAccessibleText, "sun/lwawt/macosx/CAccessibleText");
#define GET_CACCESSIBLETEXT_CLASS_RETURN(ret) \
GET_CLASS_RETURN(sjc_CAccessibleText, "sun/lwawt/macosx/CAccessibleText", ret);
-static jmethodID sjm_getAccessibleEditableText = NULL;
+DECLARE_METHOD_ONLY(sjm_getAccessibleEditableText);
#define GET_ACCESSIBLEEDITABLETEXT_METHOD_RETURN(ret) \
GET_CACCESSIBLETEXT_CLASS_RETURN(ret); \
GET_STATIC_METHOD_RETURN(sjm_getAccessibleEditableText, sjc_CAccessibleText, "getAccessibleEditableText", \
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.m
index f219e8082b4d..aaae7a031cd0 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.m
@@ -32,11 +32,11 @@
#import "GeomUtilities.h"
#import "JNIUtilities.h"
-static jclass sjc_CPrinterJob = NULL;
-static jclass sjc_PAbortEx = NULL;
+DECLARE_CLASS_ONLY(sjc_CPrinterJob);
+DECLARE_CLASS_ONLY(sjc_PAbortEx);
#define GET_CPRINTERJOB_CLASS() (sjc_CPrinterJob, "sun/lwawt/macosx/CPrinterJob");
#define GET_CPRINTERJOB_CLASS_RETURN(ret) GET_CLASS_RETURN(sjc_CPrinterJob, "sun/lwawt/macosx/CPrinterJob", ret);
-#define GET_PRINERABORTEXCEPTION_CLASS(ret) GET_CLASS_RETURN(sjc_PAbortEx, "java/awt/print/PrinterAbortException", ret);
+#define GET_PRINTERABORTEXCEPTION_CLASS(ret) GET_CLASS_RETURN(sjc_PAbortEx, "java/awt/print/PrinterAbortException", ret);
@implementation PrinterView
@@ -279,7 +279,7 @@ - (BOOL)cancelCheck:(JNIEnv*)env
BOOL b = (*env)->CallBooleanMethod(env, fPrinterJob, jm_cancelCheck); // AWT_THREADING Safe (known object)
if (b) {
- GET_PRINERABORTEXCEPTION_CLASS(b);
+ GET_PRINTERABORTEXCEPTION_CLASS(b);
(*env)->ThrowNew(env, sjc_PAbortEx, "Printer Job cancelled");
} else {
CHECK_EXCEPTION();
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ColumnAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ColumnAccessibility.m
index fb41511275b2..e93f7a22e50a 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ColumnAccessibility.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ColumnAccessibility.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, JetBrains s.r.o.. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -34,14 +34,6 @@
#import "JNIUtilities.h"
#import "sun_lwawt_macosx_CAccessibility.h"
-static jclass sjc_CAccessibility = NULL;
-
-static jmethodID jm_getChildrenAndRoles = NULL;
-#define GET_CHILDRENANDROLES_METHOD_RETURN(ret) \
- GET_CACCESSIBILITY_CLASS_RETURN(ret); \
- GET_STATIC_METHOD_RETURN(jm_getChildrenAndRoles, sjc_CAccessibility, "getChildrenAndRoles",\
- "(Ljavax/accessibility/Accessible;Ljava/awt/Component;IZ)[Ljava/lang/Object;", ret);
-
@implementation ColumnAccessibility
// NSAccessibilityElement protocol methods
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ComboBoxAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ComboBoxAccessibility.m
index 52f171e9dedd..7e4ae7a8d977 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ComboBoxAccessibility.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/ComboBoxAccessibility.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, JetBrains s.r.o.. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,13 +29,7 @@
#import "ThreadUtilities.h"
#import "JNIUtilities.h"
-static jclass sjc_CAccessibility = NULL;
-
-static jmethodID sjm_getAccessibleName = NULL;
-#define GET_ACCESSIBLENAME_METHOD_RETURN(ret) \
- GET_CACCESSIBILITY_CLASS_RETURN(ret); \
- GET_STATIC_METHOD_RETURN(sjm_getAccessibleName, sjc_CAccessibility, "getAccessibleName", \
- "(Ljavax/accessibility/Accessible;Ljava/awt/Component;)Ljava/lang/String;", ret);
+DECLARE_CLASS_ONLY(sjc_CAccessibility);
@implementation ComboBoxAccessibility
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonComponentAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonComponentAccessibility.m
index b9f9f0fa403b..b242cc86c343 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonComponentAccessibility.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonComponentAccessibility.m
@@ -37,39 +37,39 @@
// GET* macros defined in JavaAccessibilityUtilities.h, so they can be shared.
-static jclass sjc_CAccessibility = NULL;
+DECLARE_CLASS_ONLY(sjc_CAccessibility);
-static jmethodID sjm_getAccessibleName = NULL;
+DECLARE_METHOD_ONLY(sjm_getAccessibleName);
#define GET_ACCESSIBLENAME_METHOD_RETURN(ret) \
GET_CACCESSIBILITY_CLASS_RETURN(ret); \
GET_STATIC_METHOD_RETURN(sjm_getAccessibleName, sjc_CAccessibility, "getAccessibleName", \
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;)Ljava/lang/String;", ret);
-static jmethodID jm_getChildrenAndRoles = NULL;
+DECLARE_METHOD_ONLY(jm_getChildrenAndRoles);
#define GET_CHILDRENANDROLES_METHOD_RETURN(ret) \
GET_CACCESSIBILITY_CLASS_RETURN(ret); \
GET_STATIC_METHOD_RETURN(jm_getChildrenAndRoles, sjc_CAccessibility, "getChildrenAndRoles",\
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;IZ)[Ljava/lang/Object;", ret);
-static jmethodID jm_getChildrenAndRolesRecursive = NULL;
+DECLARE_METHOD_ONLY(jm_getChildrenAndRolesRecursive);
#define GET_CHILDRENANDROLESRECURSIVE_METHOD_RETURN(ret) \
GET_CACCESSIBILITY_CLASS_RETURN(ret); \
GET_STATIC_METHOD_RETURN(jm_getChildrenAndRolesRecursive, sjc_CAccessibility, "getChildrenAndRolesRecursive",\
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;IZI)[Ljava/lang/Object;", ret);
-static jmethodID sjm_getAccessibleComponent = NULL;
+DECLARE_METHOD_ONLY(sjm_getAccessibleComponent);
#define GET_ACCESSIBLECOMPONENT_STATIC_METHOD_RETURN(ret) \
GET_CACCESSIBILITY_CLASS_RETURN(ret); \
GET_STATIC_METHOD_RETURN(sjm_getAccessibleComponent, sjc_CAccessibility, "getAccessibleComponent", \
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;)Ljavax/accessibility/AccessibleComponent;", ret);
-static jmethodID sjm_getAccessibleIndexInParent = NULL;
+DECLARE_METHOD_ONLY(sjm_getAccessibleIndexInParent);
#define GET_ACCESSIBLEINDEXINPARENT_STATIC_METHOD_RETURN(ret) \
GET_CACCESSIBILITY_CLASS_RETURN(ret); \
GET_STATIC_METHOD_RETURN(sjm_getAccessibleIndexInParent, sjc_CAccessibility, "getAccessibleIndexInParent", \
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;)I", ret);
-static jclass sjc_CAccessible = NULL;
+DECLARE_CLASS_ONLY(sjc_CAccessible);
#define GET_CACCESSIBLE_CLASS_RETURN(ret) \
GET_CLASS_RETURN(sjc_CAccessible, "sun/lwawt/macosx/CAccessible", ret);
@@ -878,7 +878,7 @@ - (NSString *)accessibilityRoleDescription
DECLARE_STATIC_METHOD_RETURN(jm_getAccessibleRoleDisplayString, sjc_CAccessibility, "getAccessibleRoleDisplayString",
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;)Ljava/lang/String;", nil);
- jobject axRole = (*env)->CallStaticObjectMethod(env, jm_getAccessibleRoleDisplayString, fAccessible, fComponent);
+ jobject axRole = (*env)->CallStaticObjectMethod(env, sjc_CAccessibility, jm_getAccessibleRoleDisplayString, fAccessible, fComponent);
CHECK_EXCEPTION();
if (axRole != NULL) {
value = JavaStringToNSString(env, axRole);
@@ -1072,6 +1072,7 @@ - (id)accessibilityValue
GET_ACCESSIBLENAME_METHOD_RETURN(nil);
jobject itemValue =
(*env)->CallStaticObjectMethod( env,
+ sjc_CAccessibility,
sjm_getAccessibleName,
selectedMenuItem->fAccessible,
selectedMenuItem->fComponent );
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonTextAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonTextAccessibility.m
index 3e12f2985e01..fc2e8d43a482 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonTextAccessibility.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonTextAccessibility.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,20 +30,21 @@
#define DEFAULT_RANGE NSMakeRange(0, 0)
#define DEFAULT_RECT NSMakeRect(0, 0, 0, 0)
-static jclass sjc_CAccessibility = NULL;
-static jmethodID sjm_getAccessibleText = NULL;
+DECLARE_CLASS_ONLY(sjc_CAccessibility);
+
+DECLARE_METHOD_ONLY(sjm_getAccessibleText);
#define GET_ACCESSIBLETEXT_METHOD_RETURN(ret) \
GET_CACCESSIBILITY_CLASS_RETURN(ret); \
GET_STATIC_METHOD_RETURN(sjm_getAccessibleText, sjc_CAccessibility, "getAccessibleText", \
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;)Ljavax/accessibility/AccessibleText;", ret);
-static jclass sjc_CAccessibleText = NULL;
+DECLARE_CLASS_ONLY(sjc_CAccessibleText);
#define GET_CACCESSIBLETEXT_CLASS() \
GET_CLASS(sjc_CAccessibleText, "sun/lwawt/macosx/CAccessibleText");
#define GET_CACCESSIBLETEXT_CLASS_RETURN(ret) \
GET_CLASS_RETURN(sjc_CAccessibleText, "sun/lwawt/macosx/CAccessibleText", ret);
-static jmethodID sjm_getAccessibleEditableText = NULL;
+DECLARE_METHOD_ONLY(sjm_getAccessibleEditableText);
#define GET_ACCESSIBLEEDITABLETEXT_METHOD_RETURN(ret) \
GET_CACCESSIBLETEXT_CLASS_RETURN(ret); \
GET_STATIC_METHOD_RETURN(sjm_getAccessibleEditableText, sjc_CAccessibleText, "getAccessibleEditableText", \
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/MenuAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/MenuAccessibility.m
index 14b7ee8c6b5f..4858ede5be8f 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/MenuAccessibility.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/MenuAccessibility.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
#import "ThreadUtilities.h"
#import "sun_lwawt_macosx_CAccessibility.h"
-static jclass sjc_CAccessibility = NULL;
+DECLARE_CLASS_ONLY(sjc_CAccessibility);
/*
* Implementing a protocol that represents menus both as submenu and as a
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.m
index 8e241e65b963..1ceefc6af99f 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.m
@@ -29,25 +29,26 @@
#import "ThreadUtilities.h"
#import "JNIUtilities.h"
-static jclass sjc_CAccessibility = NULL;
+DECLARE_CLASS_ONLY(sjc_CAccessibility);
+
#define GET_CACCESSIBLITY_CLASS() \
GET_CLASS(sjc_CAccessibility, "sun/lwawt/macosx/CAccessibility");
#define GET_CACCESSIBLITY_CLASS_RETURN(ret) \
GET_CLASS_RETURN(sjc_CAccessibility, "sun/lwawt/macosx/CAccessibility", ret);
-static jmethodID sjm_getAccessibleText = NULL;
+DECLARE_METHOD_ONLY(sjm_getAccessibleText);
#define GET_ACCESSIBLETEXT_METHOD_RETURN(ret) \
GET_CACCESSIBLITY_CLASS_RETURN(ret); \
GET_STATIC_METHOD_RETURN(sjm_getAccessibleText, sjc_CAccessibility, "getAccessibleText", \
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;)Ljavax/accessibility/AccessibleText;", ret);
-static jclass sjc_CAccessibleText = NULL;
+DECLARE_CLASS_ONLY(sjc_CAccessibleText);
#define GET_CACCESSIBLETEXT_CLASS() \
GET_CLASS(sjc_CAccessibleText, "sun/lwawt/macosx/CAccessibleText");
#define GET_CACCESSIBLETEXT_CLASS_RETURN(ret) \
GET_CLASS_RETURN(sjc_CAccessibleText, "sun/lwawt/macosx/CAccessibleText", ret);
-static jmethodID sjm_getAccessibleEditableText = NULL;
+DECLARE_METHOD_ONLY(sjm_getAccessibleEditableText);
#define GET_ACCESSIBLEEDITABLETEXT_METHOD_RETURN(ret) \
GET_CACCESSIBLETEXT_CLASS_RETURN(ret); \
GET_STATIC_METHOD_RETURN(sjm_getAccessibleEditableText, sjc_CAccessibleText, "getAccessibleEditableText", \
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/OutlineAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/OutlineAccessibility.m
index 08240614bf77..218ff3328017 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/OutlineAccessibility.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/OutlineAccessibility.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2024, JetBrains s.r.o.. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,9 +29,9 @@
#import "ThreadUtilities.h"
#import "JNIUtilities.h"
-static jclass sjc_CAccessibility = NULL;
+DECLARE_CLASS_ONLY(sjc_CAccessibility);
-static jmethodID sjm_isTreeRootVisible = NULL;
+DECLARE_METHOD_ONLY(sjm_isTreeRootVisible);
#define GET_ISTREEROOTVISIBLE_METHOD_RETURN(ret) \
GET_CACCESSIBILITY_CLASS_RETURN(ret); \
GET_STATIC_METHOD_RETURN(sjm_isTreeRootVisible, sjc_CAccessibility, "isTreeRootVisible", \
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/OutlineRowAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/OutlineRowAccessibility.m
index e1392785904e..a0b3965fecb8 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/OutlineRowAccessibility.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/OutlineRowAccessibility.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, JetBrains s.r.o.. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -32,7 +32,7 @@
#import "OutlineAccessibility.h"
#import "sun_lwawt_macosx_CAccessibility.h"
-static jclass sjc_CAccessibility = NULL;
+DECLARE_CLASS_ONLY(sjc_CAccessibility);
@implementation OutlineRowAccessibility
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/TabGroupAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/TabGroupAccessibility.m
index 06375fc29342..0aa02db971b1 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/TabGroupAccessibility.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/TabGroupAccessibility.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, JetBrains s.r.o.. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -31,9 +31,9 @@
#import "JNIUtilities.h"
#import "sun_lwawt_macosx_CAccessibility.h"
-static jclass sjc_CAccessibility = NULL;
+DECLARE_CLASS_ONLY(sjc_CAccessibility);
-static jmethodID jm_getChildrenAndRoles = NULL;
+DECLARE_METHOD_ONLY(jm_getChildrenAndRoles);
#define GET_CHILDRENANDROLES_METHOD_RETURN(ret) \
GET_CACCESSIBILITY_CLASS_RETURN(ret); \
GET_STATIC_METHOD_RETURN(jm_getChildrenAndRoles, sjc_CAccessibility, "getChildrenAndRoles",\
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/TableAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/TableAccessibility.m
index 36af3dd5f108..02f6184adb7a 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/TableAccessibility.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/TableAccessibility.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2022, JetBrains s.r.o.. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -37,13 +37,7 @@
#import "sun_lwawt_macosx_CAccessibility.h"
#import "sun_lwawt_macosx_CAccessible.h"
-static jclass sjc_CAccessibility = NULL;
-
-static jmethodID sjm_getAccessibleName = NULL;
-#define GET_ACCESSIBLENAME_METHOD_RETURN(ret) \
- GET_CACCESSIBILITY_CLASS_RETURN(ret); \
- GET_STATIC_METHOD_RETURN(sjm_getAccessibleName, sjc_CAccessibility, "getAccessibleName", \
- "(Ljavax/accessibility/Accessible;Ljava/awt/Component;)Ljava/lang/String;", ret);
+DECLARE_CLASS_ONLY(sjc_CAccessibility);
@implementation TableAccessibility
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/TableRowAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/TableRowAccessibility.m
index 7c9f9bcb7449..9e48a97b8b70 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/TableRowAccessibility.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/TableRowAccessibility.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, JetBrains s.r.o.. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -33,7 +33,7 @@
#import "JNIUtilities.h"
#import "sun_lwawt_macosx_CAccessibility.h"
-static jclass sjc_CAccessibility = NULL;
+DECLARE_CLASS_ONLY(sjc_CAccessibility);
@implementation TableRowAccessibility
diff --git a/src/java.desktop/macosx/native/libosxapp/JNIUtilities.h b/src/java.desktop/macosx/native/libosxapp/JNIUtilities.h
index 51fba2770d00..74f374b7441a 100644
--- a/src/java.desktop/macosx/native/libosxapp/JNIUtilities.h
+++ b/src/java.desktop/macosx/native/libosxapp/JNIUtilities.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -51,111 +51,125 @@
/******** GET CLASS SUPPORT *********/
-#define GET_CLASS(dst_var, cls) \
- if (dst_var == NULL) { \
+#define GET_CLASS_ONLY(dst_var, cls) \
+ dispatch_once(&dst_var##_once, ^{ \
dst_var = (*env)->FindClass(env, cls); \
if (dst_var != NULL) dst_var = (*env)->NewGlobalRef(env, dst_var); \
- } \
- LOG_NULL(dst_var, cls); \
- CHECK_NULL(dst_var);
+ }); \
+ LOG_NULL(dst_var, cls);
-#define DECLARE_CLASS(dst_var, cls) \
- static jclass dst_var = NULL; \
- GET_CLASS(dst_var, cls);
+#define GET_CLASS(dst_var, cls) \
+ GET_CLASS_ONLY(dst_var, cls); \
+ CHECK_NULL(dst_var);
#define GET_CLASS_RETURN(dst_var, cls, ret) \
- if (dst_var == NULL) { \
- dst_var = (*env)->FindClass(env, cls); \
- if (dst_var != NULL) dst_var = (*env)->NewGlobalRef(env, dst_var); \
- } \
- LOG_NULL(dst_var, cls); \
+ GET_CLASS_ONLY(dst_var, cls); \
CHECK_NULL_RETURN(dst_var, ret);
-#define DECLARE_CLASS_RETURN(dst_var, cls, ret) \
+#define DECLARE_CLASS_ONLY(dst_var) \
static jclass dst_var = NULL; \
+ static dispatch_once_t dst_var##_once;
+
+#define DECLARE_CLASS(dst_var, cls) \
+ DECLARE_CLASS_ONLY(dst_var) \
+ GET_CLASS(dst_var, cls);
+
+#define DECLARE_CLASS_RETURN(dst_var, cls, ret) \
+ DECLARE_CLASS_ONLY(dst_var) \
GET_CLASS_RETURN(dst_var, cls, ret);
/******** GET METHOD SUPPORT *********/
-#define GET_METHOD(dst_var, cls, name, signature) \
- if (dst_var == NULL) { \
+#define GET_METHOD_ONLY(dst_var, cls, name, signature) \
+ dispatch_once(&dst_var##_once, ^{ \
dst_var = (*env)->GetMethodID(env, cls, name, signature); \
- } \
- LOG_NULL(dst_var, name); \
- CHECK_NULL(dst_var);
+ }); \
+ LOG_NULL(dst_var, name);
-#define DECLARE_METHOD(dst_var, cls, name, signature) \
- static jmethodID dst_var = NULL; \
- GET_METHOD(dst_var, cls, name, signature);
+#define GET_METHOD(dst_var, cls, name, signature) \
+ GET_METHOD_ONLY(dst_var, cls, name, signature); \
+ CHECK_NULL(dst_var);
#define GET_METHOD_RETURN(dst_var, cls, name, signature, ret) \
- if (dst_var == NULL) { \
- dst_var = (*env)->GetMethodID(env, cls, name, signature); \
- } \
- LOG_NULL(dst_var, name); \
+ GET_METHOD_ONLY(dst_var, cls, name, signature); \
CHECK_NULL_RETURN(dst_var, ret);
+#define DECLARE_METHOD_ONLY(dst_var) \
+ static jmethodID dst_var = NULL; \
+ static dispatch_once_t dst_var##_once;
+
+#define DECLARE_METHOD(dst_var, cls, name, signature) \
+ DECLARE_METHOD_ONLY(dst_var); \
+ GET_METHOD(dst_var, cls, name, signature);
+
#define DECLARE_METHOD_RETURN(dst_var, cls, name, signature, ret) \
- static jmethodID dst_var = NULL; \
+ DECLARE_METHOD_ONLY(dst_var); \
GET_METHOD_RETURN(dst_var, cls, name, signature, ret);
-#define GET_STATIC_METHOD(dst_var, cls, name, signature) \
- if (dst_var == NULL) { \
+#define GET_STATIC_METHOD_ONLY(dst_var, cls, name, signature) \
+ dispatch_once(&dst_var##_once, ^{ \
dst_var = (*env)->GetStaticMethodID(env, cls, name, signature); \
- } \
- LOG_NULL(dst_var, name); \
- CHECK_NULL(dst_var);
+ }); \
+ LOG_NULL(dst_var, name);
-#define DECLARE_STATIC_METHOD(dst_var, cls, name, signature) \
- static jmethodID dst_var = NULL; \
- GET_STATIC_METHOD(dst_var, cls, name, signature);
+#define GET_STATIC_METHOD(dst_var, cls, name, signature) \
+ GET_STATIC_METHOD_ONLY(dst_var, cls, name, signature); \
+ CHECK_NULL(dst_var);
#define GET_STATIC_METHOD_RETURN(dst_var, cls, name, signature, ret) \
- if (dst_var == NULL) { \
- dst_var = (*env)->GetStaticMethodID(env, cls, name, signature); \
- } \
- LOG_NULL(dst_var, name); \
+ GET_STATIC_METHOD_ONLY(dst_var, cls, name, signature); \
CHECK_NULL_RETURN(dst_var, ret);
+#define DECLARE_STATIC_METHOD(dst_var, cls, name, signature) \
+ DECLARE_METHOD_ONLY(dst_var); \
+ GET_STATIC_METHOD(dst_var, cls, name, signature);
+
#define DECLARE_STATIC_METHOD_RETURN(dst_var, cls, name, signature, ret) \
- static jmethodID dst_var = NULL; \
+ DECLARE_METHOD_ONLY(dst_var); \
GET_STATIC_METHOD_RETURN(dst_var, cls, name, signature, ret);
/******** GET FIELD SUPPORT *********/
-#define GET_FIELD(dst_var, cls, name, signature) \
- if (dst_var == NULL) { \
+#define GET_FIELD_ONLY(dst_var, cls, name, signature) \
+ dispatch_once(&dst_var##_once, ^{ \
dst_var = (*env)->GetFieldID(env, cls, name, signature); \
- } \
- LOG_NULL(dst_var, name); \
- CHECK_NULL(dst_var);
+ }); \
+ LOG_NULL(dst_var, name);
-#define DECLARE_FIELD(dst_var, cls, name, signature) \
- static jfieldID dst_var = NULL; \
- GET_FIELD(dst_var, cls, name, signature);
+#define GET_FIELD(dst_var, cls, name, signature) \
+ GET_FIELD_ONLY(dst_var, cls, name, signature); \
+ CHECK_NULL(dst_var);
#define GET_FIELD_RETURN(dst_var, cls, name, signature, ret) \
- if (dst_var == NULL) { \
- dst_var = (*env)->GetFieldID(env, cls, name, signature); \
- } \
- LOG_NULL(dst_var, name); \
+ GET_FIELD_ONLY(dst_var, cls, name, signature); \
CHECK_NULL_RETURN(dst_var, ret);
+#define DECLARE_FIELD_ONLY(dst_var) \
+ static jfieldID dst_var = NULL; \
+ static dispatch_once_t dst_var##_once;
+
+#define DECLARE_FIELD(dst_var, cls, name, signature) \
+ DECLARE_FIELD_ONLY(dst_var); \
+ GET_FIELD(dst_var, cls, name, signature);
+
#define DECLARE_FIELD_RETURN(dst_var, cls, name, signature, ret) \
- static jfieldID dst_var = NULL; \
+ DECLARE_FIELD_ONLY(dst_var); \
GET_FIELD_RETURN(dst_var, cls, name, signature, ret);
-#define GET_STATIC_FIELD_RETURN(dst_var, cls, name, signature, ret) \
- if (dst_var == NULL) { \
+#define GET_STATIC_FIELD_ONLY(dst_var, cls, name, signature) \
+ dispatch_once(&dst_var##_once, ^{ \
dst_var = (*env)->GetStaticFieldID(env, cls, name, signature); \
- } \
- LOG_NULL(dst_var, name); \
+ }); \
+ LOG_NULL(dst_var, name);
+
+#define GET_STATIC_FIELD_RETURN(dst_var, cls, name, signature, ret) \
+ GET_STATIC_FIELD_ONLY(dst_var, cls, name, signature) \
CHECK_NULL_RETURN(dst_var, ret);
#define DECLARE_STATIC_FIELD_RETURN(dst_var, cls, name, signature, ret) \
- static jfieldID dst_var = NULL; \
+ DECLARE_FIELD_ONLY(dst_var); \
GET_STATIC_FIELD_RETURN(dst_var, cls, name, signature, ret);
/********* EXCEPTION_HANDLING *********/
diff --git a/src/java.desktop/macosx/native/libosxui/ScreenMenu.m b/src/java.desktop/macosx/native/libosxui/ScreenMenu.m
index c28d87b4ed63..e055789c4f06 100644
--- a/src/java.desktop/macosx/native/libosxui/ScreenMenu.m
+++ b/src/java.desktop/macosx/native/libosxui/ScreenMenu.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,8 @@
#import "CMenuBar.h"
#import "JNIUtilities.h"
-static jclass sjc_ScreenMenu = NULL;
+DECLARE_CLASS_ONLY(sjc_ScreenMenu);
+
#define GET_SCREENMENU_CLASS() \
GET_CLASS(sjc_ScreenMenu, "com/apple/laf/ScreenMenu");
diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicListUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicListUI.java
index 8eb7f11be3f7..947d9c9c9b51 100644
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicListUI.java
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicListUI.java
@@ -3047,6 +3047,11 @@ protected Transferable createTransferable(JComponent c) {
Object obj = values[i];
String val = ((obj == null) ? "" : obj.toString());
plainStr.append(val).append('\n');
+ if (val != null && !BasicHTML.isHTMLString(val)) {
+ val = val.replace("&", "&")
+ .replace("<", "<")
+ .replace(">", ">");
+ }
htmlStr.append(" ").append(val).append('\n');
}
diff --git a/src/java.desktop/share/classes/sun/awt/image/GifImageDecoder.java b/src/java.desktop/share/classes/sun/awt/image/GifImageDecoder.java
index a8deaa71a4b2..e6b6b07a5642 100644
--- a/src/java.desktop/share/classes/sun/awt/image/GifImageDecoder.java
+++ b/src/java.desktop/share/classes/sun/awt/image/GifImageDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -242,7 +242,12 @@ public void produceImage() throws IOException, ImageFormatException {
// Fall through
case TERMINATOR:
- if (nloops == 0 || nloops-- >= 0) {
+ if (isAnimation && totalframes == 1) {
+ isAnimation = false;
+ ImageFetcher.stoppingAnimation();
+ }
+
+ if (isAnimation && (nloops == 0 || nloops-- >= 0)) {
try {
if (curframe != null) {
curframe.dispose();
@@ -257,7 +262,7 @@ public void produceImage() throws IOException, ImageFormatException {
return; // Unable to reset input buffer
}
}
- if (verbose && frameno != 1) {
+ if (verbose) {
System.out.println("processing GIF terminator,"
+ " frames: " + frameno
+ " total: " + totalframes);
diff --git a/src/java.desktop/share/classes/sun/awt/image/ImageFetcher.java b/src/java.desktop/share/classes/sun/awt/image/ImageFetcher.java
index 986b79edde9a..4dd6febbde6e 100644
--- a/src/java.desktop/share/classes/sun/awt/image/ImageFetcher.java
+++ b/src/java.desktop/share/classes/sun/awt/image/ImageFetcher.java
@@ -217,6 +217,10 @@ private void fetchloop() {
* Recycles this ImageFetcher thread as an image animator thread.
* Removes this ImageFetcher from the array of ImageFetchers, and
* resets the thread name to "ImageAnimator".
+ *
+ * Note: This method must be called only from
+ * an {@code ImageFetcher} thread.
+ * @see #stoppingAnimation()
*/
static void startingAnimation() {
final FetcherInfo info = FetcherInfo.getFetcherInfo();
@@ -238,6 +242,19 @@ static void startingAnimation() {
me.setName("Image Animator");
}
+ /**
+ * Returns the current animator thread into the pool as
+ * an {@code ImageFetcher} if possible.
+ *
+ * Note: This method must be called only from
+ * an {@code ImageFetcher} thread.
+ * @see #startingAnimation()
+ * @see #stoppingAnimation(Thread)
+ */
+ static void stoppingAnimation() {
+ stoppingAnimation(Thread.currentThread());
+ }
+
/**
* Returns this image animator thread back to service as an ImageFetcher
* if possible. Puts it back into the array of ImageFetchers and sets
diff --git a/src/java.desktop/share/classes/sun/awt/image/ImagingLib.java b/src/java.desktop/share/classes/sun/awt/image/ImagingLib.java
index fb2191c7ffce..e7150bbc26f7 100644
--- a/src/java.desktop/share/classes/sun/awt/image/ImagingLib.java
+++ b/src/java.desktop/share/classes/sun/awt/image/ImagingLib.java
@@ -77,10 +77,23 @@ public static native int transformBI(BufferedImage src, BufferedImage dst,
public static native int transformRaster(Raster src, Raster dst,
double[] matrix,
int interpType);
- public static native int convolveBI(BufferedImage src, BufferedImage dst,
- Kernel kernel, int edgeHint);
- public static native int convolveRaster(Raster src, Raster dst,
- Kernel kernel, int edgeHint);
+ private static native int convolveBINative(BufferedImage src, BufferedImage dst,
+ int width, int height, float[] data, int edgeHint);
+ public static int convolveBI(BufferedImage src, BufferedImage dst,
+ Kernel kernel, int edgeHint) {
+ return convolveBINative(src, dst, kernel.getWidth(),
+ kernel.getHeight(), kernel.getKernelData(null), edgeHint);
+ }
+
+ private static native int convolveRasterNative(Raster src, Raster dst,
+ int width, int height, float[] data, int edgeHint);
+
+ public static int convolveRaster(Raster src, Raster dst,
+ Kernel kernel, int edgeHint) {
+ return convolveRasterNative(src, dst, kernel.getWidth(),
+ kernel.getHeight(), kernel.getKernelData(null), edgeHint);
+ }
+
public static native int lookupByteBI(BufferedImage src, BufferedImage dst,
byte[][] table);
public static native int lookupByteRaster(Raster src, Raster dst,
@@ -248,7 +261,7 @@ public static BufferedImage filter(BufferedImageOp op, BufferedImage src,
case CONVOLVE_OP:
ConvolveOp cOp = (ConvolveOp) op;
if (convolveBI(src, dst, cOp.getKernel(),
- cOp.getEdgeCondition()) > 0) {
+ cOp.getEdgeCondition()) > 0) {
retBI = dst;
}
break;
diff --git a/src/java.desktop/share/classes/sun/font/SunLayoutEngine.java b/src/java.desktop/share/classes/sun/font/SunLayoutEngine.java
index d6937c667ef9..eb63c175121e 100644
--- a/src/java.desktop/share/classes/sun/font/SunLayoutEngine.java
+++ b/src/java.desktop/share/classes/sun/font/SunLayoutEngine.java
@@ -37,7 +37,7 @@
import java.awt.geom.Point2D;
import java.lang.foreign.MemorySegment;
-import java.util.concurrent.ConcurrentHashMap;
+import java.util.Arrays;
import java.util.WeakHashMap;
public final class SunLayoutEngine {
@@ -66,25 +66,43 @@ private static long getFacePtr(Font2D font2D) {
useFFM = "true".equals(prop);
}
+ // HarfBuzz keeps up to 5 code points (at most 10 UTF-16 chars) of context on each side.
+ // See hb_buffer_t::CONTEXT_LENGTH in hb-buffer.hh
+ // We use bigger margin to be on the safe side in case of a future change in HarfBuzz.
+ private static final int HB_CONTEXT_LENGTH = 1024;
+
public static void layout(Font2D font, int script, FontStrikeDesc desc, float[] mat, int gmask,
int baseIndex, TextRecord tr, int typo_flags,
Point2D.Float pt, GVData data) {
FontStrike strike = font.getStrike(desc);
+
+ char[] text = tr.text;
+ int start = tr.start;
+ int limit = tr.limit;
+
+ int contextStart = Math.max(0, start - HB_CONTEXT_LENGTH);
+ int contextLimit = Math.min(text.length, limit + HB_CONTEXT_LENGTH);
+ if (0 < contextStart || contextLimit < text.length) {
+ text = Arrays.copyOfRange(text, contextStart, contextLimit);
+ start -= contextStart;
+ limit -= contextStart;
+ }
+
if (useFFM) {
MemorySegment face = HBShaper.getFace(font);
if (face != null) {
HBShaper.shape(font, strike, mat, face,
- tr.text, data, script,
- tr.start, tr.limit, baseIndex, pt,
+ text, data, script,
+ start, limit, baseIndex, pt,
typo_flags, gmask);
}
} else {
long pFace = getFacePtr(font);
if (pFace != 0) {
shape(font, strike, mat, pFace,
- tr.text, data, script,
- tr.start, tr.limit, baseIndex, pt,
+ text, data, script,
+ start, limit, baseIndex, pt,
typo_flags, gmask);
}
}
diff --git a/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c b/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c
index dd282324df38..90fba87bcc4b 100644
--- a/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c
+++ b/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c
@@ -275,9 +275,10 @@ static int setPixelsFormMlibImage(JNIEnv *env, RasterS_t *rasterP, mlib_image* i
* External Functions *
***************************************************************************/
JNIEXPORT jint JNICALL
-Java_sun_awt_image_ImagingLib_convolveBI(JNIEnv *env, jobject this,
+Java_sun_awt_image_ImagingLib_convolveBINative(JNIEnv *env, jobject this,
jobject jsrc, jobject jdst,
- jobject jkernel, jint edgeHint)
+ jint kwidth, jint kheight,
+ jfloatArray jdata, jint edgeHint)
{
void *sdata, *ddata;
mlib_image *src;
@@ -292,9 +293,6 @@ Java_sun_awt_image_ImagingLib_convolveBI(JNIEnv *env, jobject this,
int retStatus = 1;
float *kern;
BufImageS_t *srcImageP, *dstImageP;
- jobject jdata;
- int kwidth;
- int kheight;
int w, h;
int x, y;
mlibHintS_t hint;
@@ -307,10 +305,8 @@ Java_sun_awt_image_ImagingLib_convolveBI(JNIEnv *env, jobject this,
if (s_nomlib) return 0;
if (s_timeIt) (*start_timer)(3600);
- kwidth = (*env)->GetIntField(env, jkernel, g_KernelWidthID);
- kheight = (*env)->GetIntField(env, jkernel, g_KernelHeightID);
- jdata = (*env)->GetObjectField(env, jkernel, g_KernelDataID);
klen = (*env)->GetArrayLength(env, jdata);
+
kern = (float *) (*env)->GetPrimitiveArrayCritical(env, jdata, NULL);
if (kern == NULL) {
/* out of memory exception already thrown */
@@ -516,9 +512,10 @@ Java_sun_awt_image_ImagingLib_convolveBI(JNIEnv *env, jobject this,
}
JNIEXPORT jint JNICALL
-Java_sun_awt_image_ImagingLib_convolveRaster(JNIEnv *env, jobject this,
+Java_sun_awt_image_ImagingLib_convolveRasterNative(JNIEnv *env, jobject this,
jobject jsrc, jobject jdst,
- jobject jkernel, jint edgeHint)
+ jint kwidth, jint kheight,
+ jfloatArray jdata, jint edgeHint)
{
mlib_image *src;
mlib_image *dst;
@@ -534,11 +531,8 @@ Java_sun_awt_image_ImagingLib_convolveRaster(JNIEnv *env, jobject this,
void *ddata;
RasterS_t *srcRasterP;
RasterS_t *dstRasterP;
- int kwidth;
- int kheight;
int w, h;
int x, y;
- jobject jdata;
float *kern;
/* This function requires a lot of local refs ??? Is 64 enough ??? */
@@ -548,10 +542,8 @@ Java_sun_awt_image_ImagingLib_convolveRaster(JNIEnv *env, jobject this,
if (s_nomlib) return 0;
if (s_timeIt) (*start_timer)(3600);
- kwidth = (*env)->GetIntField(env, jkernel, g_KernelWidthID);
- kheight = (*env)->GetIntField(env, jkernel, g_KernelHeightID);
- jdata = (*env)->GetObjectField(env, jkernel, g_KernelDataID);
klen = (*env)->GetArrayLength(env, jdata);
+
kern = (float *) (*env)->GetPrimitiveArrayCritical(env, jdata, NULL);
if (kern == NULL) {
/* out of memory exception already thrown */
diff --git a/src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.c b/src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.c
index 6ddb1ee6b7af..3792d47bd338 100644
--- a/src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.c
+++ b/src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.c
@@ -1726,17 +1726,6 @@ jboolean ProcessPath(ProcessHandler* hnd,
return JNI_TRUE;
}
-/* TODO Add checking of the result of the malloc/realloc functions to handle
- * out of memory error and don't leak earlier allocated data
- */
-
-
-#define ALLOC(ptr, type, n) \
- ptr = (type *)malloc((n)*sizeof(type))
-#define REALLOC(ptr, type, n) \
- ptr = (type *)realloc(ptr, (n)*sizeof(type))
-
-
struct _Edge;
typedef struct _Point {
@@ -1986,12 +1975,18 @@ void FillPolygon(ProcessHandler* hnd,
if (n <=1) return;
- ALLOC(yHash, Point*, hashSize);
+ yHash = (Point**) malloc(hashSize * sizeof(Point*));
+ if (yHash == NULL) return;
+
for (k = 0; k < hashSize; k++) {
yHash[k] = NULL;
}
- ALLOC(active, Edge, n);
+ active = (Edge*) malloc(n * sizeof(Edge));
+ if (active == NULL) {
+ free(yHash);
+ return;
+ }
/* Creating double linked list (prev, next links) describing path order and
* hash table with points which fall between scanlines. nextByY link is
diff --git a/src/java.desktop/share/native/libsplashscreen/splashscreen_gif.c b/src/java.desktop/share/native/libsplashscreen/splashscreen_gif.c
index 4b75bf37d34e..13cbe2d76187 100644
--- a/src/java.desktop/share/native/libsplashscreen/splashscreen_gif.c
+++ b/src/java.desktop/share/native/libsplashscreen/splashscreen_gif.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -95,9 +95,12 @@ SplashDecodeGif(Splash * splash, GifFileType * gif)
return 0;
}
stride = gif->SWidth * splash->imageFormat.depthBytes;
- if (splash->byteAlignment > 1)
- stride =
- (stride + splash->byteAlignment - 1) & ~(splash->byteAlignment - 1);
+ if (splash->byteAlignment > 1) {
+ if (stride > INT_MAX - (splash->byteAlignment - 1)) {
+ return 0;
+ }
+ stride = (stride + splash->byteAlignment - 1) & ~(splash->byteAlignment - 1);
+ }
if (!SAFE_TO_ALLOC(gif->SHeight, stride)) {
return 0;
diff --git a/src/java.desktop/share/native/libsplashscreen/splashscreen_impl.h b/src/java.desktop/share/native/libsplashscreen/splashscreen_impl.h
index d1f8b5564d5a..e1f5c63208a4 100644
--- a/src/java.desktop/share/native/libsplashscreen/splashscreen_impl.h
+++ b/src/java.desktop/share/native/libsplashscreen/splashscreen_impl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
#include "splashscreen_config.h"
#include "splashscreen_gfx.h"
#include "jni.h"
+#include
JNIEXPORT int
SplashLoadMemory(void *pdata, int size); /* requires preloading the file */
@@ -185,9 +186,9 @@ int SplashDecodePngStream(Splash * splash, SplashStream * stream);
int BitmapToYXBandedRectangles(ImageRect * pSrcRect, RECT_T * out);
-#define SAFE_TO_ALLOC(c, sz) \
- (((c) > 0) && ((sz) > 0) && \
- ((0xffffffffu / ((unsigned int)(c))) > (unsigned int)(sz)))
+#define SAFE_TO_ALLOC(c, sz) \
+ (((c) > 0) && ((sz) > 0) && \
+ ((size_t)(c) <= (size_t)INT_MAX / (size_t)(sz)))
#define dbgprintf printf
diff --git a/src/java.desktop/share/native/libsplashscreen/splashscreen_jpeg.c b/src/java.desktop/share/native/libsplashscreen/splashscreen_jpeg.c
index ba91abbed466..4f756a0a915c 100644
--- a/src/java.desktop/share/native/libsplashscreen/splashscreen_jpeg.c
+++ b/src/java.desktop/share/native/libsplashscreen/splashscreen_jpeg.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -172,9 +172,11 @@ SplashDecodeJpeg(Splash * splash, struct jpeg_decompress_struct *cinfo)
splash->loopCount = 1;
splash->frames[0].delay = 0;
- splash->frames[0].bitmapBits = malloc(stride * splash->height);
+ splash->frames[0].bitmapBits = malloc((size_t) stride * splash->height);
if (splash->frames[0].bitmapBits == NULL) {
free(splash->frames);
+ splash->frames = NULL;
+ splash->frameCount = 0;
return 0;
}
@@ -185,6 +187,8 @@ SplashDecodeJpeg(Splash * splash, struct jpeg_decompress_struct *cinfo)
if (buffer == NULL) {
free(splash->frames[0].bitmapBits);
free(splash->frames);
+ splash->frames = NULL;
+ splash->frameCount = 0;
return 0;
}
diff --git a/src/java.desktop/share/native/libsplashscreen/splashscreen_png.c b/src/java.desktop/share/native/libsplashscreen/splashscreen_png.c
index 0ad3d448372b..2dc59cebf690 100644
--- a/src/java.desktop/share/native/libsplashscreen/splashscreen_png.c
+++ b/src/java.desktop/share/native/libsplashscreen/splashscreen_png.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -147,13 +147,16 @@ SplashDecodePng(Splash * splash, png_rw_ptr read_func, void *io_ptr)
malloc(sizeof(SplashImage) * splash->frameCount);
if (splash->frames == NULL) {
+ splash->frameCount = 0;
goto done;
}
splash->loopCount = 1;
- splash->frames[0].bitmapBits = malloc(stride * splash->height);
+ splash->frames[0].bitmapBits = malloc((size_t) stride * splash->height);
if (splash->frames[0].bitmapBits == NULL) {
free(splash->frames);
+ splash->frames = NULL;
+ splash->frameCount = 0;
goto done;
}
splash->frames[0].delay = 0;
diff --git a/src/java.desktop/unix/legal/pipewire.md b/src/java.desktop/unix/legal/pipewire.md
index 8275928e2715..9860fb856186 100644
--- a/src/java.desktop/unix/legal/pipewire.md
+++ b/src/java.desktop/unix/legal/pipewire.md
@@ -1,4 +1,4 @@
-## PipeWire 1.3.81
+## PipeWire 1.6.11
### PipeWire license:
@@ -6,7 +6,7 @@ All PipeWire header files are licensed under the MIT License:
-Copyright © 2018-2023 Wim Taymans
+Copyright © 2018-2025 Wim Taymans
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@@ -30,17 +30,30 @@ DEALINGS IN THE SOFTWARE.
The below copyright applies to the following files:
-spa/include/spa/monitor/type-info.h
+spa/monitor/type-info.h
```
Copyright © 2021 Collabora Ltd.
```
-spa/include/spa/utils/string.h
+spa/param/audio/dts-types.h
+spa/param/audio/dts.h
```
-Copyright © 2021 Red Hat, Inc.
+Copyright © 2025 Carlos Rafael Giani
+```
+
+spa/param/video/color-types.h
+spa/utils/cleanup.h
+```
+Copyright © 2023-2025 PipeWire authors
```
-spa/utils/cleanup.h:
+spa/param/video/h265-utils.h
+spa/param/video/h265.h
```
-Copyright © 2023 PipeWire authors
+Copyright © 2025 Arun Raghavan
+```
+
+spa/utils/string.h
+```
+Copyright © 2021 Red Hat, Inc.
```
diff --git a/src/java.desktop/unix/native/common/awt/fontpath.c b/src/java.desktop/unix/native/common/awt/fontpath.c
index a7c2dfe763a3..bfe8abfa6c73 100644
--- a/src/java.desktop/unix/native/common/awt/fontpath.c
+++ b/src/java.desktop/unix/native/common/awt/fontpath.c
@@ -982,7 +982,7 @@ Java_sun_font_FontConfigManager_getFontConfig
jarray fcFontArr = NULL;
FcCharSet *unionCharset = NULL;
FcCharSet *prevUnionCharset = NULL;
- int expectedWeight, expectedSlant, skippedVarFont;
+ int expectedWeight, expectedSlant, skippedVarFont, skipVarFonts;
fcCompFontObj = (*env)->GetObjectArrayElement(env, fcCompFontArray, i);
fcNameStr =
@@ -1072,6 +1072,7 @@ Java_sun_font_FontConfigManager_getFontConfig
(*FcPatternGetInteger)(pattern, FC_WEIGHT, 0, &expectedWeight);
(*FcPatternGetInteger)(pattern, FC_SLANT, 0, &expectedSlant);
skippedVarFont = 0;
+ skipVarFonts = 1;
for (j=0; jfonts[j];
FcChar8 *fontformat;
@@ -1080,7 +1081,7 @@ Java_sun_font_FontConfigManager_getFontConfig
int weight, slant;
fontformat = NULL;
- if (fontCount == 0) {
+ if (skipVarFonts && (fontCount == 0) && (j < (nfonts / 2))) {
// Query to see if it is a variable font. 0x8000000 is used as the
// font index to tell fontconfig you want the variable font info.
// NULL is returned from FcFreeTypeQuery if it is not a variable font.
@@ -1111,6 +1112,12 @@ Java_sun_font_FontConfigManager_getFontConfig
&& (strcmp((char*)fontformat, "CFF") != 0)
#endif
) {
+ /* If we reach the end without finding non-variable fonts, reset */
+ if ((skipVarFonts == 1) && (fontCount == 0) && (j == (nfonts - 1))) {
+ skipVarFonts = 0;
+ skippedVarFont = 0;
+ j = -1;
+ }
continue;
}
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/context.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/context.h
index 7e1a2b29b949..b5790ef5122b 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/context.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/context.h
@@ -5,13 +5,13 @@
#ifndef PIPEWIRE_CONTEXT_H
#define PIPEWIRE_CONTEXT_H
+#include
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
-#include
-#include
-
/** \defgroup pw_context Context
*
* \brief The PipeWire context object manages all locally available
@@ -144,6 +144,9 @@ void pw_context_release_loop(struct pw_context *context, struct pw_loop *loop);
/** Get the work queue from the context: Since 0.3.26 */
struct pw_work_queue *pw_context_get_work_queue(struct pw_context *context);
+/** Get the timer queue from the context: Since 1.6.0 */
+struct pw_timer_queue *pw_context_get_timer_queue(struct pw_context *context);
+
/** Get the memory pool from the context: Since 0.3.74 */
struct pw_mempool *pw_context_get_mempool(struct pw_context *context);
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/core.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/core.h
index 1acfded4b07a..1550c6aa79c3 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/core.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/core.h
@@ -5,10 +5,6 @@
#ifndef PIPEWIRE_CORE_H
#define PIPEWIRE_CORE_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include
#include
@@ -16,6 +12,10 @@ extern "C" {
#include
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** \defgroup pw_core Core
*
* \brief The core global object.
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/keys.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/keys.h
index 67ea3f9cce22..d1983ad6f312 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/keys.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/keys.h
@@ -5,11 +5,12 @@
#ifndef PIPEWIRE_KEYS_H
#define PIPEWIRE_KEYS_H
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
-#include
/**
* \defgroup pw_keys Key Names
*
@@ -104,9 +105,11 @@ extern "C" {
* default pipewire-0, overwritten by
* env(PIPEWIRE_REMOTE). May also be
* a SPA-JSON array of sockets, to be tried
- * in order. */
+ * in order. The "internal" remote name and
+ * "generic" intention connects to the local
+ * PipeWire instance. */
#define PW_KEY_REMOTE_INTENTION "remote.intention" /**< The intention of the remote connection,
- * "generic", "screencast" */
+ * "generic", "screencast", "manager" */
/** application keys */
#define PW_KEY_APP_NAME "application.name" /**< application name. Ex: "Totem Music Player" */
@@ -226,6 +229,11 @@ extern "C" {
* playback or disable the prefix
* completely if an empty string
* is provided */
+#define PW_KEY_NODE_PHYSICAL "node.physical" /**< ports from the node are physical */
+#define PW_KEY_NODE_TERMINAL "node.terminal" /**< ports from the node are terminal */
+
+#define PW_KEY_NODE_RELIABLE "node.reliable" /**< node uses reliable transport 1.6.0 */
+
/** Port keys */
#define PW_KEY_PORT_ID "port.id" /**< port id */
#define PW_KEY_PORT_NAME "port.name" /**< port name */
@@ -242,6 +250,8 @@ extern "C" {
#define PW_KEY_PORT_PASSIVE "port.passive" /**< the ports wants passive links, since 0.3.67 */
#define PW_KEY_PORT_IGNORE_LATENCY "port.ignore-latency" /**< latency ignored by peers, since 0.3.71 */
#define PW_KEY_PORT_GROUP "port.group" /**< the port group of the port 1.2.0 */
+#define PW_KEY_PORT_EXCLUSIVE "port.exclusive" /**< link port only once 1.6.0 */
+#define PW_KEY_PORT_RELIABLE "port.reliable" /**< port uses reliable transport 1.6.0 */
/** link properties */
#define PW_KEY_LINK_ID "link.id" /**< a link id */
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/loop.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/loop.h
index 94b2dc2780b3..b5243b189f51 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/loop.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/loop.h
@@ -5,13 +5,13 @@
#ifndef PIPEWIRE_LOOP_H
#define PIPEWIRE_LOOP_H
+#include
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
-#include
-#include
-
/** \defgroup pw_loop Loop
*
* PipeWire loop object provides an implementation of
@@ -64,6 +64,12 @@ PW_API_LOOP_IMPL int pw_loop_invoke(struct pw_loop *object,
{
return spa_loop_invoke(object->loop, func, seq, data, size, block, user_data);
}
+PW_API_LOOP_IMPL int pw_loop_locked(struct pw_loop *object,
+ spa_invoke_func_t func, uint32_t seq, const void *data,
+ size_t size, void *user_data)
+{
+ return spa_loop_locked(object->loop, func, seq, data, size, user_data);
+}
PW_API_LOOP_IMPL int pw_loop_get_fd(struct pw_loop *object)
{
@@ -88,6 +94,36 @@ PW_API_LOOP_IMPL int pw_loop_iterate(struct pw_loop *object,
{
return spa_loop_control_iterate_fast(object->control, timeout);
}
+PW_API_LOOP_IMPL int pw_loop_check(struct pw_loop *object)
+{
+ return spa_loop_control_check(object->control);
+}
+PW_API_LOOP_IMPL int pw_loop_lock(struct pw_loop *object)
+{
+ return spa_loop_control_lock(object->control);
+}
+PW_API_LOOP_IMPL int pw_loop_unlock(struct pw_loop *object)
+{
+ return spa_loop_control_unlock(object->control);
+}
+PW_API_LOOP_IMPL int pw_loop_get_time(struct pw_loop *object, struct timespec *abstime, int64_t timeout)
+{
+ return spa_loop_control_get_time(object->control, abstime, timeout);
+}
+PW_API_LOOP_IMPL int pw_loop_wait(struct pw_loop *object, const struct timespec *abstime)
+{
+ return spa_loop_control_wait(object->control, abstime);
+}
+PW_API_LOOP_IMPL int pw_loop_signal(struct pw_loop *object, bool wait_for_accept)
+{
+ return spa_loop_control_signal(object->control, wait_for_accept);
+}
+PW_API_LOOP_IMPL int pw_loop_accept(struct pw_loop *object)
+{
+ return spa_loop_control_accept(object->control);
+}
+
+
PW_API_LOOP_IMPL struct spa_source *
pw_loop_add_io(struct pw_loop *object, int fd, uint32_t mask,
@@ -141,7 +177,7 @@ pw_loop_add_signal(struct pw_loop *object, int signal_number,
PW_API_LOOP_IMPL void pw_loop_destroy_source(struct pw_loop *object,
struct spa_source *source)
{
- return spa_loop_utils_destroy_source(object->utils, source);
+ spa_loop_utils_destroy_source(object->utils, source);
}
/**
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/port.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/port.h
index ef48c67c004d..75b067412fad 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/port.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/port.h
@@ -5,10 +5,6 @@
#ifndef PIPEWIRE_PORT_H
#define PIPEWIRE_PORT_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include
#include
@@ -18,6 +14,10 @@ extern "C" {
#include
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** \defgroup pw_port Port
* Port interface
*/
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/properties.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/properties.h
index de67f33a5017..0268f1871f37 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/properties.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/properties.h
@@ -5,16 +5,16 @@
#ifndef PIPEWIRE_PROPERTIES_H
#define PIPEWIRE_PROPERTIES_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include
#include
#include
#include
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#ifndef PW_API_PROPERTIES
#define PW_API_PROPERTIES static inline
#endif
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/protocol.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/protocol.h
index f306979877a1..cf945b7ec2e5 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/protocol.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/protocol.h
@@ -5,12 +5,12 @@
#ifndef PIPEWIRE_PROTOCOL_H
#define PIPEWIRE_PROTOCOL_H
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
-#include
-
/** \defgroup pw_protocol Protocol
*
* \brief Manages protocols and their implementation
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/proxy.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/proxy.h
index ca7f324c285c..9013f0594ea2 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/proxy.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/proxy.h
@@ -5,12 +5,12 @@
#ifndef PIPEWIRE_PROXY_H
#define PIPEWIRE_PROXY_H
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
-#include
-
/** \page page_proxy Proxy
*
* \see \ref pw_proxy
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/stream.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/stream.h
index dca13d22669c..982b10845606 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/stream.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/stream.h
@@ -167,6 +167,12 @@ extern "C" {
* Buffers that are queued after the process event completes will be delayed
* to the next processing cycle.
*
+ * \section sec_stream_timing Obtaining timing information
+ *
+ * With \ref pw_stream_get_time_n() and pw_stream_get_nsec() on can get accurate
+ * timing information of the data and the graph in the \ref pw_time. See
+ * the documentation of these functions.
+ *
* \section sec_stream_driving Driving the graph
*
* Starting in 0.3.34, it is possible for a stream to drive the graph.
@@ -263,11 +269,11 @@ struct pw_buffer {
* suggested amount of data to provide. For audio
* streams this will be the amount of frames
* required by the resampler. This field is 0
- * when no suggestion is provided. Since 0.3.49 */
+ * when no suggestion is provided. Since 0.3.50 */
uint64_t time; /**< For capture streams, this field contains the
* cycle time in nanoseconds when this buffer was
* queued in the stream. It can be compared against
- * the pw_time values or pw_stream_get_nsec()
+ * the \ref pw_time values or pw_stream_get_nsec()
* Since 1.0.5 */
};
@@ -287,10 +293,11 @@ struct pw_stream_control {
* Use pw_stream_get_time_n() to get an updated time snapshot of the stream.
* The time snapshot can give information about the time in the driver of the
* graph, the delay to the edge of the graph and the internal queuing in the
- * stream.
+ * stream. This function should only be called in the STREAMING state and will
+ * return an error when called in any other state.
*
* pw_time.ticks gives a monotonic increasing counter of the time in the graph
- * driver. I can be used to generate a timetime to schedule samples as well
+ * driver. I can be used to generate a timeline to schedule samples as well
* as detect discontinuities in the timeline caused by xruns.
*
* pw_time.delay is expressed as pw_time.rate, the time domain of the graph. This
@@ -305,15 +312,20 @@ struct pw_stream_control {
*
* pw_time.delay contains the total delay that a signal will travel through the
* graph. This includes the delay caused by filters in the graph as well as delays
- * caused by the hardware. The delay is usually quite stable and should only change when
- * the topology, quantum or samplerate of the graph changes.
+ * caused by the hardware and extra delay offsets added to this. The delay is usually
+ * quite stable and should only change when the topology, quantum or samplerate of
+ * the graph changes.
*
- * The delay requires the application to send the stream early relative to other synchronized
- * streams in order to arrive at the edge of the graph in time. This is usually done by
- * delaying the other streams with the given delay.
+ * The (positive) delay requires the application to send the stream early relative to other
+ * synchronized streams in order to arrive at the edge of the graph in time. This is usually
+ * done by delaying the other streams with the given delay.
*
- * Note that the delay can be negative. A negative delay means that this stream should be
- * delayed with the (positive) delay relative to other streams.
+ * A delay offset is sometimes added (by the user) to improve synchronization of the streams
+ * when the reported latency is incorrect in some way. This means that with a large enough
+ * negative offset, the delay can become negative as well. A negative delay in this context
+ * means that the user would like this stream to be delayed with the (positive) delay amount
+ * in order to synchronize it with other streams. Streams are in general not expected to be
+ * able to delay themselves and it is acceptable to clamp negative delays to 0.
*
* pw_time.queued and pw_time.buffered is expressed in the time domain of the stream,
* or the format that is used for the buffers of this stream.
@@ -379,10 +391,11 @@ struct pw_time {
* the playback device or the time a sample traveled
* from the capture device. This delay includes the
* delay introduced by all filters on the path between
- * the stream and the device. The delay is normally
- * constant in a graph and can change when the topology
- * of the graph or the quantum changes. This delay does
- * not include the delay caused by queued buffers. */
+ * the stream and the device and extra delay offsets. The
+ * delay is normally constant in a graph and can change when
+ * the topology of the graph or the quantum changes. This delay
+ * does not include the delay caused by queued buffers.
+ * The delay can be negative, see \ref pw_time . */
uint64_t queued; /**< data queued in the stream, this is the sum
* of the size fields in the pw_buffer that are
* currently queued */
@@ -406,7 +419,8 @@ struct pw_stream_events {
uint32_t version;
void (*destroy) (void *data);
- /** when the stream state changes */
+ /** when the stream state changes. Since 1.4 this also sets errno when the
+ * new state is PW_STREAM_STATE_ERROR */
void (*state_changed) (void *data, enum pw_stream_state old,
enum pw_stream_state state, const char *error);
@@ -511,6 +525,8 @@ void pw_stream_add_listener(struct pw_stream *stream,
const struct pw_stream_events *events,
void *data);
+/** Get the current stream state. Since 1.4 this also sets errno when the
+ * state is PW_STREAM_STATE_ERROR */
enum pw_stream_state pw_stream_get_state(struct pw_stream *stream, const char **error);
const char *pw_stream_get_name(struct pw_stream *stream);
@@ -579,7 +595,7 @@ const struct pw_stream_control *pw_stream_get_control(struct pw_stream *stream,
/** Set control values */
int pw_stream_set_control(struct pw_stream *stream, uint32_t id, uint32_t n_values, float *values, ...);
-/** Query the time on the stream, RT safe */
+/** Query the time on the stream. Returns an error when the stream is not running. RT safe */
int pw_stream_get_time_n(struct pw_stream *stream, struct pw_time *time, size_t size);
/** Get the current time in nanoseconds. This value can be compared with
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/type.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/type.h
index 2035811666ea..2692f3e66368 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/type.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/type.h
@@ -5,12 +5,12 @@
#ifndef PIPEWIRE_TYPE_H
#define PIPEWIRE_TYPE_H
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
-#include
-
/** \defgroup pw_type Type info
* Type information
*/
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/utils.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/utils.h
index c58432048754..b9a78b1bce93 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/utils.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/utils.h
@@ -5,10 +5,6 @@
#ifndef PIPEWIRE_UTILS_H
#define PIPEWIRE_UTILS_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include
#include
#include
@@ -16,15 +12,20 @@ extern "C" {
# include
#endif
#include
-
-#ifndef ENODATA
-#define ENODATA 9919
-#endif
+#include
#include
#include
#include
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef ENODATA
+#define ENODATA 9919
+#endif
+
/** \defgroup pw_utils Utilities
*
* Various utility functions
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/buffer/buffer.h b/src/java.desktop/unix/native/libpipewire/include/spa/buffer/buffer.h
index b287a76dec13..099852ff8ed9 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/buffer/buffer.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/buffer/buffer.h
@@ -5,13 +5,13 @@
#ifndef SPA_BUFFER_H
#define SPA_BUFFER_H
+#include
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
-#include
-#include
-
#ifndef SPA_API_BUFFER
#ifdef SPA_API_IMPL
#define SPA_API_BUFFER SPA_API_IMPL
@@ -118,6 +118,17 @@ SPA_API_BUFFER void *spa_buffer_find_meta_data(const struct spa_buffer *b, uint3
return NULL;
}
+SPA_API_BUFFER bool spa_buffer_has_meta_features(const struct spa_buffer *b, uint32_t type, uint32_t features)
+{
+ uint32_t i;
+ for (i = 0; i < b->n_metas; i++) {
+ uint32_t t = b->metas[i].type;
+ if ((t >> 16) == type && (t & features) == features)
+ return true;
+ }
+ return false;
+}
+
/**
* \}
*/
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/buffer/meta.h b/src/java.desktop/unix/native/libpipewire/include/spa/buffer/meta.h
index dbb452b56d70..ead00add0395 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/buffer/meta.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/buffer/meta.h
@@ -5,13 +5,13 @@
#ifndef SPA_META_H
#define SPA_META_H
+#include
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
-#include
-#include
-
#ifndef SPA_API_META
#ifdef SPA_API_IMPL
#define SPA_API_META SPA_API_IMPL
@@ -37,10 +37,17 @@ enum spa_meta_type {
SPA_META_Busy, /**< don't write to buffer when count > 0 */
SPA_META_VideoTransform, /**< struct spa_meta_transform */
SPA_META_SyncTimeline, /**< struct spa_meta_sync_timeline */
-
_SPA_META_LAST, /**< not part of ABI/API */
+
+ SPA_META_START_custom = 0x200,
+
+ SPA_META_START_features = 0x10000, /* features start, these have 0 size, the
+ * type in the upper 16 bits and a bitmask in
+ * the lower 16 bits with type specific features. */
};
+#define SPA_META_TYPE_FEATURES(type,features) (((type)<<16)|(features))
+
/**
* A metadata element.
*
@@ -183,7 +190,12 @@ struct spa_meta_videotransform {
* this metadata as SPA_PARAM_BUFFERS_metaType when negotiating a buffer
* layout with 2 extra fds.
*/
+#define SPA_META_FEATURE_SYNC_TIMELINE_RELEASE (1<<0) /**< metadata supports RELEASE */
+
struct spa_meta_sync_timeline {
+#define SPA_META_SYNC_TIMELINE_UNSCHEDULED_RELEASE (1<<0) /**< this flag is set by the producer and cleared
+ * by the consumer when it promises to signal
+ * the release point */
uint32_t flags;
uint32_t padding;
uint64_t acquire_point; /**< the timeline acquire point, this is when the data
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/buffer/type-info.h b/src/java.desktop/unix/native/libpipewire/include/spa/buffer/type-info.h
index 2a9c43c3a421..8de4aa104a86 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/buffer/type-info.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/buffer/type-info.h
@@ -5,6 +5,10 @@
#ifndef SPA_BUFFER_TYPES_H
#define SPA_BUFFER_TYPES_H
+#include
+#include
+#include
+
/**
* \addtogroup spa_buffer
* \{
@@ -14,10 +18,6 @@
extern "C" {
#endif
-#include
-#include
-#include
-
#define SPA_TYPE_INFO_Buffer SPA_TYPE_INFO_POINTER_BASE "Buffer"
#define SPA_TYPE_INFO_BUFFER_BASE SPA_TYPE_INFO_Buffer ":"
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/control/control.h b/src/java.desktop/unix/native/libpipewire/include/spa/control/control.h
index 43877eef9cc0..ccd4819c36b3 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/control/control.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/control/control.h
@@ -5,13 +5,13 @@
#ifndef SPA_CONTROL_H
#define SPA_CONTROL_H
+#include
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
-#include
-#include
-
/** \defgroup spa_control Control
* Control type declarations
*/
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/control/type-info.h b/src/java.desktop/unix/native/libpipewire/include/spa/control/type-info.h
index 3db937ec616f..8b2b8183c0f7 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/control/type-info.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/control/type-info.h
@@ -5,6 +5,10 @@
#ifndef SPA_CONTROL_TYPES_H
#define SPA_CONTROL_TYPES_H
+#include
+#include
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -14,10 +18,6 @@ extern "C" {
* \{
*/
-#include
-#include
-#include
-
/* base for parameter object enumerations */
#define SPA_TYPE_INFO_Control SPA_TYPE_INFO_ENUM_BASE "Control"
#define SPA_TYPE_INFO_CONTROL_BASE SPA_TYPE_INFO_Control ":"
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/debug/types.h b/src/java.desktop/unix/native/libpipewire/include/spa/debug/types.h
index b32fd28ed9c7..a968eedcaa17 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/debug/types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/debug/types.h
@@ -5,6 +5,10 @@
#ifndef SPA_DEBUG_TYPES_H
#define SPA_DEBUG_TYPES_H
+#include
+
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -14,10 +18,6 @@ extern "C" {
* \{
*/
-#include
-
-#include
-
#ifndef SPA_API_DEBUG_TYPES
#ifdef SPA_API_IMPL
#define SPA_API_DEBUG_TYPES SPA_API_IMPL
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/monitor/event.h b/src/java.desktop/unix/native/libpipewire/include/spa/monitor/event.h
index 423127e61206..79d61fc8866e 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/monitor/event.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/monitor/event.h
@@ -5,12 +5,12 @@
#ifndef SPA_EVENT_DEVICE_H
#define SPA_EVENT_DEVICE_H
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
-#include
-
/**
* \addtogroup spa_device
* \{
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/monitor/type-info.h b/src/java.desktop/unix/native/libpipewire/include/spa/monitor/type-info.h
index f5920c206004..aa6422f7b606 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/monitor/type-info.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/monitor/type-info.h
@@ -5,14 +5,14 @@
#ifndef SPA_DEVICE_TYPE_INFO_H
#define SPA_DEVICE_TYPE_INFO_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include
#include
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \addtogroup spa_device
* \{
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/node/command.h b/src/java.desktop/unix/native/libpipewire/include/spa/node/command.h
index 0915fca6ceeb..25c24f323a13 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/node/command.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/node/command.h
@@ -5,6 +5,8 @@
#ifndef SPA_COMMAND_NODE_H
#define SPA_COMMAND_NODE_H
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -14,8 +16,6 @@ extern "C" {
* \{
*/
-#include
-
/* object id of SPA_TYPE_COMMAND_Node */
enum spa_node_command {
SPA_NODE_COMMAND_Suspend, /**< suspend a node, this removes all configured
@@ -36,12 +36,24 @@ enum spa_node_command {
SPA_NODE_COMMAND_ParamEnd, /**< end a transaction */
SPA_NODE_COMMAND_RequestProcess,/**< Sent to a driver when some other node emitted
* the RequestProcess event. */
+ SPA_NODE_COMMAND_User, /**< User defined command */
};
#define SPA_NODE_COMMAND_ID(cmd) SPA_COMMAND_ID(cmd, SPA_TYPE_COMMAND_Node)
#define SPA_NODE_COMMAND_INIT(id) SPA_COMMAND_INIT(SPA_TYPE_COMMAND_Node, id)
+/* properties for SPA_TYPE_COMMAND_Node */
+enum spa_command_node {
+ SPA_COMMAND_NODE_START,
+
+ SPA_COMMAND_NODE_START_User = 0x1000,
+ SPA_COMMAND_NODE_extra, /** extra info (String) */
+
+ SPA_COMMAND_NODE_START_CUSTOM = 0x1000000,
+};
+
+
/**
* \}
*/
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/node/event.h b/src/java.desktop/unix/native/libpipewire/include/spa/node/event.h
index 94c2ef1316a4..1a58b1be96eb 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/node/event.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/node/event.h
@@ -5,6 +5,8 @@
#ifndef SPA_EVENT_NODE_H
#define SPA_EVENT_NODE_H
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -14,8 +16,6 @@ extern "C" {
* \{
*/
-#include
-
/* object id of SPA_TYPE_EVENT_Node */
enum spa_node_event {
SPA_NODE_EVENT_Error,
@@ -23,6 +23,7 @@ enum spa_node_event {
SPA_NODE_EVENT_RequestRefresh,
SPA_NODE_EVENT_RequestProcess, /*< Ask the driver to start processing
* the graph */
+ SPA_NODE_EVENT_User, /* User defined event */
};
#define SPA_NODE_EVENT_ID(ev) SPA_EVENT_ID(ev, SPA_TYPE_EVENT_Node)
@@ -31,6 +32,11 @@ enum spa_node_event {
/* properties for SPA_TYPE_EVENT_Node */
enum spa_event_node {
SPA_EVENT_NODE_START,
+
+ SPA_EVENT_NODE_START_User = 0x1000,
+ SPA_EVENT_NODE_extra, /** extra info (String) */
+
+ SPA_EVENT_NODE_START_CUSTOM = 0x1000000,
};
/**
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/node/io.h b/src/java.desktop/unix/native/libpipewire/include/spa/node/io.h
index fffde5bb27bb..3169b461a0cf 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/node/io.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/node/io.h
@@ -5,6 +5,9 @@
#ifndef SPA_IO_H
#define SPA_IO_H
+#include
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -14,9 +17,6 @@ extern "C" {
* \{
*/
-#include
-#include
-
/** IO areas
*
* IO information for a port on a node. This is allocated
@@ -114,23 +114,54 @@ struct spa_io_range {
* Driver nodes are supposed to update the contents of \ref SPA_IO_Clock before
* signaling the start of a graph cycle. These updated clock values become
* visible to other nodes in \ref SPA_IO_Position. Non-driver nodes do
- * not need to update the contents of their \ref SPA_IO_Clock.
+ * not need to update the contents of their \ref SPA_IO_Clock. Also
+ * see \ref page_driver for further details.
*
* The host generally gives each node a separate \ref spa_io_clock in \ref
* SPA_IO_Clock, so that updates made by the driver are not visible in the
* contents of \ref SPA_IO_Clock of other nodes. Instead, \ref SPA_IO_Position
* is used to look up the current graph time.
*
- * A node is a driver when \ref spa_io_clock.id in \ref SPA_IO_Clock and
- * \ref spa_io_position.clock.id in \ref SPA_IO_Position are the same.
+ * A node is a driver when \ref spa_io_clock::id and the ID in
+ * \ref spa_io_position.clock in \ref SPA_IO_Position are the same.
+ *
+ * The flags are set by the graph driver at the start of each cycle.
*/
struct spa_io_clock {
-#define SPA_IO_CLOCK_FLAG_FREEWHEEL (1u<<0) /* graph is freewheeling */
-#define SPA_IO_CLOCK_FLAG_XRUN_RECOVER (1u<<1) /* recovering from xrun */
-#define SPA_IO_CLOCK_FLAG_LAZY (1u<<2) /* lazy scheduling */
-#define SPA_IO_CLOCK_FLAG_NO_RATE (1u<<3) /* the rate of the clock is only approximately.
- * it is recommended to use the nsec as a clock source.
- * The rate_diff contains the measured inaccuracy. */
+#define SPA_IO_CLOCK_FLAG_FREEWHEEL (1u<<0) /**< Graph is freewheeling. It runs at the maximum
+ * possible rate, only constrained by the processing
+ * power of the machine it runs on. This can be useful
+ * for offline processing, where processing in real
+ * time is not desired. */
+#define SPA_IO_CLOCK_FLAG_XRUN_RECOVER (1u<<1) /**< A node's process callback did not complete within
+ * the last cycle's deadline, resulting in an xrun.
+ * This flag is not set for the entire graph. Instead,
+ * it is set at the start of the current cycle before
+ * a node that experienced an xrun has its process
+ * callback invoked. After said callback finished, the
+ * flag is cleared again. That way, the node knows that
+ * during the last cycle it experienced an xrun. They
+ * can use this information for example to resynchronize
+ * or clear custom stale states. */
+#define SPA_IO_CLOCK_FLAG_LAZY (1u<<2) /**< The driver uses lazy scheduling. For details, see
+ * \ref PW_KEY_NODE_SUPPORTS_LAZY . */
+#define SPA_IO_CLOCK_FLAG_NO_RATE (1u<<3) /**< The rate of the clock is only approximately.
+ * It is recommended to use the nsec as a clock source.
+ * The rate_diff contains the measured inaccuracy. */
+#define SPA_IO_CLOCK_FLAG_DISCONT (1u<<4) /**< The clock experienced a discontinuity in its
+ * timestamps since the last cycle. If this is set,
+ * nodes know that timestamps between the last and
+ * the current cycle cannot be assumed to be
+ * continuous. Nodes that synchronize playback against
+ * clock timestamps should resynchronize (for example
+ * by flushing buffers to avoid incorrect delays).
+ * This differs from an xrun in that it is not necessariy
+ * an error and that it is not caused by missed process
+ * deadlines. If for example a custom network time
+ * based driver starts to follow a different time
+ * server, and the offset between that server and its
+ * local clock consequently suddenly changes, then that
+ * driver should set this flag. */
uint32_t flags; /**< Clock flags */
uint32_t id; /**< Unique clock id, set by host application */
char name[64]; /**< Clock name prefixed with API, set by node when it receives
@@ -138,13 +169,16 @@ struct spa_io_clock {
* can be used to check if nodes share the same clock. */
uint64_t nsec; /**< Time in nanoseconds against monotonic clock
* (CLOCK_MONOTONIC). This fields reflects a real time instant
- * in the past. The value may have jitter. */
+ * in the past, when the current cycle started. The value may
+ * have jitter. */
struct spa_fraction rate; /**< Rate for position/duration/delay/xrun */
uint64_t position; /**< Current position, in samples @ \ref rate */
uint64_t duration; /**< Duration of current cycle, in samples @ \ref rate */
int64_t delay; /**< Delay between position and hardware, in samples @ \ref rate */
double rate_diff; /**< Rate difference between clock and monotonic time, as a ratio of
- * clock speeds. */
+ * clock speeds. A value higher than 1.0 means that the driver's
+ * internal clock is faster than the monotonic clock (by that
+ * factor), and vice versa. */
uint64_t next_nsec; /**< Estimated next wakeup time in nanoseconds.
* This time is a logical start time of the next cycle, and
* is not necessarily in the future.
@@ -278,8 +312,8 @@ enum spa_io_position_state {
*
* It is set on all nodes in \ref SPA_IO_Position, and the contents of \ref
* spa_io_position.clock contain the clock updates made by the driving node in
- * the graph in its \ref SPA_IO_Clock. Also, \ref spa_io_position.clock.id
- * will contain the clock id of the driving node in the graph.
+ * the graph in its \ref SPA_IO_Clock. Also, the ID in \ref spa_io_position.clock
+ * will be the clock id of the driving node in the graph.
*
* The position clock indicates the logical start time of the current graph
* cycle.
@@ -313,7 +347,7 @@ struct spa_io_position {
* and node rates. The \a flags and \a rate fields may be modified by the node.
*
* The node can request a correction to the resampling rate in its process(), by setting
- * \ref SPA_IO_RATE_MATCH_ACTIVE on \a flags, and setting \a rate to the desired rate
+ * \ref SPA_IO_RATE_MATCH_FLAG_ACTIVE on \a flags, and setting \a rate to the desired rate
* correction. Usually the rate is obtained from DLL or other adaptive mechanism that
* e.g. drives the node buffer fill level toward a specific value.
*
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/node/type-info.h b/src/java.desktop/unix/native/libpipewire/include/spa/node/type-info.h
index ab4dbdedfb76..bd8684ac0b2b 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/node/type-info.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/node/type-info.h
@@ -5,6 +5,12 @@
#ifndef SPA_NODE_TYPES_H
#define SPA_NODE_TYPES_H
+#include
+
+#include
+#include
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -14,12 +20,6 @@ extern "C" {
* \{
*/
-#include
-
-#include
-#include
-#include
-
#define SPA_TYPE_INFO_IO SPA_TYPE_INFO_ENUM_BASE "IO"
#define SPA_TYPE_INFO_IO_BASE SPA_TYPE_INFO_IO ":"
@@ -46,16 +46,20 @@ static const struct spa_type_info spa_type_node_event_id[] = {
{ SPA_NODE_EVENT_Buffering, SPA_TYPE_EVENT_Node, SPA_TYPE_INFO_NODE_EVENT_BASE "Buffering", NULL },
{ SPA_NODE_EVENT_RequestRefresh, SPA_TYPE_EVENT_Node, SPA_TYPE_INFO_NODE_EVENT_BASE "RequestRefresh", NULL },
{ SPA_NODE_EVENT_RequestProcess, SPA_TYPE_EVENT_Node, SPA_TYPE_INFO_NODE_EVENT_BASE "RequestProcess", NULL },
+ { SPA_NODE_EVENT_User, SPA_TYPE_EVENT_Node, SPA_TYPE_INFO_NODE_EVENT_BASE "User", NULL },
{ 0, 0, NULL, NULL },
};
static const struct spa_type_info spa_type_node_event[] = {
{ SPA_EVENT_NODE_START, SPA_TYPE_Id, SPA_TYPE_INFO_NODE_EVENT_BASE, spa_type_node_event_id },
+
+ { SPA_EVENT_NODE_extra, SPA_TYPE_String, SPA_TYPE_INFO_NODE_EVENT_BASE "extra", NULL },
+
{ 0, 0, NULL, NULL },
};
#define SPA_TYPE_INFO_NodeCommand SPA_TYPE_INFO_COMMAND_BASE "Node"
-#define SPA_TYPE_INFO_NODE_COMMAND_BASE SPA_TYPE_INFO_NodeCommand ":"
+#define SPA_TYPE_INFO_NODE_COMMAND_BASE SPA_TYPE_INFO_NodeCommand ":"
static const struct spa_type_info spa_type_node_command_id[] = {
{ SPA_NODE_COMMAND_Suspend, SPA_TYPE_COMMAND_Node, SPA_TYPE_INFO_NODE_COMMAND_BASE "Suspend", NULL },
@@ -69,11 +73,15 @@ static const struct spa_type_info spa_type_node_command_id[] = {
{ SPA_NODE_COMMAND_ParamBegin, SPA_TYPE_COMMAND_Node, SPA_TYPE_INFO_NODE_COMMAND_BASE "ParamBegin", NULL },
{ SPA_NODE_COMMAND_ParamEnd, SPA_TYPE_COMMAND_Node, SPA_TYPE_INFO_NODE_COMMAND_BASE "ParamEnd", NULL },
{ SPA_NODE_COMMAND_RequestProcess, SPA_TYPE_COMMAND_Node, SPA_TYPE_INFO_NODE_COMMAND_BASE "RequestProcess", NULL },
+ { SPA_NODE_COMMAND_User, SPA_TYPE_COMMAND_Node, SPA_TYPE_INFO_NODE_COMMAND_BASE "User", NULL },
{ 0, 0, NULL, NULL },
};
static const struct spa_type_info spa_type_node_command[] = {
- { 0, SPA_TYPE_Id, SPA_TYPE_INFO_NODE_COMMAND_BASE, spa_type_node_command_id },
+ { SPA_COMMAND_NODE_START, SPA_TYPE_Id, SPA_TYPE_INFO_NODE_COMMAND_BASE, spa_type_node_command_id },
+
+ { SPA_COMMAND_NODE_extra, SPA_TYPE_String, SPA_TYPE_INFO_NODE_COMMAND_BASE "extra", NULL },
+
{ 0, 0, NULL, NULL },
};
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/aac-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/aac-types.h
index e941250ff96b..8d6d87de7c29 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/aac-types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/aac-types.h
@@ -5,13 +5,13 @@
#ifndef SPA_AUDIO_AAC_TYPES_H
#define SPA_AUDIO_AAC_TYPES_H
+#include
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
-#include
-#include
-
/**
* \addtogroup spa_param
* \{
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/aac.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/aac.h
index 164eaf7de8bd..0c06ee5d7cae 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/aac.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/aac.h
@@ -5,12 +5,12 @@
#ifndef SPA_AUDIO_AAC_H
#define SPA_AUDIO_AAC_H
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
-#include
-
/**
* \addtogroup spa_param
* \{
@@ -18,19 +18,19 @@ extern "C" {
enum spa_audio_aac_stream_format {
SPA_AUDIO_AAC_STREAM_FORMAT_UNKNOWN,
- /* Raw AAC frames */
+ /** Raw AAC frames */
SPA_AUDIO_AAC_STREAM_FORMAT_RAW,
- /* ISO/IEC 13818-7 MPEG-2 Audio Data Transport Stream (ADTS) */
+ /** ISO/IEC 13818-7 MPEG-2 Audio Data Transport Stream (ADTS) */
SPA_AUDIO_AAC_STREAM_FORMAT_MP2ADTS,
- /* ISO/IEC 14496-3 MPEG-4 Audio Data Transport Stream (ADTS) */
+ /** ISO/IEC 14496-3 MPEG-4 Audio Data Transport Stream (ADTS) */
SPA_AUDIO_AAC_STREAM_FORMAT_MP4ADTS,
- /* ISO/IEC 14496-3 Low Overhead Audio Stream (LOAS) */
+ /** ISO/IEC 14496-3 Low Overhead Audio Stream (LOAS) */
SPA_AUDIO_AAC_STREAM_FORMAT_MP4LOAS,
- /* ISO/IEC 14496-3 Low Overhead Audio Transport Multiplex (LATM) */
+ /** ISO/IEC 14496-3 Low Overhead Audio Transport Multiplex (LATM) */
SPA_AUDIO_AAC_STREAM_FORMAT_MP4LATM,
- /* ISO/IEC 14496-3 Audio Data Interchange Format (ADIF) */
+ /** ISO/IEC 14496-3 Audio Data Interchange Format (ADIF) */
SPA_AUDIO_AAC_STREAM_FORMAT_ADIF,
- /* ISO/IEC 14496-12 MPEG-4 file format */
+ /** ISO/IEC 14496-12 MPEG-4 file format */
SPA_AUDIO_AAC_STREAM_FORMAT_MP4FF,
SPA_AUDIO_AAC_STREAM_FORMAT_CUSTOM = 0x10000,
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/amr-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/amr-types.h
index 34281c85763a..5a9a348a8923 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/amr-types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/amr-types.h
@@ -5,13 +5,13 @@
#ifndef SPA_AUDIO_AMR_TYPES_H
#define SPA_AUDIO_AMR_TYPES_H
+#include
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
-#include
-#include
-
/**
* \addtogroup spa_param
* \{
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/amr.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/amr.h
index aece0ab119ee..8dec9fdbafb2 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/amr.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/amr.h
@@ -5,12 +5,12 @@
#ifndef SPA_AUDIO_AMR_H
#define SPA_AUDIO_AMR_H
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
-#include
-
/**
* \addtogroup spa_param
* \{
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/dts-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/dts-types.h
new file mode 100644
index 000000000000..eedc8f8e354d
--- /dev/null
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/dts-types.h
@@ -0,0 +1,39 @@
+/* Simple Plugin API */
+/* SPDX-FileCopyrightText: Copyright © 2025 Carlos Rafael Giani */
+/* SPDX-License-Identifier: MIT */
+
+#ifndef SPA_AUDIO_DTS_TYPES_H
+#define SPA_AUDIO_DTS_TYPES_H
+
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \addtogroup spa_param
+ * \{
+ */
+
+#define SPA_TYPE_INFO_AudioDTSExtType SPA_TYPE_INFO_ENUM_BASE "AudioDTSExtType"
+#define SPA_TYPE_INFO_AUDIO_DTS_EXT_TYPE_BASE SPA_TYPE_INFO_AudioDTSExtType ":"
+
+static const struct spa_type_info spa_type_audio_dts_ext_type[] = {
+ { SPA_AUDIO_DTS_EXT_UNKNOWN, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_DTS_EXT_TYPE_BASE "UNKNOWN", NULL },
+ { SPA_AUDIO_DTS_EXT_NONE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_DTS_EXT_TYPE_BASE "NONE", NULL },
+ { SPA_AUDIO_DTS_EXT_HD_HRA, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_DTS_EXT_TYPE_BASE "HRA", NULL },
+ { SPA_AUDIO_DTS_EXT_HD_MA, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_DTS_EXT_TYPE_BASE "MA", NULL },
+ { 0, 0, NULL, NULL },
+};
+
+/**
+ * \}
+ */
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* SPA_AUDIO_DTS_TYPES_H */
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/dts.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/dts.h
new file mode 100644
index 000000000000..4ed16c3ef61d
--- /dev/null
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/dts.h
@@ -0,0 +1,51 @@
+/* Simple Plugin API */
+/* SPDX-FileCopyrightText: Copyright © 2025 Carlos Rafael Giani */
+/* SPDX-License-Identifier: MIT */
+
+#ifndef SPA_AUDIO_DTS_H
+#define SPA_AUDIO_DTS_H
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \addtogroup spa_param
+ * \{
+ */
+
+/**
+ * Possible high-definition DTS extensions on top of core DTS.
+ */
+enum spa_audio_dts_ext_type {
+ SPA_AUDIO_DTS_EXT_UNKNOWN,
+ SPA_AUDIO_DTS_EXT_NONE, /**< No extension present; this is just regular DTS data */
+ SPA_AUDIO_DTS_EXT_HD_HRA, /**< DTS-HD High Resolution Audio (lossy HD audio extension) */
+ SPA_AUDIO_DTS_EXT_HD_MA, /**< DTS-HD Master Audio (lossless HD audio extension) */
+};
+
+/**
+ * DTS Coherent Acoustics audio info. Optional extensions on top
+ * of the DTS content can be present, resulting in what is known
+ * as DTS-HD. \a ext_type specifies which extension is used in
+ * combination with the core DTS content (if any).
+ */
+struct spa_audio_info_dts {
+ uint32_t rate; /*< sample rate */
+ uint32_t channels; /*< number of channels */
+ enum spa_audio_dts_ext_type ext_type; /*< DTS-HD extension type */
+};
+
+#define SPA_AUDIO_INFO_DTS_INIT(...) ((struct spa_audio_info_dts) { __VA_ARGS__ })
+
+/**
+ * \}
+ */
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* SPA_AUDIO_DTS_H */
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/iec958-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/iec958-types.h
index 6e2e3f028a5b..eda1ac2daba0 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/iec958-types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/iec958-types.h
@@ -5,13 +5,13 @@
#ifndef SPA_AUDIO_IEC958_TYPES_H
#define SPA_AUDIO_IEC958_TYPES_H
+#include
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
-#include
-#include
-
/**
* \addtogroup spa_param
* \{
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/iec958.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/iec958.h
index 103f235cb669..1ddeb0865622 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/iec958.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/iec958.h
@@ -31,7 +31,7 @@ enum spa_audio_iec958_codec {
};
struct spa_audio_info_iec958 {
- enum spa_audio_iec958_codec codec; /*< format, one of the DSP formats in enum spa_audio_format_dsp */
+ enum spa_audio_iec958_codec codec; /*< codec, one of the values in enum spa_audio_iec958_codec */
uint32_t flags; /*< extra flags */
uint32_t rate; /*< sample rate */
};
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/layout-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/layout-types.h
new file mode 100644
index 000000000000..f996fddefed5
--- /dev/null
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/layout-types.h
@@ -0,0 +1,118 @@
+/* Simple Plugin API */
+/* SPDX-FileCopyrightText: Copyright © 2025 Wim Taymans */
+/* SPDX-License-Identifier: MIT */
+
+#ifndef SPA_AUDIO_LAYOUT_TYPES_H
+#define SPA_AUDIO_LAYOUT_TYPES_H
+
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \addtogroup spa_param
+ * \{
+ */
+
+#ifndef SPA_API_AUDIO_LAYOUT_TYPES
+ #ifdef SPA_API_IMPL
+ #define SPA_API_AUDIO_LAYOUT_TYPES SPA_API_IMPL
+ #else
+ #define SPA_API_AUDIO_LAYOUT_TYPES static inline
+ #endif
+#endif
+
+static const struct spa_type_audio_layout_info {
+ const char *name;
+ struct spa_audio_layout_info layout;
+} spa_type_audio_layout_info[] = {
+ { "Mono", { SPA_AUDIO_LAYOUT_Mono } },
+ { "Stereo", { SPA_AUDIO_LAYOUT_Stereo } },
+ { "Quad", { SPA_AUDIO_LAYOUT_Quad } },
+ { "Pentagonal", { SPA_AUDIO_LAYOUT_Pentagonal } },
+ { "Hexagonal", { SPA_AUDIO_LAYOUT_Hexagonal } },
+ { "Octagonal", { SPA_AUDIO_LAYOUT_Octagonal } },
+ { "Cube", { SPA_AUDIO_LAYOUT_Cube } },
+ { "MPEG-1.0", { SPA_AUDIO_LAYOUT_MPEG_1_0 } },
+ { "MPEG-2.0", { SPA_AUDIO_LAYOUT_MPEG_2_0 } },
+ { "MPEG-3.0A", { SPA_AUDIO_LAYOUT_MPEG_3_0A } },
+ { "MPEG-3.0B", { SPA_AUDIO_LAYOUT_MPEG_3_0B } },
+ { "MPEG-4.0A", { SPA_AUDIO_LAYOUT_MPEG_4_0A } },
+ { "MPEG-4.0B", { SPA_AUDIO_LAYOUT_MPEG_4_0B } },
+ { "MPEG-5.0A", { SPA_AUDIO_LAYOUT_MPEG_5_0A } },
+ { "MPEG-5.0B", { SPA_AUDIO_LAYOUT_MPEG_5_0B } },
+ { "MPEG-5.0C", { SPA_AUDIO_LAYOUT_MPEG_5_0C } },
+ { "MPEG-5.0D", { SPA_AUDIO_LAYOUT_MPEG_5_0D } },
+ { "MPEG-5.1A", { SPA_AUDIO_LAYOUT_MPEG_5_1A } },
+ { "MPEG-5.1B", { SPA_AUDIO_LAYOUT_MPEG_5_1B } },
+ { "MPEG-5.1C", { SPA_AUDIO_LAYOUT_MPEG_5_1C } },
+ { "MPEG-5.1D", { SPA_AUDIO_LAYOUT_MPEG_5_1D } },
+ { "MPEG-6.1A", { SPA_AUDIO_LAYOUT_MPEG_6_1A } },
+ { "MPEG-7.1A", { SPA_AUDIO_LAYOUT_MPEG_7_1A } },
+ { "MPEG-7.1B", { SPA_AUDIO_LAYOUT_MPEG_7_1B } },
+ { "MPEG-7.1C", { SPA_AUDIO_LAYOUT_MPEG_7_1C } },
+ { "2.1", { SPA_AUDIO_LAYOUT_2_1 } },
+ { "2RC", { SPA_AUDIO_LAYOUT_2RC } },
+ { "2FC", { SPA_AUDIO_LAYOUT_2FC } },
+ { "3.1", { SPA_AUDIO_LAYOUT_3_1 } },
+ { "4.0", { SPA_AUDIO_LAYOUT_4_0 } },
+ { "2.2", { SPA_AUDIO_LAYOUT_2_2 } },
+ { "4.1", { SPA_AUDIO_LAYOUT_4_1 } },
+ { "5.0", { SPA_AUDIO_LAYOUT_5_0 } },
+ { "5.0R", { SPA_AUDIO_LAYOUT_5_0R } },
+ { "5.1", { SPA_AUDIO_LAYOUT_5_1 } },
+ { "5.1R", { SPA_AUDIO_LAYOUT_5_1R } },
+ { "6.0", { SPA_AUDIO_LAYOUT_6_0 } },
+ { "6.0F", { SPA_AUDIO_LAYOUT_6_0F } },
+ { "6.1", { SPA_AUDIO_LAYOUT_6_1 } },
+ { "6.1F", { SPA_AUDIO_LAYOUT_6_1F } },
+ { "7.0", { SPA_AUDIO_LAYOUT_7_0 } },
+ { "7.0F", { SPA_AUDIO_LAYOUT_7_0F } },
+ { "7.1", { SPA_AUDIO_LAYOUT_7_1 } },
+ { "7.1W", { SPA_AUDIO_LAYOUT_7_1W } },
+ { "7.1WR", { SPA_AUDIO_LAYOUT_7_1WR } },
+ { NULL, { 0, { SPA_AUDIO_CHANNEL_UNKNOWN } } },
+};
+
+SPA_API_AUDIO_LAYOUT_TYPES int
+spa_audio_layout_info_parse_name(struct spa_audio_layout_info *layout, size_t size,
+ const char *name)
+{
+ uint32_t max_position = SPA_AUDIO_LAYOUT_INFO_MAX_POSITION(size);
+ if (spa_strstartswith(name, "AUX")) {
+ uint32_t i, n_pos;
+ if (spa_atou32(name+3, &n_pos, 10)) {
+ if (n_pos > max_position)
+ return -ECHRNG;
+ for (i = 0; i < 0x1000 && i < n_pos; i++)
+ layout->position[i] = SPA_AUDIO_CHANNEL_AUX0 + i;
+ for (; i < n_pos; i++)
+ layout->position[i] = SPA_AUDIO_CHANNEL_UNKNOWN;
+ layout->n_channels = n_pos;
+ return n_pos;
+ }
+ }
+ SPA_FOR_EACH_ELEMENT_VAR(spa_type_audio_layout_info, i) {
+ if (spa_streq(name, i->name)) {
+ if (i->layout.n_channels > max_position)
+ return -ECHRNG;
+ *layout = i->layout;
+ return i->layout.n_channels;
+ }
+ }
+ return -ENOTSUP;
+}
+
+/**
+ * \}
+ */
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* SPA_AUDIO_LAYOUT_TYPES_H */
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/layout.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/layout.h
new file mode 100644
index 000000000000..0352bef944b9
--- /dev/null
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/layout.h
@@ -0,0 +1,174 @@
+/* Simple Plugin API */
+/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
+/* SPDX-License-Identifier: MIT */
+
+#ifndef SPA_AUDIO_LAYOUT_H
+#define SPA_AUDIO_LAYOUT_H
+
+#include
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \addtogroup spa_param
+ * \{
+ */
+
+struct spa_audio_layout_info {
+ uint32_t n_channels;
+ uint32_t position[SPA_AUDIO_MAX_CHANNELS];
+ /* padding may follow to allow more channels */
+};
+
+#define SPA_AUDIO_LAYOUT_INFO_MAX_POSITION(size) (((size)-offsetof(struct spa_audio_layout_info,position))/sizeof(uint32_t))
+
+#define SPA_AUDIO_LAYOUT_Mono 1, { SPA_AUDIO_CHANNEL_MONO, }
+#define SPA_AUDIO_LAYOUT_Stereo 2, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, }
+#define SPA_AUDIO_LAYOUT_Quad 4, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, }
+#define SPA_AUDIO_LAYOUT_Pentagonal 5, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, \
+ SPA_AUDIO_CHANNEL_FC, }
+#define SPA_AUDIO_LAYOUT_Hexagonal 6, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_RC, }
+#define SPA_AUDIO_LAYOUT_Octagonal 8, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_RC, \
+ SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
+#define SPA_AUDIO_LAYOUT_Cube 8, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, \
+ SPA_AUDIO_CHANNEL_TFL, SPA_AUDIO_CHANNEL_TFR, \
+ SPA_AUDIO_CHANNEL_TRL, SPA_AUDIO_CHANNEL_TRR, }
+
+
+#define SPA_AUDIO_LAYOUT_MPEG_1_0 SPA_AUDIO_LAYOUT_Mono
+#define SPA_AUDIO_LAYOUT_MPEG_2_0 SPA_AUDIO_LAYOUT_Stereo
+#define SPA_AUDIO_LAYOUT_MPEG_3_0A 3, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, }
+#define SPA_AUDIO_LAYOUT_MPEG_3_0B 3, { SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_FL, \
+ SPA_AUDIO_CHANNEL_FR, }
+#define SPA_AUDIO_LAYOUT_MPEG_4_0A 4, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_RC, }
+#define SPA_AUDIO_LAYOUT_MPEG_4_0B 4, { SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_FL, \
+ SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_RC, }
+#define SPA_AUDIO_LAYOUT_MPEG_5_0A 5, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_SL, \
+ SPA_AUDIO_CHANNEL_SR, }
+#define SPA_AUDIO_LAYOUT_MPEG_5_0B 5, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, \
+ SPA_AUDIO_CHANNEL_FC, }
+#define SPA_AUDIO_LAYOUT_MPEG_5_0C 5, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FC, \
+ SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_SL, \
+ SPA_AUDIO_CHANNEL_SR, }
+#define SPA_AUDIO_LAYOUT_MPEG_5_0D 5, { SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_FL, \
+ SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_SL, \
+ SPA_AUDIO_CHANNEL_SR, }
+#define SPA_AUDIO_LAYOUT_MPEG_5_1A 6, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
+ SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
+#define SPA_AUDIO_LAYOUT_MPEG_5_1B 6, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, }
+#define SPA_AUDIO_LAYOUT_MPEG_5_1C 6, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FC, \
+ SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_SL, \
+ SPA_AUDIO_CHANNEL_SR, SPA_AUDIO_CHANNEL_LFE, }
+#define SPA_AUDIO_LAYOUT_MPEG_5_1D 6, { SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_FL, \
+ SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_SL, \
+ SPA_AUDIO_CHANNEL_SR, SPA_AUDIO_CHANNEL_LFE, }
+#define SPA_AUDIO_LAYOUT_MPEG_6_1A 7, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
+ SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, \
+ SPA_AUDIO_CHANNEL_RC, }
+#define SPA_AUDIO_LAYOUT_MPEG_7_1A 8, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
+ SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, \
+ SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
+#define SPA_AUDIO_LAYOUT_MPEG_7_1B 8, { SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_SL, \
+ SPA_AUDIO_CHANNEL_SR, SPA_AUDIO_CHANNEL_FL, \
+ SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_RL, \
+ SPA_AUDIO_CHANNEL_RR, SPA_AUDIO_CHANNEL_LFE, }
+#define SPA_AUDIO_LAYOUT_MPEG_7_1C 8, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
+ SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, \
+ SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, }
+
+
+#define SPA_AUDIO_LAYOUT_2_1 3, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_LFE, }
+
+#define SPA_AUDIO_LAYOUT_2RC 3, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_RC, }
+#define SPA_AUDIO_LAYOUT_2FC 3, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, }
+
+#define SPA_AUDIO_LAYOUT_3_1 4, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, }
+#define SPA_AUDIO_LAYOUT_4_0 4, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_RC, }
+#define SPA_AUDIO_LAYOUT_2_2 4, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
+
+#define SPA_AUDIO_LAYOUT_4_1 5, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
+ SPA_AUDIO_CHANNEL_RC, }
+#define SPA_AUDIO_LAYOUT_5_0 5, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_SL, \
+ SPA_AUDIO_CHANNEL_SR, }
+#define SPA_AUDIO_LAYOUT_5_0R 5, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_RL, \
+ SPA_AUDIO_CHANNEL_RR, }
+#define SPA_AUDIO_LAYOUT_5_1 6, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
+ SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
+#define SPA_AUDIO_LAYOUT_5_1R 6, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
+ SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, }
+#define SPA_AUDIO_LAYOUT_6_0 6, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_RC, \
+ SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
+#define SPA_AUDIO_LAYOUT_6_0F 6, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FLC, SPA_AUDIO_CHANNEL_FRC, \
+ SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
+#define SPA_AUDIO_LAYOUT_6_1 7, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
+ SPA_AUDIO_CHANNEL_RC, SPA_AUDIO_CHANNEL_SL, \
+ SPA_AUDIO_CHANNEL_SR, }
+#define SPA_AUDIO_LAYOUT_6_1F 7, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
+ SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, \
+ SPA_AUDIO_CHANNEL_RC, }
+#define SPA_AUDIO_LAYOUT_7_0 7, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_RL, \
+ SPA_AUDIO_CHANNEL_RR, SPA_AUDIO_CHANNEL_SL, \
+ SPA_AUDIO_CHANNEL_SR, }
+#define SPA_AUDIO_LAYOUT_7_0F 7, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_FLC, \
+ SPA_AUDIO_CHANNEL_FRC, SPA_AUDIO_CHANNEL_SL, \
+ SPA_AUDIO_CHANNEL_SR, }
+#define SPA_AUDIO_LAYOUT_7_1 8, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
+ SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, \
+ SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
+#define SPA_AUDIO_LAYOUT_7_1W 8, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
+ SPA_AUDIO_CHANNEL_FLC, SPA_AUDIO_CHANNEL_FRC, \
+ SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR, }
+#define SPA_AUDIO_LAYOUT_7_1WR 8, { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, \
+ SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, \
+ SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, \
+ SPA_AUDIO_CHANNEL_FLC, SPA_AUDIO_CHANNEL_FRC, }
+
+/**
+ * \}
+ */
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* SPA_AUDIO_LAYOUT_H */
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/mp3-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/mp3-types.h
index 8974f1efb336..1cd3d67693f3 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/mp3-types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/mp3-types.h
@@ -5,13 +5,13 @@
#ifndef SPA_AUDIO_MP3_TYPES_H
#define SPA_AUDIO_MP3_TYPES_H
+#include