WO2023124007A1 - Linux-based camera control method and apparatus, and device and storage medium - Google Patents

Linux-based camera control method and apparatus, and device and storage medium Download PDF

Info

Publication number
WO2023124007A1
WO2023124007A1 PCT/CN2022/105146 CN2022105146W WO2023124007A1 WO 2023124007 A1 WO2023124007 A1 WO 2023124007A1 CN 2022105146 W CN2022105146 W CN 2022105146W WO 2023124007 A1 WO2023124007 A1 WO 2023124007A1
Authority
WO
WIPO (PCT)
Prior art keywords
camera
source plug
linux
camera control
control instruction
Prior art date
Application number
PCT/CN2022/105146
Other languages
French (fr)
Chinese (zh)
Inventor
张兴涛
Original Assignee
北京字节跳动网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京字节跳动网络技术有限公司 filed Critical 北京字节跳动网络技术有限公司
Publication of WO2023124007A1 publication Critical patent/WO2023124007A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons

Definitions

  • the present disclosure relates to the field of computer technology, for example, to a Linux-based camera control method, device, device, and storage medium.
  • the Linux system is a set of Unix-like operating systems that are free to use and spread freely.
  • the system has been widely used.
  • the Android system is currently the operating system with the highest proportion in the mobile terminal market, and has an excellent ecological environment in the field of mobile terminals.
  • the present disclosure provides a Linux-based camera control method, device, device, and storage medium to avoid the situation that the application program on the Linux side cannot use the camera device when there is only an Android camera driver in the related art, and to realize the Linux-side camera control method.
  • the application is able to use the camera device.
  • the present disclosure provides a Linux-based camera control method applied to a Linux system, the method comprising:
  • the camera is controlled to execute the operation corresponding to the camera control instruction, and the execution result of the camera is returned to the application program through the camera source plug-in.
  • the present disclosure also provides a Linux-based camera control device, including:
  • the receiving module is configured to receive the camera control instruction sent by the application program in the Linux system through the multimedia service;
  • the control module is configured to control the camera to execute the operation corresponding to the camera control instruction based on the camera source plug-in, and return the execution result of the camera to the application program through the camera source plug-in.
  • the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and operable on the processor.
  • the processor executes the program, it implements any one of the above-mentioned Linux-based Steps of a camera control method.
  • the present disclosure also provides a non-transitory computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the Linux-based camera control methods described above are implemented.
  • FIG. 1 is one of the flow diagrams of a Linux-based camera control method provided by the present disclosure
  • FIG. 2 is one of the architecture schematic diagrams of the Linux-based camera control method provided by the present disclosure
  • FIG. 3 is the second schematic flow diagram of the Linux-based camera control method provided by the present disclosure.
  • FIG. 4 is the second schematic diagram of the architecture of the Linux-based camera control method provided by the present disclosure.
  • FIG. 5 is a structural diagram of a Linux-based camera control device provided by the present disclosure.
  • FIG. 6 is a schematic structural diagram of an electronic device provided by the present disclosure.
  • the Linux system is installed in the terminal device, that is, the operating system of the terminal device is an operating system based on the Linux kernel.
  • any application program (APP) is installed in the terminal device, and the application program needs to use a camera, which can only be controlled through the Android camera driver.
  • the terminal device may be a mobile phone, a tablet computer, a notebook computer, a desktop computer, a server, an embedded system, etc., which are not specifically limited here.
  • FIG. 1 is one of the flow diagrams of the Linux-based camera control method provided by the present disclosure. As shown in FIG. 1 , the Linux-based camera control method provided by the present disclosure includes the following steps 110-120:
  • Step 110 through the multimedia service, receive the camera control instruction sent by the application program in the Linux system.
  • the multimedia service is a multimedia framework in the Linux system, which is used for the operation of the application programs in the Linux system, that is, it is a multimedia service process of the Linux system.
  • the multimedia service is located in the user space of the Linux system.
  • the multimedia service is an extensible multimedia framework, which supports plugin (plug-in) extension.
  • the multimedia service is the GStreamer multimedia framework.
  • the GStreamer multimedia framework supports plug-in extensions, for example, a GStreamer source plugin (camera source plugin) can be implemented.
  • the multimedia service is the QtMulimedia multimedia framework.
  • the QtMultimedia multimedia framework supports plug-in extensions, for example, a QtMultimedia Camera Backend plug-in (camera source plug-in) can be implemented.
  • the Linux-based camera control method before the above step 110, also includes:
  • the camera control instructions include but not limited to: instructions for turning on the camera, instructions for turning off the camera, instructions for previewing the camera, instructions for shooting the camera, instructions for recording the camera, and instructions for setting camera parameters.
  • Step 120 based on the camera source plug-in, control the camera to execute the operation corresponding to the camera control instruction, and return the execution result of the camera to the application program through the camera source plug-in.
  • the camera source plug-in is loaded through the multimedia service.
  • the camera source plug-in is a plug-in obtained by extending the multimedia service.
  • the camera source plugin resides in userspace on Linux.
  • the camera source plug-in is set to create a communication pipe so that applications in the Linux system can access the camera device through the multimedia service.
  • the communication channel may be a pipeline.
  • the execution result includes a control result and a data transmission result
  • the data transmission result includes but not limited to: image data, video data and camera configuration parameters.
  • the execution results include, but are not limited to: the execution results of the camera opening instruction, the camera closing instruction execution result, the camera preview instruction execution result, the camera shooting instruction execution result, the camera video recording instruction execution result and the camera parameter setting instruction execution result Results and so on.
  • the execution result of the command to turn on the camera includes an indication of successful opening of the camera or an indication of failure to turn on the camera.
  • the execution result of the instruction to close the camera includes an indication of successful closing of the camera or an indication of failure of closing the camera.
  • the execution result of the camera preview instruction includes the image data captured by the camera in real time and the camera preview success flag or the camera preview failure flag.
  • the execution result of the camera shooting instruction includes the image data obtained by the camera shooting and the camera shooting success flag or the camera shooting failure flag.
  • the execution result of the camera video recording command includes the video data obtained by the camera video recording and the camera video recording success flag or the camera video recording failure flag.
  • the execution result of the camera parameter setting instruction includes an indication that the camera parameter setting is successful or an indication that the camera parameter setting is failed.
  • the camera control instruction is an instruction to turn on the camera
  • the camera is controlled to turn on, and the execution result of whether the camera is turned on successfully is returned to the application program through the camera source plug-in.
  • the camera control instruction is an instruction to turn on the camera
  • the camera is controlled to turn on, and the flag of successful opening of the camera or the flag of failure of the camera to be turned on is returned to the application through the camera source plug-in.
  • the camera control command is a camera close command
  • the camera is controlled to close, and the execution result of whether the camera closes successfully is returned to the application program through the camera source plug-in.
  • the camera control command is a camera close command
  • the camera is controlled to close, and the camera close success mark or camera close failure mark is returned to the application through the camera source plug-in.
  • the camera control command is a camera preview command
  • the camera is controlled to perform a preview operation, and the image data captured by the camera in real time and the success of the camera preview are returned to the application through the camera source plug-in, or the camera preview fails
  • the identity is returned to the application through the camera feed plugin.
  • the camera control command is a camera preview command
  • the camera preview command is a camera start preview command
  • control the camera to perform a preview operation return the image data captured by the camera in real time to the application program through the camera source plug-in, and mark the success of the camera preview Return to the application program through the camera source plug-in, or return the camera preview failure flag (camera start preview failure flag) to the application program through the camera source plug-in
  • the camera control command is a camera preview command
  • the camera preview command is a camera stop preview command
  • control the camera to stop the preview operation that is, stop the transmission of real-time data, and at the same time, return the camera preview success mark (camera stop preview success mark) to the application through the camera source plug-in, or mark the camera preview failure (camera stop preview failure mark) Return to the application through the camera feed plugin.
  • the camera control instruction is a camera shooting instruction
  • the camera is controlled to perform a shooting operation, and the image data captured by the camera is returned to the application program through the camera source plug-in and the camera shooting success is marked, or the camera shooting failure is marked Return to the application through the camera feed plugin.
  • the camera control command is a camera shooting command
  • control the camera to perform shooting operations return the image data captured by the camera to the application program through the camera source plug-in, and return the camera shooting success flag to the application program through the camera source plug-in, or, Return the camera capture failure flag to the application through the camera source plug-in.
  • the camera control command is a camera video recording command
  • the camera is controlled to perform a video recording operation, and the video data obtained by the camera video recording and the successful camera video recording are returned to the application program through the camera source plug-in, or the camera video recording failure is marked Return to the application through the camera feed plugin.
  • the camera control command is a camera recording command
  • the camera recording command is a camera start recording command
  • the camera is controlled to perform a recording operation
  • the video data stream is returned to the application through the camera source plug-in, or the camera recording failure flag is passed through the camera source
  • the plug-in returns to the application program; if the camera control command is a camera recording command, and the camera recording command is a camera stop recording command, control the camera to stop recording, that is, stop transmitting the recording data stream, and at the same time, return the successful identification of the camera recording to the application through the camera source plug-in
  • the program or, return the camera recording failure flag to the application program through the camera source plug-in.
  • the camera control instruction is a camera parameter setting instruction
  • the camera is controlled to configure the camera parameters indicated by the camera parameter setting instruction, and the execution result of whether the parameter configuration is successful is returned to the application program through the camera source plug-in.
  • the camera control instruction is a camera parameter setting instruction
  • the camera is controlled to configure the camera parameters indicated by the camera parameter setting instruction, and the camera parameter setting success flag or the camera parameter setting failure flag is returned to the application through the camera source plug-in.
  • the returning the execution result of the camera to the application through the camera source plug-in includes:
  • the application program uses the camera in the Linux system
  • the application program uses the camera in the Linux system
  • the application program generates a camera control command, and then receives the camera control command sent by the application program through the multimedia service, and then forwards the camera control command from the multimedia service to the Camera Client through the camera source plug-in Library, to control the camera to execute the operation corresponding to the camera control command through the interface of the Camera Client library and the Android camera service, and then return the execution result of the camera to the camera driver and the Android camera service; through the Camera Client library to connect with the Android camera service
  • the interface forwards the execution result from the Android camera service to the Camera Client library; through the camera source plug-in, the execution result is returned from the Camera Client library to the multimedia service, and the execution result is returned from the multimedia service to the application.
  • Fig. 2 the embodiment of the present disclosure is divided into layers, application program, multimedia service, camera source plug-in, Camera Client storehouse, Android container belong to the user space layer, camera driver (Camera Driver) belongs to the kernel layer, The camera belongs to the hardware layer.
  • the method is applied to the Linux system, and receives the camera control command sent by the application program in the Linux system through the multimedia service; based on the camera source plug-in, the camera is controlled to perform the operation corresponding to the camera control command , and return the execution result of the camera to the application through the camera source plug-in.
  • the embodiment of the present disclosure receives the camera control command sent by the application program through the multimedia service, and uses the camera based on the camera source plug-in, so that the application program can use the camera, so that when only the Android camera driver exists, the application program Programs can use the camera to enable applications on the Linux side to use the camera device.
  • step 120 based on the camera source plug-in, the camera is controlled to perform the operation corresponding to the camera control instruction, including the following steps 121-122:
  • Step 121 forward the camera control command from the multimedia service to the Camera Client library based on the camera source plug-in.
  • Step 122 through the Camera Client library, control the camera to execute the operation corresponding to the camera control instruction.
  • the camera source plug-in is loaded and called through the multimedia service.
  • the camera source plug-in is a plug-in obtained by extending the multimedia service.
  • the camera source plugin resides in userspace on Linux.
  • the camera source plugin is set up to create a communication pipe so that applications in the Linux system can access the camera device through multimedia services.
  • the communication channel may be a pipeline.
  • the command to turn on the camera is forwarded from the multimedia service to the Camera Client library, so that the Camera Client library controls the camera to perform the operation corresponding to the command to turn on the camera.
  • the camera close command is forwarded from the multimedia service to the Camera Client library, so that the Camera Client library controls the camera to perform the operation corresponding to the camera close command.
  • the camera control instruction is a camera preview instruction
  • the camera preview instruction is forwarded from the multimedia service to the Camera Client library, so that the Camera Client library controls the camera to perform the operation corresponding to the camera preview instruction.
  • the camera control instruction is a camera shooting instruction
  • the camera shooting instruction is forwarded from the multimedia service to the Camera Client library, so that the Camera Client library controls the camera to perform the operation corresponding to the camera shooting instruction.
  • the camera control command is a camera recording command
  • the camera recording command is forwarded from the multimedia service to the Camera Client library, so that the Camera Client library controls the camera to perform the operation corresponding to the camera recording command.
  • the camera control instruction is a camera parameter setting instruction
  • the camera parameter setting instruction is forwarded from the multimedia service to the Camera Client library, so that the Camera Client library controls the camera to perform the operation corresponding to the camera parameter setting instruction.
  • the Linux system includes a user space layer; the user space layer includes the application program, the multimedia service, the camera source plug-in, and the Camera Client library.
  • the above step 121 includes:
  • Step 1211 based on the camera source plug-in, determine the communication channel corresponding to the camera control command.
  • Step 1213 forward the camera control instruction from the multimedia service to the Camera Client library through the communication channel, and call the interface corresponding to the camera control instruction in the Camera Client library.
  • the communication channel is created by the camera source plug-in, and the communication channel is used to enable the application program of the Linux system to access the camera device through the multimedia service.
  • the communication channel may be a pipeline. For example, use GStreamer's v4l2src camera source plugin to create a pipeline to access camera hardware devices.
  • the Camera Client library includes interfaces corresponding to multiple camera control commands, including various camera operation application programming interfaces (Application Programming Interface, API), for example, including preview API, shooting API, video recording API, parameter setting API, etc. .
  • API Application Programming Interface
  • the Camera Client library communicates with the Android camera service through an inter-process communication channel.
  • the inter-process communication channel can realize data transmission and information transmission between processes.
  • the inter-process communication channel realizes the transmission of control instructions and processing data between the Camera Client library and the Android camera service, that is, it is used to complete the interface (API) docking between the Camera Client library and the Android camera service.
  • the processed data includes, but is not limited to: image data, video data, camera configuration parameters, and the like.
  • Inter-Process Communication provides a variety of inter-process communication methods, such as binder, socket (socket), shared memory (shared memory), etc.
  • the Camera Client library communicates with the Android camera service through an IPC channel.
  • the Camera Client library communicates with the Android camera service through a binder.
  • the Camera Client library communicates with the Android camera service through libgbinder, which is a linux implementation of binder.
  • the Camera Client library communicates with the Android camera service through sockets.
  • the Camera Client library communicates with the Android camera service through shared memory.
  • the communication between the Camera Client library and the Android camera service is realized by using the inter-process communication channel, so that the interface corresponding to the camera control command in the Camera Client library can be connected with the interface corresponding to the camera control command in the Android camera service, so that Enables data communication between Linux and Android so that applications can use the camera when only the Android camera driver exists.
  • the above-mentioned step 122 includes:
  • Step 1221 connect the interface corresponding to the camera control command in the Camera Client library with the interface corresponding to the camera control command in the Android camera service.
  • Step 1222 Control the camera to execute the operation corresponding to the camera control instruction based on the docking interface.
  • the preview interface corresponding to the camera preview command in the Camera Client library is connected with the preview interface corresponding to the camera preview command in the Android camera service.
  • the shooting interface corresponding to the camera shooting command in the Camera Client library is connected with the shooting interface corresponding to the camera shooting command in the Android camera service.
  • the video recording interface corresponding to the camera video recording command in the Camera Client library is connected with the video recording interface corresponding to the camera video recording command in the Android camera service.
  • the parameter setting interface corresponding to the camera parameter setting instruction in the Camera Client library is connected with the parameter setting interface corresponding to the camera parameter setting instruction in the Android camera service.
  • the embodiment of the present disclosure is divided into layers in Figure 4, and application programs, multimedia services, camera source plug-ins, Camera Client libraries, and Android containers belong to the user space layer , the camera driver (Camera Driver) belongs to the kernel layer, and the camera belongs to the hardware layer.
  • application programs, multimedia services, camera source plug-ins, Camera Client libraries, and Android containers belong to the user space layer
  • the camera driver belongs to the kernel layer
  • the camera belongs to the hardware layer.
  • the application can generate camera preview instructions, camera shooting instructions, camera recording instructions and camera parameter setting instructions; correspondingly, the multimedia service can receive camera preview instructions, camera shooting instructions, camera recording instructions and camera parameter setting instructions; correspondingly, the communication pipeline in the camera source plug-in includes preview pipeline, shooting pipeline, video pipeline and parameter setting API; correspondingly, the Camera Client library includes preview API, shooting API, video recording API and parameter setting API; correspondingly, the Android container in the Android Camera services include preview API, shooting API, video recording API and parameter setting API.
  • the method is applied to the Linux system, and based on the camera source plug-in, the camera control command is forwarded from the multimedia service to the Camera Client library; through the Camera Client library, the camera is controlled to execute the corresponding camera control command. operation.
  • the camera control command is forwarded through the camera source plug-in to use the camera through the Camera Client library, so that the application can use the camera through the Android camera service, so that the application can use the camera only if there is an Android camera driver.
  • Use Camera to enable applications on the Linux side to use the camera device.
  • the method further includes:
  • Step 130 load the camera source plug-in through the multimedia service.
  • the camera source plug-in is loaded to call the Camera Client library based on the camera source plug-in.
  • the camera source plug-in is a plug-in obtained by extending the multimedia service.
  • the camera source plugin resides in userspace on Linux.
  • the camera source plugin is set up to create a communication pipe so that applications on the Linux system can access the camera device through multimedia services.
  • the communication channel is a pipeline.
  • the method is applied to a Linux system, and the camera source plug-in is loaded through the multimedia service to call the Camera Client library based on the camera source plug-in, thereby controlling the camera to perform camera control through the Camera Client library
  • the operation corresponding to the instruction so that the application can use the camera through the Android camera service, so that the application can use the camera when only the Android camera driver exists, so that the application on the Linux side can use the camera device.
  • the method further includes:
  • Step 140 start the Android container after the Linux system is started.
  • Step 150 start the Android camera service in the Android container to initialize the camera.
  • the Android camera service is a service for initializing camera hardware.
  • the Android container is started by the Ixc container technology; the Android camera service is started in the Android container to initialize the camera hardware.
  • the method is applied to a Linux system, and the camera is initialized by starting an Android container and its Android camera service, thereby providing support for subsequent use of the camera.
  • the Linux-based camera control device includes:
  • the receiving module 510 is configured to receive the camera control instruction sent by the application program in the Linux system through the multimedia service;
  • the control module 510 is configured to control the camera to execute the operation corresponding to the camera control instruction based on the camera source plug-in, and return the execution result of the camera to the application program through the camera source plug-in.
  • the camera control command sent by the application program in the Linux system is received through the multimedia service; based on the camera source plug-in, the camera is controlled to perform the operation corresponding to the camera control command, and the execution result of the camera is Return to the application through the camera feed plugin.
  • the embodiment of the present disclosure receives the camera control command sent by the application program through the multimedia service, and uses the camera based on the camera source plug-in, so that the application program can use the camera, so that when only the Android camera driver exists, the application program Programs can use the camera to enable applications on the Linux side to use the camera device.
  • control module 510 is also configured to forward the camera control instruction from the multimedia service to the Camera Client library based on the camera source plug-in; through the Camera Client library, the camera is controlled to perform the operation corresponding to the camera control instruction .
  • control module 510 is further configured to determine the communication channel corresponding to the camera control instruction based on the camera source plug-in; forward the camera control instruction from the multimedia service to the Camera Client library through the communication channel, and Call the interface corresponding to the camera control command in the Camera Client library.
  • the Camera Client library communicates with the Android camera service through an interprocess communication channel.
  • control module 510 is also configured to connect the interface corresponding to the camera control command in the Camera Client library with the interface corresponding to the camera control command in the Android camera service; based on the docked interface, control The camera executes the operation corresponding to the camera control instruction.
  • the Linux-based camera control device also includes:
  • the plug-in loading module is configured to load the camera source plug-in through the multimedia service.
  • the Linux-based camera control device also includes:
  • the container startup module is configured to start the Android container after the Linux system starts;
  • the service startup module is configured to start the Android camera service in the Android container, so as to initialize the camera.
  • FIG. 6 illustrates a schematic diagram of the physical structure of an electronic device.
  • the electronic device may include: a processor (processor) 610, a communication interface (Communications Interface) 620, a memory (memory) 630 and a communication bus 640, Wherein, the processor 610 , the communication interface 620 , and the memory 630 communicate with each other through the communication bus 640 .
  • processor processor
  • Communication interface Communication interface
  • memory memory
  • FIG. 6 illustrates a schematic diagram of the physical structure of an electronic device.
  • the electronic device may include: a processor (processor) 610, a communication interface (Communications Interface) 620, a memory (memory) 630 and a communication bus 640, Wherein, the processor 610 , the communication interface 620 , and the memory 630 communicate with each other through the communication bus 640 .
  • memory memory
  • the processor 610 can call the logic instructions in the memory 630 to execute the camera control method based on Linux, the method includes: receiving the camera control instruction sent by the application program in the Linux system through the multimedia service; controlling the camera based on the camera source plug-in Execute the operation corresponding to the camera control instruction, and return the execution result of the camera to the application program through the camera source plug-in.
  • the logic instructions in the above-mentioned memory 630 may be implemented in the form of software functional units and when sold or used as an independent product, may be stored in a computer-readable storage medium.
  • the computer software product is stored in a storage medium, including several
  • the instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in multiple embodiments of the present disclosure.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disc and other media that can store program codes. .
  • the present disclosure also provides a computer program product
  • the computer program product includes a computer program
  • the computer program can be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can Executing the Linux-based camera control method provided by the above multiple methods, the method includes: receiving the camera control command sent by the application program in the Linux system through multimedia services; based on the camera source plug-in, controlling the camera to execute the camera control command corresponding operation, and return the execution result of the camera to the application program through the camera source plug-in.
  • the present disclosure also provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it is implemented to perform the Linux-based camera control method provided by the above-mentioned various methods,
  • the method includes: receiving a camera control instruction sent by an application program in the Linux system through a multimedia service; controlling the camera to perform operations corresponding to the camera control instruction based on a camera source plug-in, and passing the execution result of the camera through the The camera feed plugin returns to the application.
  • the device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. It can be understood and implemented by those skilled in the art without any creative effort.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)
  • Studio Devices (AREA)

