Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.imgstreaming
Class ImageStream

java.lang.Object
  extended by net.java.sip.communicator.impl.neomedia.control.AbstractControls
      extended by net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractBufferStream
          extended by net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractPullBufferStream
              extended by net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractVideoPullBufferStream
                  extended by net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.imgstreaming.ImageStream
All Implemented Interfaces:
javax.media.Controls, javax.media.protocol.PullBufferStream, javax.media.protocol.SourceStream

public class ImageStream
extends AbstractVideoPullBufferStream

The stream used by JMF for our image streaming.

Author:
Sebastien Vincent, Lyubomir Marinov, Damian Minkov

Field Summary
 
Fields inherited from class net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractBufferStream
dataSource, formatControl
 
Fields inherited from interface javax.media.protocol.SourceStream
LENGTH_UNKNOWN
 
Constructor Summary
ImageStream(DataSource dataSource, javax.media.control.FormatControl formatControl)
          Initializes a new ImageStream instance which is to have a specific FormatControl
 
Method Summary
protected  void doRead(javax.media.Buffer buffer)
          Blocks and reads into a Buffer from this PullBufferStream.
 byte[] readScreen(byte[] output, Dimension dim)
          Read screen.
 void setDisplayIndex(int index)
          Set display index.
 void setOrigin(int x, int y)
          Set Origin of capture.
 void start()
          Start desktop capture stream.
 void stop()
          Stop desktop capture stream.
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractVideoPullBufferStream
read
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractPullBufferStream
willReadBlock
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractBufferStream
close, doGetFormat, doSetFormat, endOfStream, getContentDescriptor, getContentLength, getControls, getFormat
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.control.AbstractControls
getControl, getControl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.media.protocol.PullBufferStream
getFormat
 
Methods inherited from interface javax.media.protocol.SourceStream
endOfStream, getContentDescriptor, getContentLength
 
Methods inherited from interface javax.media.Controls
getControl, getControls
 

Constructor Detail

ImageStream

ImageStream(DataSource dataSource,
            javax.media.control.FormatControl formatControl)
Initializes a new ImageStream instance which is to have a specific FormatControl

Parameters:
dataSource - the DataSource which is creating the new instance so that it becomes one of its streams
formatControl - the FormatControl of the new instance which is to specify the format in which it is to provide its media data
Method Detail

doRead

protected void doRead(javax.media.Buffer buffer)
               throws IOException
Blocks and reads into a Buffer from this PullBufferStream.

Specified by:
doRead in class AbstractVideoPullBufferStream
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)

setDisplayIndex

public void setDisplayIndex(int index)
Set display index.

Parameters:
index - display index

setOrigin

public void setOrigin(int x,
                      int y)
Set Origin of capture.

Parameters:
x - x coordinate
y - y coordinate

start

public void start()
Start desktop capture stream.

Overrides:
start in class AbstractVideoPullBufferStream
See Also:
AbstractBufferStream.start()

stop

public void stop()
Stop desktop capture stream.

Overrides:
stop in class AbstractVideoPullBufferStream
See Also:
AbstractBufferStream.stop()

readScreen

public byte[] readScreen(byte[] output,
                         Dimension dim)
Read screen.

Parameters:
output - output buffer for screen bytes
dim - 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.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.