Class CaptureDeviceDelegatePullBufferDataSource

  • All Implemented Interfaces:
    javax.media.Controls, javax.media.Duration, javax.media.protocol.CaptureDevice, javax.media.protocol.Controls
    Direct Known Subclasses:
    PullBufferDataSourceDelegate

    public class CaptureDeviceDelegatePullBufferDataSource
    extends javax.media.protocol.PullBufferDataSource
    implements javax.media.protocol.CaptureDevice
    Represents a PullBufferDataSource which is also a CaptureDevice through delegation to a specific CaptureDevice.
    Author:
    Damian Minkov, Lubomir Marinov
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javax.media.protocol.CaptureDevice captureDevice
      The CaptureDevice this instance delegates to in order to implement its CaptureDevice functionality.
      protected static javax.media.protocol.PullBufferStream[] EMPTY_STREAMS
      The constant which represents an empty array with PullBufferStream element type.
      • Fields inherited from interface javax.media.Duration

        DURATION_UNBOUNDED, DURATION_UNKNOWN
    • Constructor Summary

      Constructors 
      Constructor Description
      CaptureDeviceDelegatePullBufferDataSource​(javax.media.protocol.CaptureDevice captureDevice)
      Initializes a new CaptureDeviceDelegatePullBufferDataSource instance which delegates to a specific CaptureDevice in order to implement its CaptureDevice functionality.
    • Field Detail

      • captureDevice

        protected final javax.media.protocol.CaptureDevice captureDevice
        The CaptureDevice this instance delegates to in order to implement its CaptureDevice functionality.
      • EMPTY_STREAMS

        protected static final javax.media.protocol.PullBufferStream[] EMPTY_STREAMS
        The constant which represents an empty array with PullBufferStream element type. Explicitly defined in order to reduce unnecessary allocations.
    • Constructor Detail

      • CaptureDeviceDelegatePullBufferDataSource

        public CaptureDeviceDelegatePullBufferDataSource​(javax.media.protocol.CaptureDevice captureDevice)
        Initializes a new CaptureDeviceDelegatePullBufferDataSource instance which delegates to a specific CaptureDevice in order to implement its CaptureDevice functionality.
        Parameters:
        captureDevice - the CaptureDevice the new instance is to delegate to in order to provide its CaptureDevice functionality
    • Method Detail

      • getStreams

        public javax.media.protocol.PullBufferStream[] getStreams()
        Implements PullBufferDataSource.getStreams(). Delegates to the wrapped CaptureDevice if it implements PullBufferDataSource; otherwise, returns an empty array with PullBufferStream element type.
        Specified by:
        getStreams in class javax.media.protocol.PullBufferDataSource
        Returns:
        an array of PullBufferStreams as returned by the wrapped CaptureDevice if it implements PullBufferDataSource; otherwise, an empty array with PullBufferStream element type
      • getContentType

        public String getContentType()
        Implements DataSource.getContentType(). Delegates to the wrapped CaptureDevice if it implements DataSource; otherwise, returns ContentDescriptor.CONTENT_UNKNOWN.
        Specified by:
        getContentType in class javax.media.protocol.DataSource
        Returns:
        a String value which describes the content type of the wrapped CaptureDevice if it implements DataSource; otherwise, ContentDescriptor#CONTENT_UNKNOWN
      • connect

        public void connect()
                     throws IOException
        Implements CaptureDevice.connect(). Delegates to the wrapped CaptureDevice if available; otherwise, does nothing.
        Specified by:
        connect in interface javax.media.protocol.CaptureDevice
        Specified by:
        connect in class javax.media.protocol.DataSource
        Throws:
        IOException - if the wrapped CaptureDevice throws such an exception
      • disconnect

        public void disconnect()
        Implements CaptureDevice.disconnect(). Delegates to the wrapped CaptureDevice if available; otherwise, does nothing.
        Specified by:
        disconnect in interface javax.media.protocol.CaptureDevice
        Specified by:
        disconnect in class javax.media.protocol.DataSource
      • start

        public void start()
                   throws IOException
        Implements CaptureDevice.start(). Delegates to the wrapped CaptureDevice if available; otherwise, does nothing.
        Specified by:
        start in interface javax.media.protocol.CaptureDevice
        Specified by:
        start in class javax.media.protocol.DataSource
        Throws:
        IOException - if the wrapped CaptureDevice throws such an exception
      • stop

        public void stop()
                  throws IOException
        Implements CaptureDevice.start(). Delegates to the wrapped CaptureDevice if available; otherwise, does nothing.
        Specified by:
        stop in interface javax.media.protocol.CaptureDevice
        Specified by:
        stop in class javax.media.protocol.DataSource
        Throws:
        IOException - if the wrapped CaptureDevice throws such an exception
      • getControl

        public Object getControl​(String controlType)
        Implements Controls.getControl(String). Delegates to the wrapped CaptureDevice if it implements DataSource; otherwise, returns null.
        Specified by:
        getControl in interface javax.media.Controls
        Parameters:
        controlType - a String value which names the type of the control to be retrieved
        Returns:
        an Object which represents the control of the requested controlType of the wrapped CaptureDevice if it implements DataSource; otherwise, null
      • getControls

        public Object[] getControls()
        Implements Controls.getControls(). Delegates to the wrapped CaptureDevice if it implements DataSource; otherwise, returns an empty array with Object element type.
        Specified by:
        getControls in interface javax.media.Controls
        Returns:
        the array of controls for the wrapped CaptureDevice if it implements DataSource; otherwise, an empty array with Object element type
      • getDuration

        public javax.media.Time getDuration()
        Implements Duration.getDuration(). Delegates to the wrapped CaptureDevice if it implements DataSource; otherwise, returns Duration.DURATION_UNKNOWN.
        Specified by:
        getDuration in interface javax.media.Duration
        Returns:
        the duration of the wrapped CaptureDevice as returned by its implementation of DataSource if any; otherwise, returns DataSource#DURATION_UNKNOWN
      • getFormatControls

        public javax.media.control.FormatControl[] getFormatControls()
        Implements CaptureDevice.getFormatControls(). Delegates to the wrapped CaptureDevice if available; otherwise, returns an empty array with FormatControl element type.
        Specified by:
        getFormatControls in interface javax.media.protocol.CaptureDevice
        Returns:
        the array of FormatControls of the wrapped CaptureDevice if available; otherwise, an empty array with FormatControl element type
      • getCaptureDeviceInfo

        public javax.media.CaptureDeviceInfo getCaptureDeviceInfo()
        Implements CaptureDevice.getCaptureDeviceInfo(). Delegates to the wrapped CaptureDevice if available; otherwise, returns null.
        Specified by:
        getCaptureDeviceInfo in interface javax.media.protocol.CaptureDevice
        Returns:
        the CaptureDeviceInfo of the wrapped CaptureDevice if available; otherwise, null