Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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

java.lang.Object
  extended by javax.media.protocol.DataSource
      extended by javax.media.protocol.PullBufferDataSource
          extended by net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractPullBufferCaptureDevice
              extended by net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractVideoPullBufferCaptureDevice
                  extended by net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.video4linux2.DataSource
All Implemented Interfaces:
javax.media.Controls, javax.media.Duration, javax.media.protocol.CaptureDevice

public class DataSource
extends AbstractVideoPullBufferCaptureDevice

Implements a PullBufferDataSource and CaptureDevice using the Video for Linux Two API Specification.

Author:
Lyubomir Marinov

Field Summary
 
Fields inherited from interface javax.media.Duration
DURATION_UNBOUNDED, DURATION_UNKNOWN
 
Constructor Summary
DataSource()
          Initializes a new DataSource instance.
DataSource(javax.media.MediaLocator locator)
          Initializes a new DataSource instance from a specific MediaLocator.
 
Method Summary
protected  Video4Linux2Stream createStream(int streamIndex, javax.media.control.FormatControl formatControl)
          Creates a new PullBufferStream which is to be at a specific zero-based index in the list of streams of this PullBufferDataSource.
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.
static int getFFmpegPixFmt(int v4l2PixFmt)
          Gets the Video for Linux Two API Specification pixel format matching a specific FFmpeg pixel format.
static int getV4L2PixFmt(int ffmpegPixFmt)
          Gets the FFmpeg pixel format matching a specific Video for Linux Two API Specification pixel format.
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractVideoPullBufferCaptureDevice
createFrameRateControl
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractPullBufferCaptureDevice
connect, disconnect, doStart, doStop, getCaptureDeviceInfo, getContentType, getControl, getControls, getDuration, getFormat, getFormatControls, getStreams, getStreamSyncRoot, getSupportedFormats, setCaptureDeviceInfo, setFormat, start, stop, streams
 
Methods inherited from class javax.media.protocol.DataSource
getLocator, initCheck, setLocator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataSource

public DataSource()
Initializes a new DataSource instance.


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

createStream

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

Specified by:
createStream in class AbstractPullBufferCaptureDevice
Parameters:
streamIndex - the zero-based index of the PullBufferStream in the list of streams of this PullBufferDataSource
formatControl - the FormatControl which is to abstract the Format-related information of the new instance
Returns:
a new PullBufferStream which is to be at the specified streamIndex in the list of streams of this PullBufferDataSource and which has its Format-related information abstracted by the specified formatControl

doConnect

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

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

doDisconnect

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

Overrides:
doDisconnect in class AbstractPullBufferCaptureDevice

getFFmpegPixFmt

public static int getFFmpegPixFmt(int v4l2PixFmt)
Gets the Video for Linux Two API Specification pixel format matching a specific FFmpeg pixel format.

Parameters:
v4l2PixFmt - the FFmpeg pixel format to get the matching Video for Linux Two API Specification pixel format of
Returns:
the Video for Linux Two API Specification pixel format matching the specified FFmpeg format

getV4L2PixFmt

public static int getV4L2PixFmt(int ffmpegPixFmt)
Gets the FFmpeg pixel format matching a specific Video for Linux Two API Specification pixel format.

Parameters:
ffmpegPixFmt - the Video for Linux Two API Specification pixel format to get the matching FFmpeg pixel format of
Returns:
the FFmpeg pixel format matching the specified Video for Linux Two API Specification pixel format

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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