de.humatic.dsj
Class DSCapture.CaptureDevice

java.lang.Object
  extended by de.humatic.dsj.DSFilter
      extended by de.humatic.dsj.DSCapture.CaptureDevice
Enclosing class:
DSCapture

public class DSCapture.CaptureDevice
extends DSFilter

Nested class, extending DSFilter and wrapping a capture device, that has been added to the graph.


Nested Class Summary
 
Nested classes/interfaces inherited from class de.humatic.dsj.DSFilter
DSFilter.DSPin
 
Field Summary
static int AUDIO
          Capture device types
static int CAPTION
          Capture device types
static int CROSSBAR_1
          Supported native control dialogs
static int CROSSBAR_2
          Supported native control dialogs
static int DV
          Capture device types
static int MPEG
          Capture device types
static int PIN_CATEGORY_CAPTURE
          Capture device output pin types
static int PIN_CATEGORY_CC
          Capture device output pin types
static int PIN_CATEGORY_PREVIEW
          Capture device output pin types
static int PIN_CATEGORY_STILL
          Capture device output pin types
static int PIN_CATEGORY_VBI
          Capture device output pin types
static int TV_AUDIO
          Supported native control dialogs
static int TV_VIDEO
          Supported native control dialogs
static int VFW_FORMAT
          Supported native control dialogs
static int VFW_SOURCE
          Supported native control dialogs
static int VIDEO
          Capture device types
static int WDM_CAPTURE
          Supported native control dialogs
static int WDM_DEVICE
          Supported native control dialogs
static int WDM_PREVIEW
          Supported native control dialogs
 
Fields inherited from class de.humatic.dsj.DSFilter
PINDIR_INPUT, PINDIR_OUTPUT
 
Method Summary
 boolean activate()
          Activates this device and returns true on success.
 boolean canDoMPEG()
          Returns true if the device can output MPEG on any pin directly on the filter or an additional custom - that is specifically belonging to this capture device - encoding filter (for example some Hauppauge WinTV cards come with either hardware or software MPEG encoders that are implemented as separate filters).
Note: This method should work with devices that directly output MPEG2 (like those based on Cirrus Logic USB-DVR chips) and Hauppauge devices.
 void configureVDig(int TVFormat, int flags)
          Sets an analog video digitizer's TVFormat (see DSConstants ATV_...constants), vcr vertical locking behavior (bit 1 in % flags set for tape sources, not set for broadcasts) and video-port output enable (bit 2 set to enable).
 void connectCrossBarPins(int in, int out, boolean changeRelated)
          Routes data in the crossbar filter from input %in to output %out, optionally also changing the routing for related audio pins.
 float getActualFramerate(DSFilter.DSPin outputPin)
          Returns the actually delivered framerate, which may be under influence of available bus bandwidth etc., as reported by the IAMVideoControl interface (which will only be available with UVC capture devices).
