Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
92685af
Bump ant from 1.9.4 to 1.9.15
dependabot[bot] Sep 14, 2020
78047e5
Merge pull request #5 from hendriks73/dependabot/maven/org.apache.ant…
hendriks73 Sep 14, 2020
cfbc494
Merge branch 'dev' into main
hendriks73 Oct 26, 2021
1a61a94
Rel 0.9.33.
hendriks73 Oct 26, 2021
f812407
Merge branch 'dev' into main
hendriks73 Nov 5, 2021
1d6ceb6
Rel. 0.9.34.
hendriks73 Nov 5, 2021
a50d7f3
Merge branch 'dev' into main
hendriks73 Nov 5, 2021
715b69f
Merge branch 'dev' into main
hendriks73 Nov 5, 2021
4cbf0d0
Rel 0.9.36.
hendriks73 Nov 5, 2021
288b5ee
Rel 0.9.37.
hendriks73 Nov 5, 2021
b49241b
Merge branch 'dev' into main
hendriks73 Nov 25, 2021
e994c44
Re-deploy, because of Sonatype issue.
hendriks73 Nov 25, 2021
9734103
Attempt at fixing repo link.
hendriks73 Nov 25, 2021
a9c5b48
Updated version.
hendriks73 Nov 25, 2021
76671e3
Increased stagingProgressTimeoutMinutes to 30.
hendriks73 Nov 25, 2021
c3b930e
Moved to 0.9.41.
hendriks73 Nov 25, 2021
0ba2886
Merge branch 'dev' into main
hendriks73 Nov 30, 2021
a501d88
--
hendriks73 Nov 30, 2021
6a69692
Merge branch 'dev' into main
hendriks73 Jan 11, 2022
2ff1fec
Merge branch 'dev' into main
hendriks73 Jan 12, 2022
99e3b41
Merge branch 'dev' into main
hendriks73 Apr 21, 2022
8e4d1b3
Merge branch 'dev'
hendriks73 May 11, 2023
851882c
Merge branch 'dev'
hendriks73 May 11, 2023
0cb77f2
Merge branch 'dev'
hendriks73 May 11, 2023
e7250f7
Merge branch 'dev'
hendriks73 May 11, 2023
fb9a65c
Fixed version.
hendriks73 May 11, 2023
2ff9beb
Merge branch 'dev'
hendriks73 May 11, 2023
b35122f
Merge branch 'dev'
hendriks73 Jun 26, 2023
ed91596
Rel 0.9.50.
hendriks73 Jun 26, 2023
782259b
Fixed bad version number in module ffsampledsp-aarch64-unix.
hendriks73 Jun 26, 2023
49554d8
Rel 0.9.52.
hendriks73 Jun 26, 2023
aa885da
Merge branch 'dev'
hendriks73 Aug 2, 2023
fb9afb1
Added url space decoding.
Supernova1114 Jan 27, 2025
586b683
Update FFAudioFileReader.java
Supernova1114 Jan 28, 2025
9a3158c
Added proper URL decoding
Supernova1114 Jan 29, 2025
67982d5
Added comments
Supernova1114 Jan 29, 2025
a781c80
added new url decoding fix
Supernova1114 Jan 29, 2025
8b5a5f6
Added encoding for plus character
Supernova1114 Jan 29, 2025
6532d2b
Removed deprecated URL() call, added + char encoding for URLs
Supernova1114 Jan 29, 2025
7229b35
Simplified statement
Supernova1114 Jan 29, 2025
11d5e93
Simplified statement
Supernova1114 Jan 29, 2025
cb7c930
Fixes for linux
Supernova1114 Feb 9, 2025
cb6a1f4
Fixes for audio files without file extension
Supernova1114 Feb 9, 2025
4de2e1c
Update Main.java
Supernova1114 Feb 9, 2025
f02952e
Update FFAudioFileFormat.java
Supernova1114 Feb 9, 2025
d6958c6
Merge branch 'windows-url-fix-main' into bugfix/windows-file-url-decode
Supernova1114 Feb 27, 2025
378db96
Removed build files
Supernova1114 Feb 27, 2025
87387d5
Remove temp main.java
Supernova1114 Feb 27, 2025
0c39755
Update FFAudioFileFormat.java
Supernova1114 Feb 27, 2025
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
Expand Up @@ -116,6 +116,7 @@ private static float determineFrameRate(final int codecId, final float sampleRat
}

private static Type getAudioFileFormatType(final String url, final int codecId) throws UnsupportedAudioFileException {

if (url == null) {
final AudioFormat.Encoding encoding = FFAudioFormat.FFEncoding.getInstance(codecId);
final Type type = TYPE_MAP.get(codecId);
Expand Down Expand Up @@ -149,7 +150,11 @@ private static Type getAudioFileFormatType(final String url, final int codecId)
fileType = new Type(extension.toUpperCase(), extension);
}
} else {
throw new UnsupportedAudioFileException("Unknown target audio url type: " + url);
// For audio files without explicit extension in file name.
final AudioFormat.Encoding encoding = FFAudioFormat.FFEncoding.getInstance(codecId);
final Type type = TYPE_MAP.get(codecId);
if (type != null) return type;
return new Type(encoding.toString().toUpperCase(), encoding.toString());
}
return fileType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import javax.sound.sampled.spi.AudioFileReader;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLDecoder;
import java.nio.ByteBuffer;
Expand Down Expand Up @@ -126,30 +127,31 @@ public AudioFileFormat[] getAudioFileFormats(final File file) throws Unsupported
* @throws MalformedURLException if the URL is malformed
*/
static URL fileToURL(final File file) throws MalformedURLException {
try {
String encoded = file.toURI().toString().replace("+", "%2B");
return new URL(URLDecoder.decode(encoded, "UTF-8"));
} catch (UnsupportedEncodingException e) {
final MalformedURLException malformedURLException = new MalformedURLException();
malformedURLException.initCause(e);
throw malformedURLException;
}
String encoded = file.toURI().toString().replace("+", "%2B");
return URI.create(encoded).toURL();
}

/**
* Make sure that file URLs on Windows follow the super special libav style, e.g. "file:C:/path/file.ext"
* or "file://UNCServerName/path/file.ext".
*/
static String urlToString(final URL url) {
static String urlToString(final URL url) throws UnsupportedEncodingException {
if (url == null) return null;
final String s = url.toString();
if (WINDOWS && s.matches("file\\:/[^\\/].*")) {
return s.replace("file:/", "file:");
}
// deal with UNC paths
if (WINDOWS && s.matches("file\\:////[^\\/].*")) {
return s.replace("file://", "file:");

String s = url.toString();

// Encode "+" character
s = s.replace("+", "%2B");
s = URLDecoder.decode(s, "UTF-8");

if (WINDOWS) {
if (s.matches("file\\:/[^\\/].*")) {
s = s.replace("file:/", "file:"); // (file:/) -> (file:)
} else if (s.matches("file\\:////[^\\/].*")) {
s = s.replace("file://", "file:"); // For UNC paths (file:////) -> (file://)
}
}

return s;
}

Expand Down