de.humatic.dsj
Class DSFiltergraph

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by de.humatic.dsj.DSFiltergraph
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
Direct Known Subclasses:
DSBDAGraph, DSCapture, DSDVCam, DSDvd, DSGraph, DSHDVTape, DSMovie, DSStreamBufferGraph

public class DSFiltergraph
extends java.awt.Canvas

dsj - DirectShow Java Wrapper,

DSFiltergraph is this package's core class. It constructs a java object that sets up a DirectShow filtergraph, handles rendering and data delivery to java and allows you to control the playback of the graph.

DSFiltergraph can not be constructed directly. An application uses one of the subclasses that cover the main areas of available funcionality:

DSMovie - plays video and audio from files and streams.
DSCapture - lets you work with VfW and WDM capture devices.
DSDVCam - for firewire and USB 2.0 DV camcorders.
DSHDVCam - for firewire mpeg HDV camcorders and D-VHS decks.
DSDvd - for playback of standard DVDs
DSBDAGraph - for digital TV devices that follow the BDA driver standard.
DSStreamBufferGraph - for timeshifted recording from capture devices and BDA receivers.
DSGraph - for lower level access to the native structures

DSFiltergraph provides a number of different rendering modes that determine how the filtergraph's video output will be integrated into a java GUI. An application specifies these on construction by setting bits in the constructors' flags parameter: (dsj 0_8_5 introduces some shorter constant names for some modes here. Old ones remain valid)
- native (DirectDraw7) (Constants: DD7 or RENDER_NATIVE) - this is the preferred, all-purpose rendering mode. It uses DirectDraw7 via JAWT to draw into the canvas DSFiltergraph extends and delivers good performance. While the pure native modes (embedded VMR and overlay) may be stronger performancewise, this mode is fully java integrated and normally does not cause problems with AWT integration. When working with Swing, be aware, that this mode results in a heavyweight component.
- native (Direct3D9) (D3D9) - new in dsj 0_8_5 and not fully implemented yet. This is another JAWT based native mode. Uses newer DirectX API and less CPU than the former when it can work on a capeable GPU. In the moment it is purely a 2D video display, without any 3D functionality. There is no RendererControls available and the renderer needs to be tested on more hardware
- native (GDI) (NATIVE_FORCE_GDI) - another JAWT based native mode. More cpu intensive and less performant than the DirectDraw one, but in some jdk versions Java2D may conflict with DirectDraw.
- java side. self redrawing. (J2D or JAVA_AUTODRAW) - dsj pulls data over to java and renders automatically into a lightweight Swing panel, that you can directly add to your GUI
- java side, polled (JAVA_POLL) - no automatic action. Application code is responsible for retrieving data from the dll and rendering or otherwise processing it.
- jave side, polled & delivering RGB instead of BGR data (JAVA_POLL_RGB). Use this to adapt to JMF for RTP transmission
- headless (HEADLESS) - not interfering with DirectShow signal flow at all beside basic control (start, stop, etc.). This will make standard filtergraphs come up with a native window instead of rendering into java windows. It is mainly thought for custom use cases. You may have a custom renderer filter, maybe in hardware, that you want to work with or the like.
- embedded VideoMixingRenderer9 (VMR9 or VMR_EMBED). This embeds a native DirectShow renderer into the java canvas. It lets you mix a number of video streams plus graphics overlay. Despite the outstanding capabilities of the VMR9 it may have certain drawbacks at points. see below.
- overlay (VMR7 or OVERLAY). Draws a native overlay into the java window using DirectShow's VideoMixingRenderer7. High performance, but again may be problematic at points. - null sink(NULL). This does nothing but sending received frames to digital nirvana. Useful when using the SampleAccessfilter to pull data from the filtergraph and no rendering is needed at all.
- Enhanced Video Renderer (EVR). Basic support added in dsj 0_8_61. Uses Microsoft's latest video renderer and is only available on Vista and beyond. Will allow DXVA hardware accellerated decoders to be used.


Modes that use native DirectShow renderer filters are as far out of Java as can go and may not be suitable in all situations. They both tend to behave differently accross Windows versions and may present problems with proper integration into java GUIs. For example, while the VMR 9 seems to work nicely on Vista, it is problematic to reparent with WindowsMedia in XP, The overlay approach on the other hand may lock the entire GUI with capture and streaming graphs (live sources). It is therefore disabled in DSCapture, but care should be taken when using network sources in DSMovie.
Also the overlay mode will not allow Java listeners to receive events from the display component. If you need mouse and key events, initialize the graph with the MOUSE_ENABLED (or DVD_MENU_ENABLED) flag set. Events will then be generated and delivered to registered Mouse / Key listeners. On JRE 1.5 versions below update 10 only mouse button events will be transferred, because of a JNI handle leak, that becomes severe with motion events (fixed in 1.5_10). Note that this functionality is not available on 32bit Windows 7.
Both VMR_EMBED and OVERLAY modes are not fully functional until the display component has been added to some kind of container!

As off dsj 0_8_51 you can switch the library into YUV mode by setting the YUV setup flag. This is only valid with DD7, D3D9, J2D and JAVA_POLL rendering modes and means that no conversion to RGB colorspace will be performed on the native side. this can improve performance with hd videos (it will probably not make an obvious difference with nonHD stuff) and you can get yuv image data in java - for example to send it to JMF - by calling getData(). getImage() will return null in this mode.
The DD7 renderer will be able to display most yuv subtypes to encounter. Whether or not the D3D9 renderer will work highly depends on the graphics card. Most adapters should support D3D9 surfaces for 16 bit yuv types (as YUY2 or UYVY) but 12 bit modes (like YV12) may be problematic. You should listen for GRAPH_ERROR events when running with this flag as setup errors as well as errors on surface losses (like when the user logs off) may occur asynchronously and will be reported through PropertyChangeEvents.
The lightweight J2D renderer will not display anything when in YUV mode (but will continously call getData()).


As of dsj_0_8_53 you can also change the usual BGR24 format to ABGR32 bei setting the RGB32 flag. This only makes sense with sources that deliver 32bit data of course and takes more resources. One possible use case is with MPEG2 decoders that do not offer 24bit RGB output types and would require a ColorSpaceConverter filter to connect to the dsj_Sink.

All rendering modes not using DirectShow Renderer filters (that is all but HEADLESS, OVERLAY and VMR_EMBED) can call back into java with timestamped frame notifications. Set the FRAME_CALLBACK flag in the graph constructors.
With the DELIVER_AUDIO bit set, all DSFiltergraph subclasses except DSDVCam will open a second JNI pipeline to deliver raw audio data to java. Without this flag audio will simply be played on the native side.

