de.humatic.dsj.sink
Class MKVSink

java.lang.Object
  extended by de.humatic.dsj.sink.JSink
      extended by de.humatic.dsj.sink.MKVSink
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener

public class MKVSink
extends JSink

Sink for streaming in Matroska (or, at the time being, rather only WebM) format, either from a simple http server or to a user supplied OutputStream.
This class still is experimental. While in principle other av formats than VP8 / Vorbis could be used it currently only supports the WebM codecs. You will need to install the WebM VP8 Encoder Filter and a Vorbis encoder. Be aware that same as this class also the VP8 DirectShow filter is not fully finished and has some limitations. In particular it so far does not offer a very user friendly properties page (it only has one at all since version 0.9.12) or support serialization (both have already been accepted as enhancement requests). For the moment the vpj extension to dsj is the only way to configure encoding in code.
Other things to watch out for:
The VP8Encoder does not seem to be as fast as it should and probably will be at some point. With high input frame & bitrates it is likely that you will have video samples piling up and overall dataflow in the filtergraph being disturbed (listen for SINK_ERROR events for notification).
The encoder only supports some YUV input types. For best performance try to set capture devices to YV12, I420, YUY2 or YUYV output on their capture pins. Plain RGB, RGB555 and some 16bit YUV formats will work with the help of dsj's Color Space Converter, but that of course adds extra processing overhead.
Audio: dsj 0.8.63 should work with both Xiph's and Lead's Vorbis encoders. Other encoders have not been tested.


Field Summary
static int INVALID_VORBIS_SETUP
           
static int MKV_SUBS
           
 
Fields inherited from class de.humatic.dsj.sink.JSink
AV_SYNC_IN, BUFFER_OVERFLOW, CLOSED, CONNECT, CONNECTED, CONNECTION_TIMEOUT, DISPLAY_LOCAL, DUMP, ERROR, HTTP_AUDIO, LOCAL, MAX_BT_DROP, MAX_BT_WARN, MAX_DURATION, MIN_BT, MJPG, MKV, NO_AUDIO, NO_VIDEO, OFFSET_TIME_IN, OFFSET_TIME_OUT, OPT_PKT_SIZE, PIPE_SIZE, pipeSize, PREVIEW, RTMP, RTP, SHOW_DLG_SAVE, SHOW_ENC_DLG, SOCKET_ERROR, SOCKET_SBS, socketSendBufferSize, STARVING, TSNET, UNCONNECTED
 
Constructor Summary
MKVSink(DSFiltergraph src, int port, DSFilterInfo videoEncoder, DSFilterInfo audioEncoder, int flags)
          Creates a server socket on the given port and streams a filtergraph's media in WebM format.
MKVSink(DSFiltergraph src, java.io.OutputStream out, DSFilterInfo videoEncoder, DSFilterInfo audioEncoder, int flags)
           
 
Method Summary
 void close()
          Shuts down the sink and frees all resources it allocated.
 void sampleReceived(SampleBuffer buffer)
          Called from SampleAccessFilters used by this sink.
 void setSinkOption(int option, int value)
           
 
Methods inherited from class de.humatic.dsj.sink.JSink
create, getID, getOutputBufferSize, getOutputMediaType, propertyChange, setNetworkInterface, setSocketOption
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INVALID_VORBIS_SETUP

public static final int INVALID_VORBIS_SETUP
See Also:
Constant Field Values

MKV_SUBS

public static final int MKV_SUBS
See Also:
Constant Field Values
Constructor Detail

MKVSink

public MKVSink(DSFiltergraph src,
               int port,
               DSFilterInfo videoEncoder,
               DSFilterInfo audioEncoder,
               int flags)
        throws java.lang.Exception
Creates a server socket on the given port and streams a filtergraph's media in WebM format. Clients requesting a resource ending in ".webm" or accepting "video/webm" MIME types will be directly fed the stream, clients requesting .html or .htm resources will be served some simple template html containing a html5 video tag and upon parsing and requesting the embedded webm video will be served the stream (this is for html5 & WebM enabled browsers).

Throws:
java.lang.Exception

MKVSink

public MKVSink(DSFiltergraph src,
               java.io.OutputStream out,
               DSFilterInfo videoEncoder,
               DSFilterInfo audioEncoder,
               int flags)
        throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

close

public void close()
Description copied from class: JSink
Shuts down the sink and frees all resources it allocated. This method is called internally when disposing off the graph that was using this sink and is not normally used by application code.

Overrides:
close in class JSink

sampleReceived

public void sampleReceived(SampleBuffer buffer)
Description copied from class: JSink
Called from SampleAccessFilters used by this sink.

Overrides:
sampleReceived in class JSink

setSinkOption

public void setSinkOption(int option,
                          int value)
Overrides:
setSinkOption in class JSink