|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.image.MJPEGHandler
public class MJPEGHandler
a convenient implementation that provides images from the stream that are created asynchronously
MJPEGReader| Field Summary | |
|---|---|
protected ThreadWorker |
worker
|
| Constructor Summary | |
|---|---|
MJPEGHandler()
|
|
MJPEGHandler(int cacheSize)
|
|
MJPEGHandler(int cacheSize,
int idleTimeInMillis)
|
|
| Method Summary | |
|---|---|
boolean |
addAlertTask(Task<?> alertTask)
note that the alert task is performed before this handler enters the alert status; so if this instance is in alert status when the task is performed; it was from the previous alert. |
boolean |
addImageHandler(Handler<BufferedImage,?> imageHandler)
allows to add a handler that is called each time a new image is set |
protected double |
calculateMotion(BufferedImage image1,
BufferedImage image2)
|
BufferedImage |
createImage(byte[] bytes)
responsible for extracting an image from the given bytes This method is internally called in a thread spawned by handle(Object, byte[]). |
protected void |
finalize()
|
long |
getAlertPeriod()
|
byte[][] |
getCachedImages()
|
long |
getCount()
returns how many image data frames have been received by the handling method handle(Object, byte[])
(including those that were not successfully be converted into an image) |
BufferedImage |
getCurrentImage()
|
double |
getFramesPerSecond()
|
long |
getFramesTimePeriod()
the time period (milliseconds) that is considered when calculating frames per seconds rate |
int |
getIdleTime()
|
long |
getImageCount()
returns how many images were actually processed |
Processor<BufferedImage,IOException> |
getImageProcessor()
|
long |
getLastAlert()
|
Logger |
getLogger()
|
MotionDetector |
getMotionDetector()
|
BufferedImage |
getRelevantValue()
returns the relevant value for this instance at the time of calling |
long |
getTimestamp()
|
void |
handle(Object source,
byte[] bytes)
returns immediately and processes the creation/handling of the image in a new thread |
boolean |
isEnableMotionLogging()
if enabled and a MotionDetector is present, the difference is logged for each image change
and sent to the logger (with Level.INFO and the difference is given as the first parameter) |
boolean |
isInAlert()
|
protected void |
notifyAlert()
|
protected void |
notifyImageHandler(BufferedImage image)
|
boolean |
removeAlertTask(Task<?> alertTask)
|
boolean |
removeImageHandler(Handler<BufferedImage,?> imageHandler)
|
void |
resetCount()
|
void |
resetImageCount()
|
void |
setAlertPeriod(long alertPeriod)
sets the minimum time period that passes before an alert is triggered after another |
void |
setEnableMotionLogging(boolean flag)
|
void |
setFramesTimePeriod(long millis)
|
void |
setIdleTime(int millis)
allows to specify the time perid the image handling thread is pausing between images |
void |
setImageProcessor(Processor<BufferedImage,IOException> imageProcessor)
|
void |
setMotionDetector(MotionDetector motionDetector)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final ThreadWorker worker
| Constructor Detail |
|---|
public MJPEGHandler()
public MJPEGHandler(int cacheSize)
public MJPEGHandler(int cacheSize,
int idleTimeInMillis)
| Method Detail |
|---|
public Logger getLogger()
public boolean isEnableMotionLogging()
MotionDetector is present, the difference is logged for each image change
and sent to the logger (with Level.INFO and the difference is given as the first parameter)
public void setEnableMotionLogging(boolean flag)
public boolean addImageHandler(Handler<BufferedImage,?> imageHandler)
public boolean removeImageHandler(Handler<BufferedImage,?> imageHandler)
public long getAlertPeriod()
public int getIdleTime()
public void setIdleTime(int millis)
public void setAlertPeriod(long alertPeriod)
alertPeriod - a positive number representing millisecondspublic MotionDetector getMotionDetector()
public void setMotionDetector(MotionDetector motionDetector)
public boolean addAlertTask(Task<?> alertTask)
public boolean removeAlertTask(Task<?> alertTask)
public long getLastAlert()
public boolean isInAlert()
public long getCount()
handle(Object, byte[])
(including those that were not successfully be converted into an image)
public void resetCount()
public long getImageCount()
public void resetImageCount()
public long getFramesTimePeriod()
public void setFramesTimePeriod(long millis)
public double getFramesPerSecond()
public BufferedImage getRelevantValue()
throws IOException
ValueRetriever
getRelevantValue in interface ValueRetriever<BufferedImage>IOException - if any resource to fulfill the request is not accessiblepublic BufferedImage getCurrentImage()
public long getTimestamp()
public byte[][] getCachedImages()
public Processor<BufferedImage,IOException> getImageProcessor()
public void setImageProcessor(Processor<BufferedImage,IOException> imageProcessor)
public BufferedImage createImage(byte[] bytes)
throws IOException
handle(Object, byte[]).
If this method returns null, the data is ignored.
IOException
protected double calculateMotion(BufferedImage image1,
BufferedImage image2)
protected void notifyImageHandler(BufferedImage image)
protected void notifyAlert()
public void handle(Object source,
byte[] bytes)
throws IOException
handle in interface Handler<byte[],IOException>source - the object that initiated this call-backbytes - the item to be handled by this instance
IOExceptioncreateImage(byte[])
protected void finalize()
throws Throwable
finalize in class ObjectThrowable
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||