Package gda.images.camera
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 Summary
FieldsModifier and TypeFieldDescriptionprotected AtomicReference<E> static final booleanSet this totrueto get some statistics about frame processing. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddImageListener(ImageListener<E> listener) Adds a listener to which captured frames will be passed.voidvoidDisconnects from the video stream.voidDefault 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.voidConnects to the video stream and starts dispatching images to listeners.protected abstract FrameCaptureTask<E> createFrameCaptureTask(String urlSpec, ExecutorService imageDecodingService, BlockingQueue<E> receivedImages) Subclasses should override this method to create aFrameCaptureTaskthat works with images of the appropriate type.Returns the video source's display name.getImage()Grabs a frame from the video stream.booleanisUrlSet()Method to identify whether the url has been set on the MotionJpegReceivervoidremoveImageListener(ImageListener<E> listener) Removes a listener from the list of listeners to which captured frames will be passed.voidsetAutoConnect(boolean auto) voidsetDisplayName(String displayName) voidsetExecutiveServiceFactory(Function<ThreadFactory, ExecutorService> executiveServiceFactory) voidvoidstart()Starts frame capture.voidstop()Stops frame capture.Methods inherited from class gda.factory.ConfigurableBase
isConfigureAtStartup, isConfigured, reconfigure, setConfiguredMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gda.factory.Configurable
isConfigureAtStartup, isConfigured, reconfigure
-
Field Details
-
SHOW_STATS
public static final boolean SHOW_STATSSet this totrueto get some statistics about frame processing.- See Also:
-
lastImage
-
-
Constructor Details
-
MotionJpegOverHttpReceiverBase
public MotionJpegOverHttpReceiverBase()
-
-
Method Details
-
addImageListener
Description copied from interface:VideoReceiverAdds a listener to which captured frames will be passed.- Specified by:
addImageListenerin interfaceVideoReceiver<E>
-
removeImageListener
Description copied from interface:VideoReceiverRemoves a listener from the list of listeners to which captured frames will be passed.- Specified by:
removeImageListenerin interfaceVideoReceiver<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
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
configure
Description copied from class:ConfigurableBaseDefault 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:
configurein interfaceConfigurable- Overrides:
configurein classConfigurableBase- 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:VideoReceiverConnects to the video stream and starts dispatching images to listeners.- Specified by:
createConnectionin interfaceVideoReceiver<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 aFrameCaptureTaskthat works with images of the appropriate type. -
start
public void start()Description copied from interface:VideoReceiverStarts frame capture.- Specified by:
startin interfaceVideoReceiver<E>
-
stop
public void stop()Description copied from interface:VideoReceiverStops frame capture.- Specified by:
stopin interfaceVideoReceiver<E>
-
getImage
Description copied from interface:VideoReceiverGrabs a frame from the video stream.- Specified by:
getImagein interfaceVideoReceiver<E>- Throws:
DeviceException
-
closeConnection
public void closeConnection()Description copied from interface:VideoReceiverDisconnects from the video stream.- Specified by:
closeConnectionin interfaceVideoReceiver<E>
-
getDisplayName
Description copied from interface:VideoReceiverReturns the video source's display name. This is a label used in the UI to distinguish between multiple video sources.- Specified by:
getDisplayNamein interfaceVideoReceiver<E>- Returns:
- Returns the displayName.
-
setDisplayName
- Parameters:
displayName- The displayName to set.
-
setAutoConnect
public void setAutoConnect(boolean auto)
-