de.humatic.dsj.rc
Class VMRControls

java.lang.Object
  extended by de.humatic.dsj.rc.RendererControls
      extended by de.humatic.dsj.rc.DSRendererControls
          extended by de.humatic.dsj.rc.VMRControls

public class VMRControls
extends DSRendererControls

VMRControls provides access to application setable parameters of the VideoMixingRenderer9. An application retrieves this object by calling getRendererControl() on a DSFiltergraph object that has been set up with the VMR9 (or VMR_EMBED) flag.
Note that allthough the VMR has some outstanding capabilities, using it will take you as far out of java context as can go. The preferred renderer for all use cases that do not explicitly need VMR capabilities should be the JAWT / DirectDraw renderer as resulting from a setup with DD7 (or RENDER_NATIVE) in the flags parameter. By default the VMR9 offers four video channels plus static graphics overlay. You can extend the number of video streams by setting a preference named "VMR_Inputs" using DSEnvironment.storePreference(...);
The video inputs should not be used for still images.


Field Summary
static int[] MixerPref9
          Contains all valid VMR mixing preference flags to make them selectable by index.
static int MixerPref9_AnisotropicFiltering
          VMR mixing preference flags
static int MixerPref9_BiLinearFiltering
          VMR mixing preference flags
static int MixerPref9_DynamicDecimateBy2
          VMR mixing preference flags
static int MixerPref9_DynamicSwitchToBOB
          VMR mixing preference flags
static int MixerPref9_GaussianQuadFiltering
          VMR mixing preference flags
static int MixerPref9_PointFiltering
          VMR mixing preference flags
static int MixerPref9_PyramidalQuadFiltering
          VMR mixing preference flags
static int MixerPref9_RenderTargetRGB
          VMR mixing preference flags
static int MixerPref9_RenderTargetYUV
          VMR mixing preference flags
 int type
           
 
Fields inherited from class de.humatic.dsj.rc.RendererControls
BRIGHTNESS, CONTRAST, D3D9, DDR, EVR, HUE, IMG, J2D, NVR, SATURATION, VMR
 
Method Summary
 boolean addFileSource(java.lang.String filePath, int inputID, int flags)
          Renders another movie file or stream to input number %inputID on the VMR.
Any stream that was previously connected to that pin will be removed.
 boolean addFilterSource(DSFilterInfo info, int inputID, int flags)
          Connects output from a source filter to input number %inputID on the VMR.
This is mainly thought to mix live captured data.
Any stream that was previously connected to that pin will be removed.
 boolean addGraphSource(DSFiltergraph srcGraph, int inputID, int flags)
           
 void forceRedraw()
          Enforces a redraw, which may for example be needed when showing menus over a paused filtergraph.
 boolean getAutoRefresh()
           
 java.lang.String[] getAvailableDeinterlacers(int streamID)
          Returns GUIDs for deinterlacers reported to be available for the given stream, ordered by quality (best first).
 float getBrightness(int streamID)
           
 float getContrast(int streamID)
           
 java.lang.String getDeinterlacingMode(int streamID)
          Returns the deinterlacing technique currently in use for the given stream.
 float getHue(int streamID)
           
 int getMixingPrefs()
          Returns current mixing preferences (bitwise combination of MixerPref9 flags)
 int getNumberOfInputs()
          Returns 4 if not a preference named "VMR_Inputs" has been set in the XML Setup file.
 float getSaturation(int streamID)
           
 float[] getVProcAmpRanges(int property)
          Returns the minimum, maximum, default and step size values for VProcAmp related parameters (Contrast, Brightness, Hue & Saturation) in a float[] of length 4.
 byte[] grabBitmap()
          Returns raw bitmap data of the the VMR's composited output.
 boolean removeSource(int inputID, int flags)
           
 void setAlpha(int streamID, float alpha)
          Sets the alpha blending level for videostreams (streamID 0 - maxInputs) or an eventual overlay image (RenderControls.IMG).
 void setAutoRefresh(boolean refresh)
          The VMR9 will by default only update changes to a bitmap overlay, alpha, size etc.
 void setBrightness(int streamID, float value)
          VMR input VProcAmp control.
 void setContrast(int streamID, float value)
          VMR input VProcAmp control.
 void setDeinterlacingMode(int streamID, java.lang.String DeinterlacerGUID)
          Set the deinterlacing technique for the given stream.
 void setHue(int streamID, float value)
          VMR input VProcAmp control.
 void setMixingPrefs(int prefs)
          Sets VMR9 mixing preferences.
 void setOutputRect(int streamID, int oX, int oY, int oW, int oH)
          Provides scaling functionality for videostreams (streamID 0 - maxInputs) and an eventual overlay image (RenderControls.IMG).
 boolean setOverlayImage(java.awt.image.BufferedImage image, int[] dest, java.awt.Color keyColor, float alpha)
          Renders a static image overlay on top of all mixed video streams.
