Class ImageStream
- java.lang.Object
-
- org.jitsi.impl.neomedia.control.AbstractControls
-
- org.jitsi.impl.neomedia.jmfext.media.protocol.AbstractPullBufferStream<T>
-
- org.jitsi.impl.neomedia.jmfext.media.protocol.AbstractVideoPullBufferStream<DataSource>
-
- org.jitsi.impl.neomedia.jmfext.media.protocol.imgstreaming.ImageStream
-
- All Implemented Interfaces:
javax.media.Controls,javax.media.protocol.Controls,javax.media.protocol.PullBufferStream,javax.media.protocol.SourceStream
public class ImageStream extends AbstractVideoPullBufferStream<DataSource>
The stream used by JMF for our image streaming.- Author:
- Sebastien Vincent, Lyubomir Marinov, Damian Minkov
-
-
Field Summary
Fields Modifier and Type Field Description protected TdataSourceThe DataSource which has created this instance and which contains it as one of its streams.protected javax.media.control.FormatControlformatControlThe FormatControl which gives access to the Format of the media data provided by this SourceStream and which, optionally, allows setting it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Releases the resources used by this instance throughout its existence and makes it available for garbage collection.protected javax.media.FormatdoGetFormat()Gets the Format of this AbstractBufferStream as directly known by it.protected voiddoRead(javax.media.Buffer buffer)Blocks and reads into a Buffer from this PullBufferStream.protected javax.media.FormatdoSetFormat(javax.media.Format format)Attempts to set the Format of this AbstractBufferStream.booleanendOfStream()Determines whether the end of this SourceStream has been reached.javax.media.protocol.ContentDescriptorgetContentDescriptor()Gets a ContentDescriptor which describes the type of the content made available by this SourceStream.longgetContentLength()Gets the length in bytes of the content made available by this SourceStream.Object[]getControls()ImplementsControls.getControls().javax.media.FormatgetFormat()Gets the Format of the media data made available by this AbstractBufferStream.byte[]readScreen(byte[] output, Dimension dim)Read screen.voidsetDisplayIndex(int displayIndex)Sets the index of the display to be used by this ImageStream.voidsetOrigin(int x, int y)Sets the origin to be captured by this ImageStream.voidstart()Start desktop capture stream.voidstop()Stop desktop capture stream.-
Methods inherited from class org.jitsi.impl.neomedia.jmfext.media.protocol.AbstractVideoPullBufferStream
read
-
Methods inherited from class org.jitsi.impl.neomedia.jmfext.media.protocol.AbstractPullBufferStream
willReadBlock
-
Methods inherited from class org.jitsi.impl.neomedia.control.AbstractControls
getControl, getControl, queryInterface, queryInterface
-
-
-
-
Field Detail
-
dataSource
protected final T extends javax.media.protocol.DataSource dataSource
The DataSource which has created this instance and which contains it as one of its streams.
-
formatControl
protected final javax.media.control.FormatControl formatControl
The FormatControl which gives access to the Format of the media data provided by this SourceStream and which, optionally, allows setting it.
-
-
Method Detail
-
doRead
protected void doRead(javax.media.Buffer buffer) throws IOExceptionBlocks and reads into a Buffer from this PullBufferStream.- Specified by:
doReadin classAbstractVideoPullBufferStream<DataSource>- Parameters:
buffer- the Buffer this PullBufferStream is to read into- Throws:
IOException- if an I/O error occurs while this PullBufferStream reads into the specified Buffer- See Also:
AbstractVideoPullBufferStream.doRead(Buffer)
-
readScreen
public byte[] readScreen(byte[] output, Dimension dim)Read screen.- Parameters:
output- output buffer for screen bytesdim- dimension of the screen- Returns:
- raw bytes, it could be equal to output or not. Take care in the caller to check if output is the returned value.
-
setDisplayIndex
public void setDisplayIndex(int displayIndex)
Sets the index of the display to be used by this ImageStream.- Parameters:
displayIndex- the index of the display to be used by this ImageStream
-
setOrigin
public void setOrigin(int x, int y)Sets the origin to be captured by this ImageStream.- Parameters:
x- the x coordinate of the origin to be set on this instancey- the y coordinate of the origin to be set on this instance
-
start
public void start() throws IOExceptionStart desktop capture stream.- Overrides:
startin classAbstractVideoPullBufferStream<DataSource>- Throws:
IOException- if anything goes wrong while starting the transfer of media data from this AbstractBufferStream- See Also:
AbstractBufferStream.start()
-
stop
public void stop() throws IOExceptionStop desktop capture stream.- Overrides:
stopin classAbstractVideoPullBufferStream<DataSource>- Throws:
IOException- if anything goes wrong while stopping the transfer of media data from this AbstractBufferStream- See Also:
AbstractBufferStream.stop()
-
close
public void close()
Releases the resources used by this instance throughout its existence and makes it available for garbage collection. This instance is considered unusable after closing.Warning: The method is not invoked by the framework, extenders may choose to invoke it.
-
doGetFormat
protected javax.media.Format doGetFormat()
Gets the Format of this AbstractBufferStream as directly known by it. Allows extenders to override the Format known to the DataSource which created this instance and possibly provide more details on the currently set Format.- Returns:
- the Format of this AbstractBufferStream as directly known by it or null if this AbstractBufferStream does not directly know its Format and it relies on the DataSource which created it to report its Format
-
doSetFormat
protected javax.media.Format doSetFormat(javax.media.Format format)
Attempts to set the Format of this AbstractBufferStream. Allows extenders to enable setting the Format of an existing AbstractBufferStream (in contract to setting it before the AbstractBufferStream is created by the DataSource which will provide it).- Parameters:
format- the Format to be set as the format of this AbstractBufferStream- Returns:
- the Format of this AbstractBufferStream or null if the attempt to set the Format did not succeed and any last-known Format is to be left in effect
-
endOfStream
public boolean endOfStream()
Determines whether the end of this SourceStream has been reached. The AbstractBufferStream implementation always returns false.- Specified by:
endOfStreamin interfacejavax.media.protocol.SourceStream- Returns:
- true if the end of this SourceStream has been reached; otherwise, false
-
getContentDescriptor
public javax.media.protocol.ContentDescriptor getContentDescriptor()
Gets a ContentDescriptor which describes the type of the content made available by this SourceStream. The AbstractBufferStream implementation always returns a ContentDescriptor with content type equal to ContentDescriptor#RAW.- Specified by:
getContentDescriptorin interfacejavax.media.protocol.SourceStream- Returns:
- a ContentDescriptor which describes the type of the content made available by this SourceStream
-
getContentLength
public long getContentLength()
Gets the length in bytes of the content made available by this SourceStream. The AbstractBufferStream implementation always returns LENGTH_UNKNOWN.- Specified by:
getContentLengthin interfacejavax.media.protocol.SourceStream- Returns:
- the length in bytes of the content made available by this SourceStream if it is known; otherwise, LENGTH_UKNOWN
-
getControls
public Object[] getControls()
ImplementsControls.getControls(). Gets the controls available for this instance.- Specified by:
getControlsin interfacejavax.media.Controls- Returns:
- an array of Objects which represent the controls available for this instance
-
getFormat
public javax.media.Format getFormat()
Gets the Format of the media data made available by this AbstractBufferStream.- Returns:
- the Format of the media data made available by this AbstractBufferStream
-
-