public class FFURLInputStream extends FFNativePeerInputStream
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_FILE_BUFFER_SIZE
Default I/O buffer size for
file: URLs when no explicit value is configured: 1048576
bytes (1 MB). |
static int |
DEFAULT_URL_BUFFER_SIZE
Default I/O buffer size for non-
file: URLs when no explicit value is configured:
65536 bytes (64 KB). |
static String |
FILE_BUFFER_SIZE_PROPERTY
Name of the system property that overrides
DEFAULT_FILE_BUFFER_SIZE for file:
URLs when no explicit buffer size is supplied to a constructor. |
static String |
URL_BUFFER_SIZE_PROPERTY
Name of the system property that overrides
DEFAULT_URL_BUFFER_SIZE for non-file: URLs when no explicit buffer size is supplied to a constructor. |
nativeBuffer, pointer| Constructor and Description |
|---|
FFURLInputStream(URL url)
Opens the first audio stream from the given URL using the default I/O buffer size.
|
FFURLInputStream(URL url,
int streamIndex)
Opens the specified audio stream index from the given URL using the default I/O buffer size.
|
FFURLInputStream(URL url,
int streamIndex,
int fileBufferSize)
Opens the specified audio stream index from the given URL with an explicit file I/O buffer
size.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
close(long pointer)
Closes the native peer and releases all resources held by it.
|
protected void |
fillNativeBuffer()
Fills
FFNativePeerInputStream.nativeBuffer with new data. |
static int |
getDefaultBufferSize(URL url)
Returns the default I/O buffer size for the given URL.
|
static int |
getDefaultFileBufferSize()
Returns the I/O buffer size to use for
file: URLs when none is specified explicitly. |
static int |
getDefaultUrlBufferSize()
Returns the I/O buffer size to use for non-
file: URLs when none is specified
explicitly. |
int |
getFileBufferSize()
Returns the file I/O buffer size configured for this stream.
|
boolean |
isSeekable()
Returns
true if this stream supports seeking. |
void |
seek(long time,
TimeUnit timeUnit)
Seeks to the given position in the stream.
|
String |
toString() |
close, finalize, isOpen, read, readavailable, mark, markSupported, read, reset, skippublic static final int DEFAULT_FILE_BUFFER_SIZE
file: URLs when no explicit value is configured: 1048576
bytes (1 MB).FILE_BUFFER_SIZE_PROPERTY,
Constant Field Valuespublic static final String FILE_BUFFER_SIZE_PROPERTY
DEFAULT_FILE_BUFFER_SIZE for file:
URLs when no explicit buffer size is supplied to a constructor. The property value must be a
positive integer representing the desired buffer size in bytes.
Example: -Dffsampledsp.fileBufferSize=524288 sets a 512 KB buffer.
public static final int DEFAULT_URL_BUFFER_SIZE
file: URLs when no explicit value is configured:
65536 bytes (64 KB). A smaller value is used here to reduce latency when streaming over a
slow network.URL_BUFFER_SIZE_PROPERTY,
Constant Field Valuespublic static final String URL_BUFFER_SIZE_PROPERTY
DEFAULT_URL_BUFFER_SIZE for non-file: URLs when no explicit buffer size is supplied to a constructor. The property value must
be a positive integer representing the desired buffer size in bytes.
Example: -Dffsampledsp.urlBufferSize=32768 sets a 32 KB buffer.
public FFURLInputStream(URL url) throws IOException, UnsupportedAudioFileException
For file: URLs the buffer size comes from "ffsampledsp.fileBufferSize",
falling back to DEFAULT_FILE_BUFFER_SIZE. For all other URLs it comes from "ffsampledsp.urlBufferSize", falling back to DEFAULT_URL_BUFFER_SIZE.
url - URL of the audio resource to decodeIOException - if an I/O error occursUnsupportedAudioFileException - if the URL points to an unsupported or DRM-protected fileFILE_BUFFER_SIZE_PROPERTY,
URL_BUFFER_SIZE_PROPERTYpublic FFURLInputStream(URL url, int streamIndex) throws IOException, UnsupportedAudioFileException
For file: URLs the buffer size comes from "ffsampledsp.fileBufferSize",
falling back to DEFAULT_FILE_BUFFER_SIZE. For all other URLs it comes from "ffsampledsp.urlBufferSize", falling back to DEFAULT_URL_BUFFER_SIZE.
url - URL of the audio resource to decodestreamIndex - zero-based index of the audio stream to openIOException - if an I/O error occursUnsupportedAudioFileException - if the URL points to an unsupported or DRM-protected fileFILE_BUFFER_SIZE_PROPERTY,
URL_BUFFER_SIZE_PROPERTYpublic FFURLInputStream(URL url, int streamIndex, int fileBufferSize) throws IOException, UnsupportedAudioFileException
The fileBufferSize is passed directly to FFmpeg as the AVFormatContext
io_buffer_size, controlling the size of the internal read buffer used when reading from
disk or network. Larger values reduce system-call overhead and improve throughput for bulk
transcoding or analysis at the cost of higher memory usage per stream. A value of DEFAULT_FILE_BUFFER_SIZE (1 MB) is suitable for most use cases.
url - URL of the audio resource to decodestreamIndex - zero-based index of the audio stream to openfileBufferSize - FFmpeg file I/O buffer size in bytes; must be positiveIOException - if an I/O error occursUnsupportedAudioFileException - if the URL points to an unsupported or DRM-protected fileIllegalArgumentException - if fileBufferSize is not positivepublic int getFileBufferSize()
public static int getDefaultFileBufferSize()
file: URLs when none is specified explicitly.
Reads the "ffsampledsp.fileBufferSize" system property; falls back to DEFAULT_FILE_BUFFER_SIZE if the property is absent or not a positive integer.public static int getDefaultUrlBufferSize()
file: URLs when none is specified
explicitly. Reads the "ffsampledsp.urlBufferSize" system property; falls back to DEFAULT_URL_BUFFER_SIZE if the property is absent or not a positive integer.public static int getDefaultBufferSize(URL url)
getDefaultFileBufferSize() for file: URLs and to getDefaultUrlBufferSize()
for all others.url - URL whose scheme determines which default appliespublic boolean isSeekable()
FFNativePeerInputStreamtrue if this stream supports seeking.isSeekable in class FFNativePeerInputStreamtrue if seeking is supportedFFAudioInputStream.isSeekable()public void seek(long time,
TimeUnit timeUnit)
throws UnsupportedOperationException,
IOException
FFNativePeerInputStreamseek in class FFNativePeerInputStreamtime - position to seek totimeUnit - unit of timeIOException - if an IO error occursUnsupportedOperationExceptionFFAudioInputStream.seek(long, java.util.concurrent.TimeUnit)protected void fillNativeBuffer()
throws IOException
FFNativePeerInputStreamFFNativePeerInputStream.nativeBuffer with new data.fillNativeBuffer in class FFNativePeerInputStreamIOException - if an IO error occursprotected void close(long pointer)
throws IOException
FFNativePeerInputStreamclose in class FFNativePeerInputStreampointer - pointerIOException - if an IO error occursCopyright © 2013–2026 Jalulo UG (haftungsbeschränkt). All rights reserved.