Note that this image is not controlable by most of this class's functions except from setOutputRect(...) & setAlpha(...) where the IMG constant should be used for the streamID parameter.
 void setSaturation(int streamID, float value)
          VMR input VProcAmp control.
 void setZOrder(int streamID, int layer)
          Sets vertical stacking order of additonal videostreams (streamID 1 - maxInputs).
 void showVMRPropertyPage()
          Shows the VMR9's native properties dialog.
 
Methods inherited from class de.humatic.dsj.rc.DSRendererControls
getRendererStatistics
 
Methods inherited from class de.humatic.dsj.rc.RendererControls
displayResized, getControls, getFlags, setFlags
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

public int type

MixerPref9_BiLinearFiltering

public static final int MixerPref9_BiLinearFiltering
VMR mixing preference flags

See Also:
Constant Field Values

MixerPref9_PointFiltering

public static final int MixerPref9_PointFiltering
VMR mixing preference flags

See Also:
Constant Field Values

MixerPref9_AnisotropicFiltering

public static final int MixerPref9_AnisotropicFiltering
VMR mixing preference flags

See Also:
Constant Field Values

MixerPref9_PyramidalQuadFiltering

public static final int MixerPref9_PyramidalQuadFiltering
VMR mixing preference flags

See Also:
Constant Field Values

MixerPref9_GaussianQuadFiltering

public static final int MixerPref9_GaussianQuadFiltering
VMR mixing preference flags

See Also:
Constant Field Values

MixerPref9_RenderTargetRGB

public static final int MixerPref9_RenderTargetRGB
VMR mixing preference flags

See Also:
Constant Field Values

MixerPref9_RenderTargetYUV

public static final int MixerPref9_RenderTargetYUV
VMR mixing preference flags

See Also:
Constant Field Values

MixerPref9_DynamicSwitchToBOB

public static final int MixerPref9_DynamicSwitchToBOB
VMR mixing preference flags

See Also:
Constant Field Values

MixerPref9_DynamicDecimateBy2

public static final int MixerPref9_DynamicDecimateBy2
VMR mixing preference flags

See Also:
Constant Field Values

MixerPref9

public static final int[] MixerPref9
Contains all valid VMR mixing preference flags to make them selectable by index.

Method Detail

addFileSource

public boolean addFileSource(java.lang.String filePath,
                             int inputID,
                             int flags)
Renders another movie file or stream to input number %inputID on the VMR.
Any stream that was previously connected to that pin will be removed. Use -1 to connect to the next free input.
%flags is not currently used.


addFilterSource

public boolean addFilterSource(DSFilterInfo info,
                               int inputID,
                               int flags)
                        throws DSJException
Connects output from a source filter to input number %inputID on the VMR.
This is mainly thought to mix live captured data.
Any stream that was previously connected to that pin will be removed. Use -1 to connect to the next free input.
Set %flags to 1 when adding a capture device that needs a crossbar upstream from the device filter.

Throws:
DSJException

addGraphSource

public boolean addGraphSource(DSFiltergraph srcGraph,
                              int inputID,
                              int flags)

removeSource

public boolean removeSource(int inputID,
                            int flags)
                     throws DSJException
Throws:
DSJException

showVMRPropertyPage

public void showVMRPropertyPage()
Shows the VMR9's native properties dialog.


getNumberOfInputs

public int getNumberOfInputs()
Returns 4 if not a preference named "VMR_Inputs" has been set in the XML Setup file. As the number of inputs for the VideoMixingRenderer needs to be set at a pretty early state of graph construction, it needs to be set that way rather than through the VMRControls class.
DSEnvironment.storePreference("VMR_Inputs", "3") can be used to set this programmatically.


setAutoRefresh

public void setAutoRefresh(boolean refresh)
The VMR9 will by default only update changes to a bitmap overlay, alpha, size etc. settings when the filtergraph is running. This method enables an enforced update when the graph is paused accross all the methods in this class. The setting will remain in effect until changed. It is recommended to reset it when unpausing the graph.


getAutoRefresh

public boolean getAutoRefresh()

forceRedraw

public void forceRedraw()
Enforces a redraw, which may for example be needed when showing menus over a paused filtergraph.


setAlpha

public void setAlpha(int streamID,
                     float alpha)
              throws DSJException
Sets the alpha blending level for videostreams (streamID 0 - maxInputs) or an eventual overlay image (RenderControls.IMG).

Throws:
DSJException

setZOrder

public void setZOrder(int streamID,
                      int layer)
               throws DSJException
Sets vertical stacking order of additonal videostreams (streamID 1 - maxInputs).

Throws:
DSJException

setOutputRect

