de.humatic.dsj
Class DSMovie

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

public class DSMovie
extends DSFiltergraph

DSMovie plays DirectShow compatible audio & video media from files and streams and provides encodeing and editing functionality.

See Also:
Serialized Form

Nested Class Summary
static class DSMovie.MovieSelection
          MovieSelection is a struct, that contains information needed by an editable DSMovie to access a certain portion of data from a given file.
 
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 DES_SRE
           
static int INIT_EDITABLE
           
static int SC_NO_TIMEOUT
           
static int SC_SEEK_KF
           
static int TIME_FORMAT_FRAMES
           
static int TIME_FORMAT_MSEC
           
 
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, PREVIEW, 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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DSMovie(java.lang.String path, int flags, DSFilterInfo videoDecoder, DSFilterInfo audioDecoder, java.beans.PropertyChangeListener pcl)
          Creates a movie object from common media files and urls using the given video and audio decoders.
DSMovie(java.lang.String path, int flags, java.beans.PropertyChangeListener pcl)
          Creates a movie object from common media files and urls.
 
Method Summary
 void add(DSMovie.MovieSelection ms)
          Adds the data referenced by the MovieSelection argument to this movie at its current time.
 void cancelExport()
          Cancels an ongoing export operation and restores the original playback state of the graph.
 void clear()
          Removes the current selection and keeps the resulting gap.
 DSMovie.MovieSelection copy()
          Returns the currently selected part of the movie as a MovieSelection object.
static DSMovie.MovieSelection copyToClipboard(java.lang.String fileName, int in, int out)
          Places the data between %in and %out of the specified Movie file on the clipboard for use in paste and replace operations without opening the file before.
 void createBackground(int from, int to, int ARGB, int width, int height)
          Creates a solid colored background video track.
static DSMovie createEmptyMovie(DSMediaType videoType, DSMediaType audioType, java.beans.PropertyChangeListener pcl)
          Creates an empty editable movie with basic characteristics as described by the DSMediaType parameters (framerate, bit depth, width & height should be specified for video, the audio type does not need to be further specified, but it should be present or no audio group will be created).
 void cut()
          Removes the current selection and closes the resulting gap.
 int export(java.lang.String fileName, DSFilterInfo videoEncoder, DSFilterInfo audioEncoder)
          Performs transcoding.
 java.lang.String getAsXML()
          Returns the xml representation of an editable movie's timeline.
 java.lang.String getAudioCodec()
          Returns the FourCC for an AVI's audiocodec or a String representation of non AVI encodings
 java.lang.String[][] getChapters()
          Reads chapters from mp4, mov and matroska files.
 java.lang.String getCurrentFile()
           
 boolean getEditable()
           
 MovieTrack getIndTrack(int trackIndex)
          Returns the MovieTrack at the 0 based index.
 MovieTrack getIndTrackType(int mediaType, int index)
          Returns the nth MovieTrack with the given mediatype (0 based index) or null if there is no such track at the given index.
 java.lang.String getInfo()
          Returns general info retrieved from a movie.
 float getMasterFrameRate()
          Returns an editable movie's global timeline framerate, which is originally set by the movie, that has been made editable.
 java.lang.String[][] getMetaData()
          Reads MetaData from the file in use.
 boolean getPlaySelection()
           
 boolean getRecueOnStop()
           
 boolean getRerendering()
           
 int getSelectionEnd()
           
 int getSelectionStart()
           
 DSMediaType[] getSourceMediaTypes()
           
 int getStreamType_int()
           
 java.lang.String getStreamType()
          Returns info on a movie's basic stream type, i.e.: AVI, MPEG2_Program etc.
 java.awt.image.BufferedImage getThumbnail(int msec, int iw)
          Returns a thumbnail for the given time with the given width and height according to the original aspect ratio.
 int getTimeFormat()
           
 MovieTrack getTrack(int trackID)
          Returns the MovieTrack with the given ID.
 int getTrackCount()
          Returns total number of tracks
 int getTrackCount(int mediaType)
          Returns the number of tracks with the given media type (DSMediaType.MT_VIDEO or MT_AUDIO).
 java.lang.String getVideoCodec()
          Returns the FourCC for an AVI's videocodec or a String representation of non AVI encodings
 int loadFile(java.lang.String path)
          Deprecated. method. Use loadFile(String, int) instead. This old implementation now calls loadFile(path,-1) and will not set the playback position after loading the new file..
 int loadFile(java.lang.String path, int restartAt)
          Loads a new movie into an existing DSMovie graph and starts playback at %restartAt (if that is > 0).