Abstract

Provided in the present disclosure are a Linux-based camera control method and apparatus, and a device and a storage medium. The method comprises: receiving, by means of a multimedia service, a camera control instruction, which is sent by an application program in a Linux system; and controlling, on the basis of a camera source plug-in, a camera to execute an operation corresponding to the camera control instruction, and returning an execution result of the camera to the application program by means of the camera source plug-in.

Description

基于Linux的相机控制方法、装置、设备和存储介质Camera control method, device, equipment and storage medium based on Linux
本申请要求在2021年12月29日提交中国专利局、申请号为202111628449.9的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。This application claims priority to a Chinese patent application with application number 202111628449.9 filed with the China Patent Office on December 29, 2021, the entire contents of which are incorporated herein by reference.
技术领域technical field
本公开涉及计算机技术领域,例如涉及一种基于Linux的相机控制方法、装置、设备和存储介质。The present disclosure relates to the field of computer technology, for example, to a Linux-based camera control method, device, device, and storage medium.
背景技术Background technique
Linux系统是一套免费使用和自由传播的类Unix操作系统,其具备多用户、多任务、多线程、多中央处理器(Central Processing Unit/Processor,CPU)和高安全性的特点,因此,Linux系统受到了广泛应用。另外,Android系统是目前移动终端市场中占比最高的操作系统,在移动终端领域具有极好的生态环境。The Linux system is a set of Unix-like operating systems that are free to use and spread freely. The system has been widely used. In addition, the Android system is currently the operating system with the highest proportion in the mobile terminal market, and has an excellent ecological environment in the field of mobile terminals.
目前,在基于Linux内核的操作系统上,大多相机设备是通过v4l2驱动的。然而,在相机设备厂商不提供v4l2驱动,仅提供Android相机驱动的情况下,Linux侧的应用程序无法直接使用相机设备。因此,在只存在Android相机驱动的情况下,Linux侧的应用程序如何使用相机设备,是目前业界亟需解决的重要课题。Currently, on Linux-based operating systems, most camera devices are driven by v4l2. However, in the case that the camera device manufacturer does not provide the v4l2 driver but only provides the Android camera driver, the application program on the Linux side cannot directly use the camera device. Therefore, in the case that only the Android camera driver exists, how to use the camera device on the Linux side is an important issue that the industry needs to solve urgently.
发明内容Contents of the invention
本公开提供一种基于Linux的相机控制方法、装置、设备和存储介质,用以避免相关技术中在只存在Android相机驱动的情况下,Linux侧的应用程序无法使用相机设备的情况,实现Linux侧的应用程序能够使用相机设备。The present disclosure provides a Linux-based camera control method, device, device, and storage medium to avoid the situation that the application program on the Linux side cannot use the camera device when there is only an Android camera driver in the related art, and to realize the Linux-side camera control method. The application is able to use the camera device.
本公开提供一种基于Linux的相机控制方法,应用于Linux系统,所述方法包括:The present disclosure provides a Linux-based camera control method applied to a Linux system, the method comprising:
通过多媒体服务,接收所述Linux系统中应用程序发送的相机控制指令;Receive a camera control instruction sent by an application program in the Linux system through a multimedia service;
基于相机源插件,控制相机执行所述相机控制指令对应的操作,并将所述相机的执行结果通过所述相机源插件返回至所述应用程序。Based on the camera source plug-in, the camera is controlled to execute the operation corresponding to the camera control instruction, and the execution result of the camera is returned to the application program through the camera source plug-in.
本公开还提供一种基于Linux的相机控制装置,包括:The present disclosure also provides a Linux-based camera control device, including:
接收模块,设置为通过多媒体服务,接收所述Linux系统中应用程序发送的相机控制指令;The receiving module is configured to receive the camera control instruction sent by the application program in the Linux system through the multimedia service;
控制模块,设置为基于相机源插件,控制相机执行所述相机控制指令对应的操作,并将所述相机的执行结果通过所述相机源插件返回至所述应用程序。The control module is configured to control the camera to execute the operation corresponding to the camera control instruction based on the camera source plug-in, and return the execution result of the camera to the application program through the camera source plug-in.
本公开还提供一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现如上述任一种所述基于Linux的相机控制方法的步骤。The present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and operable on the processor. When the processor executes the program, it implements any one of the above-mentioned Linux-based Steps of a camera control method.
本公开还提供一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如上述任一种所述基于Linux的相机控制方法的步骤。The present disclosure also provides a non-transitory computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the Linux-based camera control methods described above are implemented.
附图说明Description of drawings
图1为本公开提供的基于Linux的相机控制方法的流程示意图之一;FIG. 1 is one of the flow diagrams of a Linux-based camera control method provided by the present disclosure;
图2为本公开提供的基于Linux的相机控制方法的架构示意图之一;FIG. 2 is one of the architecture schematic diagrams of the Linux-based camera control method provided by the present disclosure;
图3为本公开提供的基于Linux的相机控制方法的流程示意图之二;FIG. 3 is the second schematic flow diagram of the Linux-based camera control method provided by the present disclosure;
图4为本公开提供的基于Linux的相机控制方法的架构示意图之二;FIG. 4 is the second schematic diagram of the architecture of the Linux-based camera control method provided by the present disclosure;
图5为本公开提供的基于Linux的相机控制装置的结构意图;FIG. 5 is a structural diagram of a Linux-based camera control device provided by the present disclosure;
图6为本公开提供的电子设备的结构示意图。FIG. 6 is a schematic structural diagram of an electronic device provided by the present disclosure.
具体实施方式Detailed ways
相关技术中,在基于Linux内核的操作系统上,大多相机设备是通过v4l2驱动的,然而,在相机设备厂商不提供v4l2驱动,仅提供Android相机驱动的情况下,Linux侧的应用程序无法直接驱动相机设备。In related technologies, on the operating system based on the Linux kernel, most camera devices are driven by v4l2. However, when the camera device manufacturer does not provide the v4l2 driver and only provides the Android camera driver, the application program on the Linux side cannot directly drive camera equipment.
本申请提出以下实施例。为便于理解以下实施例,下面对本公开的应用场景做举例说明。This application presents the following examples. In order to facilitate understanding of the following embodiments, the application scenarios of the present disclosure are described below with examples.
例如,在终端设备中安装Linux系统,即终端设备的操作系统为基于Linux内核的操作系统。同时,该终端设备中安装了任一应用程序(APP),该应用程序需要使用相机,该相机只能通过Android相机驱动进行控制。其中,该终端设备可以为手机、平板电脑、笔记本电脑、台式电脑、服务器、嵌入式系统等等,此处不作具体限定。For example, the Linux system is installed in the terminal device, that is, the operating system of the terminal device is an operating system based on the Linux kernel. At the same time, any application program (APP) is installed in the terminal device, and the application program needs to use a camera, which can only be controlled through the Android camera driver. Wherein, the terminal device may be a mobile phone, a tablet computer, a notebook computer, a desktop computer, a server, an embedded system, etc., which are not specifically limited here.
本公开提供了一种应用于Linux系统的基于Linux的相机控制方法。图1为本公开提供的基于Linux的相机控制方法的流程示意图之一,如图1所示,本公开提供的基于Linux的相机控制方法,包括以下步骤110-120:The present disclosure provides a Linux-based camera control method applied to a Linux system. FIG. 1 is one of the flow diagrams of the Linux-based camera control method provided by the present disclosure. As shown in FIG. 1 , the Linux-based camera control method provided by the present disclosure includes the following steps 110-120:
步骤110,通过多媒体服务,接收所述Linux系统中应用程序发送的相机控制指令。 Step 110, through the multimedia service, receive the camera control instruction sent by the application program in the Linux system.
其中,多媒体服务是Linux系统中的一个多媒体框架,其用于供Linux系统中应用程序进行操作,即其为Linux系统的多媒体服务进程。此外,该多媒体服务位于Linux系统的用户空间中。Wherein, the multimedia service is a multimedia framework in the Linux system, which is used for the operation of the application programs in the Linux system, that is, it is a multimedia service process of the Linux system. In addition, the multimedia service is located in the user space of the Linux system.
此处,多媒体服务为可扩展的多媒体框架,其支持plugin(插件)扩展。Here, the multimedia service is an extensible multimedia framework, which supports plugin (plug-in) extension.
在一实施例中,多媒体服务为GStreamer多媒体框架。该GStreamer多媒体框架支持插件扩展,例如,可以实现一个GStreamer source plugin(相机源插件)。In one embodiment, the multimedia service is the GStreamer multimedia framework. The GStreamer multimedia framework supports plug-in extensions, for example, a GStreamer source plugin (camera source plugin) can be implemented.
在另一实施例中,多媒体服务为QtMulimedia多媒体框架。该QtMulimedia多媒体框架支持插件扩展,例如,可以实现一个QtMultimedia Camera Backend插件(相机源插件)。In another embodiment, the multimedia service is the QtMulimedia multimedia framework. The QtMultimedia multimedia framework supports plug-in extensions, for example, a QtMultimedia Camera Backend plug-in (camera source plug-in) can be implemented.
在一实施例中,在上述步骤110之前,所述基于Linux的相机控制方法还包括:In one embodiment, before the above step 110, the Linux-based camera control method also includes:
在所述Linux系统启动后,启动所述多媒体服务。After the Linux system is started, start the multimedia service.
其中,相机控制指令包括但不限于:开启相机指令、关闭相机指令、相机预览指令、相机拍摄指令、相机录像指令和相机参数设置指令等等。Wherein, the camera control instructions include but not limited to: instructions for turning on the camera, instructions for turning off the camera, instructions for previewing the camera, instructions for shooting the camera, instructions for recording the camera, and instructions for setting camera parameters.
步骤120,基于相机源插件,控制相机执行所述相机控制指令对应的操作,并将所述相机的执行结果通过所述相机源插件返回至所述应用程序。 Step 120, based on the camera source plug-in, control the camera to execute the operation corresponding to the camera control instruction, and return the execution result of the camera to the application program through the camera source plug-in.
其中,相机源插件是通过多媒体服务加载得到的。该相机源插件为多媒体服务扩展得到的插件。该相机源插件位于Linux的用户空间。Wherein, the camera source plug-in is loaded through the multimedia service. The camera source plug-in is a plug-in obtained by extending the multimedia service. The camera source plugin resides in userspace on Linux.
需要说明的是,相机源插件设置为创建通信管道,以使Linux系统的应用程序可以通过 多媒体服务访问相机设备。该通信管道可以为pipeline。It should be noted that the camera source plug-in is set to create a communication pipe so that applications in the Linux system can access the camera device through the multimedia service. The communication channel may be a pipeline.
其中,执行结果包括控制结果和数据传输结果,该数据传输结果包括但不限于:图像数据、视频数据和相机配置参数。例如,执行结果包括但不限于:开启相机指令的执行结果、关闭相机指令的执行结果、相机预览指令的执行结果、相机拍摄指令的执行结果、相机录像指令的执行结果和相机参数设置指令的执行结果等等。Wherein, the execution result includes a control result and a data transmission result, and the data transmission result includes but not limited to: image data, video data and camera configuration parameters. For example, the execution results include, but are not limited to: the execution results of the camera opening instruction, the camera closing instruction execution result, the camera preview instruction execution result, the camera shooting instruction execution result, the camera video recording instruction execution result and the camera parameter setting instruction execution result Results and so on.
此处,开启相机指令的执行结果包括相机开启成功标识或相机开启失败标识。关闭相机指令的执行结果包括相机关闭成功标识或相机关闭失败标识。相机预览指令的执行结果包括相机实时拍摄得到的图像数据和相机预览成功标识或相机预览失败标识。相机拍摄指令的执行结果包括相机拍摄得到的图像数据和相机拍摄成功标识或相机拍摄失败标识。相机录像指令的执行结果包括相机录像得到的视频数据和相机录像成功标识或相机录像失败标识。相机参数设置指令的执行结果包括相机参数设置成功标识或相机参数设置失败标识。Here, the execution result of the command to turn on the camera includes an indication of successful opening of the camera or an indication of failure to turn on the camera. The execution result of the instruction to close the camera includes an indication of successful closing of the camera or an indication of failure of closing the camera. The execution result of the camera preview instruction includes the image data captured by the camera in real time and the camera preview success flag or the camera preview failure flag. The execution result of the camera shooting instruction includes the image data obtained by the camera shooting and the camera shooting success flag or the camera shooting failure flag. The execution result of the camera video recording command includes the video data obtained by the camera video recording and the camera video recording success flag or the camera video recording failure flag. The execution result of the camera parameter setting instruction includes an indication that the camera parameter setting is successful or an indication that the camera parameter setting is failed.
在一实施例中,若相机控制指令为开启相机指令,控制相机开启,并将相机是否开启成功的执行结果通过相机源插件返回至应用程序。In one embodiment, if the camera control instruction is an instruction to turn on the camera, the camera is controlled to turn on, and the execution result of whether the camera is turned on successfully is returned to the application program through the camera source plug-in.
例如,若相机控制指令为开启相机指令,控制相机开启,将相机开启成功标识或相机开启失败标识通过相机源插件返回至应用程序。For example, if the camera control instruction is an instruction to turn on the camera, the camera is controlled to turn on, and the flag of successful opening of the camera or the flag of failure of the camera to be turned on is returned to the application through the camera source plug-in.
在另一实施例中,若相机控制指令为关闭相机指令,控制相机关闭,将相机是否关闭成功的执行结果通过相机源插件返回至应用程序。In another embodiment, if the camera control command is a camera close command, the camera is controlled to close, and the execution result of whether the camera closes successfully is returned to the application program through the camera source plug-in.
例如,若相机控制指令为关闭相机指令,控制相机关闭,将相机关闭成功标识或相机关闭失败标识通过相机源插件返回至应用程序。For example, if the camera control command is a camera close command, the camera is controlled to close, and the camera close success mark or camera close failure mark is returned to the application through the camera source plug-in.
在另一实施例中,若相机控制指令为相机预览指令,控制相机进行预览操作,将相机实时拍摄得到的图像数据和相机预览成功标识通过相机源插件返回至应用程序,或,将相机预览失败标识通过相机源插件返回至应用程序。In another embodiment, if the camera control command is a camera preview command, the camera is controlled to perform a preview operation, and the image data captured by the camera in real time and the success of the camera preview are returned to the application through the camera source plug-in, or the camera preview fails The identity is returned to the application through the camera feed plugin.
例如,若相机控制指令为相机预览指令,且相机预览指令为相机开始预览指令,控制相机进行预览操作,将相机实时拍摄得到的图像数据通过相机源插件返回至应用程序,同时将相机预览成功标识通过相机源插件返回至应用程序,或,将相机预览失败标识(相机开始预览失败标识)通过相机源插件返回至应用程序;若相机控制指令为相机预览指令,且相机预览指令为相机停止预览指令,控制相机停止进行预览操作,即停止传输实时数据,同时将相机预览成功标识(相机停止预览成功标识)通过相机源插件返回至应用程序,或,将相机预览失败标识(相机停止预览失败标识)通过相机源插件返回至应用程序。For example, if the camera control command is a camera preview command, and the camera preview command is a camera start preview command, control the camera to perform a preview operation, return the image data captured by the camera in real time to the application program through the camera source plug-in, and mark the success of the camera preview Return to the application program through the camera source plug-in, or return the camera preview failure flag (camera start preview failure flag) to the application program through the camera source plug-in; if the camera control command is a camera preview command, and the camera preview command is a camera stop preview command , control the camera to stop the preview operation, that is, stop the transmission of real-time data, and at the same time, return the camera preview success mark (camera stop preview success mark) to the application through the camera source plug-in, or mark the camera preview failure (camera stop preview failure mark) Return to the application through the camera feed plugin.
在另一实施例中,若相机控制指令为相机拍摄指令,控制相机进行拍摄操作,将相机拍摄得到的图像数据通过相机源插件返回至应用程序和相机拍摄成功标识,或,将相机拍摄失败标识通过相机源插件返回至应用程序。In another embodiment, if the camera control instruction is a camera shooting instruction, the camera is controlled to perform a shooting operation, and the image data captured by the camera is returned to the application program through the camera source plug-in and the camera shooting success is marked, or the camera shooting failure is marked Return to the application through the camera feed plugin.
例如,若相机控制指令为相机拍摄指令,控制相机进行拍摄操作,将相机拍摄得到的图像数据通过相机源插件返回至应用程序,同时将相机拍摄成功标识通过相机源插件返回至应用程序,或,将相机拍摄失败标识通过相机源插件返回至应用程序。For example, if the camera control command is a camera shooting command, control the camera to perform shooting operations, return the image data captured by the camera to the application program through the camera source plug-in, and return the camera shooting success flag to the application program through the camera source plug-in, or, Return the camera capture failure flag to the application through the camera source plug-in.
在另一实施例中,若相机控制指令为相机录像指令,控制相机进行录像操作,将相机录像得到的视频数据和相机录像成功标识通过相机源插件返回至应用程序,或,将相机录像失败标识通过相机源插件返回至应用程序。In another embodiment, if the camera control command is a camera video recording command, the camera is controlled to perform a video recording operation, and the video data obtained by the camera video recording and the successful camera video recording are returned to the application program through the camera source plug-in, or the camera video recording failure is marked Return to the application through the camera feed plugin.
例如,若相机控制指令为相机录像指令,且相机录像指令为相机开始录像指令,控制相 机进行录像操作,将录像数据流通过相机源插件返回至应用程序,或,将相机录像失败标识通过相机源插件返回至应用程序;若相机控制指令为相机录像指令,且相机录像指令为相机停止录像指令,控制相机停止录像,即停止传输录像数据流,同时将相机录像成功标识通过相机源插件返回至应用程序,或,将相机录像失败标识通过相机源插件返回至应用程序。For example, if the camera control command is a camera recording command, and the camera recording command is a camera start recording command, the camera is controlled to perform a recording operation, and the video data stream is returned to the application through the camera source plug-in, or the camera recording failure flag is passed through the camera source The plug-in returns to the application program; if the camera control command is a camera recording command, and the camera recording command is a camera stop recording command, control the camera to stop recording, that is, stop transmitting the recording data stream, and at the same time, return the successful identification of the camera recording to the application through the camera source plug-in The program, or, return the camera recording failure flag to the application program through the camera source plug-in.
在另一实施例中,若相机控制指令为相机参数设置指令,控制相机配置相机参数设置指令指示的相机参数,将参数是否配置成功的执行结果通过相机源插件返回至应用程序。In another embodiment, if the camera control instruction is a camera parameter setting instruction, the camera is controlled to configure the camera parameters indicated by the camera parameter setting instruction, and the execution result of whether the parameter configuration is successful is returned to the application program through the camera source plug-in.
例如,若相机控制指令为相机参数设置指令,控制相机配置相机参数设置指令指示的相机参数,将相机参数设置成功标识或相机参数设置失败标识通过相机源插件返回至应用程序。For example, if the camera control instruction is a camera parameter setting instruction, the camera is controlled to configure the camera parameters indicated by the camera parameter setting instruction, and the camera parameter setting success flag or the camera parameter setting failure flag is returned to the application through the camera source plug-in.
在一实施例中,所述将所述相机的执行结果通过所述相机源插件返回至所述应用程序,包括:In an embodiment, the returning the execution result of the camera to the application through the camera source plug-in includes:
将相机的执行结果返回至Android相机服务;将执行结果返回至Camera Client库;通过相机源插件,将执行结果从Camera Client库转发至多媒体服务;将执行结果从多媒体服务返回至应用程序。Return the execution result of the camera to the Android camera service; return the execution result to the Camera Client library; forward the execution result from the Camera Client library to the multimedia service through the camera source plug-in; return the execution result from the multimedia service to the application.
为便于理解,对本公开的实施方式进行举例说明。在Linux系统中应用程序使用相机时,应用程序生成相机控制指令,然后,通过多媒体服务,接收应用程序发送的相机控制指令,之后,通过相机源插件,将相机控制指令从多媒体服务转发至Camera Client库,以通过Camera Client库与Android相机服务对接的接口,控制相机执行相机控制指令对应的操作,之后,将相机的执行结果返回至相机驱动和Android相机服务;通过Camera Client库与Android相机服务对接的接口,将执行结果从Android相机服务转发至Camera Client库;通过相机源插件,将执行结果从Camera Client库返回至多媒体服务,将执行结果从多媒体服务返回至应用程序。此外,创建Android容器,并将Android相机服务部署于Android容器。可参见图2,在图2中对本公开实施例进行了层的划分,应用程序、多媒体服务、相机源插件、Camera Client库、Android容器属于用户空间层,相机驱动(Camera Driver)属于内核层,相机属于硬件层。Embodiments of the present disclosure will be described by way of example for easy understanding. When the application program uses the camera in the Linux system, the application program generates a camera control command, and then receives the camera control command sent by the application program through the multimedia service, and then forwards the camera control command from the multimedia service to the Camera Client through the camera source plug-in Library, to control the camera to execute the operation corresponding to the camera control command through the interface of the Camera Client library and the Android camera service, and then return the execution result of the camera to the camera driver and the Android camera service; through the Camera Client library to connect with the Android camera service The interface forwards the execution result from the Android camera service to the Camera Client library; through the camera source plug-in, the execution result is returned from the Camera Client library to the multimedia service, and the execution result is returned from the multimedia service to the application. In addition, create an Android container and deploy the Android camera service to the Android container. Can refer to Fig. 2, in Fig. 2 the embodiment of the present disclosure is divided into layers, application program, multimedia service, camera source plug-in, Camera Client storehouse, Android container belong to the user space layer, camera driver (Camera Driver) belongs to the kernel layer, The camera belongs to the hardware layer.
根据本公开实施例的基于Linux的相机控制方法,该方法应用于Linux系统,通过多媒体服务,接收Linux系统中应用程序发送的相机控制指令;基于相机源插件,控制相机执行相机控制指令对应的操作,并将相机的执行结果通过相机源插件返回至应用程序。通过上述方式,本公开实施例通过多媒体服务,接收应用程序发送的相机控制指令,并基于相机源插件使用相机,进而使应用程序可以使用相机,以使在只存在Android相机驱动的情况下,应用程序可以使用相机,以使Linux侧的应用程序能够使用相机设备。According to the Linux-based camera control method according to the embodiment of the present disclosure, the method is applied to the Linux system, and receives the camera control command sent by the application program in the Linux system through the multimedia service; based on the camera source plug-in, the camera is controlled to perform the operation corresponding to the camera control command , and return the execution result of the camera to the application through the camera source plug-in. Through the above method, the embodiment of the present disclosure receives the camera control command sent by the application program through the multimedia service, and uses the camera based on the camera source plug-in, so that the application program can use the camera, so that when only the Android camera driver exists, the application program Programs can use the camera to enable applications on the Linux side to use the camera device.
例如,基于上述实施例,提出本公开基于Linux的相机控制方法的另一实施例。如图3所示,上述步骤120中,基于相机源插件,控制相机执行所述相机控制指令对应的操作,包括以下步骤121-122:For example, based on the above embodiments, another embodiment of the Linux-based camera control method of the present disclosure is proposed. As shown in FIG. 3, in the above step 120, based on the camera source plug-in, the camera is controlled to perform the operation corresponding to the camera control instruction, including the following steps 121-122:
步骤121,基于相机源插件,将所述相机控制指令从所述多媒体服务转发至Camera Client库。 Step 121, forward the camera control command from the multimedia service to the Camera Client library based on the camera source plug-in.
步骤122,通过所述Camera Client库,控制相机执行所述相机控制指令对应的操作。 Step 122, through the Camera Client library, control the camera to execute the operation corresponding to the camera control instruction.
其中,相机源插件是通过多媒体服务加载调用的。该相机源插件为多媒体服务扩展得到的插件。该相机源插件位于Linux的用户空间。Wherein, the camera source plug-in is loaded and called through the multimedia service. The camera source plug-in is a plug-in obtained by extending the multimedia service. The camera source plugin resides in userspace on Linux.
需要说明的是,相机源插件设置为创建通信管道,以使Linux系统的应用程序可以通过多媒体服务访问相机设备。该通信管道可以为pipeline。It should be noted that the camera source plugin is set up to create a communication pipe so that applications in the Linux system can access the camera device through multimedia services. The communication channel may be a pipeline.
例如,若相机控制指令为开启相机指令,则将开启相机指令从多媒体服务转发至Camera Client库,以使Camera Client库,控制相机执行开启相机指令对应的操作。For example, if the camera control command is a command to turn on the camera, the command to turn on the camera is forwarded from the multimedia service to the Camera Client library, so that the Camera Client library controls the camera to perform the operation corresponding to the command to turn on the camera.
例如,若相机控制指令为关闭相机指令,则将关闭相机指令从多媒体服务转发至Camera Client库,以使Camera Client库,控制相机执行关闭相机指令对应的操作。For example, if the camera control command is a camera close command, the camera close command is forwarded from the multimedia service to the Camera Client library, so that the Camera Client library controls the camera to perform the operation corresponding to the camera close command.
例如,若相机控制指令为相机预览指令,则将相机预览指令从多媒体服务转发至Camera Client库,以使Camera Client库,控制相机执行相机预览指令对应的操作。For example, if the camera control instruction is a camera preview instruction, the camera preview instruction is forwarded from the multimedia service to the Camera Client library, so that the Camera Client library controls the camera to perform the operation corresponding to the camera preview instruction.
例如,若相机控制指令为相机拍摄指令,则将相机拍摄指令从多媒体服务转发至Camera Client库,以使Camera Client库,控制相机执行相机拍摄指令对应的操作。For example, if the camera control instruction is a camera shooting instruction, the camera shooting instruction is forwarded from the multimedia service to the Camera Client library, so that the Camera Client library controls the camera to perform the operation corresponding to the camera shooting instruction.
例如,若相机控制指令为相机录像指令,则将相机录像指令从多媒体服务转发至Camera Client库,以使Camera Client库,控制相机执行相机录像指令对应的操作。For example, if the camera control command is a camera recording command, the camera recording command is forwarded from the multimedia service to the Camera Client library, so that the Camera Client library controls the camera to perform the operation corresponding to the camera recording command.
例如,若相机控制指令为相机参数设置指令,则将相机参数设置指令从多媒体服务转发至Camera Client库,以使Camera Client库,控制相机执行相机参数设置指令对应的操作。For example, if the camera control instruction is a camera parameter setting instruction, the camera parameter setting instruction is forwarded from the multimedia service to the Camera Client library, so that the Camera Client library controls the camera to perform the operation corresponding to the camera parameter setting instruction.
在一实施例中,所述Linux系统包括用户空间层;所述用户空间层包括所述应用程序、所述多媒体服务、所述相机源插件、所述Camera Client库。In one embodiment, the Linux system includes a user space layer; the user space layer includes the application program, the multimedia service, the camera source plug-in, and the Camera Client library.
在一实施例中,上述步骤121包括:In one embodiment, the above step 121 includes:
步骤1211,基于相机源插件,确定所述相机控制指令对应的通信通道。Step 1211, based on the camera source plug-in, determine the communication channel corresponding to the camera control command.
步骤1213,通过所述通信通道,将所述相机控制指令从所述多媒体服务转发至Camera Client库,并调用所述Camera Client库中所述相机控制指令对应的接口。Step 1213, forward the camera control instruction from the multimedia service to the Camera Client library through the communication channel, and call the interface corresponding to the camera control instruction in the Camera Client library.
其中,通信通道由相机源插件进行创建,该通信通道用于使Linux系统的应用程序可以通过多媒体服务访问相机设备。该通信管道可以为pipeline。例如,使用GStreamer的v4l2src相机源插件创建pipeline访问相机硬件设备。Wherein, the communication channel is created by the camera source plug-in, and the communication channel is used to enable the application program of the Linux system to access the camera device through the multimedia service. The communication channel may be a pipeline. For example, use GStreamer's v4l2src camera source plugin to create a pipeline to access camera hardware devices.
其中,Camera Client库中包括多个相机控制指令对应的接口,即包括多种相机操作应用程序编程接口(Application Programming Interface,API),例如,包括预览API、拍摄API、录像API、参数设置API等。Among them, the Camera Client library includes interfaces corresponding to multiple camera control commands, including various camera operation application programming interfaces (Application Programming Interface, API), for example, including preview API, shooting API, video recording API, parameter setting API, etc. .
在一实施例中,所述Camera Client库与Android相机服务通过进程间通信通道进行通信。In one embodiment, the Camera Client library communicates with the Android camera service through an inter-process communication channel.
其中,进程间通信通道能够实现进程间的数据传递和信息传递。例如,进程间通信通道实现Camera Client库与Android相机服务进行控制指令的传输和处理数据的传输,即其用于完成Camera Client库与Android相机服务的接口(API)对接。该处理数据包括但不限于:图像数据、视频数据、相机的配置参数等等。Wherein, the inter-process communication channel can realize data transmission and information transmission between processes. For example, the inter-process communication channel realizes the transmission of control instructions and processing data between the Camera Client library and the Android camera service, that is, it is used to complete the interface (API) docking between the Camera Client library and the Android camera service. The processed data includes, but is not limited to: image data, video data, camera configuration parameters, and the like.
进程间通信(Inter-Process Communication,IPC),提供了多种进程间的通信方法,例如,binder,套接字(socket),共享内存(shared memory)等。Inter-Process Communication (IPC) provides a variety of inter-process communication methods, such as binder, socket (socket), shared memory (shared memory), etc.
例如,Camera Client库通过IPC通道与Android相机服务进行通信。For example, the Camera Client library communicates with the Android camera service through an IPC channel.
在一实施例中,Camera Client库通过binder与Android相机服务进行通信。例如,Camera Client库通过libgbinder与Android相机服务进行通信,该libgbinder为binder的一种linux实现。In one embodiment, the Camera Client library communicates with the Android camera service through a binder. For example, the Camera Client library communicates with the Android camera service through libgbinder, which is a linux implementation of binder.
在另一实施例中,Camera Client库通过socket与Android相机服务进行通信。In another embodiment, the Camera Client library communicates with the Android camera service through sockets.
在另一实施例中,Camera Client库通过shared memory与Android相机服务进行通信。In another embodiment, the Camera Client library communicates with the Android camera service through shared memory.
例如,创建Android容器,并将Android相机服务部署于Android容器。可参见图2,此处不再一一赘述。For example, create an Android container and deploy the Android camera service to the Android container. Refer to FIG. 2 , which will not be repeated here.
可以理解的是,利用进程间通信通道实现Camera Client库和Android相机服务的通信,以能够将Camera Client库中相机控制指令对应的接口与Android相机服务中相机控制指令对应的接口,进行对接,以能够在Linux和Android之间进行数据通信,以使在只存在Android相机驱动的情况下,应用程序可以使用相机。It can be understood that the communication between the Camera Client library and the Android camera service is realized by using the inter-process communication channel, so that the interface corresponding to the camera control command in the Camera Client library can be connected with the interface corresponding to the camera control command in the Android camera service, so that Enables data communication between Linux and Android so that applications can use the camera when only the Android camera driver exists.
基于上述实施例,上述步骤122包括:Based on the above-mentioned embodiment, the above-mentioned step 122 includes:
步骤1221,将所述Camera Client库中所述相机控制指令对应的接口与所述Android相机服务中所述相机控制指令对应的接口,进行对接。Step 1221, connect the interface corresponding to the camera control command in the Camera Client library with the interface corresponding to the camera control command in the Android camera service.
步骤1222,基于对接的接口,控制相机执行所述相机控制指令对应的操作。Step 1222: Control the camera to execute the operation corresponding to the camera control instruction based on the docking interface.
在一实施例中,将Camera Client库中相机预览指令对应的预览接口与Android相机服务中相机预览指令对应的预览接口,进行对接。In one embodiment, the preview interface corresponding to the camera preview command in the Camera Client library is connected with the preview interface corresponding to the camera preview command in the Android camera service.
在一实施例中,将Camera Client库中相机拍摄指令对应的拍摄接口与Android相机服务中相机拍摄指令对应的拍摄接口,进行对接。In one embodiment, the shooting interface corresponding to the camera shooting command in the Camera Client library is connected with the shooting interface corresponding to the camera shooting command in the Android camera service.
在一实施例中,将Camera Client库中相机录像指令对应的录像接口与Android相机服务中相机录像指令对应的录像接口,进行对接。In one embodiment, the video recording interface corresponding to the camera video recording command in the Camera Client library is connected with the video recording interface corresponding to the camera video recording command in the Android camera service.
在一实施例中,将Camera Client库中相机参数设置指令对应的参数设置接口与Android相机服务中相机参数设置指令对应的参数设置接口,进行对接。In one embodiment, the parameter setting interface corresponding to the camera parameter setting instruction in the Camera Client library is connected with the parameter setting interface corresponding to the camera parameter setting instruction in the Android camera service.
为便于理解,在一实施例中,如图4所示,在图4中对本公开实施例进行了层的划分,应用程序、多媒体服务、相机源插件、Camera Client库、Android容器属于用户空间层,相机驱动(Camera Driver)属于内核层,相机属于硬件层。此处,应用程序可生成相机预览指令、相机拍摄指令、相机录像指令和相机参数设置指令;相应的,多媒体服务可以接收相机预览指令、相机拍摄指令、相机录像指令和相机参数设置指令;相应的,相机源插件中的通信管道包括预览管道、拍摄管道、录像管道和参数设置API;相应的,Camera Client库中包括预览API、拍摄API、录像API和参数设置API;相应的,Android容器中Android相机服务包括预览API、拍摄API、录像API和参数设置API。For ease of understanding, in one embodiment, as shown in Figure 4, the embodiment of the present disclosure is divided into layers in Figure 4, and application programs, multimedia services, camera source plug-ins, Camera Client libraries, and Android containers belong to the user space layer , the camera driver (Camera Driver) belongs to the kernel layer, and the camera belongs to the hardware layer. Here, the application can generate camera preview instructions, camera shooting instructions, camera recording instructions and camera parameter setting instructions; correspondingly, the multimedia service can receive camera preview instructions, camera shooting instructions, camera recording instructions and camera parameter setting instructions; correspondingly , the communication pipeline in the camera source plug-in includes preview pipeline, shooting pipeline, video pipeline and parameter setting API; correspondingly, the Camera Client library includes preview API, shooting API, video recording API and parameter setting API; correspondingly, the Android container in the Android Camera services include preview API, shooting API, video recording API and parameter setting API.
根据本公开实施例的基于Linux的相机控制方法,该方法应用于Linux系统,基于相机源插件,将相机控制指令从多媒体服务转发至Camera Client库;通过Camera Client库,控制相机执行相机控制指令对应的操作。通过上述方式,将相机控制指令通过相机源插件进行转发,以通过Camera Client库使用相机,以使应用程序可以通过Android相机服务使用相机,以使在只存在Android相机驱动的情况下,应用程序可以使用相机,以使Linux侧的应用程序能够使用相机设备。According to the Linux-based camera control method according to the embodiment of the present disclosure, the method is applied to the Linux system, and based on the camera source plug-in, the camera control command is forwarded from the multimedia service to the Camera Client library; through the Camera Client library, the camera is controlled to execute the corresponding camera control command. operation. In the above way, the camera control command is forwarded through the camera source plug-in to use the camera through the Camera Client library, so that the application can use the camera through the Android camera service, so that the application can use the camera only if there is an Android camera driver. Use Camera to enable applications on the Linux side to use the camera device.
例如,基于上述任一实施例,提出本公开基于Linux的相机控制方法的另一实施例。在本实施例中,在上述步骤120之前,该方法还包括:For example, based on any of the above embodiments, another embodiment of the Linux-based camera control method of the present disclosure is proposed. In this embodiment, before the above step 120, the method further includes:
步骤130,通过所述多媒体服务,加载所述相机源插件。Step 130, load the camera source plug-in through the multimedia service.
例如,通过多媒体服务,加载相机源插件,以基于相机源插件调用Camera Client库。For example, through the multimedia service, the camera source plug-in is loaded to call the Camera Client library based on the camera source plug-in.
其中,相机源插件为多媒体服务扩展得到的插件。该相机源插件位于Linux的用户空间。Wherein, the camera source plug-in is a plug-in obtained by extending the multimedia service. The camera source plugin resides in userspace on Linux.
相机源插件设置为创建通信管道,以使Linux系统的应用程序可以通过多媒体服务访问相机设备。The camera source plugin is set up to create a communication pipe so that applications on the Linux system can access the camera device through multimedia services.
在一实施例中,通信管道为pipeline。In one embodiment, the communication channel is a pipeline.
根据本公开实施例的基于Linux的相机控制方法,该方法应用于Linux系统,通过多媒 体服务,加载相机源插件,以基于相机源插件调用Camera Client库,从而通过Camera Client库,控制相机执行相机控制指令对应的操作,以使应用程序可以通过Android相机服务使用相机,以使在只存在Android相机驱动的情况下,应用程序可以使用相机,以使Linux侧的应用程序能够使用相机设备。According to the Linux-based camera control method according to an embodiment of the present disclosure, the method is applied to a Linux system, and the camera source plug-in is loaded through the multimedia service to call the Camera Client library based on the camera source plug-in, thereby controlling the camera to perform camera control through the Camera Client library The operation corresponding to the instruction, so that the application can use the camera through the Android camera service, so that the application can use the camera when only the Android camera driver exists, so that the application on the Linux side can use the camera device.
例如,基于上述任一实施例,提出本公开基于Linux的相机控制方法的另一实施例。在本实施例中,上述步骤110之前,该方法还包括:For example, based on any of the above embodiments, another embodiment of the Linux-based camera control method of the present disclosure is proposed. In this embodiment, before the above step 110, the method further includes:
步骤140,在所述Linux系统启动后,启动Android容器。Step 140, start the Android container after the Linux system is started.
步骤150,启动所述Android容器中的Android相机服务,以供初始化所述相机。Step 150, start the Android camera service in the Android container to initialize the camera.
此处,Android相机服务为用于初始化相机硬件的服务。Here, the Android camera service is a service for initializing camera hardware.
在一实施例中,在所述Linux系统启动后,通过Ixc容器技术,启动启动Android容器;在Android容器中启动Android相机服务,以初始化相机硬件。In one embodiment, after the Linux system is started, the Android container is started by the Ixc container technology; the Android camera service is started in the Android container to initialize the camera hardware.
根据本公开实施例的基于Linux的相机控制方法,该方法应用于Linux系统,通过启动Android容器及其Android相机服务,以初始化相机,从而为后续使用相机提供支持。According to the Linux-based camera control method of the embodiment of the present disclosure, the method is applied to a Linux system, and the camera is initialized by starting an Android container and its Android camera service, thereby providing support for subsequent use of the camera.
下面对本公开提供的基于Linux的相机控制装置进行描述,下文描述的基于Linux的相机控制装置与上文描述的基于Linux的相机控制方法可相互对应参照,重复之处不再赘述,如图5所示,该基于Linux的相机控制装置包括:The following describes the Linux-based camera control device provided by the present disclosure. The Linux-based camera control device described below and the Linux-based camera control method described above can be referred to each other. According to the report, the Linux-based camera control device includes:
接收模块510,设置为通过多媒体服务,接收所述Linux系统中应用程序发送的相机控制指令;The receiving module 510 is configured to receive the camera control instruction sent by the application program in the Linux system through the multimedia service;
控制模块510,设置为基于相机源插件,控制相机执行所述相机控制指令对应的操作,并将所述相机的执行结果通过所述相机源插件返回至所述应用程序。The control module 510 is configured to control the camera to execute the operation corresponding to the camera control instruction based on the camera source plug-in, and return the execution result of the camera to the application program through the camera source plug-in.
根据本公开实施例的基于Linux的相机控制装置,通过多媒体服务,接收Linux系统中应用程序发送的相机控制指令;基于相机源插件,控制相机执行相机控制指令对应的操作,并将相机的执行结果通过相机源插件返回至应用程序。通过上述方式,本公开实施例通过多媒体服务,接收应用程序发送的相机控制指令,并基于相机源插件使用相机,进而使应用程序可以使用相机,以使在只存在Android相机驱动的情况下,应用程序可以使用相机,以使Linux侧的应用程序能够使用相机设备。According to the Linux-based camera control device according to the embodiment of the present disclosure, the camera control command sent by the application program in the Linux system is received through the multimedia service; based on the camera source plug-in, the camera is controlled to perform the operation corresponding to the camera control command, and the execution result of the camera is Return to the application through the camera feed plugin. Through the above method, the embodiment of the present disclosure receives the camera control command sent by the application program through the multimedia service, and uses the camera based on the camera source plug-in, so that the application program can use the camera, so that when only the Android camera driver exists, the application program Programs can use the camera to enable applications on the Linux side to use the camera device.
例如,所述控制模块510还设置为基于相机源插件,将所述相机控制指令从所述多媒体服务转发至Camera Client库;通过所述Camera Client库,控制相机执行所述相机控制指令对应的操作。For example, the control module 510 is also configured to forward the camera control instruction from the multimedia service to the Camera Client library based on the camera source plug-in; through the Camera Client library, the camera is controlled to perform the operation corresponding to the camera control instruction .
例如,所述控制模块510还设置为基于相机源插件,确定所述相机控制指令对应的通信通道;通过所述通信通道,将所述相机控制指令从所述多媒体服务转发至Camera Client库,并调用所述Camera Client库中所述相机控制指令对应的接口。For example, the control module 510 is further configured to determine the communication channel corresponding to the camera control instruction based on the camera source plug-in; forward the camera control instruction from the multimedia service to the Camera Client library through the communication channel, and Call the interface corresponding to the camera control command in the Camera Client library.
例如,所述Camera Client库与Android相机服务通过进程间通信通道进行通信。For example, the Camera Client library communicates with the Android camera service through an interprocess communication channel.
例如,所述控制模块510还设置为将所述Camera Client库中所述相机控制指令对应的接口与所述Android相机服务中所述相机控制指令对应的接口,进行对接;基于对接的接口,控制相机执行所述相机控制指令对应的操作。For example, the control module 510 is also configured to connect the interface corresponding to the camera control command in the Camera Client library with the interface corresponding to the camera control command in the Android camera service; based on the docked interface, control The camera executes the operation corresponding to the camera control instruction.
例如,所述基于Linux的相机控制装置还包括:For example, the Linux-based camera control device also includes:
插件加载模块,设置为通过所述多媒体服务,加载所述相机源插件。The plug-in loading module is configured to load the camera source plug-in through the multimedia service.
例如,所述基于Linux的相机控制装置还包括:For example, the Linux-based camera control device also includes:
容器启动模块,设置为在所述Linux系统启动后,启动Android容器;The container startup module is configured to start the Android container after the Linux system starts;
服务启动模块,设置为启动所述Android容器中的Android相机服务,以供初始化所述相机。The service startup module is configured to start the Android camera service in the Android container, so as to initialize the camera.
图6示例了一种电子设备的实体结构示意图,如图6所示,该电子设备可以包括:处理器(processor)610、通信接口(Communications Interface)620、存储器(memory)630和通信总线640,其中,处理器610,通信接口620,存储器630通过通信总线640完成相互间的通信。处理器610可以调用存储器630中的逻辑指令,以执行基于Linux的相机控制方法,该方法包括:通过多媒体服务,接收所述Linux系统中应用程序发送的相机控制指令;基于相机源插件,控制相机执行所述相机控制指令对应的操作,并将所述相机的执行结果通过所述相机源插件返回至所述应用程序。FIG. 6 illustrates a schematic diagram of the physical structure of an electronic device. As shown in FIG. 6, the electronic device may include: a processor (processor) 610, a communication interface (Communications Interface) 620, a memory (memory) 630 and a communication bus 640, Wherein, the processor 610 , the communication interface 620 , and the memory 630 communicate with each other through the communication bus 640 . The processor 610 can call the logic instructions in the memory 630 to execute the camera control method based on Linux, the method includes: receiving the camera control instruction sent by the application program in the Linux system through the multimedia service; controlling the camera based on the camera source plug-in Execute the operation corresponding to the camera control instruction, and return the execution result of the camera to the application program through the camera source plug-in.
此外,上述的存储器630中的逻辑指令可以通过软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本公开的技术方案本质上或者说对相关技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本公开多个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等多种可以存储程序代码的介质。In addition, the logic instructions in the above-mentioned memory 630 may be implemented in the form of software functional units and when sold or used as an independent product, may be stored in a computer-readable storage medium. Based on this understanding, the essence of the technical solution of the present disclosure or the part that contributes to the related technology or the part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several The instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in multiple embodiments of the present disclosure. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disc and other media that can store program codes. .
另一方面,本公开还提供一种计算机程序产品,所述计算机程序产品包括计算机程序,计算机程序可存储在非暂态计算机可读存储介质上,所述计算机程序被处理器执行时,计算机能够执行上述多种方法所提供的基于Linux的相机控制方法,该方法包括:通过多媒体服务,接收所述Linux系统中应用程序发送的相机控制指令;基于相机源插件,控制相机执行所述相机控制指令对应的操作,并将所述相机的执行结果通过所述相机源插件返回至所述应用程序。On the other hand, the present disclosure also provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can Executing the Linux-based camera control method provided by the above multiple methods, the method includes: receiving the camera control command sent by the application program in the Linux system through multimedia services; based on the camera source plug-in, controlling the camera to execute the camera control command corresponding operation, and return the execution result of the camera to the application program through the camera source plug-in.
又一方面,本公开还提供一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现以执行上述多种方法提供的基于Linux的相机控制方法,该方法包括:通过多媒体服务,接收所述Linux系统中应用程序发送的相机控制指令;基于相机源插件,控制相机执行所述相机控制指令对应的操作,并将所述相机的执行结果通过所述相机源插件返回至所述应用程序。In yet another aspect, the present disclosure also provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it is implemented to perform the Linux-based camera control method provided by the above-mentioned various methods, The method includes: receiving a camera control instruction sent by an application program in the Linux system through a multimedia service; controlling the camera to perform operations corresponding to the camera control instruction based on a camera source plug-in, and passing the execution result of the camera through the The camera feed plugin returns to the application.
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。The device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. It can be understood and implemented by those skilled in the art without any creative effort.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到多个实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行多个实施例 或者实施例的某些部分所述的方法。Through the above description of the implementations, those skilled in the art can clearly understand that multiple implementations can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware. Based on this understanding, the essence of the above technical solutions or the part that contributes to related technologies can be embodied in the form of software products, and the computer software products can be stored in computer-readable storage media, such as ROM/RAM, disk , CD, etc., including several instructions to make a computer device (which may be a personal computer, server, or network device, etc.) execute the methods described in multiple embodiments or some parts of the embodiments.

