
public class NullProtocolHandler extends Object implements IURLProtocolHandler
IURLProtocolHandler, but discards
any data written and always returns 0 for reading.
This can be useful if your operating system doesn't have the unix
equivalent of /dev/null or you want to cheaply
discard data.
SEEK_CUR, SEEK_END, SEEK_SET, SEEK_SIZE, URL_RDONLY_MODE, URL_RDWR, URL_WRONLY_MODE| Modifier and Type | Method and Description |
|---|---|
int |
close()
A request to close() from FFMPEG
|
boolean |
isStreamed(String aUrl,
int aFlags)
Special callback made by Humble Video in order to determine if your
stream supports streaming.
|
int |
open(String aUrl,
int aFlags)
This method gets called by FFMPEG when it opens a file.
|
int |
read(byte[] aBuf,
int aSize)
This method gets called by FFMPEG when it tries to read data.
|
long |
seek(long aOffset,
int aWhence)
A request from FFMPEG to seek to a position in the stream.
|
int |
write(byte[] aBuf,
int aSize)
This method gets called by FFMPEG when it tries to write data.
|
public int close()
IURLProtocolHandlerclose in interface IURLProtocolHandlerpublic boolean isStreamed(String aUrl, int aFlags)
IURLProtocolHandlerIf 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.
isStreamed in interface IURLProtocolHandleraUrl - The URL that would be passed to IURLProtocolHandler.open(String, int)aFlags - The flags that would be passed to IURLProtocolHandler.open(String, int)public int open(String aUrl, int aFlags)
IURLProtocolHandleropen in interface IURLProtocolHandleraUrl - The URL to openaFlags - The flags (e.g. IURLProtocolHandler.URL_RDONLY_MODE)public int read(byte[] aBuf,
int aSize)
IURLProtocolHandler
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.
read in interface IURLProtocolHandleraBuf - The buffer to write your data to.aSize - The number of bytes in buf data available for you to write the data that FFMPEG will read.public long seek(long aOffset,
int aWhence)
IURLProtocolHandlerseek in interface IURLProtocolHandleraOffset - The offset in bytes.aWhence - Where that offset is relative to. Follow the C stdlib fseek() conventions EXCEPT
IURLProtocolHandler.SEEK_SIZE should return back the size of the stream in bytes if known without adjusting
the seek pointer.public int write(byte[] aBuf,
int aSize)
IURLProtocolHandler
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.
write in interface IURLProtocolHandleraBuf - The data you should write.aSize - The number of bytes in buf.Copyright © 2018 Humble Software. All rights reserved.