static void mux(java.lang.String inputPath1, java.lang.String inputPath2, int[] times, java.lang.String outputPath)
          Muxes the mediafiles referred to by inputPath 1 & 2 into a combined avi file.
 void paste(DSMovie.MovieSelection ms)
          Pastes the data referenced by the MovieSelection argument into this movie at its current time.
 void removeTrack(MovieTrack track)
          Removes the given track from an editable movie's timeline.
 void replace(DSMovie.MovieSelection ms)
          Replaces the current selection with the data referenced by the MovieSelection argument.
 boolean rewriteASFIndex()
          Reindexes an opened asf file.
 void saveAs(java.lang.String newPath, boolean reopen)
          Saves the current editing state to a file at %newPath and eventually opens the targetfile on return.
The movie must be editable.
To save an xml representation of the editing session, specify an .xtl ending.
Output file and compression considerations for avi, asf a.o.
 void setEditable(boolean enabled)
          Rebuilds the native filtergraph to enable basic editing functions.
 void setMasterFrameRate(float rate)
          Sets the timeline's global framerate in an editable movie.
 void setMasterVolume(float vol)
           
 void setPlaySelection(boolean playSelectionOnly)
          Toggles wether only a selected part of a movie or the entire file will be played .
 void setRecueOnStop(boolean recue)
          Sets Movie behaviour on stop time (either eof or end of selected segment): if true (default) DSMovie will reposition to the beginning (or start of selected segment).
 void setRerendering(boolean immediateRerender)
          Controls if the native implementation immediately rerenders the timeline after an editing operation.
 void setSelection(int in, int out)
          Sets the "active segment" in a movie.
 void setTimeFormat(int format)
           
static void streamCopy(java.lang.String input, java.lang.String output, DSFilterInfo splitter, DSFilterInfo muxer, int msec_in, int msec_out, int flags)
          Copies the portion between in and out times in a moviefile at %input into a new file without recompression and without requiring an editable movie.
This is in first hand made for avi, wav & mp3 files.
 void trim()
          Trims the movie to the current selection, i.e.: everything before selectionStart and after selectionEnd will be discarded.
 
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, getLoop, getMediaDimension, getMinimumSize, getOutFlags, getPan, getPreferredSize, getRate, getRendererControls, getTime, getVolume, getYUVType, goFullScreen, graphChanged, hasMediaOfType, insertFilter, insertOverlayFilter, insertSampleAccessFilter, insertTransInPlaceFilter, isFullScreen, isSubGraph, leaveFullScreen, listFilters, lockAspectRatio, paint, pause, play, queryCapability, redraw, register, reloadFilter, removeFilter, removeNotify, removePropertyChangeListener, removeSink, setAudioRenderer, setAviExportOptions, setBounds, setClockSource, setEvent, setLoop, setPan, setPreferredSize, setRate, setTimeValue, setVolume, step, stop, 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

INIT_EDITABLE

public static final int INIT_EDITABLE
See Also:
Constant Field Values

DES_SRE

public static final int DES_SRE
See Also:
Constant Field Values

TIME_FORMAT_MSEC

public static final int TIME_FORMAT_MSEC
See Also:
Constant Field Values

TIME_FORMAT_FRAMES

public static final int TIME_FORMAT_FRAMES
See Also:
Constant Field Values

SC_SEEK_KF

public static final int SC_SEEK_KF
See Also:
Constant Field Values

SC_NO_TIMEOUT

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

DSMovie

public DSMovie(java.lang.String path,
               int flags,
               java.beans.PropertyChangeListener pcl)
        throws DSJException
Creates a movie object from common media files and urls. When loading .xtl files, the returned DSMovie will be editable. DSMovie by default is set to autostart. Set the INIT_PAUSED bit in the flags parameter to prevent that.

Throws:
DSJException

DSMovie

public DSMovie(java.lang.String path,
               int flags,
               DSFilterInfo videoDecoder,
               DSFilterInfo audioDecoder,
               java.beans.PropertyChangeListener pcl)
        throws DSJException
Creates a movie object from common media files and urls using the given video and audio decoders. This constructor is for special use cases where you know exactly what media formats to expect (giving decoder preferences in the xml-setup is not supported by DSMovie).

Throws:
DSJException
Method Detail

getCurrentFile

public java.lang.String getCurrentFile()

loadFile

public int loadFile(java.lang.String path,
                    int restartAt)
             throws DSJException