All display flags (DD7 / RENDER_NATIVE to GDI) are mutually exclusive, that is: dsj will use the highest set bit. Flags that are not display related (see below) can be combined with them by using the | operator (exp: DD7 | DELIVER_AUDIO will run in DirectDraw7 mode and deliver audio bytes to java). Application code should only use the defined flags (we have seen support requests where people use something like 0xFF80 | JAVA_AUTODRAW and wonder why things don't go the way they want it to). Higher bits in the flags parameter are at parts used internally, so please stick with the documented ones. Also remember your school lessons and use the constants and not their numeric values (which may change)!

All DSFiltergraph subclasses by default automatically start the native filtergraph with audio at normal volume (if there is audio). To prevent autostarting either set the INIT_PAUSED bit in the flags parameter or call pause() right after initialization. To mute volume initially set the INIT_MUTED bit
Non-rendering related setup flags:
DELIVER_AUDIO,
DVD_MENU_ENABLED (or MOUSE_ENABLED),
INIT_PAUSED,
INIT_MUTED,
NO_SYNC,
FRAME_CALLBACK

To shutdown a filtergraph call dispose(). This will also remove the display component from any container it was added to. Disposing the native structures when you're done with them is especially important for graphs that directly talk to hardware drivers (Capture, DV, BDA). While undisposed movie classes may have no worse side-effects than memory loss, open unreferenced driver instances may lead to completely unpredictable behaviour, including JVM and system crashes. In c++ there is no garbage collector automatically cleaning up behind you. dsj will try to keep track of allocated objects and clean them up when the dll is unloaded, but it is highly recommended that application code uses dispose() on any graph that it no longer intends to use.

Some more general considerations:
It is recommended to not declare DSFiltergraph subclass instances static.

See Also:
Serialized Form

Nested Class Summary
 class DSFiltergraph.DSAudioStream
          Nested class that wraps the stream of audio bytes dsj delivers when the DELIVER_AUDIO bit is set on construction.
 
Nested classes/interfaces inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int ACTIVATING
          DSFiltergraph events
static int ANAMORPHIC
          DSFiltergraph rendering & setup flags
static int ASYNC_BUFFER_GET
          DSFiltergraph events
static int ASYNC_BUFFER_REQ
          DSFiltergraph events
static int AUDIO_BUFFER_REQUEST
          DSFiltergraph events
static int BDA
          DSFiltergraph types
static int BDA_PRG_CHANGED
          DSFiltergraph events
static int BDA_SCAN_PROGRESS
          DSFiltergraph events
static int BDA_SCANNED_FREQ
          DSFiltergraph events
static int BDA_SIG_REC
          DSFiltergraph events
static int BUFFER_COMPLETE
          DSFiltergraph events
static int BUFFERING
          DSFiltergraph events
static int CALLER
          Event delivery thread constants
static int CAP_STATE_CHANGED
          DSFiltergraph events
static int CAPTURE
          DSFiltergraph types
static int CLOSED
          DSFiltergraph events
static int CLOSING
          DSFiltergraph events
static int COMP_AUDIO_BUFFER_REQ
          DSFiltergraph events
static int COMP_BUFFER_FILLED
          DSFiltergraph events
static int COMP_VIDEO_BUFFER_REQ
          DSFiltergraph events
static int D3D9
          DSFiltergraph rendering & setup flags
static int DD7
          DSFiltergraph rendering & setup flags
static int DECKLINK
          Extension API identifiers
static int DELIVER_AUDIO
          DSFiltergraph rendering & setup flags
static int DES_ERROR
          DSFiltergraph events
static int DONE
          DSFiltergraph events
static int DV
          DSFiltergraph types
static int DV_STATE_CHANGED
          DSFiltergraph events
static int DVD
          DSFiltergraph types
static int DVD_FORMAT_CHANGED
          DSFiltergraph events
static int DVD_MENU_ENABLED
          DSFiltergraph rendering & setup flags
static int E_CANT_PUMP_AUDIO
          DSFiltergraph errors
static int E_INIT_HEADLESS
          DSFiltergraph errors
static int EDITABLE
          DSFiltergraph types
static int ENTER_FS
          DSFiltergraph events
static int EPG
          DSFiltergraph events
static int EVR
          DSFiltergraph rendering & setup flags
static int EXIT_FS
          DSFiltergraph events
static int EXPORT_DONE
          DSFiltergraph events
static int EXPORT_FINISHING
          DSFiltergraph events
static int EXPORT_PROGRESS
          DSFiltergraph events
static int EXPORT_STARTED
          DSFiltergraph events
static int EXT_API_EVENT
          DSFiltergraph events
static int FILTER_CHANGED
          DSFiltergraph events
static int FORMAT_CHANGED
          DSFiltergraph events
static int FRAME_CALLBACK
          DSFiltergraph rendering & setup flags
static int FRAME_LOCKED
          DSFiltergraph rendering & setup flags
static int FRAME_NOTIFY
          DSFiltergraph events
static int GD
          Event delivery thread constants
static int GE_DEVICE_CONNECTED
          Graph events
static int GE_DEVICE_LOST
          Graph events
static int GE_REF_REC_STOPPED
          Graph events
static int GRAPH
          DSFiltergraph types
static int GRAPH_CHANGED
          DSFiltergraph events
static int GRAPH_ERROR
          DSFiltergraph events
static int GRAPH_EVENT
          DSFiltergraph events
static int HDV
          DSFiltergraph types
static int HDV_STATE_CHANGED
          DSFiltergraph events
static int HEADLESS
          DSFiltergraph rendering & setup flags
static int INDEXER_DONE
          DSFiltergraph events
static int INDEXER_STARTED
          DSFiltergraph events
static int INIT_MUTED
          DSFiltergraph rendering & setup flags
static int INIT_PAUSED
          DSFiltergraph rendering & setup flags
static int INITIALIZED
          DSFiltergraph events
static int IP_READY
          DSFiltergraph events
static int J2D
          DSFiltergraph rendering & setup flags
static int JAVA_AUTODRAW
          DSFiltergraph rendering & setup flags
static int JAVA_POLL
          DSFiltergraph rendering & setup flags
static int JAVA_POLL_RGB
          DSFiltergraph rendering & setup flags
static int JAVASOUND
          DSFiltergraph rendering & setup flags
static int KEY_EVENT
          DSFiltergraph events
static int KF_NOTIFY
          DSFiltergraph events
static int LOCK_BUFFER
          DSFiltergraph events
static int LOOP
          DSFiltergraph events
static int MGD
          Extension API identifiers
static int MOUSE_ENABLED
          DSFiltergraph rendering & setup flags
static int MOUSE_EVENT
          DSFiltergraph events
static int MOVIE
          DSFiltergraph types
static int NATIVE_FORCE_GDI
          DSFiltergraph rendering & setup flags
static int NIO_UPDATE
          DSFiltergraph events
static int NO_AMW
          DSFiltergraph rendering & setup flags
static int NO_SYNC
          DSFiltergraph rendering & setup flags
static int NULL
          DSFiltergraph rendering & setup flags
static int ONESHOT
          Event delivery thread constants
static int OVERLAY
          DSFiltergraph rendering & setup flags
static int OVERLAY_BUFFER_REQUEST
          DSFiltergraph events
static int PLAYLIST_PARSED
          DSFiltergraph events
static int PREVIEW
          Common flag values
static int RENDER_NATIVE
          DSFiltergraph rendering & setup flags
static int RESTART_REQ
          DSFiltergraph events
static int RGB32
          DSFiltergraph rendering & setup flags
static int RTCP_EVENT
          DSFiltergraph events
static int RTMP_EVENT
          DSFiltergraph events
static int RTMP_SO_CHANGED
          DSFiltergraph events
static int RTMP_STATE_CHANGED
          DSFiltergraph events
static int SAMPLE_BUFFER_FILLED
          DSFiltergraph events
static int SAVE_DONE
          DSFiltergraph events
static int SAVE_STARTED
          DSFiltergraph events
static int SBE
          DSFiltergraph types
static int SBE_REC_STATE_CHANGED
          DSFiltergraph events
static int SERVICE_ERROR
          DSFiltergraph events
static int SERVICE_EVENT
          DSFiltergraph events
static int SINK_ERROR
          DSFiltergraph events
static int SINK_STATE_CHANGED
          DSFiltergraph events
static int SIZE_CHANGED
          DSFiltergraph events
static int SOURCE_ERROR
          DSFiltergraph events
static int SOURCE_STATE_CHANGED
          DSFiltergraph events
static int SOURCE_STATE_NOTIFY
          DSFiltergraph events
static int SOURCE_USER_DATA
          DSFiltergraph events
static int STILL_IMG_RECEIVED
          DSFiltergraph events
static int STREAM_SEEK
          DSFiltergraph events
static int SUBCLASS_EVENT
          DSFiltergraph events
static int SWING
          Event delivery thread constants
static int SYNC_BUFFER_REQ
          DSFiltergraph events
static int TABLE_RECEIVED
          DSFiltergraph events
static int TIME_FORMAT_CHANGED
          DSFiltergraph events
static int TRANS_IN_PLACE
          DSFiltergraph events
static int TRANSPORT
          DSFiltergraph events
static int TS_BUFFER_FILLED
          DSFiltergraph events
 int type
           
static int VIDEO_BUFFER_REQUEST
          DSFiltergraph events
static int VMR_EMBED
          DSFiltergraph rendering & setup flags
static int VMR7
          DSFiltergraph rendering & setup flags
static int VMR9
          DSFiltergraph rendering & setup flags
static int VPJ
          Extension API identifiers
static int YUV
          DSFiltergraph rendering & setup flags
static int YUV_ORG
          DSFiltergraph rendering & setup flags
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DSFiltergraph()
           
 
Method Summary
 DSFilter addColorSpaceConverter(int mode, int reserved)
           
 DSFilter addFilterToGraph(DSFilterInfo info)
          Adds a filter to the native filtergraph and creates a DSFilter object representing it.
 void addNotify()
           
 void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
          Instead of defining another interface DSFiltergraph uses existing java api and fires PropertyChangeEvents when properties change.
 java.awt.Component asComponent()
          Depending on rendering mode, returns either the canvas DSFiltergraph extends or a JPanel it renders into
 DSFilter connectDump(DSFilter.DSPin toPin, java.lang.String outputFilePath)
          Connects a filter that will write raw data of any type - as received from the given pin - to a file at %outputFilePath.
 int connectSink(Sink sink)
          Connects the given Sink object to the graph.
static DSFiltergraph createDSFiltergraph(java.lang.String path, int flags, java.beans.PropertyChangeListener pcl)
          "Factory" method.
 void dispose()
          Disposes off all native & java structures and is to be seen as a mandatory call when you are done with a Filtergraph.
 void dumpGraph(boolean dc)
          Prints a listing of filters in the graph (& evtl.
 DSFilter findFilterByName(java.lang.String name)
          Tries to find a filter of the given name in the graph.
 DSFilter findRenderer(int majorType)
          Tries to find the renderer for the given major media type (DSMediaType.MT_..).
 int flipImage(int flip)
          Flips the display and eventually the return of getImage().
 boolean getActive()
          Returns the internal state of the graph.
 boolean getAspectLocked()
           
 int[] getAspectRatio()
           
 int[] getAudioProperties()
          Returns sample rate, samplesize and number of channels of a graph's audio stream if any.
 DSFiltergraph.DSAudioStream getAudioStream()
          Returns the constructed DSAudioStream when set up with DELIVER_AUDIO bit set.
 int getBitDepth()
          Returns bitDepth of uncompressed data.
 byte[] getData()
          Returns native uncompressed BGR or RGB image data in a byte array (YUV when the YUV flag(s) have been set).
 int getDataSize()
           
 java.awt.Dimension getDisplaySize()
          Returns rendering component's boundary in a java.awt.Dimension object.
 int getDuration()
          Returns graph duration if known, expressed in milliseconds
 float getEffectiveFrameRate()
          Returns the effective framerate when the Filtergraph is running
 float getFrameRate()
          Returns media, capture device or DV tape derived framerate.
 java.awt.Frame getFullScreenWindow()
           
 long getID()
          Returns the native memory pointer.
 java.awt.image.BufferedImage getImage()
          Returns native uncompressed BGR or RGB (ARGB in VMR9 and EVR modes) data in a BufferedImage object backed by a DataBufferByte.
 java.lang.String getInfo()
           
 boolean getLoop()
           
 java.awt.Dimension getMediaDimension()
          Returns original media dimension.
 java.awt.Dimension getMinimumSize()
           
 int getOutFlags()
          Returns the flag int passed on construction, with some bits possibly changed.
 float getPan()
           
 java.awt.Dimension getPreferredSize()
           
 float getRate()
          Returns current playback rate.
 RendererControls getRendererControls()
          Gets the RendererControls object for the renderer this Filtergraph has been constructed with.
 int getTime()
          Returns current playback position in milliseconds.
 float getVolume()
           
 int getYUVType()
          Returns the YUV type of image data as a packed FCC when set up with YUV flag, -1 otherwise.
 void goFullScreen(java.awt.GraphicsDevice device, int flags)
          Displays graph in fullscreen mode.
 void graphChanged()
           
 boolean hasMediaOfType(int majorType)
          Returns true if the filtergraph has streams of the given major media type (DSMediaType.MT_AUDIO / MT_VIDEO)
 DSFilter insertFilter(DSFilter before, DSFilter after, DSFilterInfo toInsert)
          Tries to insert a filter described by the FilterInfo argument between the two given filters and returns it
If the method fails, dsj tries to restore the graph to its previous state.
 JavaOverlayFilter insertOverlayFilter(int flags)
          Inserts the dsj_JavaOverlayFilter and establishes communication with it.
 DSSampleBuffer insertSampleAccessFilter(DSFilter before, DSFilter.DSPin srcPin, DSFilter after, int flags)
          Installs an nio.ByteBuffer between the two specified filters from which the application can read - depending on the insertion point - compressed or uncompressed data.
 DSFilter insertTransInPlaceFilter(DSFilter before, DSFilter.DSPin srcPin, DSFilter after, JTransInPlaceFilter jtip, int flags)
          Inserts the native part of dsj's TransInPlace filter between the two given filters and establishes communication with the supplied extension of JTransInPlaceFilter whose transform method will then be called from the filtergraph.
 boolean isFullScreen()
           
 boolean isSubGraph()
           
 void leaveFullScreen()
          Closes the fullscreen window.
 DSFilter[] listFilters()
          Returns all the filters in the filtergraph as DSFilter objects.
 void lockAspectRatio(boolean locked)
          Enables or disables fixed ratio resize behavior.
 void paint(java.awt.Graphics g)
           
 void pause()
          Temporarily pauses the graph
 void play()
          Runs the graph
 boolean queryCapability(int c)
          Queries for some IAMSeeking capabilities.
 void redraw()
          Do not call paint() or repaint() on a natively rendering DSFiltergraph directly.
 void register(COMObject co)
           
 void reloadFilter(DSFilter filter)
          Disconnects and removes a filter then reinserts and reconnects it.
 void removeFilter(DSFilter filter, boolean restart)
          Removes the given filter from the graph.
 void removeNotify()
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
           
 boolean removeSink()
          Removes a connected sink and puts the graph back into its "normal" initial display state.
 void setAudioRenderer(DSFilterInfo ar)
          Directs audio output from this filtergraph to the given sound device.
 void setAviExportOptions(int interleavingMode, int interleavingFreq, int audioPreroll, boolean synced, int flags)
          Sets some (avi) exporting parameters.
 void setBounds(int jx, int jy, int jw, int jh)
           
 boolean setClockSource(DSFilter refClock)
          Sets the filter to provide the reference clock for the filtergraph (by default this usually is set to the audio renderer).
 void setEvent(java.beans.PropertyChangeEvent event, int th)
          Called by some lower level classes to get events posted to listeners.
 void setLoop(boolean looping)
           
 void setPan(float pan)
          Set audio balance (-1.0 left, 1.0 right)
 void setPreferredSize(java.awt.Dimension dim)
           
 void setRate(float rate)
          Set the playback rate (-1.0 to 2.0).
 void setTimeValue(int time)
          Set (movie) position to %time (milliseconds)
 void setVolume(float vol)
          (1.0 - full volume, 0 silence).
 void step(int dir)
          Step fwd or bwd (set %dir to 1 or -1).
 void stop()
          Stops the graph.
 void tearDown(DSFilter fromFilter, boolean removeThatFilter)
          Disconnects and removes all filters downstream from %fromFilter, optionally also removing that filter.
 void update(java.awt.Graphics g)
           
 
Methods inherited from class java.awt.Canvas
createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLOSED

public static final int CLOSED
DSFiltergraph events

See Also:
Constant Field Values

ACTIVATING

public static final int ACTIVATING
DSFiltergraph events

See Also:
Constant Field Values

INITIALIZED

public static final int INITIALIZED
DSFiltergraph events

See Also:
Constant Field Values

IP_READY

public static final int IP_READY
DSFiltergraph events

See Also:
Constant Field Values

TRANSPORT

public static final int TRANSPORT
DSFiltergraph events

See Also:
Constant Field Values

DV_STATE_CHANGED

public static final int DV_STATE_CHANGED
DSFiltergraph events

See Also:
Constant Field Values

FORMAT_CHANGED

public static final int FORMAT_CHANGED
DSFiltergraph events

See Also:
Constant Field Values

CAP_STATE_CHANGED

public static final int CAP_STATE_CHANGED
DSFiltergraph events

See Also:
Constant Field Values

EXPORT_PROGRESS

public static final int EXPORT_PROGRESS
DSFiltergraph events

See Also:
Constant Field Values

LOOP

public static final int LOOP
DSFiltergraph events

See Also:
Constant Field Values

DONE

public static final int DONE
DSFiltergraph events

See Also:
Constant Field Values

FRAME_NOTIFY

public static final int FRAME_NOTIFY
DSFiltergraph events

See Also:
Constant Field Values

GRAPH_EVENT

public static final int GRAPH_EVENT
DSFiltergraph events

See Also:
Constant Field Values

GRAPH_ERROR

public static final int GRAPH_ERROR
DSFiltergraph events

See Also:
Constant Field Values

BDA_SCAN_PROGRESS

public static final int BDA_SCAN_PROGRESS
DSFiltergraph events

See Also:
Constant Field Values

BDA_SCANNED_FREQ

public static final int BDA_SCANNED_FREQ
DSFiltergraph events

See Also:
Constant Field Values

BDA_SIG_REC

public static final int BDA_SIG_REC
DSFiltergraph events

See Also:
Constant Field Values

PLAYLIST_PARSED

public static final int PLAYLIST_PARSED
DSFiltergraph events

See Also:
Constant Field Values

BUFFERING

public static final int BUFFERING
DSFiltergraph events

See Also:
Constant Field Values

BUFFER_COMPLETE

public static final int BUFFER_COMPLETE
DSFiltergraph events

See Also:
Constant Field Values

KF_NOTIFY

public static final int KF_NOTIFY
DSFiltergraph events

See Also:
Constant Field Values

MOUSE_EVENT

public static final int MOUSE_EVENT
DSFiltergraph events

See Also:
Constant Field Values

KEY_EVENT

public static final int KEY_EVENT
DSFiltergraph events

See Also:
Constant Field Values

CLOSING

public static final int CLOSING
DSFiltergraph events

See Also:
Constant Field Values

HDV_STATE_CHANGED

public static final int HDV_STATE_CHANGED
DSFiltergraph events

See Also:
Constant Field Values

SBE_REC_STATE_CHANGED

public static final int SBE_REC_STATE_CHANGED
DSFiltergraph events

See Also:
Constant Field Values

ENTER_FS

public static final int ENTER_FS
DSFiltergraph events

See Also:
Constant Field Values

EXIT_FS

public static final int EXIT_FS
DSFiltergraph events

See Also:
Constant Field Values

NIO_UPDATE

public static final int NIO_UPDATE
DSFiltergraph events

See Also:
Constant Field Values

GRAPH_CHANGED

public static final int GRAPH_CHANGED
DSFiltergraph events

See Also:
Constant Field Values

FILTER_CHANGED

public static final int FILTER_CHANGED
DSFiltergraph events

See Also:
Constant Field Values

SIZE_CHANGED

public static final int SIZE_CHANGED
DSFiltergraph events

See Also:
Constant Field Values

DVD_FORMAT_CHANGED

public static final int DVD_FORMAT_CHANGED
DSFiltergraph events

See Also:
Constant Field Values

TIME_FORMAT_CHANGED

public static final int TIME_FORMAT_CHANGED
DSFiltergraph events

See Also:
Constant Field Values

TS_BUFFER_FILLED

public static final int TS_BUFFER_FILLED
DSFiltergraph events

See Also:
Constant Field Values

EPG

public static final int EPG
DSFiltergraph events

See Also:
Constant Field Values

BDA_PRG_CHANGED

public static final int BDA_PRG_CHANGED
DSFiltergraph events

See Also:
Constant Field Values

SUBCLASS_EVENT

public static final int SUBCLASS_EVENT
DSFiltergraph events

See Also:
Constant Field Values

EXT_API_EVENT

public static final int EXT_API_EVENT
DSFiltergraph events

See Also:
Constant Field Values

EXPORT_STARTED

public static final int EXPORT_STARTED
DSFiltergraph events

See Also:
Constant Field Values

EXPORT_FINISHING

public static final int EXPORT_FINISHING
DSFiltergraph events

See Also:
Constant Field Values

EXPORT_DONE

public static final int EXPORT_DONE
DSFiltergraph events

See Also:
Constant Field Values

SAVE_STARTED

public static final int SAVE_STARTED
DSFiltergraph events

See Also:
Constant Field Values

SAVE_DONE

public static final int SAVE_DONE
DSFiltergraph events

See Also:
Constant Field Values

INDEXER_STARTED

public static final int INDEXER_STARTED
DSFiltergraph events

See Also:
Constant Field Values

INDEXER_DONE

public static final int INDEXER_DONE
DSFiltergraph events

See Also:
Constant Field Values

DES_ERROR

public static final int DES_ERROR
DSFiltergraph events

See Also:
Constant Field Values

SOURCE_STATE_CHANGED

public static final int SOURCE_STATE_CHANGED
DSFiltergraph events

See Also:
Constant Field Values

SOURCE_USER_DATA

public static final int SOURCE_USER_DATA
DSFiltergraph events

See Also:
Constant Field Values

SOURCE_ERROR

public static final int SOURCE_ERROR
DSFiltergraph events

See Also:
Constant Field Values

SOURCE_STATE_NOTIFY

public static final int SOURCE_STATE_NOTIFY
DSFiltergraph events

See Also:
Constant Field Values

SINK_STATE_CHANGED

public static final int SINK_STATE_CHANGED
DSFiltergraph events

See Also:
Constant Field Values

SINK_ERROR

public static final int SINK_ERROR
DSFiltergraph events

See Also:
Constant Field Values

RTMP_EVENT

public static final int RTMP_EVENT
DSFiltergraph events

See Also:
Constant Field Values

RTMP_STATE_CHANGED

public static final int RTMP_STATE_CHANGED
DSFiltergraph events

See Also:
Constant Field Values

RTMP_SO_CHANGED

public static final int RTMP_SO_CHANGED
DSFiltergraph events

See Also:
Constant Field Values

RTCP_EVENT

public static final int RTCP_EVENT
DSFiltergraph events

See Also:
Constant Field Values

SERVICE_EVENT

public static final int SERVICE_EVENT
DSFiltergraph events

See Also:
Constant Field Values

SERVICE_ERROR

public static final int SERVICE_ERROR
DSFiltergraph events

See Also:
Constant Field Values

VIDEO_BUFFER_REQUEST

public static final int VIDEO_BUFFER_REQUEST
DSFiltergraph events

See Also:
Constant Field Values

OVERLAY_BUFFER_REQUEST

public static final int OVERLAY_BUFFER_REQUEST
DSFiltergraph events

See Also:
Constant Field Values

AUDIO_BUFFER_REQUEST

public static final int AUDIO_BUFFER_REQUEST
DSFiltergraph events

See Also:
Constant Field Values

COMP_BUFFER_FILLED

public static final int COMP_BUFFER_FILLED
DSFiltergraph events

See Also:
Constant Field Values

SAMPLE_BUFFER_FILLED

public static final int SAMPLE_BUFFER_FILLED
DSFiltergraph events

See Also:
Constant Field Values

COMP_VIDEO_BUFFER_REQ

public static final int COMP_VIDEO_BUFFER_REQ
DSFiltergraph events

See Also:
Constant Field Values

COMP_AUDIO_BUFFER_REQ

public static final int COMP_AUDIO_BUFFER_REQ
DSFiltergraph events

See Also:
Constant Field Values

SYNC_BUFFER_REQ

public static final int SYNC_BUFFER_REQ
DSFiltergraph events

See Also:
Constant Field Values

ASYNC_BUFFER_REQ

public static final int ASYNC_BUFFER_REQ
DSFiltergraph events

See Also:
Constant Field Values

ASYNC_BUFFER_GET

public static final int ASYNC_BUFFER_GET
DSFiltergraph events

See Also:
Constant Field Values

STREAM_SEEK

public static final int STREAM_SEEK
DSFiltergraph events

See Also:
Constant Field Values

RESTART_REQ

public static final int RESTART_REQ
DSFiltergraph events

See Also:
Constant Field Values

TRANS_IN_PLACE

public static final int TRANS_IN_PLACE
DSFiltergraph events

See Also:
Constant Field Values

LOCK_BUFFER

public static final int LOCK_BUFFER
DSFiltergraph events

See Also:
Constant Field Values

TABLE_RECEIVED

public static final int TABLE_RECEIVED
DSFiltergraph events

See Also:
Constant Field Values

STILL_IMG_RECEIVED

public static final int STILL_IMG_RECEIVED
DSFiltergraph events

See Also:
Constant Field Values

GE_DEVICE_LOST

public static final int GE_DEVICE_LOST
Graph events

See Also:
Constant Field Values

GE_DEVICE_CONNECTED

public static final int GE_DEVICE_CONNECTED
Graph events

See Also:
Constant Field Values

GE_REF_REC_STOPPED

public static final int GE_REF_REC_STOPPED
Graph events

See Also:
Constant Field Values

MOVIE

public static final int MOVIE
DSFiltergraph types

See Also:
Constant Field Values

DVD

public static final int DVD
DSFiltergraph types

See Also:
Constant Field Values

GRAPH

public static final int GRAPH
DSFiltergraph types

See Also:
Constant Field Values

DV

public static final int DV
DSFiltergraph types

See Also:
Constant Field Values

CAPTURE

public static final int CAPTURE
DSFiltergraph types

See Also:
Constant Field Values

SBE

public static final int SBE
DSFiltergraph types

See Also:
Constant Field Values

BDA

public static final int BDA
DSFiltergraph types

See Also:
Constant Field Values

EDITABLE

public static final int EDITABLE
DSFiltergraph types

See Also:
Constant Field Values

HDV

public static final int HDV
DSFiltergraph types

See Also:
Constant Field Values

RENDER_NATIVE

public static final int RENDER_NATIVE
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

DD7

public static final int DD7
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

D3D9

public static final int D3D9
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

JAVA_AUTODRAW

public static final int JAVA_AUTODRAW
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

J2D

public static final int J2D
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

JAVA_POLL

public static final int JAVA_POLL
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

JAVA_POLL_RGB

public static final int JAVA_POLL_RGB
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

HEADLESS

public static final int HEADLESS
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

VMR_EMBED

public static final int VMR_EMBED
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

VMR9

public static final int VMR9
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

OVERLAY

public static final int OVERLAY
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

VMR7

public static final int VMR7
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

NATIVE_FORCE_GDI

public static final int NATIVE_FORCE_GDI
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

NULL

public static final int NULL
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

EVR

public static final int EVR
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

DELIVER_AUDIO

public static final int DELIVER_AUDIO
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

JAVASOUND

public static final int JAVASOUND
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

INIT_PAUSED

public static final int INIT_PAUSED
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

DVD_MENU_ENABLED

public static final int DVD_MENU_ENABLED
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

MOUSE_ENABLED

public static final int MOUSE_ENABLED
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

NO_AMW

public static final int NO_AMW
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

INIT_MUTED

public static final int INIT_MUTED
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

NO_SYNC

public static final int NO_SYNC
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

FRAME_CALLBACK

public static final int FRAME_CALLBACK
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

YUV

public static final int YUV
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

YUV_ORG

public static final int YUV_ORG
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

RGB32

public static final int RGB32
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

ANAMORPHIC

public static final int ANAMORPHIC
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

FRAME_LOCKED

public static final int FRAME_LOCKED
DSFiltergraph rendering & setup flags

See Also:
Constant Field Values

E_INIT_HEADLESS

public static final int E_INIT_HEADLESS
DSFiltergraph errors

See Also:
Constant Field Values

E_CANT_PUMP_AUDIO

public static final int E_CANT_PUMP_AUDIO
DSFiltergraph errors

See Also:
Constant Field Values

PREVIEW

public static final int PREVIEW
Common flag values

See Also:
Constant Field Values

MGD

public static final int MGD
Extension API identifiers

See Also:
Constant Field Values

DECKLINK

public static final int DECKLINK
Extension API identifiers

See Also:
Constant Field Values

VPJ

public static final int VPJ
Extension API identifiers

See Also:
Constant Field Values

GD

public static final int GD
Event delivery thread constants

See Also:
Constant Field Values

CALLER

public static final int CALLER
Event delivery thread constants

See Also:
Constant Field Values

SWING

public static final int SWING
Event delivery thread constants

See Also:
Constant Field Values

ONESHOT

public static final int ONESHOT
Event delivery thread constants

See Also:
Constant Field Values

type

public int type
Constructor Detail

DSFiltergraph

public DSFiltergraph()
Method Detail

createDSFiltergraph

public static DSFiltergraph createDSFiltergraph(java.lang.String path,
                                                int flags,
                                                java.beans.PropertyChangeListener pcl)
                                         throws DSJException
"Factory" method. Will create a subclass according to file extensions or type string. Use this or the basic constructors directly, the result will be the same. For more control over the setup of the subclasses, their extended constructors should be used.
.wmv, .avi, .mpg etc will create DSMovie, avisynth scripts (.avs) will also work
.IFO, null string, "DVD" or "dvd" will create DSDvd
.grf and .xgr or a raw xml string will create DSGraph
"DV" or "dv" will create DSDVCam

Throws:
DSJException

getID

public long getID()
Returns the native memory pointer. This is here mainly for debugging purposes in multi graph (& possibly multithreaded) scenarios. Besides there is no real use for this in application code.


getImage

public java.awt.image.BufferedImage getImage()
                                      throws DSJException
Returns native uncompressed BGR or RGB (ARGB in VMR9 and EVR modes) data in a BufferedImage object backed by a DataBufferByte. This method polls DirectShow for the current image data. Be aware that it is the returned image's DataBuffer that is passed to and filled by the native code. You may want to copy the buffer if you plan to do more than just display the image.
This method & getData() effectively do the same. If you want both image & bytes, call getImage() and use java's BufferedImage api to get the bytes, instead of doing 2 native calls. The method may fail when called directly after construction and the display component has not been added to some kind of container or after format changes. A short sleep(..) usually helps, alternatively consider using the FRAME_CALLBACK constructor flag and only start calling getImage after you recived the first FRAME_NOTIFY event.
Returns null in HEADLESS and VMR7 mode.

Throws:
DSJException

getData

public byte[] getData()
Returns native uncompressed BGR or RGB image data in a byte array (YUV when the YUV flag(s) have been set). This method polls DirectShow for the current image data. Be aware that it is the returned array that is passed to and filled by the native code. You may want to copy it for further processing.
This method & getImage() effectively do the same. If you want both image & bytes, call getImage() and use java's BufferedImage api to get the bytes, instead of doing 2 native calls.


play

public void play()
Runs the graph


stop

public void stop()
          throws DSJException
Stops the graph. This can make a significant difference to pausing at points.
For example all capture classes will close the file they're capturing to on stop(). In most cases a filtergraph must be stopped to change its wiring ((re)connect pins). Stopping a filtergraph does not close and terminate it (dispose() does)!

Throws:
DSJException

pause

public void pause()
Temporarily pauses the graph


setRate

public void setRate(float rate)
             throws DSJException
Set the playback rate (-1.0 to 2.0). Use this to start and stop playback (1.0 is normal speed 0 stops. Most DirectShow Filters will not allow negative rates (playing backwards)).

Throws:
DSJException

setTimeValue

public void setTimeValue(int time)
                  throws DSJException
Set (movie) position to %time (milliseconds)

Throws:
DSJException

getTime

public int getTime()
            throws DSJException
Returns current playback position in milliseconds.

Throws:
DSJException

getRate

public float getRate()
              throws DSJException
Returns current playback rate.

Throws:
DSJException

step

public void step(int dir)
          throws DSJException
Step fwd or bwd (set %dir to 1 or -1). This may not properly work with some intraframe compressed encodings

Throws:
DSJException

setLoop

public void setLoop(boolean looping)
             throws DSJException
Throws:
DSJException

getLoop

public boolean getLoop()

getMediaDimension

public java.awt.Dimension getMediaDimension()
Returns original media dimension.


getDisplaySize

public java.awt.Dimension getDisplaySize()
Returns rendering component's boundary in a java.awt.Dimension object. May be differend from Dimension returned by getMediaDimension() when the graph is flagged as 16:9 or the like.


setBounds

public void setBounds(int jx,
                      int jy,
                      int jw,
                      int jh)
               throws DSJException
Overrides:
setBounds in class java.awt.Component
Throws:
DSJException

addNotify

public void addNotify()
               throws DSJException
Overrides:
addNotify in class java.awt.Canvas
Throws:
DSJException

removeNotify

public void removeNotify()
Overrides:
removeNotify in class java.awt.Component

getYUVType

public int getYUVType()
Returns the YUV type of image data as a packed FCC when set up with YUV flag, -1 otherwise.


getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class java.awt.Component

setPreferredSize

public void setPreferredSize(java.awt.Dimension dim)
Overrides:
setPreferredSize in class java.awt.Component

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class java.awt.Component

getBitDepth

public int getBitDepth()
Returns bitDepth of uncompressed data.


getDataSize

public int getDataSize()

getDuration

public int getDuration()
Returns graph duration if known, expressed in milliseconds


getFrameRate

public float getFrameRate()
                   throws DSJException
Returns media, capture device or DV tape derived framerate.

Throws:
DSJException

getEffectiveFrameRate

public float getEffectiveFrameRate()
                            throws DSJException
Returns the effective framerate when the Filtergraph is running

Throws:
DSJException

setVolume

public void setVolume(float vol)
               throws DSJException
(1.0 - full volume, 0 silence). Only works when audio is played in native code. When set up with DELIVER_AUDIO flag, use javasound to control the volume.

Throws:
DSJException

getVolume

public float getVolume()
                throws DSJException
Throws:
DSJException

setPan

public void setPan(float pan)
            throws DSJException
Set audio balance (-1.0 left, 1.0 right)

Throws:
DSJException

getPan

public float getPan()
             throws DSJException
Throws:
DSJException

queryCapability

public boolean queryCapability(int c)
Queries for some IAMSeeking capabilities. See DSConstants for capability flags (AM_SEEKING_Can...).


dispose

public void dispose()
Disposes off all native & java structures and is to be seen as a mandatory call when you are done with a Filtergraph. It will also remove the display component from any container it was added to.
Calling this method from a filtergraph callback should be avoided.
Disposing the native structures is especially important for graphs that directly talk to hardware drivers (Capture, DV, BDA). While undisposed movie classes may have no worse side-effects than memory loss, open unreferenced driver instances may lead to completely unpredictable behaviour, including JVM and system crashes. Remember the code that does the work here is not Java and there is no highly optimized garbage collector automatically cleaning up behind you. dsj will try to keep track of allocated objects and clean them up when the dll is unloaded, but it is still highly recommended that application code uses dispose() on any graph that it no longer intends to use.


register

public void register(COMObject co)

goFullScreen

public void goFullScreen(java.awt.GraphicsDevice device,
                         int flags)
Displays graph in fullscreen mode. With the flags parameter set to 1 dsj just centers the display without scaling. In case of streching, the aspect ratio is maintained, so a letterbox may be constructed for movies that do not fill the entire screen.
Set bit 2 in the flags parameter to make dsj use regular JPanels, that can be used to add other components to the fullscreen window, for padding instead of RigidAreas.
The upper 24 bits can be used to set a RGB color value for the letterbox / panels.
Pressing Escape returns to windowed mode. Both entering and exiting fullscreen mode fire a PropertyChangeEvent.


leaveFullScreen

public void leaveFullScreen()
Closes the fullscreen window. After calling this (or using the ESC key handler) an application may need to re-add the display component and possibly call pack() if dsj could not determine the container hierachy before or you wish to change it.


getFullScreenWindow

public java.awt.Frame getFullScreenWindow()

dumpGraph

public void dumpGraph(boolean dc)
Prints a listing of filters in the graph (& evtl. their connections & connection media types) to the current log stream (see DSEnvironment.setLogStream(..)). For debugging purposes.


listFilters

public DSFilter[] listFilters()
                       throws DSJException
Returns all the filters in the filtergraph as DSFilter objects. When changes have been made to the graph, this method should be called again to reflect those changes in java. Filters that remained unchanged on the native side will remain unchanged on the java side - i.e. represented by the same DSFilter object - across such refreshes.

Throws:
DSJException

addFilterToGraph

public DSFilter addFilterToGraph(DSFilterInfo info)
                          throws DSJException
Adds a filter to the native filtergraph and creates a DSFilter object representing it. This is the main method for manually adding filters.

Throws:
DSJException

findFilterByName

public DSFilter findFilterByName(java.lang.String name)
                          throws DSJException
Tries to find a filter of the given name in the graph.

Throws:
DSJException

findRenderer

public DSFilter findRenderer(int majorType)
Tries to find the renderer for the given major media type (DSMediaType.MT_..).


tearDown

public void tearDown(DSFilter fromFilter,
                     boolean removeThatFilter)
              throws DSJException
Disconnects and removes all filters downstream from %fromFilter, optionally also removing that filter.

Throws:
DSJException

removeFilter

public void removeFilter(DSFilter filter,
                         boolean restart)
                  throws DSJException
Removes the given filter from the graph. dsj will try to reconnect the pins the removed filter was connected to and restart the graph when %restart is set to true.

Throws:
DSJException

reloadFilter

public void reloadFilter(DSFilter filter)
                  throws DSJException
Disconnects and removes a filter then reinserts and reconnects it. The purpose behind this is to make registry manipulations take effect. When the graph was running, it will auutomatically be restarted after this.

Throws:
DSJException

insertFilter

public DSFilter insertFilter(DSFilter before,
                             DSFilter after,
                             DSFilterInfo toInsert)
                      throws java.lang.IllegalArgumentException,
                             DSJException
Tries to insert a filter described by the FilterInfo argument between the two given filters and returns it
If the method fails, dsj tries to restore the graph to its previous state. (Note that this method also adds %toInsert to the graph, you do not need to do that separately).

Throws:
java.lang.IllegalArgumentException
DSJException

setAudioRenderer

public void setAudioRenderer(DSFilterInfo ar)
                      throws DSJException
Directs audio output from this filtergraph to the given sound device. %ar - a DSFilterInfo from the CLSID_AudioRendererCategory category (or null / DSFilterInfo.doNotRender() for the DirectShow Null Renderer to mute the graph).
The audio output may be changed anytime unless the graph is in in some kind of data exporting state. To make a graph start with some other than the Default DirectSound Device, construct the graph with INIT_PAUSED & INIT_MUTED flags set and call this method before actually starting the graph.

Throws:
DSJException

insertOverlayFilter

public JavaOverlayFilter insertOverlayFilter(int flags)
                                      throws DSJException
Inserts the dsj_JavaOverlayFilter and establishes communication with it. The filter can be used to do "in graph" drawwing over video in movie or capture graphs. See JavaOverlayFilter for more information.

Throws:
DSJException

setClockSource

public boolean setClockSource(DSFilter refClock)
                       throws DSJException
Sets the filter to provide the reference clock for the filtergraph (by default this usually is set to the audio renderer). This method should normally not be called by application code.
The native counterpart of the given filter must implement the IReferenceClock interface (which is usually the case with Audio renderers, some (MPEG)Demultiplexers and dedicated clock filters.
If %refClock is null, the "Default Sync Source" as chosen by the graph will be set.

Throws:
DSJException

insertSampleAccessFilter

public DSSampleBuffer insertSampleAccessFilter(DSFilter before,
                                               DSFilter.DSPin srcPin,
                                               DSFilter after,
                                               int flags)
Installs an nio.ByteBuffer between the two specified filters from which the application can read - depending on the insertion point - compressed or uncompressed data. Be aware that depending on where the buffer was inserted, you may not be dealing with fixed size samples!
The native DirectShow filter that this method inserts into the graph does not work with pull mode transports and this method will fail when you try to insert between an async source and a parser / splitter filter. Most other insertion points should normally work though, regardless of mediatypes.
The pin parameter can be null and needs to be specified only in the rare cases where there are multiple connections between the two filters.
Whenever a new sample has been delivered to the buffer, a PropertyChangeEvent of type SAMPLE_BUFFER_FILLED will be posted to listeners. The callback transfers the filled DSSampleBuffer via the oldValue field. Application code can then use DSSampleBuffer.getSample() to read the data and getSampleLength() to learn about the current length in case of variable size samples.

By default the event is dispatched on a DSFiltergraph internal thread. You can redirect the delivery of the event to the AWT Event Dispatch Thread or get it directly on the native DirectShow thread by setting either DSSampleBuffer.THREAD_SWING or DSSampleBuffer.THREAD_DS in the flags parameter.
Further considerations: Ideally samples travelling through a DirectShow filtergraph are timestamped in a monochroically increasing manner. There are however situations where samples carry no timestamps at all (quite common) or multiple samples are stamped with equal time (rarely). The SampleAccessFilter will by default drop samples with equal non-zero timestamps, which, while catching error potential in usual circumstances, can be undesireable depending much on the insertion point of the filter. The .._EQUAL_TIMES. flags in DSSampleBuffer can be used to force delivery of every - potentially partial - sample as it passes the filter (IGNORE_EQUAL_TIMES) or enable collection of equally timed samples into one complete sample before delivering it (COLLECT_EQUAL_TIMES).


insertTransInPlaceFilter

public DSFilter insertTransInPlaceFilter(DSFilter before,
                                         DSFilter.DSPin srcPin,
                                         DSFilter after,
                                         JTransInPlaceFilter jtip,
                                         int flags)
                                  throws DSJException
Inserts the native part of dsj's TransInPlace filter between the two given filters and establishes communication with the supplied extension of JTransInPlaceFilter whose transform method will then be called from the filtergraph. The native filter accepts all mediatypes, so can be used to modify plain rgb data, do audio dsp as well as for example change PIDs in an mpeg stream. It does however require push mode transport and will not connect between async source and parser filters. See JTransInPlaceFilter for more information.
The srcPin argument is only used for rare ocassions where there are more than one connection between two filters and can be null otherwise.

Throws:
DSJException

connectDump

public DSFilter connectDump(DSFilter.DSPin toPin,
                            java.lang.String outputFilePath)
                     throws DSJException
Connects a filter that will write raw data of any type - as received from the given pin - to a file at %outputFilePath.

Throws:
DSJException

addColorSpaceConverter

public DSFilter addColorSpaceConverter(int mode,
                                       int reserved)

getOutFlags

public int getOutFlags()
Returns the flag int passed on construction, with some bits possibly changed. For example when dsj can not sucessfully intercept the graph for image delivery it will set the headless bit.


getInfo

public java.lang.String getInfo()

asComponent

public java.awt.Component asComponent()
Depending on rendering mode, returns either the canvas DSFiltergraph extends or a JPanel it renders into


addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
Instead of defining another interface DSFiltergraph uses existing java api and fires PropertyChangeEvents when properties change. The use of this api is somewhat special though in that dsj allways uses the event's newValue field to signal the event type (helper method: DSJUtils.getEventType(event)) and the oldValue field for event values. The propagationID field is set to the ID of the filtergraph.
For most events listeners will be called on a DSFiltergraph private thread, to which native events are offloaded. Some gui related events are put on the AWT event queue instead.

Overrides:
addPropertyChangeListener in class java.awt.Component

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
Overrides:
removePropertyChangeListener in class java.awt.Component

lockAspectRatio

public void lockAspectRatio(boolean locked)
Enables or disables fixed ratio resize behavior. By default this is true,


getAspectLocked

public boolean getAspectLocked()

getAspectRatio

public int[] getAspectRatio()

flipImage

public int flipImage(int flip)
Flips the display and eventually the return of getImage(). The int parameter affects the flip axis: set bit 1 for vertical flipping, bit 2 for horizontal.
The capabilities and outcome of this method depends on the renderer in use:
DD7 & D3D9 allow for vertical & horizontal flipping. The return of getImage() will only be flipped if also bit 3 is set.
J2D (and JAVA_POLL / POLL_RGB) will flip display and getImage() accordingly, but only do so on the vertical axis.
VMR9 may flip the y and x axis of display and getImage() accordingly. HEADLESS & OVERLAY won't flip.
The method returns the new state. Initial default state is always 0.


graphChanged

public void graphChanged()

getAudioStream

public DSFiltergraph.DSAudioStream getAudioStream()
Returns the constructed DSAudioStream when set up with DELIVER_AUDIO bit set.


getActive

public boolean getActive()
Returns the internal state of the graph. Will return true when the native structures are ready to operate. Some methods may throw DSJExceptions when called on an inactive graph. Instead of trying to catch these, you may use this method (or listen to the INITIALIZED PropertyChangeEvent) to check if a graph is ready to go.


getRendererControls

public RendererControls getRendererControls()
                                     throws DSJException
Gets the RendererControls object for the renderer this Filtergraph has been constructed with. Currently the DirectDraw, Java and VMR renderers support controls, which can be used to scale video and do graphics overlays. See the rc package for more information.

Throws:
DSJException

connectSink

public int connectSink(Sink sink)
                throws DSJException
Connects the given Sink object to the graph. dsj currently includes a configureable filesink that supports writing of filetypes other than avi, wav, mp3 or asf/wmv and WindowsMedia network sinks. See the sink package for more information.
The method returns 0 on success or a possible errorcode (< 0).
FileSink specific information:
When connecting to a capture graph a return value of Sink.CONTROLABLE indicates that the graph's filewriting part can be separately controlled. In that case the sink will not be recording when this method returns and you can use DSCapture/DSDVCam.record() to start and pause filewriting. When the return value is 0, as well as in non-capture classes, a filesink will be recording when this method returns. If this functionality is not desired for capture sitautions, set the NO_CONTROL flag on the sink.

Throws:
DSJException

removeSink

public boolean removeSink()
                   throws DSJException
Removes a connected sink and puts the graph back into its "normal" initial display state.

Throws:
DSJException

setAviExportOptions

public void setAviExportOptions(int interleavingMode,
                                int interleavingFreq,
                                int audioPreroll,
                                boolean synced,
                                int flags)
Sets some (avi) exporting parameters. Set values will stay valid for the lifetime of the filtergraph or until changed again. Calling this method is not required, there are reasonable defaults in place. %interleavingMode - governs how audio and video are interleaved into the resulting avi file. This has an effect on filesize, file behavior on further editing and on the results of aborting an export operation prematurely. Possible values are defined in DSConstants (INTERLEAVING_xyz). %audioPreroll: An audio preroll of 750 msec (default) is recommended when authoring a file for distribution.
%interleavingFreq: default is 1000 msec.The smaller the number, the larger the file.
%synced - instruct dsj to turn the graph clock on or off for exporting. If false (default) the graph will turn the clock off and in turn will run fast as it possibly can.(only applies to movie export). Special considerations for the %synced:
Can also be used when exporting Movies to Windows Media, to keep the graph clock active
With capture graphs, setting %synced to true will reject the insertion of a custom filter used to avoid still frame recording when pausing capture. This filter may lead to undesired results (wrong timing in recorded files) with capture devices that drop a lot of frames or otherwise do not deliver proper timestamps. This is also useable when capturing to WindowsMedia
%flags - not yet used.
Set any of the int values you don't want changed to -1.


isSubGraph

public boolean isSubGraph()

hasMediaOfType

public boolean hasMediaOfType(int majorType)
Returns true if the filtergraph has streams of the given major media type (DSMediaType.MT_AUDIO / MT_VIDEO)


isFullScreen

public boolean isFullScreen()

getAudioProperties

public int[] getAudioProperties()
Returns sample rate, samplesize and number of channels of a graph's audio stream if any.


setEvent

public void setEvent(java.beans.PropertyChangeEvent event,
                     int th)
Called by some lower level classes to get events posted to listeners. Should not be used by application code.


update

public void update(java.awt.Graphics g)
Overrides:
update in class java.awt.Canvas

redraw

public void redraw()
Do not call paint() or repaint() on a natively rendering DSFiltergraph directly. Instead call the redraw() method.


paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Canvas