Package org.jitsi.impl.neomedia.protocol
Class FakePushBufferDataSource
- java.lang.Object
-
- javax.media.protocol.DataSource
-
- javax.media.protocol.PushBufferDataSource
-
- org.jitsi.impl.neomedia.jmfext.media.protocol.AbstractPushBufferCaptureDevice
-
- org.jitsi.impl.neomedia.protocol.FakePushBufferDataSource
-
- All Implemented Interfaces:
javax.media.Controls,javax.media.Duration,javax.media.protocol.CaptureDevice,javax.media.protocol.Controls
public class FakePushBufferDataSource extends AbstractPushBufferCaptureDevice
ImplementsPushBufferDataSourcefor the purposes ofRTPTranslatorwhen it does not have a CaptureDevice yet RTPManager.createSendStream(DataSource, int) has to be called to have RTPTranslatorImpl send packets.- Author:
- Lyubomir Marinov
-
-
Constructor Summary
Constructors Constructor Description FakePushBufferDataSource(javax.media.Format... supportedFormats)Initializes a new FakePushBufferCaptureDevice instance which is to report a specific list of Formats as supported.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconnect()Opens a connection to the media source specified by the MediaLocator of this DataSource.protected org.jitsi.impl.neomedia.protocol.FakePushBufferDataSource.FakePushBufferStreamcreateStream(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.voiddisconnect()Closes the connection to the media source specified of this AbstractBufferCaptureDevice.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.FormatsetFormat(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.voidstart()Starts the transfer of media data from this DataSource.voidstop()Stops the transfer of media data from this DataSource.-
Methods inherited from class org.jitsi.impl.neomedia.jmfext.media.protocol.AbstractPushBufferCaptureDevice
createFrameRateControl, doConnect, doDisconnect, doStart, doStop, getCaptureDeviceInfo, getContentType, getControl, getControls, getDuration, getFormat, getFormatControls, getStreams, getStreamSyncRoot, streams
-
-
-
-
Constructor Detail
-
FakePushBufferDataSource
public FakePushBufferDataSource(javax.media.Format... supportedFormats)
Initializes a new FakePushBufferCaptureDevice instance which is to report a specific list of Formats as supported.- Parameters:
supportedFormats- the list of Formats to be reported as supported by the new instance
-
-
Method Detail
-
connect
public void connect() throws IOExceptionOpens a connection to the media source specified by the MediaLocator of this DataSource.- Specified by:
connectin interfacejavax.media.protocol.CaptureDevice- Overrides:
connectin classAbstractPushBufferCaptureDevice- Throws:
IOException- if anything goes wrong while opening the connection to the media source specified by the MediaLocator of this DataSource
-
createStream
protected org.jitsi.impl.neomedia.protocol.FakePushBufferDataSource.FakePushBufferStream 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:
createStreamin classAbstractPushBufferCaptureDevice- Parameters:
streamIndex- the zero-based index of the PushBufferStream in the list of streams of this PushBufferDataSourceformatControl- 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
-
disconnect
public void disconnect()
Closes the connection to the media source specified of this AbstractBufferCaptureDevice. If such a connection has not been opened, the call is ignored.- Specified by:
disconnectin interfacejavax.media.protocol.CaptureDevice- Overrides:
disconnectin classAbstractPushBufferCaptureDevice
-
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:
getSupportedFormatsin classAbstractPushBufferCaptureDevice- 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
-
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. Allows extenders to override the default behavior which is to not attempt to set the specified Format so that they can enable setting the Format prior to creating the PushBufferStream. If setting the Format of an existing PushBufferStream is desired, AbstractPushBufferStream#doSetFormat(Format) should be overridden instead. Allows setting an arbitrary Format on this DataSource because it does not really provide any media.- Overrides:
setFormatin classAbstractPushBufferCaptureDevice- Parameters:
streamIndex- the zero-based index of the PushBufferStream the Format of which is to be setoldValue- the last-known Format for the PushBufferStream at the specified streamIndexnewValue- 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
-
start
public void start() throws IOExceptionStarts the transfer of media data from this DataSource.- Specified by:
startin interfacejavax.media.protocol.CaptureDevice- Overrides:
startin classAbstractPushBufferCaptureDevice- Throws:
IOException- if anything goes wrong while starting the transfer of media data from this DataSource
-
stop
public void stop() throws IOExceptionStops the transfer of media data from this DataSource.- Specified by:
stopin interfacejavax.media.protocol.CaptureDevice- Overrides:
stopin classAbstractPushBufferCaptureDevice- Throws:
IOException- if anything goes wrong while stopping the transfer of media data from this DataSource
-
-