
public interface IURLProtocolHandler
You must implement this interface if you want to register a
new type of URLProtocolHandler with the URLProtocolManager.
If you throw an exception in your implementation of this handler during a callback from within Humble Video, we will assume your method returned -1 while still in native code. Once the stack unwinds back into Java we will re-raise your exception.
FileProtocolHandler,
NullProtocolHandler| Modifier and Type | Field and Description |
|---|---|
static int |
SEEK_CUR
A flag for
seek(long, int). |
static int |
SEEK_END
A flag for
seek(long, int). |
static int |
SEEK_SET
A flag for
seek(long, int). |
static int |
SEEK_SIZE
A flag for
seek(long, int). |
static int |
URL_RDONLY_MODE
Open the file in Read Only mode.
|
static int |
URL_RDWR
Implement the file in Read/Write mode.
|
static int |
URL_WRONLY_MODE
Open the file in Write Only mode.
|
| Modifier and Type | Method and Description |
|---|---|
int |
close()
A request to close() from FFMPEG
|
boolean |
isStreamed(String url,
int flags)
Special callback made by Humble Video in order to determine if your
stream supports streaming.
|
int |
open(String url,
int flags)
This method gets called by FFMPEG when it opens a file.
|
int |
read(byte[] buf,
int size)
This method gets called by FFMPEG when it tries to read data.
|
long |
seek(long offset,
int whence)
A request from FFMPEG to seek to a position in the stream.
|
int |
write(byte[] buf,
int size)
This method gets called by FFMPEG when it tries to write data.
|
static final int SEEK_SET
seek(long, int). Denotes positions relative to start of file.static final int SEEK_CUR
seek(long, int). Denotes positions relative to where the current file pointer is.static final int SEEK_END
seek(long, int). Denotes positions relative to the end of file.static final int SEEK_SIZE
seek(long, int).
A special hack of FFMPEG, denotes you want to find the total size of the file.static final int URL_RDONLY_MODE
static final int URL_WRONLY_MODE
static final int URL_RDWR
int open(String url, int flags)
url - The URL to openflags - The flags (e.g. URL_RDONLY_MODE)int read(byte[] buf,
int size)
For non-blocking IO, return:
io.humble.video.Error#typeToErrorNumber(io.humble.video.Error.Type)
pass in io.humble.video.Error.Type#ERROR_AGAIN for the error type. This
returns the platform specific number for EAGAIN on your platform
signaling that callers should try again later.
Alternately implementors may block until data is returning, but they should then
respect the Thread.isInterrupted() setting.
buf - The buffer to write your data to.size - The number of bytes in buf data available for you to write the data that FFMPEG will read.int write(byte[] buf,
int size)
For non-blocking IO, return:
io.humble.video.Error#typeToErrorNumber(io.humble.video.Error.Type)
pass in io.humble.video.Error.Type#ERROR_AGAIN for the error type. This
returns the platform specific number for EAGAIN on your platform
signaling that callers should try again later.
Alternately implementators may block until data is returning, but they should then
respect the Thread.isInterrupted() setting.
buf - The data you should write.size - The number of bytes in buf.long seek(long offset,
int whence)
offset - The offset in bytes.whence - Where that offset is relative to. Follow the C stdlib fseek() conventions EXCEPT
SEEK_SIZE should return back the size of the stream in bytes if known without adjusting
the seek pointer.int close()
boolean isStreamed(String url, int flags)
If this method returns true, Humble Video will assume it cannot seek backwards in this container.
This has one main practical consequence. When writing it means certain container formats (e.g. the MOV container) will not be usable as it requires seeking back to the start of a file to write MOV required header information once the entire file has been encoded.
But if your medium is streaming, you'll want to return true for this, and then FFMPEG will not attempt to seek back in time.
url - The URL that would be passed to open(String, int)flags - The flags that would be passed to open(String, int)Copyright © 2018 Humble Software. All rights reserved.