Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.directshow
Class DataSource

java.lang.Object
  extended by javax.media.protocol.DataSource
      extended by javax.media.protocol.PushBufferDataSource
          extended by net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractPushBufferCaptureDevice
              extended by net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractVideoPushBufferCaptureDevice
                  extended by net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.directshow.DataSource
All Implemented Interfaces:
javax.media.Controls, javax.media.Duration, javax.media.protocol.CaptureDevice

public class DataSource
extends AbstractVideoPushBufferCaptureDevice

Implements a CaptureDevice and a DataSource using DirectShow.

Author:
Lyubomir Marinov, Sebastien Vincent

Field Summary
 
Fields inherited from interface javax.media.Duration
DURATION_UNBOUNDED, DURATION_UNKNOWN
 
Constructor Summary
DataSource()
          Constructor.
DataSource(javax.media.MediaLocator locator)
          Initializes a new DataSource instance from a specific MediaLocator.
 
Method Summary
protected  javax.media.control.FrameRateControl createFrameRateControl()
          Creates a new FrameRateControl instance which is to allow the getting and setting of the frame rate of this AbstractVideoPushBufferCaptureDevice.
protected  AbstractPushBufferStream createStream(int streamIndex, javax.media.control.FormatControl formatControl)
          Create a new PushBufferStream which is to be at a specific zero-based index in the list of streams of this PushBufferDataSource.
protected  void doConnect()
          Opens a connection to the media source specified by the MediaLocator of this DataSource.
protected  void doDisconnect()
          Closes the connection to the media source specified by the MediaLocator of this DataSource.
protected  void doStart()
          Starts the transfer of media data from this DataSource.
protected  void doStop()
          Stops the transfer of media data from this DataSource.
static long getDSPixFmt(int ffmpegPixFmt)
          Gets the FFmpeg pixel format matching a specific DirectShow Specification pixel format.
static long getFFmpegPixFmt(long dsPixFmt)
          Gets the DirectShow pixel format matching a specific FFmpeg pixel format.
protected  javax.media.Format[] getSupportedFormats(int streamIndex)
          Gets the Formats which are to be reported by a FormatControl as supported formats for a PushBufferStream at a specific zero-based index in the list of streams of this PushBufferDataSource.
protected  javax.media.Format setFormat(int streamIndex, javax.media.Format oldValue, javax.media.Format newValue)
          Attempts to set the Format to be reported by the FormatControl of a PushBufferStream at a specific zero-based index in the list of streams of this PushBufferDataSource.
 void setLocator(javax.media.MediaLocator locator)
          Sets the MediaLocator which specifies the media source of this DataSource.
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractPushBufferCaptureDevice
connect, disconnect, getCaptureDeviceInfo, getContentType, getControl, getControls, getDuration, getFormat, getFormatControls, getStreams, getStreamSyncRoot, start, stop, streams
 
Methods inherited from class javax.media.protocol.DataSource
getLocator, initCheck
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataSource

public DataSource()
Constructor.


DataSource

public DataSource(javax.media.MediaLocator locator)
Initializes a new DataSource instance from a specific MediaLocator.

Parameters:
locator - the MediaLocator to create the new instance from
Method Detail

setLocator

public void setLocator(javax.media.MediaLocator locator)
Sets the MediaLocator which specifies the media source of this DataSource.

Overrides:
setLocator in class javax.media.protocol.DataSource
Parameters:
locator - the MediaLocator which specifies the media source of this DataSource
See Also:
setLocator(MediaLocator)

createFrameRateControl

protected javax.media.control.FrameRateControl createFrameRateControl()
Creates a new FrameRateControl instance which is to allow the getting and setting of the frame rate of this AbstractVideoPushBufferCaptureDevice.

Overrides:
createFrameRateControl in class AbstractVideoPushBufferCaptureDevice
Returns:
a new FrameRateControl instance which is to allow the getting and setting of the frame rate of this AbstractVideoPushBufferCaptureDevice
See Also:
AbstractPushBufferCaptureDevice.createFrameRateControl()

createStream

protected AbstractPushBufferStream createStream(int streamIndex,
                                                javax.media.control.FormatControl formatControl)
