For the third party ZXINGOBJC on the internet, the self-perception is a package of the two-dimensional code part of the native avfoundation, roughly looking at the internal realization of ZXINGOBJC similar to the native realization, There are several classes in the Avfoundation framework: Avcapturesession,avcapturedevice,avcaptureinput, Avcaptureoutput. Just see these classes, as well as the properties and variables inside the class, do not know what it is, slowly have to understand:
The official website explains these categories:
- An instance of Avcapturedevice to represent the input device, such as a camera or microphone
- An instance of a concrete subclass of Avcaptureinput to configure the ports from the input device
- An instance of a concrete subclass of Avcaptureoutput to manage the output to a movie file or still image
- An instance of avcapturesession to coordinate the data flow from the input to the output
From the official website you can learn:
1. Avcapturedevice is the device for inputting data, such as camera, microphone, etc.
2. Avcaptureinput (the abstract class will have several sub-classes such as Avdevicecaptureinput) to configure the port of the input device (this port is represented by Avcaptureinputport, which represents the type of data stream entered from the input device, There are several types of data streams:
NSString *const avmediatypevideo;
NSString *const avmediatypeaudio;
NSString *const avmediatypetext;
NSString *const avmediatypeclosedcaption;
NSString *const avmediatypesubtitle;
NSString *const avmediatypetimecode;
NSString *const avmediatypetimedmetadata;
NSString *const avmediatypemetadata;
NSString *const avmediatypemuxed;
For example, Avdevicecaptureinput has a port that is used to denote "video traffic: Avmediatypevideo");
3.AVCaptureOutput indicates that the capture data output management is used to indicate the data type of data output as a video file or a picture;
The 4.AVCaptureSession is used to reconcile the input data stream until the output data is processed.
An image from the official website below shows the relationship between these classes
Adding Avcaptureinput and Avcaptureoutput to the session creates a avcaptureconnection that is used to establish a connection between the input and the output
Here are a few properties about Avcapturedevice
Focus Mode: Focusing modes
- avcapturefocusmodelocked : Fixed focus position.
- Avcapturefocusmodeautofocus : Auto Focus once returns to the focus lock to the focus you focus on.
- Avcapturefocusmodecontinuousautofocus : Keeps auto-focusing when needed.
Exposure Mode: Exposure modes
- avcaptureexposuremodecontinuousautoexposure : Automatically adjusts the exposure as needed.
- avcaptureexposuremodelocked : Fixed exposure.
Flash Mode: Flash modes
- Avcaptureflashmodeoff : Always turn off the flash
- Avcaptureflashmodeon : Always turn on the flash
- Avcaptureflashmodeauto : Determines whether the flash is turned on depending on the light condition.
Torch Mode: Flashlight modes
- Avcapturetorchmodeoff : Always turn off the flashlight
- Avcapturetorchmodeon : Always turn on the flashlight
- Avcapturetorchmodeauto : Automatically determines whether the flashlight is turned on as needed
White Balance: Balance mode
- avcapturewhitebalancemodelocked : Fixed white balance value
- avcapturewhitebalancemodecontinuousautowhitebalance : The camera automatically adjusts the white balance value on Demand
Avcapturedeviceposition: Device Location
Avcapturedevicepositionunspecified = 0, no position specified
avcapturedevicepositionback = 1, rear-facing camera
Avcapturedevicepositionfront = 2 front-facing camera
QR code scan in IOS (ZXINGOBJC and native)