|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
it.lilik.capturemjpeg.CaptureMJPEG
public class CaptureMJPEG
This class produces JPEG images from Motion JPEG stream.
It searches for a callback function called void captureMJPEGEvent(PImage img)
into the parent PApplet
Example
import it.lilik.capturemjpeg.*; private CaptureMJPEG capture; private PImage next_img = null; void setup() { size(400, 300); background(0); capture = new CaptureMJPEG(this, "http://mynetworkcamera/image?speed=20", "admin", "password"); capture.startCapture(); frameRate(20); } void draw() { if (next_img != null) { image(next_img, 0, 0); } } void captureMJPEGEvent(PImage img) { next_img = img; }
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
CaptureMJPEG(PApplet parent,
String url)
Creates a CaptureMJPEG without HTTP Auth credential |
|
CaptureMJPEG(PApplet parent,
String url,
String username,
String password)
Creates a CaptureMJPEG with HTTP Auth credential |
Method Summary | |
---|---|
void |
dispose()
Callback method. |
PImage |
getImage()
Provides the oldest image not yet provided. |
boolean |
isAdaptFrameSize()
Sets the adaptive frame size behavior. |
boolean |
isImageAvailable()
Return true if there is at least one image available into
the internal buffer. |
boolean |
isStopping()
Checks if the running thread is in stopping state. |
void |
run()
|
void |
setAdaptFrameSize(boolean adaptFrameSize)
If true when a stream is initialized
the parent size is set to the image size. |
void |
setCredential(String username,
String password)
Sets username and password for HTTP Auth. |
void |
setURL(String url)
Changes the URI. |
void |
startCapture()
Starts the capture cycle. |
void |
stopCapture()
Stops this thread when the current image if finished |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CaptureMJPEG(PApplet parent, String url)
CaptureMJPEG
without HTTP Auth credential
public CaptureMJPEG(PApplet parent, String url, String username, String password)
CaptureMJPEG
with HTTP Auth credential
parent
- the PApplet
which uses this objecturl
- the MJPEG stream URIusername
- HTTP AUTH usernamepassword
- HTTP AUTH passwordMethod Detail |
---|
public boolean isStopping()
true
the thread is stopped or it will
stop after the next image was captured.
public void startCapture()
public void stopCapture()
public void setURL(String url)
url
- the url of the MJPEG streampublic void setCredential(String username, String password)
username
- the usernamepassword
- the passwordpublic boolean isAdaptFrameSize()
setAdaptFrameSize(boolean)
public void setAdaptFrameSize(boolean adaptFrameSize)
true
when a stream is initialized
the parent
size is set to the image size.
adaptFrameSize
- the adaptFrameSize to setpublic void run()
run
in interface Runnable
run
in class Thread
public void dispose()
public PImage getImage()
PImage
public boolean isImageAvailable()
true
if there is at least one image available into
the internal buffer.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |