de.humatic.dsj
Class DSDVCam

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by de.humatic.dsj.DSFiltergraph
              extended by de.humatic.dsj.DSDVCam
All Implemented Interfaces:
AVCDevice, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class DSDVCam
extends DSFiltergraph
implements AVCDevice

DSDVCam wraps DirectShow functionality for IEEE 1394 (aka Firewire, iLink) DV camcorders and - as of dsj 0_8_4 - also for USB 2.0 ones.
Both camera and VCR mode are supported.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class de.humatic.dsj.DSFiltergraph
DSFiltergraph.DSAudioStream
 
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 AUDIO_BITS_16
           
static int AVC
          Device type
static int C2F
          Software operation mode
static int CAMERA
          Hardware operation mode
static int F2T
          Software operation mode
static int NO_AUDIO
           
static int PREVIEW
          Software operation mode
static int RECORDING
          Software operation mode
static int T2F
          Software operation mode
static int UVC
          Device type
static int VCR
          Hardware operation mode
 
Fields inherited from class de.humatic.dsj.DSFiltergraph
ACTIVATING, ANAMORPHIC, ASYNC_BUFFER_GET, ASYNC_BUFFER_REQ, AUDIO_BUFFER_REQUEST, BDA, BDA_PRG_CHANGED, BDA_SCAN_PROGRESS, BDA_SCANNED_FREQ, BDA_SIG_REC, BUFFER_COMPLETE, BUFFERING, CALLER, CAP_STATE_CHANGED, CAPTURE, CLOSED, CLOSING, COMP_AUDIO_BUFFER_REQ, COMP_BUFFER_FILLED, COMP_VIDEO_BUFFER_REQ, D3D9, DD7, DECKLINK, DELIVER_AUDIO, DES_ERROR, DONE, DV, DV_STATE_CHANGED, DVD, DVD_FORMAT_CHANGED, DVD_MENU_ENABLED, E_CANT_PUMP_AUDIO, E_INIT_HEADLESS, EDITABLE, ENTER_FS, EPG, EVR, EXIT_FS, EXPORT_DONE, EXPORT_FINISHING, EXPORT_PROGRESS, EXPORT_STARTED, EXT_API_EVENT, FILTER_CHANGED, FORMAT_CHANGED, FRAME_CALLBACK, FRAME_LOCKED, FRAME_NOTIFY, GD, GE_DEVICE_CONNECTED, GE_DEVICE_LOST, GE_REF_REC_STOPPED, GRAPH, GRAPH_CHANGED, GRAPH_ERROR, GRAPH_EVENT, HDV, HDV_STATE_CHANGED, HEADLESS, INDEXER_DONE, INDEXER_STARTED, INIT_MUTED, INIT_PAUSED, INITIALIZED, IP_READY, J2D, JAVA_AUTODRAW, JAVA_POLL, JAVA_POLL_RGB, JAVASOUND, KEY_EVENT, KF_NOTIFY, LOCK_BUFFER, LOOP, MGD, MOUSE_ENABLED, MOUSE_EVENT, MOVIE, NATIVE_FORCE_GDI, NIO_UPDATE, NO_AMW, NO_SYNC, NULL, ONESHOT, OVERLAY, OVERLAY_BUFFER_REQUEST, PLAYLIST_PARSED, RENDER_NATIVE, RESTART_REQ, RGB32, RTCP_EVENT, RTMP_EVENT, RTMP_SO_CHANGED, RTMP_STATE_CHANGED, SAMPLE_BUFFER_FILLED, SAVE_DONE, SAVE_STARTED, SBE, SBE_REC_STATE_CHANGED, SERVICE_ERROR, SERVICE_EVENT, SINK_ERROR, SINK_STATE_CHANGED, SIZE_CHANGED, SOURCE_ERROR, SOURCE_STATE_CHANGED, SOURCE_STATE_NOTIFY, SOURCE_USER_DATA, STILL_IMG_RECEIVED, STREAM_SEEK, SUBCLASS_EVENT, SWING, SYNC_BUFFER_REQ, TABLE_RECEIVED, TIME_FORMAT_CHANGED, TRANS_IN_PLACE, TRANSPORT, TS_BUFFER_FILLED, type, VIDEO_BUFFER_REQUEST, VMR_EMBED, VMR7, VMR9, VPJ, YUV, YUV_ORG
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface de.humatic.dsj.AVCDevice
ED_MODE_FF, ED_MODE_FREEZE, ED_MODE_PLAY, ED_MODE_REW, ED_MODE_STEP_FW, ED_MODE_STEP_REV, ED_MODE_STOP
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DSDVCam(int flags, DSFilterInfo deviceInfo, java.beans.PropertyChangeListener pcl)
          Use this constructor with a DSFilterInfo for a DV device as returned by DSCapture.queryDevices(...) when you need to work with (one out of) multiple DV Cameras.