Loads a new movie into an existing DSMovie graph and starts playback at %restartAt (if that is > 0). This will only work when the formats of both the previously loaded and the new movie match exactly and will dispose off the current DSMovie object and throw a DSJException otherwise. If it succeeds it may provide a smoother transition from one movie to the other than tearing down the whole graph and its rendering setup and setting up a new one.

Throws:
DSJException

loadFile

public int loadFile(java.lang.String path)
             throws DSJException
Deprecated. method. Use loadFile(String, int) instead. This old implementation now calls loadFile(path,-1) and will not set the playback position after loading the new file..

Throws:
DSJException

setSelection

public void setSelection(int in,
                         int out)
                  throws DSJException
Sets the "active segment" in a movie. Once set, a call to setPlaySelection(true) will result in only the selected part being played. %in and %out: times in the movie, specified in milliseconds.

Throws:
DSJException

getSelectionStart

public int getSelectionStart()

getSelectionEnd

public int getSelectionEnd()

setPlaySelection

public void setPlaySelection(boolean playSelectionOnly)
                      throws DSJException
Toggles wether only a selected part of a movie or the entire file will be played .

Throws:
DSJException

getPlaySelection

public boolean getPlaySelection()

setRecueOnStop

public void setRecueOnStop(boolean recue)
                    throws DSJException
Sets Movie behaviour on stop time (either eof or end of selected segment): if true (default) DSMovie will reposition to the beginning (or start of selected segment).

Throws:
DSJException

getRecueOnStop

public boolean getRecueOnStop()

setTimeFormat

public void setTimeFormat(int format)

getTimeFormat

public int getTimeFormat()

getThumbnail

public java.awt.image.BufferedImage getThumbnail(int msec,
                                                 int iw)
Returns a thumbnail for the given time with the given width and height according to the original aspect ratio.


setEditable

public void setEditable(boolean enabled)
                 throws DSJException
Rebuilds the native filtergraph to enable basic editing functions. Alternatively to edit-enabling an already opened Movie you may set the INIT_EDITABLE flag in the constructor's flags parameter or start of an editing session by creating an empty movie.
An editable DSMovie presents a relatively high level interface to the DirectShow Editing Services api. This has some higher requirements in terms of installed filters and it may not be possible to set all stream formats to be editable or to save changes without reencoding.
Editing related methods in DSMovie, MovieTracks and the classes in the edit package are only available with editable movies.

Throws:
DSJException

getEditable

public boolean getEditable()

getSourceMediaTypes

public DSMediaType[] getSourceMediaTypes()

getVideoCodec

public java.lang.String getVideoCodec()
                               throws DSJException
Returns the FourCC for an AVI's videocodec or a String representation of non AVI encodings

Throws:
DSJException

getStreamType

public java.lang.String getStreamType()
                               throws DSJException
Returns info on a movie's basic stream type, i.e.: AVI, MPEG2_Program etc.

Throws:
DSJException

getStreamType_int

public int getStreamType_int()

getAudioCodec

public java.lang.String getAudioCodec()
                               throws DSJException
Returns the FourCC for an AVI's audiocodec or a String representation of non AVI encodings

Throws:
DSJException

getInfo

public java.lang.String getInfo()
Returns general info retrieved from a movie.

Overrides:
getInfo in class DSFiltergraph

getMetaData

public java.lang.String[][] getMetaData()
Reads MetaData from the file in use. This will return all data found in no particular order in a two dimensional String array holding keys, resp. values. It is up to the application to sort these and make use of only the entries it's interested in. Supported formats are WindowsMedia, mp3 (ID3 ver.2), mp4 (iTunes style user data & g3p), Quicktime (.mov), vorbis and Matroska.


getChapters

public java.lang.String[][] getChapters()
Reads chapters from mp4, mov and matroska files. Returns a two dimensional String array with chapter times in milliseconds in slot 0 and chapter titles in slot 1. If no chapters are found the returned arrays will have zero length. Matroska support is rather simplified.


export

public int export(java.lang.String fileName,
                  DSFilterInfo videoEncoder,
                  DSFilterInfo audioEncoder)
           throws DSJException
