public class YVUFrameGrabber extends Object
VideoDevice. A YVU420 frame grabber can only be
created if the associated video device can produce images in a format v4l4j
knows how to encode in YVU420. The VideoDevice.supportYVUConversion()
method can be used to find out whether a video device can have its images
YVU420-encoded by v4l4j, ie if a YVU420 frame grabber can be instantiated.
YVUFrameGrabber objects are not instantiated directly.
Instead, the
VideoDevice.getYVUFrameGrabber(int, int, int, int)
or
VideoDevice.getYVUFrameGrabber(int, int, int, int, ImageFormat)
method must be called on the associated VideoDevice. YVU frame grabbers
implement the FrameGrabber interface which provides methods to handle
video capture. See its documentation for more information.{@link FrameGrabber}| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractGrabber.State |
| Modifier and Type | Field and Description |
|---|---|
protected static int |
BGR24_GRABBER |
protected DeviceInfo |
dInfo |
protected int |
format |
protected static int |
JPEG_GRABBER |
protected int |
nbV4LBuffers |
protected long |
object |
protected static int |
RAW_GRABBER |
protected static int |
RGB24_GRABBER |
protected AbstractGrabber.State |
state |
protected Vector<au.edu.jcu.v4l4j.BaseVideoFrame> |
videoFrames |
protected static int |
YUV_GRABBER |
protected static int |
YVU_GRABBER |
| Modifier and Type | Method and Description |
|---|---|
protected void |
createBuffers(int bufferSize)
This abstract method is called when
init() succeeds and is
responsible for populating the videoFrames member (vector of
nbV4LBuffers BaseVideoFrames). |
boolean |
equals(Object obj) |
int |
getChannel()
This method returns the video channel used to capture frames.
|
FrameInterval.DiscreteInterval |
getFrameInterval()
This method returns the current frame interval used for capture.
|
int |
getHeight()
This method returns the actual height of captured frames.
|
ImageFormat |
getImageFormat()
This method returns the native image format used by this
FrameGrabber.
|
int |
getNumberOfRecycledVideoFrames()
This method returns the number of recycled video frames, ie.
|
int |
getNumberOfVideoFrames()
This method returns the number of buffers v4l4j has negotiated with
the driver.
|
int |
getStandard()
This method returns the actual video standard:
V4L4JConstants.STANDARD_NTSC, V4L4JConstants.STANDARD_PAL
, V4L4JConstants.STANDARD_SECAM or
V4L4JConstants.STANDARD_WEBCAM |
Tuner |
getTuner()
This method returns the
Tuner associated with the input of this
FrameGrabber, or throws a NoTunerException if there
is none. |
int |
getVideoInput()
This method retrieves the current video input channel number.
|
int |
getVideoStandard()
This method retrieves the current video standard used by the current video input.
|
int |
getWidth()
This method returns the actual width of captured frames.
|
int |
hashCode() |
void |
setCaptureCallback(CaptureCallback callback)
setCaptureCallback sets the CaptureCallback object
which will be notified by this grabber as soon as new frames become
available.This method cannot be called while the capture is active, ie. |
void |
setFrameInterval(int num,
int denom)
This method sets the frame interval used for capture.
|
protected void |
setQuality(long o,
int i)
This method sets a new value for the JPEG quality
|
void |
setVideoInputNStandard(int input,
int standard)
This method adjusts the current video input number and video standard.
|
void |
startCapture()
This method starts the capture.
|
void |
stopCapture()
This method stops the capture, and recycles all @link
VideoFrames. |
protected static final int RAW_GRABBER
protected static final int JPEG_GRABBER
protected static final int RGB24_GRABBER
protected static final int BGR24_GRABBER
protected static final int YUV_GRABBER
protected static final int YVU_GRABBER
protected DeviceInfo dInfo
protected int nbV4LBuffers
protected Vector<au.edu.jcu.v4l4j.BaseVideoFrame> videoFrames
protected AbstractGrabber.State state
protected int format
protected long object
public ImageFormat getImageFormat()
StateException - if this
FrameGrabber has been already released, and therefore must
not be used anymore.protected void createBuffers(int bufferSize)
init() succeeds and is
responsible for populating the videoFrames member (vector of
nbV4LBuffers BaseVideoFrames).bufferSize - the size of each bufferprotected void setQuality(long o,
int i)
o - the struct v4l4_devicei - the new valueV4L4JException - if the JPEG quality is disabled because of the
type of this frame grabber (not JPEG_GRABBER).public int getNumberOfVideoFrames()
FrameGrabberVideoFrame represents (and encapsulates) one of
these buffers. Hence, this number is an indication of how many video
frames can be delivered by v4l4j to your application before the capture
blocks until a buffer is returned to the driver. Practically speaking,
this number specifies how many times v4l4j can call
CaptureCallback.nextFrame(VideoFrame frame) and block waiting for
one of the previous frames to be recycled through VideoFrame.recycle().v4l4j.num_driver_buffers property to an integer value
before creating a frame grabber object. The number you specify is only an
indication, and the driver can decide to allocate a different number of buffers.
Before setting this number, make sure you fully understand the implications of doing this.getNumberOfVideoFrames in interface FrameGrabberpublic int getNumberOfRecycledVideoFrames()
FrameGrabberVideoFrame.recycle().getNumberOfRecycledVideoFrames in interface FrameGrabberFrameGrabber.getNumberOfVideoFrames()public void setFrameInterval(int num,
int denom)
throws InvalidValue
FrameGrabberUnsupportedMethod exception. This method will throw an
InvalidValue exception if the given frame interval value is not
supported.
As a guide, you can check the ResolutionInfo objects associated
with the video device to find out whether frame intervals are at all
supported, and if they are, what values (or range of values) are accepted.
ResolutionInfo objects can be obtained for each
ImageFormat. See the ImageFormat and
ResolutionInfo documentation for more information.setFrameInterval in interface FrameGrabbernum - the numerator of the frame interval to be setdenom - the denominator of the frame interval to be setInvalidValue - if the given frame interval value is invalid.public FrameInterval.DiscreteInterval getFrameInterval()
FrameGrabberUnsupportedMethod exception.getFrameInterval in interface FrameGrabberpublic void setVideoInputNStandard(int input,
int standard)
throws VideoStandardException,
CaptureChannelException
FrameGrabbersetVideoInputNStandard in interface FrameGrabberVideoStandardException - if the chosen video standard is not
supportedCaptureChannelException - if the given channel number value is not
validpublic int getVideoInput()
FrameGrabbergetVideoInput in interface FrameGrabberpublic int getVideoStandard()
FrameGrabbergetVideoStandard in interface FrameGrabberpublic final Tuner getTuner() throws NoTunerException
FrameGrabberTuner associated with the input of this
FrameGrabber, or throws a NoTunerException if there
is none.getTuner in interface FrameGrabberTuner object associated with the chosen input.NoTunerException - if the selected input does not have a tunerpublic final void setCaptureCallback(CaptureCallback callback)
FrameGrabbersetCaptureCallback sets the CaptureCallback object
which will be notified by this grabber as soon as new frames become
available.FrameGrabber.startCapture() and FrameGrabber.stopCapture().setCaptureCallback in interface FrameGrabbercallback - an object implementing the CaptureCallback
interface which will receive new frames and capture exceptions.public final void startCapture()
throws V4L4JException
FrameGrabberCaptureCallback object.startCapture in interface FrameGrabberV4L4JException - if no valid CaptureCallback object was
provided (call FrameGrabber.setCaptureCallback(CaptureCallback callback)
OR if the capture cannot be startedpublic final void stopCapture()
FrameGrabberVideoFrames.stopCapture in interface FrameGrabberpublic final int getHeight()
FrameGrabbergetHeight in interface FrameGrabberpublic final int getWidth()
FrameGrabbergetWidth in interface FrameGrabberpublic final int getChannel()
FrameGrabbergetChannel in interface FrameGrabberpublic final int getStandard()
FrameGrabberV4L4JConstants.STANDARD_NTSC, V4L4JConstants.STANDARD_PAL
, V4L4JConstants.STANDARD_SECAM or
V4L4JConstants.STANDARD_WEBCAMgetStandard in interface FrameGrabberCopyright © 2013-2015 Bartosz Firyn (sarxos). All Rights Reserved.