See first constructor for DV specific flags.
DSDVCam(int flags, java.beans.PropertyChangeListener pcl)
          This constructor creates a DSDVCam from the first DV Device found.
 
Method Summary
 void cameraToFile(java.lang.String fileName, DSFilterInfo videoEncoder, boolean preview, boolean grabAudio)
          Sets up Direct Show for direct to disc grabbing.
%videoEncoder: DSFilterInfo object as retrieved by DSEnvironment.getEncoders() or DSFilterInfo.doNotRender().
 void changeCaptureFile(java.lang.String newPath, boolean startRecording)
          Once a capture file, compression etc.
 void fastFwd()
          VCR transport
 int getDeviceMode()
          Returns the current hardware operation mode, i.e.
 int getDeviceType()
          Returns AVC (0) for IEEE 1394 / Firewire devices, UVC (1) for USB 2.0 ones
 int getExtTransportState()
           
 int getOperationMode()
          Returns the current software operation mode
 void grabTapeToFile(java.lang.String fileName, DSFilterInfo videoEncoder, boolean preview, boolean grabAudio, int fileType)
          Sets up Direct Show to write DV tape to file.
fileType 1 - muxed avi DV Stream, containing video and audio.
fileType 2 - avi with separate video and audio streams.
(both fileType 1 & 2 will capture the original DV stream into an avi container when no encoders are specified)
fileType 3 - raw DV (Encoder and audio grabbing parameters will be ignored, file should have a .dv suffix).
%videoEncoder DSFilterInfo object as retrieved by DSEnvironment.getEncoders().
 void grabToDisc()
          Toggles recording when in direct to disc mode
 void pause()
          Toggles VCR playback
 void record()
          Toggles recording when DVDevice is in camera mode or grabbing tape to file
 void rewind()
          VCR transport
 void scanBwd()
          VCR transport
 void scanFwd()
          VCR transport
 void seekToTime(int msec)
           
 void seekToTime(int h, int m, int s, int fr)
          Winds tape to seekTime when in VCR mode
 int sendRawAVC(byte[] cmd)
           
 void setPreview()
          Sets up Direct Show for preview and camera operation.
This is also the default state after construction.
 java.awt.Dimension setResolution()
          Resets DV device's resolution.
 void stepBwd()
          VCR transport
 void stepFwd()
          VCR transport
 void stop()
          Stops the graph.
 void writeFileToTape(java.lang.String fileName, int fileType)
          Sets up Direct Show to write a DV avi file to tape.
 
Methods inherited from class de.humatic.dsj.DSFiltergraph
addColorSpaceConverter, addFilterToGraph, addNotify, addPropertyChangeListener, asComponent, connectDump, connectSink, createDSFiltergraph, dispose, dumpGraph, findFilterByName, findRenderer, flipImage, getActive, getAspectLocked, getAspectRatio, getAudioProperties, getAudioStream, getBitDepth, getData, getDataSize, getDisplaySize, getDuration, getEffectiveFrameRate, getFrameRate, getFullScreenWindow, getID, getImage, getInfo, getLoop, getMediaDimension, getMinimumSize, getOutFlags, getPan, getPreferredSize, getRate, getRendererControls, getTime, getVolume, getYUVType, goFullScreen, graphChanged, hasMediaOfType, insertFilter, insertOverlayFilter, insertSampleAccessFilter, insertTransInPlaceFilter, isFullScreen, isSubGraph, leaveFullScreen, listFilters, lockAspectRatio, paint, play, queryCapability, redraw, register, reloadFilter, removeFilter, removeNotify, removePropertyChangeListener, removeSink, setAudioRenderer, setAviExportOptions, setBounds, setClockSource, setEvent, setLoop, setPan, setPreferredSize, setRate, setTimeValue, setVolume, step, tearDown, update
 
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

