Package com.digimarc.dms.readers
Class BaseReader
java.lang.Object
com.digimarc.dms.readers.BaseReader
- Direct Known Subclasses:
AudioReader
,BaseCaptureReader
,ImageReader
All reader objects derive from this base class. Readers are available for both image and audio,
and they can be separated into two main types: synchronous and asynchronous. The synchronous
readers (
ImageReader
and AudioReader
) provide a base level of reading functionality
but they are not intended for use with streaming or captured media. The asynchronous readers
(VideoCaptureReader
and AudioCaptureReader
) are intended for media capture
applications and provide a more advanced level of capabilities. The asynchronous readers are
designed to balance their performance levels (processor use, frequency of execution, etc.) to
provide the best reading experience for an application.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Audio symbologies are intended for use with the audio-based readers (AudioReader
andAudioCaptureReader
).static enum
ImageDetectionType is used by theImageReader
andVideoCaptureReader
to specify how intensively the reader examines each image.static enum
Image symbologies are intended for use with the image-based readers (ImageReader
andVideoCaptureReader
).static enum
Error codes that may be received by Readers.protected static enum
static enum
Used byResultListener
to signal what type of results a callback contains.static interface
All symbologies implement the Symbology interface.static enum
The undefined symbology is a default value only. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Prebuilt bitmask containing all the available audio readers.static final int
Prebuilt bitmask containing all the available 1D barcode readers.static final int
Prebuilt bitmask containing the normally used barcode readers (1D & QR).static final int
Prebuilt bitmask containing the normally used image readers.protected final ReentrantLock
protected boolean
protected ReaderOptions
protected int
-
Constructor Summary
ModifierConstructorDescriptionprotected
BaseReader
(int symbologyMask, ReaderOptions options) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic int
buildSymbologyMask
(BaseReader.Symbology... symbologies) Helper method to build a symbology bitmask of different reader types.void
This method clears the internalPayloadCache
.protected void
Allows an application to retrieve the reader dictionary that was passed in to the constructor.int
Get the bitmask of symbologies the reader is looking for.protected void
void
release()
This method should be called when the reader is no longer needed.protected void
void
setAllowPerformanceScheduling
(boolean allowScheduling) This method allows managed reader performance to be turned off.void
setReaderOptions
(ReaderOptions options) Allows the reader to be reconfigured with new reader options after creation.void
setSymbologies
(int symbologyMask) protected boolean
validateSymbologies
(int symbologyMask, BaseReader.ReaderType type) This method will ensure that the symbology mask value specified for a reader includes at least one valid symbology for this type of reader (image or audio).
-
Field Details
-
All_Barcode_1D_Readers
public static final int All_Barcode_1D_ReadersPrebuilt bitmask containing all the available 1D barcode readers.- See Also:
-
All_Barcode_Readers
public static final int All_Barcode_ReadersPrebuilt bitmask containing the normally used barcode readers (1D & QR). Note that PDF417 is not included in this bitmask.- See Also:
-
All_Image_Readers
public static final int All_Image_ReadersPrebuilt bitmask containing the normally used image readers. Note that PDF417 is not included in this bitmask.- See Also:
-
All_Audio_Readers
public static final int All_Audio_ReadersPrebuilt bitmask containing all the available audio readers.- See Also:
-
mOptions
-
mSymbologyMask
protected int mSymbologyMask -
mAllowScheduling
protected boolean mAllowScheduling -
mActionLock
-
-
Constructor Details
-
BaseReader
Constructor.- Parameters:
symbologyMask
- A bitmask value containing the symbologies that the reader should use.options
- An optional dictionary of flags and settings for the reader. The available entries are documented separately.- Throws:
ReaderException
- An exception will be thrown if an invalid symbology or options entry is specified for this reader.
-
-
Method Details
-
release
@CallSuper public void release()This method should be called when the reader is no longer needed. Failure to call this method may result in objects remaining in memory beyond their useful lifespan. -
setSymbologies
- Throws:
ReaderException
-
buildSymbologyMask
Helper method to build a symbology bitmask of different reader types.- Parameters:
symbologies
- A list of the symbologies to be added to the bitmask- Returns:
- A bitmask value containing the specified readers.
-
initialize
- Throws:
ReaderException
-
createDetectors
- Throws:
ReaderException
-
releaseDetectors
protected void releaseDetectors() -
getReaderOptions
Allows an application to retrieve the reader dictionary that was passed in to the constructor.- Returns:
- A ReaderOptions dictionary or null if none was specified in the constructor.
-
setReaderOptions
Allows the reader to be reconfigured with new reader options after creation. Passing in null will clear all existing reader options.- Parameters:
options
- ReaderOptions dictionary.- Throws:
ReaderException
-
getSymbologies
public int getSymbologies()Get the bitmask of symbologies the reader is looking for.- Returns:
- Bitmask of symbologies.
-
setAllowPerformanceScheduling
@CallSuper public void setAllowPerformanceScheduling(boolean allowScheduling) This method allows managed reader performance to be turned off. It is primarily useful for applications using asynchronous readers, although it can be used with synchronous readers.In normal operation the SDK will work to balance the performance of asynchronous readers. This is useful for maximizing throughput while also working to not overload the device. In practice this means that some image frames might be ignored by a reader. In some applications, though, this might not be desirable to disable this behavior. For instance, if your application is performing operations (resizing, scaling, etc.) on the image frames before they go into the reader you would want to be sure that every frame you modified was read, otherwise you might be wasting time processing a frame that is going to be dropped.
- Parameters:
allowScheduling
- Set whether performance scheduling may occur. If scheduling is not allowed then every frame passed into the reader will be processed.
-
clearCache
public void clearCache()This method clears the internalPayloadCache
. -
validateSymbologies
This method will ensure that the symbology mask value specified for a reader includes at least one valid symbology for this type of reader (image or audio).- Parameters:
symbologyMask
- Bitmask of symbology values as passed into the reader constructor.type
- Enum fromBaseReader.ReaderType
for what type of reader we are validating.- Returns:
- Returns true if the bitmask contains at least one valid symbology for the indicated reader type, false otherwise.
-