de.humatic.dsj
Class DSEnvironment

java.lang.Object
  extended by de.humatic.dsj.DSEnvironment

public class DSEnvironment
extends java.lang.Object

DSEnvironment manages general setup tasks.


Field Summary
static int AM_KSCATEGORY_CAPTURE
           
static int AM_KSCATEGORY_CROSSBAR
           
static int AM_KSCATEGORY_RENDER
           
static int AM_KSCATEGORY_SPLITTER
           
static int AM_KSCATEGORY_TVAUDIO
           
static int AM_KSCATEGORY_TVTUNER
           
static int AM_KSCATEGORY_VBICODEC
           
static int CLSID_ActiveMovieCategories
           
static int CLSID_AudioCompressorCategory
           
static int CLSID_AudioInputDeviceCategory
           
static int CLSID_AudioRendererCategory
           
static int CLSID_CPCAFiltersCategory
           
static int CLSID_DeviceControlCategory
           
static int CLSID_DXA
           
static int CLSID_LegacyAmFilterCategory
           
static int CLSID_MFX
           
static int CLSID_MidiRendererCategory
           
static int CLSID_TransmitCategory
           
static int CLSID_VideoCompressorCategory
           
static int CLSID_VideoEffects1Category
           
static int CLSID_VideoEffects2Category
           
static int CLSID_VideoInputDeviceCategory
           
static int DMOCATEGORY_AUDIO_CAPTURE_EFFECT
           
static int DMOCATEGORY_AUDIO_DECODER
           
static int DMOCATEGORY_AUDIO_EFFECT
           
static int DMOCATEGORY_AUDIO_ENCODER
           
static int DMOCATEGORY_VIDEO_DECODER
           
static int DMOCATEGORY_VIDEO_EFFECT
           
static int DMOCATEGORY_VIDEO_ENCODER
           
static int KSCATEGORY_BDA_NETWORK_PROVIDER
           
static int KSCATEGORY_BDA_NETWORK_TUNER
           
static int KSCATEGORY_BDA_RECEIVER_COMPONENT
           
static int KSCATEGORY_BDA_TRANSPORT_INFORMATION
           
static int KSCATEGORY_IP_SINK
           
static int LF_APPEND
          Log flags
static int LF_TIMESTAMP
          Log flags
static int PINDIR_INPUT
           
static int PINDIR_OUTPUT
           
static int SP_CODEPAGE
          System properties
static int SP_FILTERSTATE_DIR
          System properties
static int SP_PROCESS_DIR
          System properties
static int SP_TMP_DIR
          System properties
 
Constructor Summary
DSEnvironment()
           
 
Method Summary
static DSFiltergraph[] getActiveGraphs()
          Returns an array holding all currently active filtergraphs.
static DSMediaType[] getAudioEncoderMediaTypes(DSFilterInfo encoder, DSFiltergraph graph)
          Returns the formats an AudioEncoder can produce from the given filtergraph's audio stream.
static org.w3c.dom.Node getClassNode(java.lang.String className, org.w3c.dom.Document d)
           
static int getDebugLevel()
           
static java.lang.String getDllVersion()
           
static DSFilterInfo[][] getEncoders()
          Returns a 2 dimensional FilterInfo array holding the installed video and audio compressors.
WindowsMedia encoders are no longer included here - see DSMovie.export(..) for information on how to write WindowsMedia.
static java.lang.String[] getFilterCategories()
           
static DSFilterInfo[] getFilters(int category)
          Returns a FilterInfo array for installed filters in the given category (see constants).
static java.lang.String getJarVersion()
           
static int getOSVersion()
          Returns an adapted Windows version number (XP - 5, Vista - 6, 7 on Windows7, despite the OS reporting 6.1)
static int getProcessID()
          Returns the Windows processID we're running unter
static java.lang.String getProperty(int type)
           
static DSJService getService(DSFiltergraph onGraph, java.lang.String guid, int flags)
          Creates a DSJService for the given GUID.
static java.lang.String getSetupPath()
           
static java.lang.String getSystemInfo(boolean inclPaths)
           
static int getVersionCode()
          Returns the dll and jar version strings encoded into a 32bit integer for quick methematical comparism.
static java.lang.String getVersionInfo()
           
static java.lang.String getXMLPreference(java.lang.String prefName)
           
static org.w3c.dom.Document getXMLSetup()
           
static void handleUncaughtException(java.lang.Thread t, java.lang.Throwable throwable)
          There are situations where uncaught java exceptions may cause damage, that dsj's native part is not able to detect and recover from alone.
