Class MotionJpegOverHttpReceiverBase<E>

java.lang.Object
gda.factory.ConfigurableBase
gda.images.camera.MotionJpegOverHttpReceiverBase<E>
All Implemented Interfaces:
Configurable, VideoReceiver<E>, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
MotionJpegOverHttpReceiver, MotionJpegOverHttpReceiverSwt

public abstract class MotionJpegOverHttpReceiverBase<E> extends ConfigurableBase implements VideoReceiver<E>, org.springframework.beans.factory.InitializingBean
Captures an MJPEG stream from a HTTP connection.
  • Field Details

    • SHOW_STATS

      public static final boolean SHOW_STATS
      Set this to true to get some statistics about frame processing.
      See Also:
    • lastImage

      protected AtomicReference<E> lastImage
  • Constructor Details

    • MotionJpegOverHttpReceiverBase

      public MotionJpegOverHttpReceiverBase()
  • Method Details

    • addImageListener

      public void addImageListener(ImageListener<E> listener)
      Description copied from interface: VideoReceiver
      Adds a listener to which captured frames will be passed.
      Specified by:
      addImageListener in interface VideoReceiver<E>
    • removeImageListener

      public void removeImageListener(ImageListener<E> listener)
      Description copied from interface: VideoReceiver
      Removes a listener from the list of listeners to which captured frames will be passed.
      Specified by:
      removeImageListener in interface VideoReceiver<E>
    • isUrlSet

      public boolean isUrlSet()
      Method to identify whether the url has been set on the MotionJpegReceiver
      Returns:
      true is the urlspec is not null
    • setUrl

      public void setUrl(String url)
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • configure

      public void configure() throws FactoryException
      Description copied from class: ConfigurableBase
      Default implementation for classes that do not have to do any specific configuration.
      Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.
      Specified by:
      configure in interface Configurable
      Overrides:
      configure in class ConfigurableBase
      Throws:
      FactoryException - if there is an error in configuration e.g. required variable not set or cannot connect to device
    • createConnection

      public void createConnection()
      Description copied from interface: VideoReceiver
      Connects to the video stream and starts dispatching images to listeners.
      Specified by:
      createConnection in interface VideoReceiver<E>
    • setExecutiveServiceFactory

      public void setExecutiveServiceFactory(Function<ThreadFactory,ExecutorService> executiveServiceFactory)
    • createFrameCaptureTask

      protected abstract FrameCaptureTask<E> createFrameCaptureTask(String urlSpec, ExecutorService imageDecodingService, BlockingQueue<E> receivedImages)
      Subclasses should override this method to create a FrameCaptureTask that works with images of the appropriate type.
    • start

      public void start()
      Description copied from interface: VideoReceiver
      Starts frame capture.
      Specified by:
      start in interface VideoReceiver<E>
    • stop

      public void stop()
      Description copied from interface: VideoReceiver
      Stops frame capture.
      Specified by:
      stop in interface VideoReceiver<E>
    • getImage

      public E getImage() throws DeviceException
      Description copied from interface: VideoReceiver
      Grabs a frame from the video stream.
      Specified by:
      getImage in interface VideoReceiver<E>
      Throws:
      DeviceException
    • closeConnection

      public void closeConnection()
      Description copied from interface: VideoReceiver
      Disconnects from the video stream.
      Specified by:
      closeConnection in interface VideoReceiver<E>
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: VideoReceiver
      Returns the video source's display name. This is a label used in the UI to distinguish between multiple video sources.
      Specified by:
      getDisplayName in interface VideoReceiver<E>
      Returns:
      Returns the displayName.
    • setDisplayName

      public void setDisplayName(String displayName)
      Parameters:
      displayName - The displayName to set.
    • setAutoConnect

      public void setAutoConnect(boolean auto)