Performs transcoding.
%video and audio encoder - DSFilterInfos for DirectShow encoder filters as derived from DSEnvironment.getEncoders() or null to write out uncompressed data.
To write Windows Media specify an .asf or .wmv file and leave the encoders set to null (or DSFilterInfo.doNotRender()). dsj will then use a default - relatively low quality, 320*240 size - WMV8 System profile for AV files or an equal default for audio or video only files. You can control WindowsMedia encoding to the bits and pieces by setting %videoEncoder to a custom WindowsMedia profile (see DSFilterInfo.filterInfoForProfile(...)).
To write audio only files specify a .wav or .mp3 file. Exporting to wma is possible when using a filetype of either .wma or .asf (& eventually supplying an audio only WindowsMedia profile for %videoEncoder).
Encoder settings dialog may be shown if the filter supports it by setting the encoder's preferred format to DSFilterInfo.SHOW_USER_DIALOG (also works for the doNotRender() dummy object to show Windows Media Encoder System profiles dialog).
When initially set up with a PropertyChangeListener, this will receive progress notification during export.
Once export is finished the graph will be reset to it's previous state except when the rendering mode has been OVERLAY. In that case the filtergraph will be closed and you would need to reopen it in application code..

Throws:
DSJException

cancelExport

public void cancelExport()
                  throws DSJException
Cancels an ongoing export operation and restores the original playback state of the graph. The output file may or may not be usable afterwards.
If the rendering mode is OVERLAY, this method will close the graph and application code would need to reopen it.

Throws:
DSJException

streamCopy

public static void streamCopy(java.lang.String input,
                              java.lang.String output,
                              DSFilterInfo splitter,
                              DSFilterInfo muxer,
                              int msec_in,
                              int msec_out,
                              int flags)
Copies the portion between in and out times in a moviefile at %input into a new file without recompression and without requiring an editable movie.
This is in first hand made for avi, wav & mp3 files. Windows Media files may or may not work depending on the profile used. For all other container formats splitter and multiplexer need to be specified (the splitter may be null if the - automatically picked - source filter for the format is itself splitting the stream) and the outcome of the operation will heavily depend on these filters' behavior: You may see connection failures, times not being obeyed, headers but no data written or other undesired things.
Timing accuracy in relation to the out time depends on original file authoring (interleaving frequency etc.). This method is not suitable for fine grain editing.
The method blocks and will not return before the copy operation is done (which usually is very fast) or a default 10 second timeout occurs. Timing out can be disabled, see flags.
If %msec_out is <= 0 it will be interpreted as "total duration". Within limits the method may also work for transmuxing purposes (like avi to mp4, dvr-ms to mpg repackaging or eq.), but that may - depending on elementary stream encoding - involve transcoding of separate streams which will neither be rejected nor reported.
%flags:
set SC_SEEK_KF to make use of the AM_SEEKING_SeekToKeyFrame flag when setting the segment's starttime
SC_NO_TIMEOUT - strictly wait for completion event


getTrackCount

public int getTrackCount()
                  throws DSJException
Returns total number of tracks

Throws:
DSJException

getTrackCount

public int getTrackCount(int mediaType)
                  throws DSJException
Returns the number of tracks with the given media type (DSMediaType.MT_VIDEO or MT_AUDIO).

Throws:
DSJException

getIndTrack

public MovieTrack getIndTrack(int trackIndex)
                       throws DSJException
Returns the MovieTrack at the 0 based index.

Throws:
DSJException

getTrack

public MovieTrack getTrack(int trackID)
                    throws DSJException
Returns the MovieTrack with the given ID. Track IDs are 1 based.

Throws:
DSJException

getIndTrackType

public MovieTrack getIndTrackType(int mediaType,
                                  int index)
                           throws DSJException
Returns the nth MovieTrack with the given mediatype (0 based index) or null if there is no such track at the given index.

Throws:
DSJException

createBackground

public void createBackground(int from,
                             int to,
                             int ARGB,
                             int width,
                             int height)
                      throws DSJException
Creates a solid colored background video track. Width and height parameters are only read when there is no video in the movie so far.
When video is added to an audio only movie, dsj will temporarily save and reopen the editing session.
The movie must be editable.

Throws:
DSJException

createEmptyMovie

public static DSMovie createEmptyMovie(DSMediaType videoType,
                                       DSMediaType audioType,
                                       java.beans.PropertyChangeListener pcl)
Creates an empty editable movie with basic characteristics as described by the DSMediaType parameters (framerate, bit depth, width & height should be specified for video, the audio type does not need to be further specified, but it should be present or no audio group will be created).


setMasterVolume

public void setMasterVolume(float vol)
                     throws DSJException
Throws:
DSJException

copy

public DSMovie.MovieSelection copy()
                            throws DSJException
Returns the currently selected part of the movie as a MovieSelection object. The movie does not need to be editable.

Throws:
DSJException

copyToClipboard

public static DSMovie.MovieSelection copyToClipboard(java.lang.String fileName,
                                                     int in,
                                                     int out)
                                              throws DSJException
Places the data between %in and %out of the specified Movie file on the clipboard for use in paste and replace operations without opening the file before.

Throws:
DSJException

