Dev Center
Swift
Objective-C
Table of contents

Video Decoding Methods

Method Description
startFrameDecoding Starts a new thread to decode barcodes from the inner frame queue.
startFrameDecodingEx Starts a new thread to decode barcodes from the inner frame queue.
appendFrame Appends a frame image buffer to the inner frame queue.
stopFrameDecoding Stops the frame decoding thread created by StartFrameDecoding.
getFrameDecodingParameters Initialize frame decoding parameter.
setDBRErrorDelegate Set callback function to process errors generated during frame decoding.
setDBRTextResultDelegate Set callback function to process text results generated during frame decoding.
setDBRIntermediateResultDelegate Set callback function to process intermediate results generated during frame decoding.
getLengthOfFrameQueue Get length of current inner frame queue.

startFrameDecoding

Starts a new thread to decode barcodes from the inner frame queue.

-(void)startFrameDecoding:(NSInteger)maxQueueLength
    maxResultQueueLength:(NSInteger)maxResultQueueLength
    width:(NSInteger)width
    height:(NSInteger)height
    stride:(NSInteger)stride
    format:(EnumImagePixelFormat)format
    templateName:(NSString* _Nonnull)templateName
    error:(NSError* _Nullable * _Nullable)error;

Parameters

[in] maxQueueLength The max number of frames waiting for decoding.
[in] maxResultQueueLength The max number of frames whose results (text result/localization result) will be kept.
[in] width The width of the frame image in pixels.
[in] height The height of the frame image in pixels.
[in] stride The stride (or scan width) of the frame image.
[in] format The image pixel format used in the image byte array.
[in] templateName The template name.
[in,out] error Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Code Snippet

  • Objective-C
  • Swift
  1. NSError __autoreleasing * _Nullable error;
    [barcodeReader startFrameDecoding:2 maxResultQueueLength:10 width:1024 height:720 stride:720 format:EnumImagePixelFormatBinary templateName:@"" error:&error];
    
  2. let error: NSError? = NSError()
    barcodeReader.startFrameDecoding(maxQueueLength:2, maxResultQueueLength:10, width:1024, height:720, stride:720, format:EnumImagePixelFormat.Binary, templateName:"", error:&error)
    

startFrameDecodingEx

Start a new thread to decode barcodes from the inner frame queue with specific frame decoding setting defined in iFrameDecodingParameters struct.

-(void)startFrameDecodingEx:(iFrameDecodingParameters* _Nullable) parameters
                templateName:(NSString* _Nonnull)templateName
                    error:(NSError* _Nullable __autoreleasing* _Nullable)error;

Parameters

[in] parameters The frame decoding parameters.
[in] templateName The template name.
[in,out] error Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Code Snippet

  • Objective-C
  • Swift
  1. NSError __autoreleasing * _Nullable error;
    iFrameDecodingParameters *parameters = [barcodeReader getFrameDecodingParameters:nil];
    parameters.maxQueueLength = 2;
    parameters.maxResultQueueLength = 10;
    parameters.width = 1024;
    parameters.height = 720;
    parameters.stride = 720;
    parameters.imagePixelFormat = EnumImagePixelFormatBinary;
    [barcodeReader startFrameDecodingEx:parameters templateName:@"" error:&error];
    
  2. let error: NSError? = NSError()
    let parameters = barcodeReader.getFrameDecodingParameters
    parameters?.maxQueueLength = 2
    parameters?.maxResultQueueLength = 10
    parameters?.width = 1024
    parameters?.height = 720
    parameters?.stride = 720
    parameters?.imagePixelFormat = EnumImagePixelFormat.Binary
    barcodeReader.StartFrameDecodingEx(parameter: parameters!, templateName: "", error: &error)
    

appendFrame

Appends a frame image buffer to the inner frame queue.

-(NSInteger)appendFrame:(NSData* _Nullable) bufferBytes;

Parameters

[in] bufferBytes The array of bytes which contain the image data.

Return Value

Returns the ID of the appended frame.

Code Snippet

  • Objective-C
  • Swift
  1. NSError __autoreleasing * _Nullable error;
    [barcodeReader startFrameDecoding:2 maxResultQueueLength:10 width:1024 height:720 stride:720 format:EnumImagePixelFormatBinary templateName:@"" error:&error];
    NSInteger frameId = [barcodeReader appendFrame:bufferBytes];
    
  2. let error: NSError? = NSError()
    barcodeReader.startFrameDecoding(maxQueueLength:2, maxResultQueueLength:10, width:1024, height:720, stride:720, format:EnumImagePixelFormat.Binary, templateName:"", error:&error)
    let frameId = barcodeReader.appendFrame(bufferBytes:bufferBytes)
    

stopFrameDecoding

Stops the frame decoding thread created by startFrameDecoding or startFrameDecodingEx.

-(void)stopFrameDecoding:(NSError* _Nullable * _Nullable)error;

Parameters

