Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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
Loading