paste

public void paste(DSMovie.MovieSelection ms)
           throws DSJException
Pastes the data referenced by the MovieSelection argument into this movie at its current time. This inserts data - all media behind the insertion point will be pushed back by the length of the inserted segment.
When video is added to an audio only movie, dsj will temporarily save and reopen the editing session.
The movie must be editable.

Throws:
DSJException

add

public void add(DSMovie.MovieSelection ms)
         throws DSJException
Adds the data referenced by the MovieSelection argument to this movie at its current time. This will create parallel tracks and may for example be used to add soundtracks to videofiles.
When video is added to an audio only movie, dsj will temporarily save and reopen the editing session.
The movie must be editable.

Throws:
DSJException

cut

public void cut()
         throws DSJException
Removes the current selection and closes the resulting gap. The movie must be editable.

Throws:
DSJException

clear

public void clear()
           throws DSJException
Removes the current selection and keeps the resulting gap. The movie must be editable.

Throws:
DSJException

replace

public void replace(DSMovie.MovieSelection ms)
Replaces the current selection with the data referenced by the MovieSelection argument. If the current selection is of 0 length, this effectively does the same as paste(...).
The movie must be editable.


trim

public void trim()
          throws DSJException
Trims the movie to the current selection, i.e.: everything before selectionStart and after selectionEnd will be discarded. The movie must be editable.

Throws:
DSJException

removeTrack

public void removeTrack(MovieTrack track)
                 throws DSJException
Removes the given track from an editable movie's timeline.

Throws:
DSJException

setRerendering

public void setRerendering(boolean immediateRerender)
                    throws DSJException
Controls if the native implementation immediately rerenders the timeline after an editing operation. The default is true, i.e.: editing steps will immediately be made audible and visible.
As rerendering may take time, you may temporarily disable it using this method when you want a number of editing steps to be performed fast as possible. Setting this variable to true after it has been false will trigger an immediate rerender.
The movie must be editable.

Throws:
DSJException

getRerendering

public boolean getRerendering()

setMasterFrameRate

public void setMasterFrameRate(float rate)
                        throws DSJException
Sets the timeline's global framerate in an editable movie. Changing this will affect the timing of tracks, effects and edits and should be handled with care.

Throws:
DSJException

getMasterFrameRate

public float getMasterFrameRate()
                         throws DSJException
Returns an editable movie's global timeline framerate, which is originally set by the movie, that has been made editable. Use setMasterFrameRate(...) to change it if needed.

Throws:
DSJException

getAsXML

public java.lang.String getAsXML()
Returns the xml representation of an editable movie's timeline. This is mainly for debugging purposes. To save an editing state one would rather use saveAs() with an .xtl target file.


saveAs

public void saveAs(java.lang.String newPath,
                   boolean reopen)
            throws DSJException,
                   java.io.IOException
Saves the current editing state to a file at %newPath and eventually opens the targetfile on return.
The movie must be editable.
To save an xml representation of the editing session, specify an .xtl ending.
Output file and compression considerations for avi, asf a.o. output formats:
This method determines its output format from the original moviefile in use by the DSMovie, that was set to be editable. It does not transcode. Attempts to enforce transcoding by specifying mismatching extensions will result in exceptions being thrown.
For Windows Media files the profile used for outputing is read from the first inputfile.
For .avi files, video output will make use of the original source file's compression if a matching encoder can be found. If that is not the case (which is very likely to happen on machines that are not crammed with codecs), this method will throw an exception that an application should catch in order to then eventually make use of the export(...) method.
Audio output in avi or audio only files will allways be uncompresssed PCM (only .wav is valid for outputting audio only).
If you explicitely want to transcode, use the export(...) method instead.

Throws:
DSJException
java.io.IOException

mux

public static void mux(java.lang.String inputPath1,
                       java.lang.String inputPath2,
                       int[] times,
                       java.lang.String outputPath)
                throws DSJException
Muxes the mediafiles referred to by inputPath 1 & 2 into a combined avi file. This uses direct stream copying and does not transcode, but will only work for some audio and videoformats. An avi can have multiple soundtracks, but only one video track.
The int[] parameter is not yet used.
This is a blocking call, that will not return before the operation has finished (which usually goes pretty fast).

Throws:
DSJException

rewriteASFIndex

public boolean rewriteASFIndex()
Reindexes an opened asf file. This may be useful for edited files as well as files that got corrupted in some way and - though opening and playing fine - are not seekable.
This method executes asynchronously. A PropertyChangeEvent of type INDEXER_DONE will be sent to listeners when the indexer finished.