Skip to content

Commit fe81a27

Browse files
author
Alexander Matveev
committed
8287822: [macos] Remove support of duplicated formats from macOS
Reviewed-by: angorya, kcr
1 parent 9416874 commit fe81a27

File tree

26 files changed

+499
-2828
lines changed

26 files changed

+499
-2828
lines changed

modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/platform/gstreamer/GSTPlatform.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
4141
*/
4242
public final class GSTPlatform extends Platform {
4343
/**
44-
* The MIME types of all supported media.
44+
* The MIME types of all supported media on Windows and Linux.
4545
*/
4646
private static final String[] CONTENT_TYPES = {
4747
"audio/x-aiff",
@@ -55,6 +55,14 @@ public final class GSTPlatform extends Platform {
5555
"audio/mpegurl"
5656
};
5757

58+
/**
59+
* The MIME types of all supported media on macOS.
60+
*/
61+
private static final String[] CONTENT_TYPES_MACOS = {
62+
"audio/x-aiff",
63+
"audio/x-wav"
64+
};
65+
5866
/**
5967
* All supported protocols.
6068
*/
@@ -99,7 +107,11 @@ private GSTPlatform() {}
99107

100108
@Override
101109
public String[] getSupportedContentTypes() {
102-
return Arrays.copyOf(CONTENT_TYPES, CONTENT_TYPES.length);
110+
if (HostUtils.isMacOSX()) {
111+
return Arrays.copyOf(CONTENT_TYPES_MACOS, CONTENT_TYPES_MACOS.length);
112+
} else {
113+
return Arrays.copyOf(CONTENT_TYPES, CONTENT_TYPES.length);
114+
}
103115
}
104116

105117
@Override

modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/platform/osx/OSXMediaPlayer.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,8 @@ final class OSXMediaPlayer extends NativeMediaPlayer {
4646
init();
4747
mediaLocator = sourceMedia.getLocator();
4848
// This will throw an exception if we can't create the player
49-
osxCreatePlayer(mediaLocator.getStringLocation());
49+
osxCreatePlayer(mediaLocator, mediaLocator.getContentType(),
50+
mediaLocator.getContentLength());
5051
audioEq = createNativeAudioEqualizer(osxGetAudioEqualizerRef());
5152
audioSpectrum = createNativeAudioSpectrum(osxGetAudioSpectrumRef());
5253
}
@@ -169,7 +170,9 @@ protected void playerDispose() {
169170
public void playerInit() throws MediaException {
170171
}
171172

172-
private native void osxCreatePlayer(String sourceURI) throws MediaException;
173+
private native void osxCreatePlayer(Locator locator,
174+
String contentType,
175+
long sizeHint) throws MediaException;
173176
// Have to use native references for these two things
174177
private native long osxGetAudioEqualizerRef();
175178
private native long osxGetAudioSpectrumRef();
@@ -191,4 +194,5 @@ public void playerInit() throws MediaException {
191194
private native double osxGetDuration() throws MediaException;
192195
private native void osxSeek(double streamTime) throws MediaException;
193196
private native void osxDispose();
197+
private native boolean osxNeedsLocator() throws MediaException;
194198
}

modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/platform/osx/OSXPlatform.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,6 @@ public final class OSXPlatform extends Platform {
4545
* The MIME types of all supported media.
4646
*/
4747
private static final String[] CONTENT_TYPES = {
48-
"audio/x-aiff",
4948
"audio/mp3",
5049
"audio/mpeg",
5150
"audio/x-m4a",
@@ -61,7 +60,9 @@ public final class OSXPlatform extends Platform {
6160
private static final String[] PROTOCOLS = {
6261
"file",
6362
"http",
64-
"https"
63+
"https",
64+
"jrt",
65+
"resource"
6566
};
6667

6768
private static final class OSXPlatformInitializer {

0 commit comments

Comments
 (0)