| CPC H04N 21/21805 (2013.01) [H04N 21/2187 (2013.01); H04N 23/60 (2023.01); H04N 23/90 (2023.01)] | 20 Claims |

|
1. A method for sharing a camera by a plurality of applications, the method comprising:
separately performing, by an electronic device, in response to an image obtaining request sent by a first application and an image obtaining request sent by a second application, wherein the image obtaining requests are used to request to obtain, from a first camera, image data that meets a requirement of a first image parameter set, the following operations:
creating a first image consumer instance corresponding to the first application and creating a second image consumer instance corresponding to the second application;
obtaining a corresponding first image provider instance based on the first camera and the first image parameter set that are requested by the image obtaining requests sent by the first application and the second application;
establishing an association between the first image consumer instance and the first image provider instance and an association between the second image consumer instance and the first image provider instance; and
in response to receiving the image data from the first camera:
processing, by the first image provider instance based on the first image parameter set, the received image data being collected by the first camera and sending processed image data to the first image consumer instance and the second image consumer instance that are associated with the first image provider instance;
sending, by the first image consumer instance, the received image data to the first application, and sending, by the second image consumer instance, the received image data to the second application; and
performing, in response to an image obtaining request sent by a third application, wherein the image obtaining request is used to request to obtain, from the first camera, image data that meets a requirement of a second image parameter set, the following operation:
creating a third image consumer instance corresponding to the third application;
obtaining a corresponding second image provider instance based on the first camera and the second image parameter set that are requested by the image obtaining request sent by the third application;
establishing an association between the third image consumer instance and the second image provider instance; and
performing, in response to receiving image data from the first camera, the following operation:
processing, by the second image provider instance based on the second image parameter set, the received image data being collected by the first camera and sending processed image data to the third image consumer instance associated with the second image provider instance; and
sending, by the third image consumer instance, the received image data to the third application.
|