[in,out] error Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Code Snippet

  • Objective-C
  • Swift
  1. NSError __autoreleasing * _Nullable error;
    [barcodeReader startFrameDecoding:2 maxResultQueueLength:10 width:1024 height:720 stride:720 format:EnumImagePixelFormatBinary templateName:@"" error:&error];
    [barcodeReader stopFrameDecoding:&error];
    
  2. let error: NSError? = NSError()
    barcodeReader.startFrameDecoding(maxQueueLength:2, maxResultQueueLength:10, width:1024, height:720, stride:720, format:EnumImagePixelFormat.Binary, templateName:"", error:nil)
    barcodeReader.stopFrameDecoding(error:&error)
    

getFrameDecodingParameters

Initialize frame decoding parameters with default values.

-(iFrameDecodingParameters*_Nullable)getFrameDecodingParameters:(NSError* _Nullable * _Nullable)error;

Parameters

[in,out] error Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Return Value

Returns frame decoding parameters.

Code Snippet

  • Objective-C
  • Swift
  1. iFrameDecodingParameters *parameters = [barcodeReader getFrameDecodingParameters:nil];
    
  2. let parameters = barcodeReader.getFrameDecodingParameters(error: nil)
    

setDBRErrorDelegate

Sets callback function to process errors generated during frame decoding.

-(void)setDBRErrorDelegate:(id _Nullable)errorDelegate userData:(NSObject* _Nullable)userData;

Parameters

[in] errorDelegate Callback function.
[in] userData Customized arguments passed to your function.

Code Snippet

  • Objective-C
  • Swift
  1. [barcodeReader setDBRErrorDelegate:self userData:nil];
    
  2. barcodeReader.setDBRErrorDelegate(errorDelegate:self, userData:nil)
    

setDBRTextResultDelegate

Set callback function to process text results generated during frame decoding.

-(void)setDBRTextResultDelegate:(id _Nullable)textResultDelegate userData:(NSObject* _Nullable)userData;

Parameters

[in] textResultDelegate Callback function.
[in] userDataCustomized arguments passed to your function.

Code Snippet

  • Objective-C
  • Swift
  1. [barcodeReader setDBRTextResultDelegate:self userData:nil];
    
  2. barcodeReader.setDBRTextResultDelegate(textResultDelegate:self, userData:nil)
    

setDBRIntermediateResultDelegate

Set callback function to process intermediate results generated during frame decoding.

-(void)setDBRIntermediateResultDelegate:(id _Nullable)intermediateResultDelegate userData:(NSObject* _Nullable)userData;

Parameters

[in] intermediateResultDelegate Callback function.
[in] userData Customized arguments passed to your function.

Code Snippet

  • Objective-C
  • Swift
  1. DynamsoftBarcodeReader *barcodeReader;
    [barcodeReader setDBRIntermediateResultDelegate:self userData:nil];
    
  2. barcodeReader.setDBRIntermediateResultDelegate(intermediateResultDelegate:self, userData:nil)
    

getLengthOfFrameQueue

Get length of current inner frame queue.

-(NSInteger)getLengthOfFrameQueue;

Return Value

Returns the length of the inner frame queue.

Code Snippet

  • Objective-C
  • Swift
  1. NSInteger length = [barcodeReader getLengthOfFrameQueue];
    
  2. let length = barcodeReader.getLengthOfFrameQueue()
    

This page is compatible for:

Is this page helpful?

YesYes NoNo

In this article:

version 8.8.0

  • Latest version
  • Version 10.x
    • Version 10.2.1100
    • Version 10.2.1101
    • Version 10.2.10
    • Version 10.0.21
    • Version 10.0.20
    • Version 10.2.10
    • Version 10.0.21
    • Version 10.0.20
  • Version 9.x
    • Version 9.6.40
    • Version 9.6.20
    • Version 9.6.11
    • Version 9.6.10
    • Version 9.6.0
    • Version 9.4.0
    • Version 9.2.11
    • Version 9.2.10
    • Version 9.0.2
    • Version 9.0.1
    • Version 9.0.0
    • Version 9.6.40
    • Version 9.6.20
    • Version 9.6.10
    • Version 9.6.0
    • Version 9.4.0
    • Version 9.2.13
    • Version 9.2.10
    • Version 9.0.2
    • Version 9.0.1
    • Version 9.0.0
  • Version 8.x
    • Version 8.9.3
    • Version 8.9.1
    • Version 8.9.0
    • Version 8.8.0
    • Version 8.6.0
    • Version 8.4.0
    • Version 8.2.1
    • Version 8.2.0
    • Version 8.1.2
    • Version 8.1.0
    • Version 8.0.0
    • Version 8.9.3
    • Version 8.9.1
    • Version 8.9.0
    • Version 8.8.0
    • Version 8.6.0
    • Version 8.4.0
    • Version 8.2.1
    • Version 8.2.0
    • Version 8.1.2
    • Version 8.1.0
    • Version 8.0.0
  • Version 7.x
    • Version 7.6.0
    • Version 7.5.0
    • Version 7.6.0
    • Version 7.5.0
  • Documentation Homepage
Change +