ImageSourceAdapter
The ImageSourceAdapter
class provides an interface for fetching and buffering images. It is an abstract class that needs to be implemented by a concrete class to provide actual functionality.
Definition
Namespace: com.dynamsoft.core.basic_structures
Assembly: DynamsoftCore.aar
class ImageSourceAdapter
Methods
Method | Description |
---|---|
addImageToBuffer |
Adds an image to the internal buffer. |
clearBuffer |
Clears all images from the buffer, resetting the state for new image fetching. |
getBufferOverflowProtectionMode |
Get the current mode for handling buffer overflow. |
getColourChannelUsageType |
Get the current usage type for color channels in images. |
getImageCount |
Get the current number of images in the buffer. |
getImage |
Get a buffered image. Implementing classes should return a Promise that resolves with an instance of DSImageData . |
getMaxImageCount |
Get the maximum number of images that can be buffered. |
hasImage |
Checks if an image with the specified ID is present in the buffer. |
hasNextImageToFetch |
Determines whether there are more images available to fetch. |
isBufferEmpty |
Determines whether the buffer is currently empty. |
setBufferOverflowProtectionMode |
Sets the behavior for handling new incoming images when the buffer is full. |
setColourChannelUsageType |
Sets the usage type for color channels in images. |
setErrorListener |
Sets an error listener to receive notifications about errors that occur during image source operations. |
setMaxImageCount |
Sets the maximum number of images that can be buffered at any time. |
setNextImageToReturn(imageId) |
Sets the processing priority of a specific image. This can affect the order in which images are returned by getImage. |
setNextImageToReturn(imageId,keepInBuffer) |
Sets the processing priority of a specific image. This can affect the order in which images are returned by getImage. |
startFetching |
Start fetching images from the source to the Video Buffer of ImageSourceAdapter. |
stopFetching |
Stop fetching images from the source to the Video Buffer of ImageSourceAdapter. |
addImageToBuffer
Adds an image to the internal buffer.
void addImageToBuffer(ImageData image);
Parameters
[in] image
: The ImageData object to add.
clearBuffer
Clears all images from the buffer, resetting the state for new image fetching.
void clearBuffer();
getBufferOverflowProtectionMode
Get the current mode for handling buffer overflow.
BufferOverflowProtectionMode getBufferOverflowProtectionMode();
getColourChannelUsageType
Get the current usage type for color channels in images.
EnumColourChannelUsageType getColourChannelUsageType();
getImageCount
Get the current number of images in the buffer.
int getImageCount();
Return Value
The current number of images in the buffer.
getImage
Get an image from the Video Buffer.
ImageData getImage();
Return Value
An object of ImageData.
- If an image is set as the “next image” by method
setNextImageToReturn
, return that image. - If no image is set as the “next image”, return the latest image.
getMaxImageCount
Get the maximum number of images that can be buffered.
int getMaximumImageCount();
Return Value
The maximum capability of the Video Buffer.
hasImage
Checks if an image with the specified ID is present in the buffer.
boolean hasImage(int imageId);
Parameters
[in] imageId
: The imageId of image you want to check the availability.
Return Value
A boolean value that indicates whether the specified image is found in the video buffer.
hasNextImageToFetch
Determines whether there are more images available to fetch.
abstract boolean hasNextImageToFetch();
Return value
A boolean value that determines whether there are more images left to fetch.
isBufferEmpty
Determines whether the buffer is currently empty.
boolean isBufferEmpty();
Return Value
A boolean value that indicates whether the Video Buffer is empty.
setBufferOverflowProtectionMode
Sets the behavior for handling new incoming images when the buffer is full.
void setBufferOverflowProtectionMode(BufferOverflowProtectionMode mode);
Parameters
[in] mode
: One of the EnumBufferOverflowProtectionMode
that indicates the buffer overflow protection mode.
Return Value
The buffer overflow protection mode.
setColourChannelUsageType
Sets the usage type for color channels in images.
void setColourChannelUsageType(EnumColourChannelUsageType type);
Parameters
[in] type
: One of the EnumColourChannelUsageType
that indicates whether the colour channel usage type.
Return Value
One of the EnumColourChannelUsageType
that indicates whether the colour channel usage type.
setErrorListener
Sets an error listener to receive notifications about errors that occur during image source operations.
void setErrorListener(ImageSourceErrorListener* listener);
Parameters
[in] listener
: A interface object of ImageSourceErrorListener
to receive the errors that occurs in the ImageSourceAdapter
.
setMaxImageCount
Sets the maximum number of images that can be buffered at any time.
void setMaximumImageCount(int count);
Parameters
[in] count
: The maximum capability of the Video Buffer.
setNextImageToReturn(imageId)
Sets the processing priority of a specific image. This can affect the order in which images are returned by getImage.
boolean setNextImageToReturn(int imageId);
Parameters
[in] imageId
: The imageId of image you want to set as the “next image”.
Return Value
A boolean value that indicates whether the specified image is successfully set as the “next image”.
setNextImageToReturn(imageId,keepInBuffer)
Sets the processing priority of a specific image. This can affect the order in which images are returned by getImage.
boolean setNextImageToReturn(int imageId, boolean keepInBuffer)
Parameters
[in] imageId
: The imageId of image you want to set as the “next image”.
[in] keepInBuffer
: Set this value to true so that the “next image” is protected from being pushed out before is it returned by method getImage.
Return Value
A boolean value that indicates whether the specified image is successfully set as the “next image”.
startFetching
Start fetching images from the source to the Video Buffer of ImageSourceAdapter
.
void startFetching();
stopFetching
Stop fetching images from the source to the Video Buffer of ImageSourceAdapter
.
void stopFetching();