public void setOutputRect(int streamID,
                          int oX,
                          int oY,
                          int oW,
                          int oH)
                   throws DSJException
Provides scaling functionality for videostreams (streamID 0 - maxInputs) and an eventual overlay image (RenderControls.IMG).

Overrides:
setOutputRect in class RendererControls
Throws:
DSJException

getVProcAmpRanges

public float[] getVProcAmpRanges(int property)
Returns the minimum, maximum, default and step size values for VProcAmp related parameters (Contrast, Brightness, Hue & Saturation) in a float[] of length 4.


setContrast

public void setContrast(int streamID,
                        float value)
                 throws DSJException
VMR input VProcAmp control. Value should be in the valid range as returned by getVProcAmpRanges(property).

Throws:
DSJException

getContrast

public float getContrast(int streamID)
                  throws DSJException
Throws:
DSJException

setBrightness

public void setBrightness(int streamID,
                          float value)
                   throws DSJException
VMR input VProcAmp control. Value should be in the valid range as returned by getVProcAmpRanges(property).

Throws:
DSJException

getBrightness

public float getBrightness(int streamID)
                    throws DSJException
Throws:
DSJException

setHue

public void setHue(int streamID,
                   float value)
            throws DSJException
VMR input VProcAmp control. Value should be in the valid range as returned by getVProcAmpRanges(property).

Throws:
DSJException

getHue

public float getHue(int streamID)
             throws DSJException
Throws:
DSJException

setSaturation

public void setSaturation(int streamID,
                          float value)
                   throws DSJException
VMR input VProcAmp control. Value should be in the valid range as returned by getVProcAmpRanges(property).

Throws:
DSJException

getSaturation

public float getSaturation(int streamID)
                    throws DSJException
Throws:
DSJException

grabBitmap

public byte[] grabBitmap()
                  throws DSJException
Returns raw bitmap data of the the VMR's composited output. This is in a byte order not instantly compatible with java image formats! To get compatible data use DSFiltergraph.getImage() instead.
This method in oposition to getImage does not perform format conversion and may therefore be faster. It should however be noted that in VMR9 rendering mode both methods read data back from video memory which is slow in itself.

Throws:
DSJException

setMixingPrefs

public void setMixingPrefs(int prefs)
                    throws DSJException
Sets VMR9 mixing preferences. %prefs - bitwise combination of preference flags (see declared fields). Mixing preferences are devided into categories ( MixerPref9_Filter, MixerPref9_RenderTarget, MixerPref9_Dynamic). This method will only change preferences in the ranges that the incoming value has bits set for. Some flags may require the graph to be stopped and eventually the filter input to be reconnected.
Validity of flags also depends on the initial setup of the VMR as governed by the "VMR_MixFlags" parameter in the xml setup and on whether an image overlay has been rendered on top of video. Changing render target settings for example will not work in the latter case.

Throws:
DSJException

getMixingPrefs

public int getMixingPrefs()
Returns current mixing preferences (bitwise combination of MixerPref9 flags)


getAvailableDeinterlacers

public java.lang.String[] getAvailableDeinterlacers(int streamID)
                                             throws DSJException
Returns GUIDs for deinterlacers reported to be available for the given stream, ordered by quality (best first). To use hardware deinterlacing the VMR must be in YUV rendering mode (as controlled by MixFlag preferences or setMixingPrefs().

Throws:
DSJException

setDeinterlacingMode

public void setDeinterlacingMode(int streamID,
                                 java.lang.String DeinterlacerGUID)
Set the deinterlacing technique for the given stream. You get the valid GUIDs by calling getAvailableDeinterlacers().


getDeinterlacingMode

public java.lang.String getDeinterlacingMode(int streamID)
                                      throws DSJException
Returns the deinterlacing technique currently in use for the given stream.

Throws:
DSJException

setOverlayImage

public boolean setOverlayImage(java.awt.image.BufferedImage image,
                               int[] dest,
                               java.awt.Color keyColor,
                               float alpha)
                        throws DSJException
Renders a static image overlay on top of all mixed video streams.
Note that this image is not controlable by most of this class's functions except from setOutputRect(...) & setAlpha(...) where the IMG constant should be used for the streamID parameter. This is because the image overlay does not connect to one of the stream inputs of the VMR.
The supplied image MUST be a 32 bit image with alpha channel (use BufferedImage.TYPE_4BYTE_ABGR when constructing the image in code (preferred) or .png when reading from image file,). All pixels in %image whose RGB value meets %colorKey will be transparent in the resulting composition regardless of overall alpha setting via %alpha.
%alpha takes values between 0.0 (fully transparent) and 1.0 (fully opaque).
Image overlays will not work when the VMR has been set to YUV rendering mode.

Overrides:
setOverlayImage in class RendererControls
Throws:
DSJException