CAMERA

public static final int CAMERA
Hardware operation mode

See Also:
Constant Field Values

VCR

public static final int VCR
Hardware operation mode

See Also:
Constant Field Values

PREVIEW

public static final int PREVIEW
Software operation mode

See Also:
Constant Field Values

T2F

public static final int T2F
Software operation mode

See Also:
Constant Field Values

F2T

public static final int F2T
Software operation mode

See Also:
Constant Field Values

C2F

public static final int C2F
Software operation mode

See Also:
Constant Field Values

RECORDING

public static final int RECORDING
Software operation mode

See Also:
Constant Field Values

NO_AUDIO

public static final int NO_AUDIO
See Also:
Constant Field Values

AUDIO_BITS_16

public static final int AUDIO_BITS_16
See Also:
Constant Field Values

AVC

public static final int AVC
Device type

See Also:
Constant Field Values

UVC

public static final int UVC
Device type

See Also:
Constant Field Values
Constructor Detail

DSDVCam

public DSDVCam(int flags,
               java.beans.PropertyChangeListener pcl)
        throws DSJException
This constructor creates a DSDVCam from the first DV Device found. This is usually a camera connected to the first firewire port.
Extra DV related flags:
NO_AUDIO: ignore the stream's audio
AUDIO_BITS_16: make sure that the DV Splitter uses a correct mediatype on its audio output pin when the device is set to 16bit 48K audio (by default this output type will always be 12bit 32k - consumer DV defaults - no matter what the stream actually looks like). You don't need to care for this for normal operation as audio renderers will do a dynamic formatchange, but it may be necessary if you plan to insert additional filters or connect stream sinks, which may rely on the mediatype information on the output pin. To correct this, some graph rebuilding and some run / pause needs to be done, which is better avoided if not really needed.

Throws:
DSJException

DSDVCam

public DSDVCam(int flags,
               DSFilterInfo deviceInfo,
               java.beans.PropertyChangeListener pcl)
        throws DSJException
Use this constructor with a DSFilterInfo for a DV device as returned by DSCapture.queryDevices(...) when you need to work with (one out of) multiple DV Cameras.
See first constructor for DV specific flags.

Throws:
DSJException
Method Detail

getDeviceMode

public int getDeviceMode()
Returns the current hardware operation mode, i.e. camera or vcr

Specified by:
getDeviceMode in interface AVCDevice

getOperationMode

public int getOperationMode()
Returns the current software operation mode


getDeviceType

public int getDeviceType()
Returns AVC (0) for IEEE 1394 / Firewire devices, UVC (1) for USB 2.0 ones


rewind

public void rewind()
            throws DSJException
VCR transport

Specified by:
rewind in interface AVCDevice
Throws:
DSJException

scanBwd

public void scanBwd()
             throws DSJException
VCR transport

Specified by:
scanBwd in interface AVCDevice
Throws:
DSJException

stepBwd

public void stepBwd()
             throws DSJException
VCR transport

Specified by:
stepBwd in interface AVCDevice
Throws:
DSJException

fastFwd

public void fastFwd()
             throws DSJException
VCR transport

Specified by:
fastFwd in interface AVCDevice
Throws:
DSJException

scanFwd

public void scanFwd()
             throws DSJException
VCR transport

Specified by:
scanFwd in interface AVCDevice
Throws:
DSJException

stepFwd

public void stepFwd()
             throws DSJException
VCR transport

Specified by:
stepFwd in interface AVCDevice
Throws:
DSJException

pause

public void pause()
Toggles VCR playback

Overrides:
pause in class DSFiltergraph

stop

public void stop()
Description copied from class: DSFiltergraph
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)!

Overrides:
stop in class DSFiltergraph

record

public void record()
            throws DSJException
Toggles recording when DVDevice is in camera mode or grabbing tape to file

Throws:
DSJException

grabToDisc

