de.humatic.dsj.sink
Class FileSink

java.lang.Object
  extended by de.humatic.dsj.sink.Sink
      extended by de.humatic.dsj.sink.FileSink

public class FileSink
extends Sink

FileSink is an abstraction of filter assemblies that encode and multiplex data into various types of files. While the export and filecapture methods in DSMovie, DSCapture & DSDVCam provide export to avi or Windows Media files, other filetypes can be written via FileSink objects. To do so, construct a FileSink and call connectSink(...) on the DSFiltergraph subclass in use.


Field Summary
static int MKV
          FileSink types used in the forType(...) method.
static int MP4
          FileSink types used in the forType(...) method.
static int OGG
          FileSink types used in the forType(...) method.
static int WAV
          FileSink types used in the forType(...) method.
static int WEBM
          FileSink types used in the forType(...) method.
 
Fields inherited from class de.humatic.dsj.sink.Sink
connected, CONTROLABLE, DISPLAY_LOCAL, DS_NETWORK, DUAL_OUTPUT, DUMP, FILE, flags, FORCE_PREVIEW_BRANCH, LOCAL, majorType, NO_CONTROLS, NO_TRANSCODE, PLAY_OUT, PREVIEW, SHOW_DIALOGS, SHOW_DLG_SAVE, subType, WM_NETWORK
 
Constructor Summary
FileSink(java.lang.String outputPath)
          The basic constructor creates an "empty" filesink object.
 
Method Summary
static FileSink forType(int fileType, java.lang.String outputPath)
          Creates a predefined FileSink for the given type.
You will only get a valid object returned if the native DirectShow filters needed to write the various filetypes are installed on the runtime system.
static FileSink fromXML(java.lang.String name, java.lang.String outputPath)
          Creates a FileSink from a filterchain description layed out in the xml setup file, allowing to easily extend functionality.
You will only get a valid object returned if the native DirectShow filters listed in the xml are installed on the runtime system.
 void setFileWriter(DSFilterInfo writerInfo)
           
 void setTargetFile(java.lang.String newOutputPath)
           
 java.lang.String toString()
           
 
Methods inherited from class de.humatic.dsj.sink.Sink
getAudioEncoderInfo, getFlags, getMultiplexerInfo, getOutputPath, getVideoEncoderInfo, getWriterInfo, setAudioEncoder, setFlags, setMultiplexer, setVideoEncoder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MP4

public static final int MP4
FileSink types used in the forType(...) method.

See Also:
Constant Field Values

OGG

public static final int OGG
FileSink types used in the forType(...) method.

See Also:
Constant Field Values

MKV

public static final int MKV
FileSink types used in the forType(...) method.

See Also:
Constant Field Values

WEBM

public static final int WEBM
FileSink types used in the forType(...) method.

See Also:
Constant Field Values

WAV

public static final int WAV
FileSink types used in the forType(...) method.

See Also:
Constant Field Values
Constructor Detail

FileSink

public FileSink(java.lang.String outputPath)
The basic constructor creates an "empty" filesink object. The setEncoder(...), setMultiplexer(...) and setFileWriterMethods(...) must be used to make it useable.

Filesinks are constructed from up to 4 filters: Audio & videoencoders, multiplexer & filewriter. Some codecs may combine encoders and multiplexer in a single filter, some multiplexer and filewriter. dsj will asume that if no special filewriter is specified, the standard file writer will be used. Therefore codecs with combined multiplexer/filewriters should set filewriter to null. If no encoders are wanted or needed, do not insert video- and audioencoder.

See the static methods for creating predefined filesink types.

Method Detail

fromXML

public static FileSink fromXML(java.lang.String name,
                               java.lang.String outputPath)
Creates a FileSink from a filterchain description layed out in the xml setup file, allowing to easily extend functionality.
You will only get a valid object returned if the native DirectShow filters listed in the xml are installed on the runtime system. (Note that dsj does neither bring any encoding filters nor does it license you to use them or create content of the given type.)
For an example see the dsj.xml file in the demo directory.


forType

public static FileSink forType(int fileType,
                               java.lang.String outputPath)
                        throws DSJException
Creates a predefined FileSink for the given type.
You will only get a valid object returned if the native DirectShow filters needed to write the various filetypes are installed on the runtime system. (Note that dsj does neither bring any encoding filters nor does it license you to use them or create content of the given type.)

Filter requirements for the defined types are as follows:

MP4
uses the 3ivX Filter Suite to create ISO compliant mp4 files.

OGG
uses the the Illiminable filters to create ogg (theora / vorbis) files.

MKV
This, strictly spoken does not encode, but rather repackages media into Matroska (.mkv) containers.
It uses gabest's Matroska Muxer (sourceforge.net/projects/guliverkli)
A sink of type MKV will take the original streams and remux them to mkv without transcoding. Supported input formats include .avi, .asf/.wmv, mp4 and 3gp. MPEG 1 & 2 can not be packed into Matroska files with this. You will need a serious Matroska-centric tool like mkvtoolnix or AVImuxGUI for that.

WEBM
uses Google's VP8 encoder and webm muxer and the Vorbis encoder from Xiph to create webm files.

WAV
requires no further filters, but you can alternatively make this create mp3 files by specifying an audio encoder (and using an .mp3 file suffix). Other encodings besides raw PCM and mp3 are not supported

Throws:
DSJException

setFileWriter

public void setFileWriter(DSFilterInfo writerInfo)

setTargetFile

public void setTargetFile(java.lang.String newOutputPath)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object