Claims (10)

  1. 一种基于Linux的相机控制方法,应用于Linux系统,所述方法包括:A method for controlling a camera based on Linux, applied to a Linux system, said method comprising:
    通过多媒体服务,接收所述Linux系统中应用程序发送的相机控制指令;Receive a camera control instruction sent by an application program in the Linux system through a multimedia service;
    基于相机源插件,控制相机执行所述相机控制指令对应的操作,并将所述相机的执行结果通过所述相机源插件返回至所述应用程序。Based on the camera source plug-in, the camera is controlled to execute the operation corresponding to the camera control instruction, and the execution result of the camera is returned to the application program through the camera source plug-in.
  2. 根据权利要求1所述的方法,其中,所述基于相机源插件,控制相机执行所述相机控制指令对应的操作,包括:The method according to claim 1, wherein, based on the camera source plug-in, controlling the camera to perform operations corresponding to the camera control instruction includes:
    基于相机源插件,将所述相机控制指令从所述多媒体服务转发至相机客户端Camera Client库;Based on the camera source plug-in, the camera control command is forwarded from the multimedia service to the camera client Camera Client library;
    通过所述Camera Client库,控制相机执行所述相机控制指令对应的操作。Through the Camera Client library, the camera is controlled to perform the operation corresponding to the camera control instruction.
  3. 根据权利要求2所述的方法,其中,所述基于相机源插件,将所述相机控制指令从所述多媒体服务转发至Camera Client库,包括:The method according to claim 2, wherein the camera source plug-in-based forwarding the camera control command from the multimedia service to the Camera Client library includes:
    基于相机源插件,确定所述相机控制指令对应的通信通道;Based on the camera source plug-in, determine the communication channel corresponding to the camera control command;
    通过所述通信通道,将所述相机控制指令从所述多媒体服务转发至Camera Client库,并调用所述Camera Client库中所述相机控制指令对应的接口。Through the communication channel, forward the camera control instruction from the multimedia service to the Camera Client library, and call the interface corresponding to the camera control instruction in the Camera Client library.
  4. 根据权利要求2所述的方法,其中,所述Camera Client库与安卓Android相机服务通过进程间通信通道进行通信。The method according to claim 2, wherein the Camera Client storehouse communicates with the Android camera service through an inter-process communication channel.
  5. 根据权利要求4所述的方法,其中,所述通过所述Camera Client库,控制相机执行所述相机控制指令对应的操作,包括:The method according to claim 4, wherein the controlling the camera to perform operations corresponding to the camera control instruction through the Camera Client library includes:
    将所述Camera Client库中所述相机控制指令对应的接口与所述Android相机服务中所述相机控制指令对应的接口,进行对接;The interface corresponding to the camera control command described in the Camera Client library is docked with the interface corresponding to the camera control command described in the Android camera service;
    基于对接的接口,控制相机执行所述相机控制指令对应的操作。Based on the docking interface, the camera is controlled to perform the operation corresponding to the camera control instruction.
  6. 根据权利要求1至5任一项所述的方法,所述基于相机源插件,控制相机执行所述相机控制指令对应的操作,并将所述相机的执行结果通过所述相机源插件返回至所述应用程序之前,还包括:According to the method according to any one of claims 1 to 5, based on the camera source plug-in, the camera is controlled to execute the operation corresponding to the camera control instruction, and the execution result of the camera is returned to the camera source plug-in Before the above application, also include:
    通过所述多媒体服务,加载所述相机源插件。Through the multimedia service, the camera source plug-in is loaded.
  7. 根据权利要求1至5任一项所述的方法,所述通过多媒体服务,接收所述Linux系统中应用程序发送的相机控制指令之前,还包括:According to the method according to any one of claims 1 to 5, before receiving the camera control instruction sent by the application program in the Linux system through the multimedia service, it also includes:
    在所述Linux系统启动后,启动Android容器;After the Linux system starts, start the Android container;
    启动所述Android容器中的Android相机服务,以供初始化所述相机。Start the Android camera service in the Android container for initializing the camera.
  8. 一种基于Linux的相机控制装置,包括:A Linux-based camera control setup consisting of:
    接收模块,设置为通过多媒体服务,接收所述Linux系统中应用程序发送的相机控制指令;The receiving module is configured to receive the camera control instruction sent by the application program in the Linux system through the multimedia service;
    控制模块,设置为基于相机源插件,控制相机执行所述相机控制指令对应的操作,并将所述相机的执行结果通过所述相机源插件返回至所述应用程序。The control module is configured to control the camera to execute the operation corresponding to the camera control instruction based on the camera source plug-in, and return the execution result of the camera to the application program through the camera source plug-in.
  9. 一种电子设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述程序时实现如权利要求1至7任一项所述基于Linux的相机控制方法的步骤。An electronic device, comprising a memory, a processor, and a computer program stored on the memory and operable on the processor, when the processor executes the program, the computer program described in any one of claims 1 to 7 is implemented. Describe the steps of the camera control method based on Linux.
  10. 一种非暂态计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述基于Linux的相机控制方法的步骤。A non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the Linux-based camera control method according to any one of claims 1 to 7 are implemented.
