Skip to content

Commit

Permalink
8287822: [macos] Remove support of duplicated formats from macOS
Browse files Browse the repository at this point in the history
Reviewed-by: angorya, kcr
  • Loading branch information
Alexander Matveev committed Dec 3, 2022
1 parent 9416874 commit fe81a27
Show file tree
Hide file tree
Showing 26 changed files with 499 additions and 2,828 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022, 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
Expand Down Expand Up @@ -41,7 +41,7 @@
*/
public final class GSTPlatform extends Platform {
/**
* The MIME types of all supported media.
* The MIME types of all supported media on Windows and Linux.
*/
private static final String[] CONTENT_TYPES = {
"audio/x-aiff",
Expand All @@ -55,6 +55,14 @@ public final class GSTPlatform extends Platform {
"audio/mpegurl"
};

/**
* The MIME types of all supported media on macOS.
*/
private static final String[] CONTENT_TYPES_MACOS = {
"audio/x-aiff",
"audio/x-wav"
};

/**
* All supported protocols.
*/
Expand Down Expand Up @@ -99,7 +107,11 @@ private GSTPlatform() {}

@Override
public String[] getSupportedContentTypes() {
return Arrays.copyOf(CONTENT_TYPES, CONTENT_TYPES.length);
if (HostUtils.isMacOSX()) {
return Arrays.copyOf(CONTENT_TYPES_MACOS, CONTENT_TYPES_MACOS.length);
} else {
return Arrays.copyOf(CONTENT_TYPES, CONTENT_TYPES.length);
}
}

@Override
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022, 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
Expand Down Expand Up @@ -46,7 +46,8 @@ final class OSXMediaPlayer extends NativeMediaPlayer {
init();
mediaLocator = sourceMedia.getLocator();
// This will throw an exception if we can't create the player
osxCreatePlayer(mediaLocator.getStringLocation());
osxCreatePlayer(mediaLocator, mediaLocator.getContentType(),
mediaLocator.getContentLength());
audioEq = createNativeAudioEqualizer(osxGetAudioEqualizerRef());
audioSpectrum = createNativeAudioSpectrum(osxGetAudioSpectrumRef());
}
Expand Down Expand Up @@ -169,7 +170,9 @@ protected void playerDispose() {
public void playerInit() throws MediaException {
}

private native void osxCreatePlayer(String sourceURI) throws MediaException;
private native void osxCreatePlayer(Locator locator,
String contentType,
long sizeHint) throws MediaException;
// Have to use native references for these two things
private native long osxGetAudioEqualizerRef();
private native long osxGetAudioSpectrumRef();
Expand All @@ -191,4 +194,5 @@ public void playerInit() throws MediaException {
private native double osxGetDuration() throws MediaException;
private native void osxSeek(double streamTime) throws MediaException;
private native void osxDispose();
private native boolean osxNeedsLocator() throws MediaException;
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022, 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
Expand Down Expand Up @@ -45,7 +45,6 @@ public final class OSXPlatform extends Platform {
* The MIME types of all supported media.
*/
private static final String[] CONTENT_TYPES = {
"audio/x-aiff",
"audio/mp3",
"audio/mpeg",
"audio/x-m4a",
Expand All @@ -61,7 +60,9 @@ public final class OSXPlatform extends Platform {
private static final String[] PROTOCOLS = {
"file",
"http",
"https"
"https",
"jrt",
"resource"
};

private static final class OSXPlatformInitializer {
Expand Down

1 comment on commit fe81a27

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.