public void grabToDisc()
                throws DSJException
Toggles recording when in direct to disc mode

Throws:
DSJException

seekToTime

public void seekToTime(int h,
                       int m,
                       int s,
                       int fr)
                throws DSJException
Winds tape to seekTime when in VCR mode

Specified by:
seekToTime in interface AVCDevice
Throws:
DSJException

seekToTime

public void seekToTime(int msec)

sendRawAVC

public int sendRawAVC(byte[] cmd)
Specified by:
sendRawAVC in interface AVCDevice

setResolution

public java.awt.Dimension setResolution()
Resets DV device's resolution. This method uses a native property page dialog. It essentially needs user input & can not be done programatically. The native code will stop both DV device and filtergraph.


writeFileToTape

public void writeFileToTape(java.lang.String fileName,
                            int fileType)
Sets up Direct Show to write a DV avi file to tape. This will not transcode and only accept dv avi input. To write other source files to tape use DSMovie and DVPlayoutSink.
%fileType describes the DV avi type of the input. If in doubt use 1.
To actually start grabbing also unpause camera / VCR and call record() on the graph.


grabTapeToFile

public void grabTapeToFile(java.lang.String fileName,
                           DSFilterInfo videoEncoder,
                           boolean preview,
                           boolean grabAudio,
                           int fileType)
Sets up Direct Show to write DV tape to file.
fileType 1 - muxed avi DV Stream, containing video and audio.
fileType 2 - avi with separate video and audio streams.
(both fileType 1 & 2 will capture the original DV stream into an avi container when no encoders are specified)
fileType 3 - raw DV (Encoder and audio grabbing parameters will be ignored, file should have a .dv suffix).
%videoEncoder DSFilterInfo object as retrieved by DSEnvironment.getEncoders(). Building DV Graphs with audio compression requires some non standard audio resampling filters, that's why there is no audioEncoder parameter here. There will be grf / xgr files for download that can be used for building those graphs. To actually start grabbing also unpause camera and graph and call record. To capture to WindowsMedia do not use any of the encoder FilterInfos. Instead proceed like this:
- make sure your output file has an .asf, .wmv or .wma ending.
- leave encoder parameters set to null (will then use the default WM system profile) OR:
- use DSFilterInfo.doNotRender() with preferredFormat set to SHOW_USER_DIALOG for the videoEncoder parameter (will let you pick a WM System profile from a dialog). OR:
- use a custom WM profile for the videoEncoder parameter via DSFilterInfo.filterInfoForProfile(...).


cameraToFile

public void cameraToFile(java.lang.String fileName,
                         DSFilterInfo videoEncoder,
                         boolean preview,
                         boolean grabAudio)
Sets up Direct Show for direct to disc grabbing.
%videoEncoder: DSFilterInfo object as retrieved by DSEnvironment.getEncoders() or DSFilterInfo.doNotRender(). %preview allows to grab with or without preview Without videoEncoder this will always capture audio (i.e. the original DV stream), regardless of the grabAudio parameter.
To capture the raw DV stream as is (not into an avi container) pass in a fileName with .dv suffix. When done, call stop() to close the file.
To capture to WindowsMedia do not use any of the encoder FilterInfos. Instead proceed like this:
- make sure your output file has an .asf, .wmv or .wma ending.
- leave encoder parameters set to null (will then use the default WM system profile) OR:
- use DSFilterInfo.doNotRender() with preferredFormat set to SHOW_USER_DIALOG for the videoEncoder parameter (will let you pick a WM System profile from a dialog). OR:
- use a custom WM profile for the videoEncoder parameter via DSFilterInfo.filterInfoForProfile(...).


changeCaptureFile

public void changeCaptureFile(java.lang.String newPath,
                              boolean startRecording)
Once a capture file, compression etc. have been set using setCaptureFile(...) this method can be used to change the target file without reseting to preview mode and rebuilding the filtergraph. This may be problematic with some avi codecs. This method is not frame accurate, you will loose frames between files.


setPreview

public void setPreview()
Sets up Direct Show for preview and camera operation.
This is also the default state after construction.


getExtTransportState

public int getExtTransportState()
Specified by:
getExtTransportState in interface AVCDevice