PCT/CN2022/105146 2021-12-29 2022-07-12 Linux-based camera control method and apparatus, and device and storage medium WO2023124007A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111628449.9A CN113986368A (en) 2021-12-29 2021-12-29 Linux-based camera control method, device, equipment and storage medium
CN202111628449.9 2021-12-29

Publications (1)

Publication Number Publication Date
WO2023124007A1 true WO2023124007A1 (en) 2023-07-06

Family

ID=79734864

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/105146 WO2023124007A1 (en) 2021-12-29 2022-07-12 Linux-based camera control method and apparatus, and device and storage medium

Country Status (2)

Country Link
CN (1) CN113986368A (en)
WO (1) WO2023124007A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113986368A (en) * 2021-12-29 2022-01-28 北京鲸鲮信息系统技术有限公司 Linux-based camera control method, device, equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104484181A (en) * 2014-12-23 2015-04-01 北京元心科技有限公司 Method, device and mobile device for controlling Android camera under glibc environment
US20200278895A1 (en) * 2019-02-28 2020-09-03 Crowdstrike, Inc. Container application for android-based devices
CN113190294A (en) * 2021-04-07 2021-07-30 北京鲸鲮信息系统技术有限公司 Method and device for calling Android HIDL interface by Linux system and storage medium
CN113824888A (en) * 2021-11-23 2021-12-21 北京鲸鲮信息系统技术有限公司 Linux-compatible Android camera control method, system, device and medium
CN113835672A (en) * 2021-11-23 2021-12-24 北京鲸鲮信息系统技术有限公司 Linux-compatible Android audio control method, system and device
CN113986368A (en) * 2021-12-29 2022-01-28 北京鲸鲮信息系统技术有限公司 Linux-based camera control method, device, equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113360179A (en) * 2021-06-24 2021-09-07 平安普惠企业管理有限公司 Camera API adaptation method, device, equipment and medium based on Android system
CN113452916A (en) * 2021-06-29 2021-09-28 技德技术研究所(武汉)有限公司 Linux-compatible Android camera image processing method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104484181A (en) * 2014-12-23 2015-04-01 北京元心科技有限公司 Method, device and mobile device for controlling Android camera under glibc environment
US20200278895A1 (en) * 2019-02-28 2020-09-03 Crowdstrike, Inc. Container application for android-based devices
CN113190294A (en) * 2021-04-07 2021-07-30 北京鲸鲮信息系统技术有限公司 Method and device for calling Android HIDL interface by Linux system and storage medium
CN113824888A (en) * 2021-11-23 2021-12-21 北京鲸鲮信息系统技术有限公司 Linux-compatible Android camera control method, system, device and medium
CN113835672A (en) * 2021-11-23 2021-12-24 北京鲸鲮信息系统技术有限公司 Linux-compatible Android audio control method, system and device
CN113986368A (en) * 2021-12-29 2022-01-28 北京鲸鲮信息系统技术有限公司 Linux-based camera control method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN113986368A (en) 2022-01-28