More IAMVideoControl methods are implemented in CaptureDeviceControls.
 CaptureDeviceControls getControls()
          Returns a CaptureDeviceControls object that can be used for programatical control of device parameters (brightness, contrast, hue, audio levels and inputs etc.; pan & tilt for cameras that support it, Input source, level etc.
 DSFilterInfo.DSCrossBarInfo getCrossBar()
          Returns the CrossbarInfo describing the crossbar filter that this device may be linked with.
 int getCrossBarConnection(int outputID)
          Returns the id of the crossbar input that is currently routed to the given output.
 int[] getCurrentFrequencies()
          Returns currently set video and audio frequencies.
 DSFilter.DSPin getDeviceOutput(int pinCategory)
          Returns a device's output pin for the given category - use this to locate preview and capture pins.
 float getFrameRate(DSFilter.DSPin outputPin)
           
 java.lang.String getName()
          Returns the filter's "friendly name"
 int[] getOutputFrameRates(DSFilter.DSPin outputPin)
          Returns the minimum and maximum framerates the given pin can deliver
 java.lang.String getPath()
           
 int getSelectedFormat(DSFilter.DSPin outputPin)
          Returns the index of the currently selected output format for the given pin.
 DSMediaType getSelectedMediaType(DSFilter.DSPin outputPin)
           
 int getSupportedDialogs()
          Returns an int with the bits representing supported dialogs (see constants) set.
 DSFilterInfo.DSTVTunerInfo getTVTuner()
           
 int getType()
           
 int[] getVDigSettings()
          Returns and int[4] holding an analog video digitizer's current TVFormat (see DSConstants ATV_...constants), number of video scan lines, a bitwise combination of TVFormats supported by the device and a bit set containing information on vertical locking (bit 1 set for tape sources, not set for broadcasts), video-port output enable (bit 2 set if enabled) and horizontal sync lock (bit 3 set when locked).
The native interface required to get this information will only be available with devices that capture analog video (but there is no guarantee, that all such devices will support it).
 boolean hasCrossBar()
          Crossbars are special filters upstream from some capture device filters and are used for selecting between different physical input connections on the device (Video digitizers with composite and S-Video inputs for example will usually have an associated crossbar filter).
 boolean hasTVTuner()
           
 boolean isActive()
           
 int[] setBasicTVParameters(int tuningSpace, int countryCode)
          Sets TuningSpace and CountryCode.
 int setCropSize(DSFilter.DSPin outputPin, int x, int y, int w, int h)
          Sets the video cropping rectangle on the given video output pin.
 float setFrameRate(DSFilter.DSPin outputPin, float fps)
          Sets a video capture device's framerate on the given output and returns the framerate in effect after this call.
 int setOutputFormat(DSFilter.DSPin outputPin, int index)
          Sets the output format on the specified pin after the graph has been built (in opposition to setting a preferred format on the device's FilterInfo and/or PinInfos prior to constructing the graph).
This may act as a programmatical alternative to showing the format dialogs, although some devices may offer more formats via their properties dialogs.
%index - index into the available formats, which can be read from the FilterInfo.
The method does not work when the graph is record enabled or recording.
 int[] setTunerMode(int mode, int input)
          Sets Tuner mode (see http://msdn2.microsoft.com/en-us/library/ms778981(VS.85).aspx) and input (0 - cable, 1 - antenna).
 int setTVChannel(int channel, boolean autoTune)
          Sets TV Channel on analogue TV tuners and optionally performs autotuning Return value reflects signal quality (0 if no signal is present, negative if undetermined, positive if OK.
 int showDialog(int dialogType)
          Brings up a native dialog (a filter, pin or filter interface PropertyPage) of the given type (see constants).
 
Methods inherited from class de.humatic.dsj.DSFilter
applyPropPageSettings, closePropPage, connectDownstream, disconnect, dumpConnections, embedPropertiesPage, getCLSID, getFiltergraph, getFilterInfo, getFilterState, getID, getInputs, getOutputs, getPin, getPin, getPin, getPins, getPropPageCount, getPropPageSize, getPropPageTitles, loadFilterState, renderEx, renderPin, saveFilterState, setParameter, showPropertiesDialog, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VIDEO

public static final int VIDEO
Capture device types

See Also:
Constant Field Values

AUDIO

public static final int AUDIO
Capture device types

See Also:
Constant Field Values

MPEG

public static final int MPEG
Capture device types

See Also:
Constant Field Values

DV

public static final int DV
Capture device types

See Also:
Constant Field Values

CAPTION

public static final int CAPTION
Capture device types

See Also:
Constant Field Values

VFW_SOURCE

public static final int VFW_SOURCE
Supported native control dialogs

See Also:
Constant Field Values

VFW_FORMAT

public static final int VFW_FORMAT
Supported native control dialogs

See Also:
Constant Field Values

WDM_DEVICE

public static final int WDM_DEVICE
Supported native control dialogs

See Also:
Constant Field Values

WDM_CAPTURE

public static final int WDM_CAPTURE
Supported native control dialogs

See Also:
Constant Field Values

WDM_PREVIEW

public static final int WDM_PREVIEW
Supported native control dialogs

See Also:
Constant Field Values

CROSSBAR_1

public static final int CROSSBAR_1
Supported native control dialogs

See Also:
Constant Field Values

CROSSBAR_2

public static final int CROSSBAR_2
Supported native control dialogs

See Also:
Constant Field Values

TV_VIDEO

public static final int TV_VIDEO
Supported native control dialogs

See Also:
Constant Field Values

TV_AUDIO

public static final int TV_AUDIO
Supported native control dialogs

See Also:
Constant Field Values

PIN_CATEGORY_CAPTURE

public static final int PIN_CATEGORY_CAPTURE
Capture device output pin types

See Also:
Constant Field Values

PIN_CATEGORY_PREVIEW

public static final int PIN_CATEGORY_PREVIEW
Capture device output pin types

See Also:
Constant Field Values

PIN_CATEGORY_STILL

public static final int PIN_CATEGORY_STILL
Capture device output pin types

See Also:
Constant Field Values

PIN_CATEGORY_CC

public static final int PIN_CATEGORY_CC
Capture device output pin types

See Also:
Constant Field Values

PIN_CATEGORY_VBI

public static final int PIN_CATEGORY_VBI
Capture device output pin types

See Also:
Constant Field Values
Method Detail

activate

public boolean activate()
Activates this device and returns true on success. Activating a particular device will deactivate any similar type device that has been active before (i.e. DSCapture supports only one video and / or one audiodevice at a time). If the device is allready active in another graph an Exception is thrown.


isActive

public boolean isActive()

getType

public int getType()

getName

public java.lang.String getName()
Description copied from class: DSFilter
Returns the filter's "friendly name"

Overrides:
getName in class DSFilter

getPath

public java.lang.String getPath()

canDoMPEG

public boolean canDoMPEG()
Returns true if the device can output MPEG on any pin directly on the filter or an additional custom - that is specifically belonging to this capture device - encoding filter (for example some Hauppauge WinTV cards come with either hardware or software MPEG encoders that are implemented as separate filters).
Note: This method should work with devices that directly output MPEG2 (like those based on Cirrus Logic USB-DVR chips) and Hauppauge devices. It may fail with devices that use other implementations for encoding.the MPEG stream.


hasCrossBar

public boolean hasCrossBar()
Crossbars are special filters upstream from some capture device filters and are used for selecting between different physical input connections on the device (Video digitizers with composite and S-Video inputs for example will usually have an associated crossbar filter). Crossbar filters will be automatically added to the graph if needed.


connectCrossBarPins

public void connectCrossBarPins(int in,
                                int out,
                                boolean changeRelated)
Routes data in the crossbar filter from input %in to output %out, optionally also changing the routing for related audio pins.


getCrossBarConnection

public int getCrossBarConnection(int outputID)
Returns the id of the crossbar input that is currently routed to the given output. The return value for unrouted pins will be -1, if the device has no crossbar or an error occurs it will be an error code < -1. Note that depending on the driver implementation, if connections have been made with %changeRelated set to true, calling this on the audio output may also return -1, allthough it is actually connected.


getCrossBar

public DSFilterInfo.DSCrossBarInfo getCrossBar()
Returns the CrossbarInfo describing the crossbar filter that this device may be linked with. The returned object holds information on inputs and outputs on the crossbar filter.


hasTVTuner

public boolean hasTVTuner()

getTVTuner

public DSFilterInfo.DSTVTunerInfo getTVTuner()

setBasicTVParameters

public int[] setBasicTVParameters(int tuningSpace,
                                  int countryCode)
Sets TuningSpace and CountryCode. Set any parameter you don't want changed to -1. Returns the newly set parameters.


setTunerMode

public int[] setTunerMode(int mode,
                          int input)
Sets Tuner mode (see http://msdn2.microsoft.com/en-us/library/ms778981(VS.85).aspx) and input (0 - cable, 1 - antenna). Set any parameter you don't want changed to -1. Returns the newly set parameters.


getCurrentFrequencies

public int[] getCurrentFrequencies()
Returns currently set video and audio frequencies.


setTVChannel

public int setTVChannel(int channel,
                        boolean autoTune)
Sets TV Channel on analogue TV tuners and optionally performs autotuning Return value reflects signal quality (0 if no signal is present, negative if undetermined, positive if OK.


configureVDig

public void configureVDig(int TVFormat,
                          int flags)
                   throws DSJException
Sets an analog video digitizer's TVFormat (see DSConstants ATV_...constants), vcr vertical locking behavior (bit 1 in % flags set for tape sources, not set for broadcasts) and video-port output enable (bit 2 set to enable). Any parameter set to -1 will be ignored. Lots of devices will not support video-ports and changing vcr locking behavior and will ignore the second parameter.
The required interface will only be available with devices that capture analog video. Driver authors may however opt to implement identical functionality in some proprietary way, so there is no guarantee that all analog capture boards will support the underlying standard interface. An exception is thrown when the interface is not present.

Throws:
DSJException

getVDigSettings

public int[] getVDigSettings()
                      throws DSJException
Returns and int[4] holding an analog video digitizer's current TVFormat (see DSConstants ATV_...constants), number of video scan lines, a bitwise combination of TVFormats supported by the device and a bit set containing information on vertical locking (bit 1 set for tape sources, not set for broadcasts), video-port output enable (bit 2 set if enabled) and horizontal sync lock (bit 3 set when locked).
The native interface required to get this information will only be available with devices that capture analog video (but there is no guarantee, that all such devices will support it). An exception is thrown when the interface is not present.

Throws:
DSJException

getSupportedDialogs

public int getSupportedDialogs()
Returns an int with the bits representing supported dialogs (see constants) set. call this once before calling showDialog(....) and to set up GUI elements etc.


showDialog

public int showDialog(int dialogType)
               throws DSJException
Brings up a native dialog (a filter, pin or filter interface PropertyPage) of the given type (see constants). This method blocks until the dialog is closed or returns immediately on failure. Returns:
-1 when the device does not support the wanted control,
DSJException errorcode on failure
0 or a positive value on success.
For dialogs related to pins that may change output formats (VFW_FORMAT, WDM_CAPTURE, WDM_PREVIEW):
0 if the pin was connected, the dialog was shown and the pin format could be changed
1 if the pin was not connected, but the dialog was shown and the pin format could be changed
WDM_FORMAT dialogs may not work, when the video capture device was initially set up with a format other than the default one.

Throws:
DSJException

getControls

public CaptureDeviceControls getControls()
Returns a CaptureDeviceControls object that can be used for programatical control of device parameters (brightness, contrast, hue, audio levels and inputs etc.; pan & tilt for cameras that support it, Input source, level etc. for audio devices).
Not all device drivers will expose the required interface and not all may use the standard interfaces this method accesses to implement certain functionality!


getDeviceOutput

public DSFilter.DSPin getDeviceOutput(int pinCategory)
Returns a device's output pin for the given category - use this to locate preview and capture pins. %pinCategory - one of the DSCapture.CaptureDevice.PIN_CATEGORY... constants. Returns null if the device does not have a pin of the wanted category (Webcams for example mostly only have a capture, but no preview pin).


getOutputFrameRates

public int[] getOutputFrameRates(DSFilter.DSPin outputPin)
Returns the minimum and maximum framerates the given pin can deliver


getFrameRate

public float getFrameRate(DSFilter.DSPin outputPin)
                   throws DSJException
Throws:
DSJException

setFrameRate

public float setFrameRate(DSFilter.DSPin outputPin,
                          float fps)
                   throws DSJException
Sets a video capture device's framerate on the given output and returns the framerate in effect after this call.

Throws:
DSJException

setOutputFormat

public int setOutputFormat(DSFilter.DSPin outputPin,
                           int index)
Sets the output format on the specified pin after the graph has been built (in opposition to setting a preferred format on the device's FilterInfo and/or PinInfos prior to constructing the graph).
This may act as a programmatical alternative to showing the format dialogs, although some devices may offer more formats via their properties dialogs.
%index - index into the available formats, which can be read from the FilterInfo.
The method does not work when the graph is record enabled or recording. When called on video devices it will rebuild parts of the filtergraph so may not be suitable for custom setups. Returns 0 (and - in case of video - fires a FORMAT_CHANGED event) when succeeded, 1 if the format has been set, but the graph could not be rebuilt (as no output pin had been connected for example), < 0 errorCode on failure.


setCropSize

public int setCropSize(DSFilter.DSPin outputPin,
                       int x,
                       int y,
                       int w,
                       int h)
                throws DSJException
Sets the video cropping rectangle on the given video output pin. Parameters must follow allowed granularity and supported ranges. Before using this a format must have been explicitely set using setOutputFormat(...). Valid parameter ranges can be retrieved from the return of DSPin.getFormatCaps().
What this method does, highly depends on the implementation of the device filter. It will usually only work with devices that just offer formats with all the same size. Among those the outcome of the method may be either scaling or cropping (Viewcast's Osprey boards for example will scale down the image according to given width and height. IDS's uEye cameras will crop to the given rectangle).
Returns 0 (and fires a FORMAT_CHANGED event) when succeeded, 1 if the format has been set, but the graph could not be rebuilt (as no output pin had been connected for example). An exception is thrown on failure.

Throws:
DSJException

getSelectedFormat

public int getSelectedFormat(DSFilter.DSPin outputPin)
Returns the index of the currently selected output format for the given pin. This method may for some devices fail to accurately track selections when formats are changed with native dialogs.


getSelectedMediaType

public DSMediaType getSelectedMediaType(DSFilter.DSPin outputPin)

getActualFramerate

public float getActualFramerate(DSFilter.DSPin outputPin)
                         throws DSJException
Returns the actually delivered framerate, which may be under influence of available bus bandwidth etc., as reported by the IAMVideoControl interface (which will only be available with UVC capture devices).
More IAMVideoControl methods are implemented in CaptureDeviceControls.

Throws:
DSJException