static int persistCodecState(DSFilterInfo codecInfo, java.io.File output)
          Permanently saves the settings for the given codec into %output.
static boolean registerFilter(java.lang.String pathToAX, boolean unregister)
          Utility to (un)register DirectShow filters.
static void registerGraph(DSFiltergraph graph)
          Registers an activated graph with the internal track keeping mechanisms.
static void schedule(java.util.TimerTask tt, int delay, int interval)
           
static void setDebugLevel(int level)
          Controls the amount of debug printed by the library.
static void setDefaultGraphBackground(java.awt.Color bg)
          Sets the default background color for all filtergraphs' visual components, that is: the java canvas that DSFiltergraph extends or the Swing component it renders to.
static void setDLLPath(java.lang.String path)
          Allows to load the native dll from some other than the default locations (i.e.
static void setLogFile(java.io.File f)
          dsj debug and log output by default goes to System.err, use this method to direct output to a file.
static void setLogFlags(int flags)
          Sets options for log output - currently defined flags are LF_TIMESTAMP (to prefix each new line with a Y/M/D;H:M:S:ms timestamp) and LF_APPEND (to append to previously written logfiles rather than overwrite them).
static void setLogStream(java.io.PrintStream ps)
          dsj debug and log output by default goes to System.err, use this method to set a different stream to write to.
static void setProperty(int property, int value, java.lang.String strValue)
           
static void setSetupPath(java.lang.String path)
          Overwrites the locations, that dsj will search for the xml setup file.
static void storePreference(java.lang.String key, java.lang.String value)
          Stores a preference to the setup file, set %value to null to clear the given key.
static boolean unlockDLL(java.lang.String str, long code, long code2, long code3)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SP_CODEPAGE

public static final int SP_CODEPAGE
System properties

See Also:
Constant Field Values

SP_TMP_DIR

public static final int SP_TMP_DIR
System properties

See Also:
Constant Field Values

SP_FILTERSTATE_DIR

public static final int SP_FILTERSTATE_DIR
System properties

See Also:
Constant Field Values

SP_PROCESS_DIR

public static final int SP_PROCESS_DIR
System properties

See Also:
Constant Field Values

LF_TIMESTAMP

public static final int LF_TIMESTAMP
Log flags

See Also:
Constant Field Values

LF_APPEND

public static final int LF_APPEND
Log flags

See Also:
Constant Field Values

CLSID_AudioInputDeviceCategory

public static final int CLSID_AudioInputDeviceCategory
See Also:
Constant Field Values

CLSID_AudioCompressorCategory

public static final int CLSID_AudioCompressorCategory
See Also:
Constant Field Values

CLSID_AudioRendererCategory

public static final int CLSID_AudioRendererCategory
See Also:
Constant Field Values

CLSID_DeviceControlCategory

public static final int CLSID_DeviceControlCategory
See Also:
Constant Field Values

CLSID_LegacyAmFilterCategory

public static final int CLSID_LegacyAmFilterCategory
See Also:
Constant Field Values

CLSID_TransmitCategory

public static final int CLSID_TransmitCategory
See Also:
Constant Field Values

CLSID_MidiRendererCategory

public static final int CLSID_MidiRendererCategory
See Also:
Constant Field Values

CLSID_VideoInputDeviceCategory

public static final int CLSID_VideoInputDeviceCategory
See Also:
Constant Field Values

CLSID_VideoCompressorCategory

public static final int CLSID_VideoCompressorCategory
See Also:
Constant Field Values

CLSID_VideoEffects1Category

public static final int CLSID_VideoEffects1Category
See Also:
Constant Field Values

CLSID_VideoEffects2Category

public static final int CLSID_VideoEffects2Category
See Also:
Constant Field Values

AM_KSCATEGORY_CAPTURE

public static final int AM_KSCATEGORY_CAPTURE
See Also:
Constant Field Values

AM_KSCATEGORY_CROSSBAR

public static final int AM_KSCATEGORY_CROSSBAR
See Also:
Constant Field Values

AM_KSCATEGORY_RENDER

public static final int AM_KSCATEGORY_RENDER
See Also:
Constant Field Values

AM_KSCATEGORY_SPLITTER

public static final int AM_KSCATEGORY_SPLITTER
See Also:
Constant Field Values

AM_KSCATEGORY_TVAUDIO

public static final int AM_KSCATEGORY_TVAUDIO
See Also:
Constant Field Values

AM_KSCATEGORY_TVTUNER

public static final int AM_KSCATEGORY_TVTUNER
See Also:
Constant Field Values

AM_KSCATEGORY_VBICODEC

public static final int AM_KSCATEGORY_VBICODEC
See Also:
Constant Field Values

CLSID_ActiveMovieCategories

public static final int CLSID_ActiveMovieCategories
See Also:
Constant Field Values

CLSID_CPCAFiltersCategory

public static final int CLSID_CPCAFiltersCategory
See Also:
Constant Field Values

KSCATEGORY_BDA_NETWORK_PROVIDER

public static final int KSCATEGORY_BDA_NETWORK_PROVIDER
See Also:
Constant Field Values

KSCATEGORY_BDA_RECEIVER_COMPONENT

public static final int KSCATEGORY_BDA_RECEIVER_COMPONENT
See Also:
Constant Field Values

KSCATEGORY_IP_SINK

public static final int KSCATEGORY_IP_SINK
See Also:
Constant Field Values

KSCATEGORY_BDA_NETWORK_TUNER

public static final int KSCATEGORY_BDA_NETWORK_TUNER
See Also:
Constant Field Values

KSCATEGORY_BDA_TRANSPORT_INFORMATION

public static final int KSCATEGORY_BDA_TRANSPORT_INFORMATION
See Also:
Constant Field Values

DMOCATEGORY_AUDIO_DECODER

public static final int DMOCATEGORY_AUDIO_DECODER
See Also:
Constant Field Values

DMOCATEGORY_AUDIO_EFFECT

public static final int DMOCATEGORY_AUDIO_EFFECT
See Also:
Constant Field Values

DMOCATEGORY_AUDIO_ENCODER

public static final int DMOCATEGORY_AUDIO_ENCODER
See Also:
Constant Field Values

DMOCATEGORY_VIDEO_DECODER

public static final int DMOCATEGORY_VIDEO_DECODER
See Also:
Constant Field Values

DMOCATEGORY_VIDEO_EFFECT

public static final int DMOCATEGORY_VIDEO_EFFECT
See Also:
Constant Field Values

DMOCATEGORY_VIDEO_ENCODER

public static final int DMOCATEGORY_VIDEO_ENCODER
See Also:
Constant Field Values

DMOCATEGORY_AUDIO_CAPTURE_EFFECT

public static final int DMOCATEGORY_AUDIO_CAPTURE_EFFECT
See Also:
Constant Field Values

CLSID_DXA

public static final int CLSID_DXA
See Also:
Constant Field Values

CLSID_MFX

public static final int CLSID_MFX
See Also:
Constant Field Values

PINDIR_OUTPUT

public static final int PINDIR_OUTPUT
See Also:
Constant Field Values

PINDIR_INPUT

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

DSEnvironment

public DSEnvironment()
Method Detail

setSetupPath

public static void setSetupPath(java.lang.String path)
Overwrites the locations, that dsj will search for the xml setup file. Without this call dsj will first look in the applications working directory, then in the user's home directory. If no setup file is found it will be created in user.home. If you need to change this, the very first call to dsj should set an alternative path using this method.


getSetupPath

public static java.lang.String getSetupPath()

setDLLPath

public static void setDLLPath(java.lang.String path)
Allows to load the native dll from some other than the default locations (i.e. from some place not on the java library path). Should be called before constructing any DSFiltergraph subclass or calling any of dsj's static query methods.


getXMLSetup

public static org.w3c.dom.Document getXMLSetup()

getClassNode

public static org.w3c.dom.Node getClassNode(java.lang.String className,
                                            org.w3c.dom.Document d)

getDebugLevel

public static int getDebugLevel()

setDebugLevel

public static void setDebugLevel(int level)
Controls the amount of debug printed by the library. The higher the level, the more verbose the output. Default level is 0, i.e. no output. For unregistered use the max level is limited to 3.


setLogStream

public static void setLogStream(java.io.PrintStream ps)
dsj debug and log output by default goes to System.err, use this method to set a different stream to write to.


setLogFile

public static void setLogFile(java.io.File f)
dsj debug and log output by default goes to System.err, use this method to direct output to a file.


setLogFlags

public static void setLogFlags(int flags)
Sets options for log output - currently defined flags are LF_TIMESTAMP (to prefix each new line with a Y/M/D;H:M:S:ms timestamp) and LF_APPEND (to append to previously written logfiles rather than overwrite them). By default none of these flags is set.


getOSVersion

public static int getOSVersion()
Returns an adapted Windows version number (XP - 5, Vista - 6, 7 on Windows7, despite the OS reporting 6.1)


setProperty

public static void setProperty(int property,
                               int value,
                               java.lang.String strValue)

registerFilter

public static boolean registerFilter(java.lang.String pathToAX,
                                     boolean unregister)
                              throws DSJException
Utility to (un)register DirectShow filters. The method returns true on success or throws an exception with a Windows error code on failure (see Winerror.h for details). Note that on Vista and Windows7 filter registration needs admin rights. If the calling process has not been started with those, this method will fail with ERROR_ACCESS_DENIED (5) in the DSJException's errorCode field.

Throws:
DSJException

getFilters

public static DSFilterInfo[] getFilters(int category)
Returns a FilterInfo array for installed filters in the given category (see constants).


getFilterCategories

public static java.lang.String[] getFilterCategories()

getEncoders

public static DSFilterInfo[][] getEncoders()
Returns a 2 dimensional FilterInfo array holding the installed video and audio compressors.
WindowsMedia encoders are no longer included here - see DSMovie.export(..) for information on how to write WindowsMedia. Also be aware that not all encoders register in the proper category - there may be more under "DirectShowFilters".


persistCodecState

public static int persistCodecState(DSFilterInfo codecInfo,
                                    java.io.File output)
                             throws java.io.IOException
Permanently saves the settings for the given codec into %output. Before calling this the FilterInfo must have been used in an encoding function with preferred format set to DSFilterInfo.SHOW_DLG_SAVE. If the codec state could not be saved during that step this method will throw a FileNotFoundException.

Throws:
java.io.IOException

getAudioEncoderMediaTypes

public static DSMediaType[] getAudioEncoderMediaTypes(DSFilterInfo encoder,
                                                      DSFiltergraph graph)
Returns the formats an AudioEncoder can produce from the given filtergraph's audio stream. May be used to set the format index on encoding. Some filters may not report any formats long as the input is not connected (which this method does not do).


unlockDLL

public static boolean unlockDLL(java.lang.String str,
                                long code,
                                long code2,
                                long code3)

getProcessID

public static int getProcessID()
Returns the Windows processID we're running unter


getProperty

public static java.lang.String getProperty(int type)

registerGraph

public static void registerGraph(DSFiltergraph graph)
Registers an activated graph with the internal track keeping mechanisms. This method is called internally and is public for package design reasons. There should normally be no need for application code to call it.


getActiveGraphs

public static DSFiltergraph[] getActiveGraphs()
Returns an array holding all currently active filtergraphs.


handleUncaughtException

public static void handleUncaughtException(java.lang.Thread t,
                                           java.lang.Throwable throwable)
There are situations where uncaught java exceptions may cause damage, that dsj's native part is not able to detect and recover from alone. JDK 1.5 has methods that would allow to silently handle such situations from within the dsj java api, but as we would like to keep things 1.4. compatible, we decided to not implement those into the library itself. Instead applications may register themselves as an UncaughtExceptionHandler using either the unflexible 1.4. way of extending ThreadGroup or by implementing the 1.5. Thread.UncaughtExceptionHandler Interface. Whenever this handler gets notified of an uncaught exception, it should then call this method, which in turn will try to recover things in the dll. Currently this is used only with OVERLAY mouseevents


getSystemInfo

public static java.lang.String getSystemInfo(boolean inclPaths)

getVersionInfo

public static java.lang.String getVersionInfo()

getDllVersion

public static java.lang.String getDllVersion()

getJarVersion

public static java.lang.String getJarVersion()

getVersionCode

public static int getVersionCode()
Returns the dll and jar version strings encoded into a 32bit integer for quick methematical comparism.


getXMLPreference

public static java.lang.String getXMLPreference(java.lang.String prefName)

storePreference

public static void storePreference(java.lang.String key,
                                   java.lang.String value)
Stores a preference to the setup file, set %value to null to clear the given key.


schedule

public static void schedule(java.util.TimerTask tt,
                            int delay,
                            int interval)

setDefaultGraphBackground

public static void setDefaultGraphBackground(java.awt.Color bg)
Sets the default background color for all filtergraphs' visual components, that is: the java canvas that DSFiltergraph extends or the Swing component it renders to. This might become visible for short moments during resizes, layout changes or before the dll starts drawing on top of it. dsj 0_8_5 changes the default from black to null and introduces this method for applications to control the property themselves.


getService

public static DSJService getService(DSFiltergraph onGraph,
                                    java.lang.String guid,
                                    int flags)
                             throws java.lang.Exception
Creates a DSJService for the given GUID.

Throws:
java.lang.Exception