Similar Documents

Publication Publication Date Title
KR101292936B1 (en) Plug and play device redirection for remote systems
US8606950B2 (en) System and method for transparently processing multimedia data
TWI449429B (en) Computer system, computer-readable medium and method allowing applications to simultaneously use a physical camera thereof
KR101130474B1 (en) Generic usb drivers
US8788634B2 (en) Portable device upgrade via a content transfer protocol
WO2019072182A1 (en) Hardware abstraction layer multiplexing method and apparatus, operating system and device
WO2015196967A1 (en) Method and apparatus for application to permanently reside in background of operating system
CN110032413B (en) Desktop virtualization method, related equipment and computer storage medium
WO2023124002A1 (en) Linux-based audio control method and apparatus, device, and storage medium
US10747526B2 (en) Apparatus and method to execute prerequisite code before delivering UEFI firmware capsule
CN112612536B (en) Method and device for controlling camera shooting based on Android application program in Linux system
US20070043833A1 (en) Computer platform system program remote upgrading control method and system
WO2023124007A1 (en) Linux-based camera control method and apparatus, and device and storage medium
WO2023093715A1 (en) Camera control method, system and apparatus for achieving compatibility between linux and android, and medium
US10824486B1 (en) Two-way clipboard exchange in virtual console
CN113826074B (en) Adaptive real-time communication plug-in for virtual desktop infrastructure solutions
WO2020177731A1 (en) Real-time communication method between hosted applications
KR20200135138A (en) Method, device, apparatus, and medium for booting a virtual machine
CN107491330B (en) Method for improving running speed of embedded browser
WO2023035619A1 (en) Scene rendering method and apparatus, device and system
CN114302055A (en) Linux-based camera control method, device, equipment and storage medium
WO2022111277A1 (en) Hot-plug device information transmission method, computer device and readable medium
JP2019536173A (en) Reduce application resource usage
US10862757B2 (en) Isolating a redirected biometric device to a remote session
WO2020064000A1 (en) Method and apparatus for displaying message box, terminal and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22913296

Country of ref document: EP

Kind code of ref document: A1