Create a new PushBufferStream which is to be at a specific zero-based index in the list of streams of this PushBufferDataSource. The Format-related information of the new instance is to be abstracted by a specific FormatControl.

Specified by:
createStream in class AbstractPushBufferCaptureDevice
Parameters:
streamIndex - the zero-based index of the PushBufferStream in the list of streams of this PushBufferDataSource
formatControl - the FormatControl which is to abstract the Format-related information of the new instance
Returns:
a new PushBufferStream which is to be at the specified streamIndex in the list of streams of this PushBufferDataSource and which has its Format-related information abstracted by the specified formatControl
See Also:
AbstractPushBufferCaptureDevice.createStream(int, FormatControl)

getSupportedFormats

protected javax.media.Format[] getSupportedFormats(int streamIndex)
Gets the Formats which are to be reported by a FormatControl as supported formats for a PushBufferStream at a specific zero-based index in the list of streams of this PushBufferDataSource.

Overrides:
getSupportedFormats in class AbstractPushBufferCaptureDevice
Parameters:
streamIndex - the zero-based index of the PushBufferStream for which the specified FormatControl is to report the list of supported Formats
Returns:
an array of Formats to be reported by a FormatControl as the supported formats for the PushBufferStream at the specified streamIndex in the list of streams of this PushBufferDataSource
See Also:
AbstractPushBufferCaptureDevice.getSupportedFormats(int)

setFormat

protected javax.media.Format setFormat(int streamIndex,
                                       javax.media.Format oldValue,
                                       javax.media.Format newValue)
Attempts to set the Format to be reported by the FormatControl of a PushBufferStream at a specific zero-based index in the list of streams of this PushBufferDataSource. The PushBufferStream does not exist at the time of the attempt to set its Format.

Overrides:
setFormat in class AbstractPushBufferCaptureDevice
Parameters:
streamIndex - the zero-based index of the PushBufferStream the Format of which is to be set
oldValue - the last-known Format for the PushBufferStream at the specified streamIndex
newValue - the Format which is to be set
Returns:
the Format to be reported by the FormatControl of the PushBufferStream at the specified streamIndex in the list of streams of this PushBufferStream or null if the attempt to set the Format did not success and any last-known Format is to be left in effect
See Also:
AbstractPushBufferCaptureDevice.setFormat(int, Format, Format)

doConnect

protected void doConnect()
                  throws IOException
Opens a connection to the media source specified by the MediaLocator of this DataSource.

Overrides:
doConnect in class AbstractPushBufferCaptureDevice
Throws:
IOException - if anything goes wrong while opening the connection to the media source specified by the MediaLocator of this DataSource
See Also:
AbstractPushBufferCaptureDevice.doConnect()

doDisconnect

protected void doDisconnect()
Closes the connection to the media source specified by the MediaLocator of this DataSource.

Overrides:
doDisconnect in class AbstractPushBufferCaptureDevice
See Also:
AbstractPushBufferCaptureDevice.doDisconnect()

doStart

protected void doStart()
                throws IOException
Starts the transfer of media data from this DataSource.

Overrides:
doStart in class AbstractPushBufferCaptureDevice
Throws:
IOException - if anything goes wrong while starting the transfer of media data from this DataSource
See Also:
AbstractPushBufferCaptureDevice.doStart()

doStop

protected void doStop()
               throws IOException
Stops the transfer of media data from this DataSource.

Overrides:
doStop in class AbstractPushBufferCaptureDevice
Throws:
IOException - if anything goes wrong while stopping the transfer of media data from this DataSource
See Also:
AbstractPushBufferCaptureDevice.doStop()

getFFmpegPixFmt

public static long getFFmpegPixFmt(long dsPixFmt)
Gets the DirectShow pixel format matching a specific FFmpeg pixel format.

Parameters:
dsPixFmt - the DirectShow pixel format to get the matching FFmpeg pixel format of
Returns:
the FFmpeg pixel format matching the specified DirectShow pixel

getDSPixFmt

public static long getDSPixFmt(int ffmpegPixFmt)
Gets the FFmpeg pixel format matching a specific DirectShow Specification pixel format.

Parameters:
ffmpegPixFmt - FFmpeg format
Returns:
the DirectShow pixel format matching the specified FFmpeg format

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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