|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.humatic.dsj.src.Source
de.humatic.dsj.src.NetworkSource
de.humatic.dsj.src.AsyncSource
public class AsyncSource
JNI implementation of DirectShow's IAsyncReader interface, that can be used to play mpg (mpeg1 video and mp3 audio that is),
avi, mp4, wmv / asf, dv, Matroska & flv data from java input streams, including Jar- and ZipInputStreams.
This is basically a clone of the stock FileSource (Async) DirectShow filter, reading data on the java side. Do not use it for
playback of local files or URLs, that DSMovie can open directly, as the JNI overhead makes this far less efficient.
The source operates in combination with DirectShow parser filters, that will issue the read requests. These requests can be seemingly
random in terms of read position and read length during setup while the parser tries to determine the format of the
stream. The incoming stream MUST therefore be seekable itself or be wrapable into a seekable BufferedInputStream. This class's
constructor will fail when InputStream.markSupported() returns false in both cases.
The source will attempt to operate without caching data. It may however be necessary to write portions of a stream to a filecache.
This will be cleaned up after the source exits.
A plain Windows DirectShow installation will bring splitter / parser filters for mpg, avi & wav streams. In order for this class
to work with WindowsMedia, mp4, dv, flv, mkv and other stream formats, additional parsers are required. The dll has hardcoded defaults for
flv (Gabest's FLVSplitter),
dv (Main Concept's DV Dif Parser,
asf(Geraint Davies's GDCL WMV/WMA Parser),
mp4 (Gabest's MP4Splitter) and
mkv (Gabest's MatroskaSplitter).
These can be overwritten by xml preferences in the dsj.xml setup file, linking a file suffix with a filter CLSID. Example:
<preference name="async_splitter"><async_splitter name="flv" value="{47E792CF-0BBE-4F7A-859C-194B0768650A}"/></preference>
| Field Summary |
|---|
| Fields inherited from class de.humatic.dsj.src.NetworkSource |
|---|
BUFFER_OVERFLOW, CONNECTION_TIMEOUT, FASTSTART, H264_FASTSTART, H264_FORCE_INLINE_SPS, H264_OMMIT_SPS, H264_PASS_INLINE_SPS, IDLE_TIMEOUT, KF_NOTIFY, LIVE_SRC, MAX_BUFFER_TIME, MAX_DURATION, MAX_FRAME_TIME, NO_USER_PROMPT, READ_USER_DATA, RECEIVE_TIMEOUT, RTCP_RECEIVE_ERROR, SEEK_FAILURE, SOCKET_ERROR, STARVING, UDP_UNCONNECTED |
| Fields inherited from class de.humatic.dsj.src.Source |
|---|
ASYNC, AUTO_GC, DIRECT, ES, FILTER_SETUP_ERROR, FLV, HTTP, HTTP_AUDIO, JAS, MJPG, MKV, MP4, PSNET, PULL, PUSH, RAW, RTMP, RTP, RTSP, SHOUTCAST, SS_CLOSED, SS_CONNECT, SS_CONNECTED, SS_DONE, SS_EOS, SS_FORMAT_READ, SS_RUNNING, SS_SEEKING, SS_SETUP, SS_STREAMS_READ, SS_TCP_ROLLOVER, TIMEOUT, TSFILE, TSNET, UNKNOWN |
| Constructor Summary | |
|---|---|
AsyncSource(java.io.InputStream in,
int streamSubType,
java.beans.PropertyChangeListener listener)
Reads mpg, avi, wmv, dv and flv data from java input streams. |
|
AsyncSource(java.net.URL url,
java.beans.PropertyChangeListener listener)
Reads mpg, avi, asf, mp4, dv, mkv, wav and flv data from an InputStream opened on the given URL, including jar URLs. |
|
| Method Summary | |
|---|---|
byte[] |
asyncRead(int numBytes)
Called by async sources on a DSFiltergraph internal dispatch thread. |
boolean |
canSeek()
|
void |
closeSource(boolean terminate)
Closes down the source. |
DSGraph |
createGraph(int flags)
Creates a DSGraph object with CompressedJavaSource filters that are fed from this source. |
DSGraph |
createGraph(int flags,
DSFilterInfo videoDecoder,
DSFilterInfo audioDecoder)
Creates a DSGraph object with CompressedJavaSource filters, fed from this source and the given video and audio decoders. |
int |
getAvailable()
Returns the available number of bytes a pull source can access or 0 if unknown. |
DSMediaType[] |
getMediaTypes()
Returns the media types created by this source. |
int |
getSubType()
|
boolean |
streamSeek(int toPos)
Instructs the Source implementation to reposition its read pointer in the incoming stream to the requested byte position. |
byte[] |
syncRead(int numBytes)
Called by async sources on a native DirectShow thread during stream investigation (the MPEG splitter continues to use this method also during normal playback). |
| Methods inherited from class de.humatic.dsj.src.NetworkSource |
|---|
configurePasswordDialog, getDefaultInterfaceAddress, getPasswordDialogOptions, getServerInfo, getTimeConstraint, setConnectionTimeout, setHTTPConnector, setNetworkInterface, setSocketFactory, setTimeConstraint, setUserAgent |
| Methods inherited from class de.humatic.dsj.src.Source |
|---|
addSourceFilter, createSourceFilter_async, createSourceFilter, getBuffered, getGraph, getID, getMaxTimeLoaded, getMinBufferTime, getNumChannels, getOffsetTime, getPath, getSourceDuration, getSourceFilter, getSourceFilters, getSourceFlags, getSourceTime, getTransport, getType, isLive, notifyChannelFailure, queryParameter_int, read, sendEvent, setOffsetTime, setSourceRate, setSourceTime |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AsyncSource(java.io.InputStream in,
int streamSubType,
java.beans.PropertyChangeListener listener)
throws java.lang.Exception
java.lang.Exception
public AsyncSource(java.net.URL url,
java.beans.PropertyChangeListener listener)
throws java.lang.Exception
java.lang.Exception| Method Detail |
|---|
public DSGraph createGraph(int flags)
Source
createGraph in class Source
public DSGraph createGraph(int flags,
DSFilterInfo videoDecoder,
DSFilterInfo audioDecoder)
Source
createGraph in class Sourcepublic void closeSource(boolean terminate)
Source
closeSource in class Sourcepublic DSMediaType[] getMediaTypes()
Source
getMediaTypes in class Sourcepublic boolean streamSeek(int toPos)
Source
streamSeek in class Sourcepublic byte[] syncRead(int numBytes)
Source
syncRead in class Sourcepublic byte[] asyncRead(int numBytes)
Source
asyncRead in class Sourcepublic int getAvailable()
Source
getAvailable in class Sourcepublic int getSubType()
public boolean canSeek()
canSeek in class Source
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||