Data acquisition method and device, equipment, storage medium and computer program product
By obtaining the target data structure provided by the operating system and using the data index to obtain camera video data, the problem of inconsistency between camera video data and status data in the existing technology is solved, data correlation is achieved, and system stability and security are improved. .
Patent Information
- Application Number
- CN202410572326.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-09
- Publication Date
- 2024-09-17
AI Technical Summary
In the existing technology, obtaining camera video data and camera status data requires two operations, which may cause data inconsistency when the system is busy, affecting the stability and security of the system.
By obtaining the target data structure provided by the operating system, which contains the camera status data and the data index of the buffer array, the camera video data is obtained using the data index to ensure the correlation between the camera status data and the video data.
It achieves consistent acquisition of camera video data and status data, avoids data inconsistencies, and improves system stability and security.
Smart Images

Figure CN118656515A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a data acquisition method, a data acquisition device, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] As cameras are used more and more widely, when acquiring video data from cameras, in order to ensure the normal operation of the cameras, it is necessary to acquire the status data of the cameras at the same time as acquiring the video data of the cameras, so as to troubleshoot the cameras in time and ensure that the cameras can operate normally and provide accurate video data.
[0003] However, currently obtaining camera video data and camera status data requires two acquisition operations, which may cause the camera video data and camera status data to be out of sync when the system is busy, resulting in the application being unable to respond to changes in camera status data in a timely manner, reducing the stability and security of the system. Summary of the invention
[0004] The main technical problem solved by the present application is to provide a data acquisition method, a data acquisition device, an electronic device, a computer-readable storage medium and a computer program product, which can ensure the consistency of camera video data and camera status data.
[0005] In order to solve the above technical problems, a technical solution adopted in the present application is: a data acquisition method is provided, the data acquisition method comprising: obtaining a target data structure provided by an operating system, the target data structure comprising camera status data and a data index of a buffer array, the buffer array being used to store a file handle corresponding to camera video data; obtaining the corresponding camera video data according to the file handle corresponding to the data index, so that the acquired camera status data and the camera video data are associated.
[0006] In some embodiments, before the step of obtaining the target data structure provided by the operating system, the data acquisition method further includes: determining a data index corresponding to the camera video data from a first buffer queue of the operating system according to the storage address of the camera video data obtained by the operating system, the first buffer queue being used to store the storage address of the camera video data and the data index of the buffer array; filling the camera status data obtained by the operating system into a corresponding initial data structure according to the data index corresponding to the camera video data to obtain the target data structure, the initial data structure including the data index of the buffer array and a null value working status.
[0007] In some embodiments, the step of filling the camera status data obtained by the operating system into the corresponding initial data structure according to the data index corresponding to the camera video data to obtain the target data structure includes: determining the corresponding initial data structure in a second buffer queue according to the data index corresponding to the camera video data, and the second buffer queue is used to store the initial data structure; filling the camera status data obtained by the operating system into the empty value working state to obtain the target data structure.
[0008] In some embodiments, before the step of determining the data index corresponding to the camera video data in the first buffer queue of the operating system according to the storage address of the camera video data obtained by the operating system, the method also includes: constructing a data array, the data array being used to store the initial data structure; and determining the first buffer queue and the second buffer queue based on the initial data structure in the data array.
[0009] In some embodiments, the step of determining the first buffer queue and the second buffer queue based on the data index in the data array and the initial data structure includes: inserting the initial data structure stored in the data array into the second buffer queue; determining the corresponding file handle according to the data index in the initial data structure; determining the storage address of the camera video data according to the corresponding file handle; inserting the storage address of the camera video data and the data index in the initial data structure into the first buffer queue.
[0010] In some embodiments, the step of acquiring corresponding camera video data according to the file handle corresponding to the data index so as to associate the acquired camera status data with the camera video data includes: determining the storage address of the camera video data according to the file handle corresponding to the data index; acquiring the camera video data according to the storage address of the camera video data so as to associate the acquired camera status data with the camera video data.
[0011] In order to solve the above technical problems, another technical solution adopted in the present application is: a data acquisition device is provided, the data acquisition device includes a first acquisition module and a second acquisition module, the first acquisition module is used to obtain a target data structure provided by an operating system, the target data structure includes camera status data and a data index of a buffer array, the buffer array is used to store a file handle corresponding to the camera video data; the second acquisition module is used to obtain the corresponding camera video data according to the file handle corresponding to the data index, so that the acquired camera status data and the camera video data are associated.
[0012] In order to solve the above technical problems, another technical solution adopted in the present application is: an electronic device is provided, including a memory and a processor, the processor is used to execute program instructions stored in the memory to implement the above data acquisition method.
[0013] In order to solve the above technical problems, another technical solution adopted in the present application is: providing a computer-readable storage medium on which program instructions are stored, and the above data acquisition method is implemented when the program instructions are executed by a processor.
[0014] In order to solve the above technical problem, another technical solution adopted by the present application is: providing a computer program product, which is used to implement the above data acquisition method when executed by a processor.
[0015] Compared with the current method of obtaining camera video data and camera status data through two operations, the above scheme is prone to the problem of inconsistency between camera video data and camera status data. The present application provides a data acquisition method, which includes: obtaining a target data structure provided by the operating system, the target data structure includes camera status data and a data index of a buffer array, and the buffer array is used to store the file handle corresponding to the camera video data; obtaining the corresponding camera video data according to the file handle corresponding to the data index, so that the obtained camera status data and camera video data are associated. Thus, the data indexes of the camera status data and the camera video data are stored in a target data structure, and the data indexes of the camera status data and the camera video data can be obtained through a single acquisition operation, and the corresponding camera video data can be found through the data index of the camera video data, which can ensure that the obtained camera video data and the camera status data are associated, avoiding the inconsistency between the camera video data and the camera status data. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work, among which:
[0017] Figure 1 is a flowchart of an exemplary embodiment of a data acquisition method shown in the present application;
[0018] Figure 2 yes Figure 1 A flow chart of an exemplary embodiment of the data acquisition method before step S110 is shown;
[0019] Figure 3 yes Figure 2 A schematic diagram of a framework of an exemplary embodiment of the data acquisition method before step S210 is shown;
[0020] Figure 4 yes Figure 1 A flow chart of an exemplary embodiment of step S120 in the data acquisition method is shown;
[0021] Figure 5 is a structural schematic diagram of an exemplary embodiment of a data acquisition device shown in the present application;
[0022] Figure 6 It is a structural schematic diagram of an embodiment of an electronic device provided by the present application;
[0023] Figure 7 It is a structural schematic diagram of an embodiment of a computer-readable storage medium provided by the present application. DETAILED DESCRIPTION
[0024] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It will be appreciated that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only some but not all structures related to the present application are shown in the drawings. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the art without making creative work are within the scope of protection of the present application.
[0025] First of all, it should be noted that cameras are currently widely used in vehicle-mounted applications, such as reversing images, AVM, DVR, DMS, etc. The operating environment of the vehicle-mounted system is complex and there are many cameras. During the use of the camera, unstable power supply and poor contact may occur, causing the camera status data to change. In-vehicle applications require higher security, so it is necessary to obtain camera video data and camera status data at the same time, and process the camera in time to ensure the stability of the system.
[0026] Currently, the application layer needs to actively call the interface to obtain the camera video data, and the application layer needs to listen to an event to obtain the camera status data. V4L2 sends an event to the application layer when the camera status data changes, which includes the camera status data. It can be seen that currently, obtaining the camera video data and camera status data requires two operations. When the system is busy, the camera video data and camera status data are prone to inconsistency, which affects travel safety.
[0027] Based on this, the present application provides a data acquisition method, a data acquisition device, an electronic device, a computer-readable storage medium, and a computer program product. Figure 1 , Figure 1 It is a flowchart of an exemplary embodiment of a data acquisition method shown in the present application.
[0028] The execution subject of the data acquisition method may be a terminal device or a server or other processing device, wherein the terminal device may be a user equipment (UE), a computer, a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. The execution subject of the data acquisition method may also be a data acquisition device. In some possible implementations, the data acquisition method may be implemented by a processor calling a computer-readable instruction stored in a memory.
[0029] Specifically, the data acquisition method of this embodiment includes the following steps:
[0030] S110: Acquire a target data structure provided by the operating system, the target data structure including camera status data and a data index of a buffer array, the buffer array being used to store a file handle corresponding to the camera video data.
[0031] The operating system manages computer hardware and software resources and provides interfaces and services for users and applications. Common operating systems include Android, Windows, macOS, Linux, Unix, etc. The Linux kernel is usually used to obtain camera video data and camera status data. The Linux kernel is the core component of the Linux operating system, responsible for managing system resources, providing hardware abstraction layer and scheduling tasks. The Linux kernel provides the V4L2 architecture (Video For Linux2, Linux Video Device Interface 2) for the development of Linux video applications. For the application layer, each camera will be defined as a Video node. The application layer calls the V4L2 related interface by operating the corresponding node to obtain the camera video data and the camera status data of the corresponding Video node. Among them, the application layer can be a Camera APP (camera application).
[0032] The target data structure includes the camera status data and the data index of the buffer array. Exemplarily, first, after the Linux kernel obtains the camera video data, it obtains the corresponding data index according to the storage address of the camera video data, and actively obtains the camera status data, and fills the obtained camera status data and data index into the initial data structure to obtain the target data structure. This ensures that each frame of video data obtained corresponds to the corresponding camera video data in the target data structure.
[0033] The camera status data includes the working status of the camera, etc. The working status includes None (initial status), Inited (initialized status), Running (starting status, collecting images), and No Signal (the camera is not online). When acquiring camera video data, the camera status data is generally Running (starting status, collecting images), and No Signal (the camera is not online).
[0034] Camera video data refers to the digital data consisting of video content captured and output by a camera, usually consisting of a series of continuous image frames.
[0035] The buffer array is used to store the file handle corresponding to the camera video data, that is, the array element corresponding to the data index in the buffer array is the file handle of the camera video data. The file handle can be used to identify the location and status of the file in the system. The storage address of the camera video data can be obtained through the file handle, and the corresponding file handle can also be obtained through the storage address of the camera video data. In the Linux kernel, the physical address of the buffer storing the camera video data can be obtained through the file handle, and the obtained physical address is filled into the DMA hardware, so that the camera video data can be directly filled into the buffer storing the camera video data without MEMCPY (memory copy); the data index of the buffer array is passed to the Linux kernel as the data index of the camera video data, ensuring that the data index and the file handle correspond one to one, so that the application layer can find the corresponding file handle in the buffer array through the data index, and then obtain the virtual address of the buffer.
[0036] The data index may refer to the position number of an element in an array or list. For example, the first element in the buffer array is usually referred to as data index 0, and the second element is data index 1. The elements in the buffer array are file handles of the camera video data.
[0037] The data acquisition device fills the acquired data index and camera status data into the initial data structure to obtain the target data structure.
[0038] S120: Obtain corresponding camera video data according to the file handle corresponding to the data index, so as to associate the obtained camera status data with the camera video data.
[0039] After the data acquisition device acquires the target data structure, it can extract the camera status data and the data index of the file handle therefrom, and acquire the storage address of the camera video data through the file handle corresponding to the data index, thereby acquiring the camera video data. Thus, the camera status data and the corresponding data index of the camera video data are acquired through a single acquisition operation, so that the acquired camera status data and the camera video data are associated, and the association means that the camera status data and the camera video data are synchronized in time and space. It should be noted that the above synchronization can refer to acquiring the camera status data and the camera video data at the same time point, and there can also be a certain time deviation, as long as it does not affect the stability of the system.
[0040] It can be seen that the data acquisition method of the embodiment of the present application acquires the target data structure provided by the operating system, the target data structure includes the camera status data and the data index of the buffer array, the buffer array is used to store the file handle corresponding to the camera video data; the corresponding camera video data is acquired according to the file handle corresponding to the data index, so that the acquired camera status data and the camera video data are associated. Thus, the data index of the camera status data and the camera video data are stored in a target data structure, the data index of the camera status data and the camera video data can be obtained through a single acquisition operation, and the corresponding camera video data can be found through the data index of the camera video data, which can ensure that the acquired camera video data and the camera status data are associated, avoiding the inconsistency between the camera video data and the camera status data.
[0041] Based on the above embodiments, the embodiments of the present application adopt Figure 2 The flowchart details how to get the target data structure. Figure 2 , Figure 2 yes Figure 1 The flowchart of an exemplary embodiment before step S110 in the data acquisition method is shown. Specifically, before the process of acquiring the target data structure provided by the operating system in step S110, the following steps are also included:
[0042] S210: According to the storage address of the camera video data obtained by the operating system, determine the data index corresponding to the camera video data from the first buffer queue of the operating system, the first buffer queue is used to store the storage address of the camera video data and the data index of the buffer array.
[0043] The storage address refers to the location of the camera video data in the memory. This address can be the physical address of the buffer storing the camera video data, directly pointing to the location of the camera video data in the memory chip, or it can be a virtual address that needs to be converted by the memory management unit (MMU) and finally mapped to the physical address. Exemplarily, the storage address of the camera video data can be obtained by the Linux kernel while obtaining the camera video data.
[0044] The first buffer queue can be used in the Linux kernel to store the storage address of the camera video data and the data index of the buffer array. Exemplarily, after obtaining the camera video data, the Linux kernel finds the corresponding data index through the storage address of the camera video data, fills the obtained camera status data into the initial data structure in the second buffer queue corresponding to the data index, and submits the filled target data structure to the application layer. The application layer obtains the camera status data and data index through the QDBUF (dequeue operation) system call, finds the corresponding file handle in the buffer array through the data index, and obtains the storage address of the camera video data according to the file handle, thereby successfully obtaining the camera video data and camera status data at the same time. The storage address is submitted to the peripheral camera (Camera peripheral), and the camera submits the video data to the corresponding buffer for storing the camera video data after successfully reading a frame of video data, so that the Linux kernel can obtain the corresponding camera video data.
[0045] When acquiring the camera video data, the data acquisition device acquires the storage address of the camera video data, and finds the corresponding data index in the first buffer queue according to the storage address of the camera video data.
[0046] In some embodiments, before the data index corresponding to the camera video data is determined from the first buffer queue of the operating system according to the storage address of the camera video data obtained by the operating system, and the first buffer queue is used to store the storage address of the camera video data and the data index of the buffer array, the data acquisition device will also construct a data array, and the data array is used to store the initial data structure; and the first buffer queue and the second buffer queue are determined based on the initial data structure in the data array. Among them, the step of determining the first buffer queue and the second buffer queue based on the initial data structure in the data array also includes: inserting the initial data structure stored in the data array into the second buffer queue; determining the corresponding file handle according to the data index in the initial data structure; determining the storage address of the camera video data according to the corresponding file handle; inserting the storage address of the camera video data and the data index in the initial data structure into the first buffer queue. In this way, the storage address of the camera video data and the camera status data are associated, which facilitates the synchronous acquisition of the camera video data and the camera status data.
[0047] The data array is used to store the data index and the initial data structure of the buffer array. It should be noted that when acquiring the camera status data and the camera video data, the initial data structure in the data array is filled with the acquired camera status data and becomes the target data structure. Therefore, the content stored in the data array at this time also includes the data index and the target data structure. The data stored in the data array constitutes a standard buffer of the Linux V4L2 architecture, which can be set to the second buffer queue in the Linux kernel through the system call (mmap) provided by the V4L2 subsystem. The application layer and the Linux kernel can manage the data structure (including the initial data structure and the target data structure) through the mmap function. The modification of the data structure by the application layer can be directly reflected to the Linux kernel. Similarly, the modification of the data structure by the Linux kernel is also directly reflected to the application layer. Therefore, the efficiency of operations such as large-scale data transmission between the Linux kernel and the application layer can be improved through the mmap function.
[0048] The second buffer queue provides a communication interface between the application layer and the Linux kernel, is maintained by the V4L2 subsystem, and is used to store data structures in the Linux kernel. Exemplarily, the Linux kernel creates a second buffer queue and mounts the initial data structure in the data array into the second buffer queue. After obtaining the camera status data, the Linux kernel will fill the camera status data into the initial data structure in the second buffer queue. The application layer can obtain the filled target data structure in the second buffer queue through the mmap function, thereby directly obtaining the data index of the camera status data and the camera video data, and obtain the corresponding camera video data through the file handle corresponding to the data index.
[0049] For example, see Figure 3 , Figure 3 yes Figure 2The framework diagram of an exemplary embodiment before step S210 in the data acquisition method is shown. The framework includes an application layer and a Linux kernel layer, and part of the driver program content is implemented in the application layer and the Linux kernel layer respectively, and a packaged structure is provided to the application layer, so that the camera video data and the corresponding camera status data can be obtained respectively at each DQBUF (get a frame of data) operation. Specifically, before constructing the data array, the application layer calls the ION interface to apply for a DMA BUF as a buffer for the camera video data, and obtains the file handle fd of the buffer through the return value of the interface; the application layer constructs BufferArray, that is, the buffer array, and inserts the obtained file handle fd into the unwritten position in BufferArray through traversal, and reads the data index bufIdx of the file handle fd in BufferArray; the application layer constructs the capture_priv structure, that is, the initial data structure; the application layer constructs DataArray, that is, the data array, and inserts the capture_priv structure into the unwritten position in DataArray through traversal, and obtains the index dataIdx of the capture_priv structure in DataArray; the application layer enqueues the capture_priv structure in DataArray, that is, mounts the capture_priv structure in DataArray to the V4L2 Buffer Queue queue in the Linux kernel, and the V4L2 Buffer The Queue queue is also the second buffer queue; the application layer executes the setFd operation, through which the capture_priv structure and file handle in the DataArray can be submitted to the Linux kernel. The Linux kernel executes the corresponding setFd operation, and when executing the setFd operation, the corresponding file handle in the data index is taken out, and the buffer address of the DMA BUF is obtained through the file handle, which is also the storage address of the camera video data; the buffer address is filled into the second buffer queue, so that the capture_priv structure and buffer address are stored in the second buffer queue, and the one-to-one correspondence between the data index and the file handle is realized in the Linux kernel. The Linux kernel enters the buffer address and data index into the Real Buffer Queue queue, which is also the first buffer queue, and submits the buffer address and data index to the external camera (Camera external device). After successfully reading a frame of video data, the external camera will submit the video data to the corresponding buffer.
[0050] S220: Fill the camera status data obtained by the operating system into the corresponding initial data structure according to the data index corresponding to the camera video data to obtain a target data structure, wherein the initial data structure includes the data index of the buffer array and the null value working state.
[0051] The initial data structure includes the data index of the buffer array and the null value working state. The null value working state means that the structure that has not been filled with the camera status data is set to a null value. Exemplarily, the initial data structure can be constructed by the application layer driver and customized as a capture_priv type structure to obtain the initial data structure.
[0052] Specifically, the data acquisition device determines the corresponding initial data structure in the second buffer queue according to the data index corresponding to the camera video data, and the second buffer queue is used to store the initial data structure; the camera status data acquired by the operating system is filled into the empty working state to obtain the target data structure. After the Linux kernel acquires the camera status data, it finds the corresponding initial data structure according to the data index acquired in step S210, and fills the acquired camera status data into the empty working state in the initial data structure to obtain the target data structure. The target data structure is passed to the application layer through V4L2, and the application layer takes out the camera status data and data index in the target data structure, finds the corresponding file handle in the buffer array through the data index, and determines the storage address of the camera video data according to the file handle, thereby acquiring the camera video data. In this way, the filling position of the camera status data is determined by the data index, which ensures the consistency of the camera status data and the camera video data.
[0053] It can be seen that the data acquisition method of the embodiment of the present application determines the data index corresponding to the camera video data from the first buffer queue of the operating system according to the storage address of the camera video data acquired by the operating system, and the first buffer queue is used to store the storage address of the camera video data and the data index of the buffer array; according to the data index corresponding to the camera video data, the camera status data acquired by the operating system is filled into the corresponding initial data structure to obtain the target data structure, and the initial data structure includes the data index of the buffer array and the null value working state. In this way, the data index of the camera status data and the camera video data acquired at the same time are stored in the same data structure, which is convenient for the application layer to obtain the associated camera status data and camera video data.
[0054] Based on the above embodiments, the embodiments of the present application adopt Figure 4 The flowchart details how to obtain the associated camera video data and camera status data. Figure 4 , Figure 4 yes Figure 1 The flowchart of an exemplary embodiment of step S120 in the data acquisition method is shown. Specifically, in step S120, the corresponding camera video data is acquired according to the file handle corresponding to the data index, so that the acquired camera status data and the camera video data are associated with each other, including the following steps:
[0055] S410: Determine the storage address of the camera video data according to the file handle corresponding to the data index.
[0056] The file handle and the storage address have a corresponding relationship. The corresponding storage address can be obtained through the file handle, and the corresponding file handle can be obtained through the storage address. After obtaining the data index of the camera video data, the data acquisition device finds the corresponding file handle in the buffer array according to the data index, and determines the storage address of the camera video data according to the file handle.
[0057] S420: Acquire the camera video data according to the storage address of the camera video data, so as to associate the acquired camera status data with the camera video data.
[0058] After determining the storage address of the camera video data according to the file handle, the data acquisition device takes out the camera video data from the storage address corresponding to the camera video data, thereby acquiring the associated camera status data and the camera video data.
[0059] It can be seen that the data acquisition method of the embodiment of the present application determines the storage address of the camera video data according to the file handle corresponding to the data index; the camera video data is acquired according to the storage address of the camera video data, so that the acquired camera status data is associated with the camera video data. Thus, the storage address of the camera video data can be quickly located through the file handle.
[0060] See also Figure 5 , Figure 5 1 is a schematic diagram of an exemplary embodiment of a data acquisition device shown in the present application. The data acquisition device 500 includes a first acquisition module 510 and a second acquisition module 520. The first acquisition module 510 is used to acquire a target data structure provided by an operating system. The target data structure includes camera status data and a data index of a buffer array. The buffer array is used to store a file handle corresponding to the camera video data. The second acquisition module 520 is used to acquire the corresponding camera video data according to the file handle corresponding to the data index, so that the acquired camera status data and the camera video data are associated.
[0061] In the above method, the data acquisition device of the embodiment of the present application acquires the target data structure provided by the operating system, the target data structure includes the camera status data and the data index of the buffer array, the buffer array is used to store the file handle corresponding to the camera video data; the corresponding camera video data is acquired according to the file handle corresponding to the data index, so that the acquired camera status data and the camera video data are associated. Thus, the data index of the camera status data and the camera video data are stored in a target data structure, the data index of the camera status data and the camera video data can be obtained through a single acquisition operation, and the corresponding camera video data can be found through the data index of the camera video data, which can ensure that the acquired camera video data and the camera status data are associated, avoiding the inconsistency between the camera video data and the camera status data.
[0062] In some embodiments, the data acquisition device 500 also includes a filling module (not shown in the figure), which is used to determine the data index corresponding to the camera video data from the first buffer queue of the operating system according to the storage address of the camera video data obtained by the operating system, and the first buffer queue is used to store the storage address of the camera video data and the data index of the buffer array; according to the data index corresponding to the camera video data, the camera status data obtained by the operating system is filled into the corresponding initial data structure to obtain the target data structure, and the initial data structure includes the data index of the buffer array and the null value working status.
[0063] In some embodiments, the filling module (not shown) also determines the corresponding initial data structure according to the data index corresponding to the camera video data; fills the camera status data obtained by the operating system into the empty value working state to obtain the target data structure.
[0064] In some embodiments, the data acquisition device 500 also includes a construction module (not shown), which is used to construct a data array, and the data array is used to store an initial data structure; the first buffer queue and the second buffer queue are determined based on the initial data structure in the data array.
[0065] In some embodiments, the data acquisition device 500 also includes a queue-insertion module (not shown), which is used to insert the initial data structure stored in the data array into the second buffer queue; determine the corresponding file handle according to the data index in the initial data structure; determine the storage address of the camera video data according to the corresponding file handle; and insert the storage address of the camera video data and the data index in the second buffer queue into the first buffer queue.
[0066] In some embodiments, the second acquisition module 520 further determines the storage address of the camera video data according to the file handle corresponding to the data index; and acquires the camera video data according to the storage address of the camera video data, so that the acquired camera status data is associated with the camera video data.
[0067] The functions of each module can be found in the data acquisition method embodiment, which will not be described in detail here.
[0068] In order to implement the data acquisition method of the above embodiment, the present application proposes another electronic device, which is specifically referred to as Figure 6 , Figure 6 It is a structural schematic diagram of an embodiment of an electronic device provided by the present application.
[0069] The electronic device 600 includes a memory 610 and a processor 620 , wherein the memory 610 and the processor 620 are coupled.
[0070] The memory 610 is used to store program data, and the processor 620 is used to execute the program data to implement the data acquisition method of the above embodiment.
[0071] In this embodiment, the processor 620 may also be referred to as a CPU (Central Processing Unit). The processor 620 may be an integrated circuit chip having signal processing capabilities. The processor 620 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. A general-purpose processor may be a microprocessor or the processor 620 may also be any conventional processor, etc.
[0072] The above scheme obtains the target data structure provided by the operating system, the target data structure includes the camera status data and the data index of the buffer array, and the buffer array is used to store the file handle corresponding to the camera video data; the corresponding camera video data is obtained according to the file handle corresponding to the data index, so that the obtained camera status data and the camera video data are associated. Thus, the data index of the camera status data and the camera video data are stored in a target data structure, and the data index of the camera status data and the camera video data can be obtained through a single acquisition operation, and the corresponding camera video data can be found through the data index of the camera video data, which can ensure that the obtained camera video data and the camera status data are associated, avoiding the inconsistency between the camera video data and the camera status data.
[0073] The present application also provides a computer readable storage medium 700, such as Figure 7As shown, the computer-readable storage medium 700 is used to store program data 710. When the program data 710 is executed by the processor, it is used to implement the data acquisition method in the method embodiment of the present application.
[0074] The above scheme obtains the target data structure provided by the operating system, the target data structure includes the camera status data and the data index of the buffer array, and the buffer array is used to store the file handle corresponding to the camera video data; the corresponding camera video data is obtained according to the file handle corresponding to the data index, so that the obtained camera status data and the camera video data are associated. Thus, the data index of the camera status data and the camera video data are stored in a target data structure, and the data index of the camera status data and the camera video data can be obtained through a single acquisition operation, and the corresponding camera video data can be found through the data index of the camera video data, which can ensure that the obtained camera video data and the camera status data are associated, avoiding the inconsistency between the camera video data and the camera status data.
[0075] In some embodiments, the present application also provides a computer program product, which, when executed by a processor, is used to implement the above-mentioned data acquisition method.
[0076] It is understandable that the computer program product may be a computer program product contained in a tangible computer-readable medium, and the computer program product includes a program code for executing the above-mentioned data acquisition method. In some embodiments, the computer program product can be downloaded and installed from the Internet, or copied, transferred, and installed between different computer hardware. Its wireless transmission method may include the Internet, Bluetooth, WIFI, etc., and its wired transmission method may include USB, lighting, type-C, etc.
[0077] The above scheme obtains the target data structure provided by the operating system, the target data structure includes the camera status data and the data index of the buffer array, and the buffer array is used to store the file handle corresponding to the camera video data; the corresponding camera video data is obtained according to the file handle corresponding to the data index, so that the obtained camera status data and the camera video data are associated. Thus, the data index of the camera status data and the camera video data are stored in a target data structure, and the data index of the camera status data and the camera video data can be obtained through a single acquisition operation, and the corresponding camera video data can be found through the data index of the camera video data, which can ensure that the obtained camera video data and the camera status data are associated, avoiding the inconsistency between the camera video data and the camera status data.
[0078] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0079] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0080] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, units or components can be combined or integrated into another system, or some features can be ignored or not executed. In another image position, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0081] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
Claims
1. A data acquisition method, characterized in that: The data acquisition method comprises: Obtaining a target data structure provided by the operating system, wherein the target data structure includes camera status data and a data index of a buffer array, wherein the buffer array is used to store a file handle corresponding to the camera video data; The corresponding camera video data is obtained according to the file handle corresponding to the data index, so that the obtained camera status data is associated with the camera video data.
2. The data acquisition method according to claim 1, characterized in that: Before the step of obtaining the target data structure provided by the operating system, the data acquisition method further includes: According to the storage address of the camera video data obtained by the operating system, determining the data index corresponding to the camera video data from a first buffer queue of the operating system, wherein the first buffer queue is used to store the storage address of the camera video data and the data index of the buffer array; The camera status data acquired by the operating system is filled into the corresponding initial data structure according to the data index corresponding to the camera video data to obtain the target data structure, wherein the initial data structure includes the data index of the buffer array and the null value working state.
3. The data acquisition method according to claim 2, characterized in that: The step of filling the camera status data acquired by the operating system into the corresponding initial data structure according to the data index corresponding to the camera video data to obtain the target data structure comprises: According to the data index corresponding to the camera video data, determining the corresponding initial data structure in a second buffer queue, wherein the second buffer queue is used to store the initial data structure; The camera status data acquired by the operating system is filled into the null value working state to obtain the target data structure.
4. The data acquisition method according to claim 2, characterized in that: Before the step of determining the data index corresponding to the camera video data in the first buffer queue of the operating system according to the storage address of the camera video data obtained by the operating system, the data acquisition method further includes: Constructing a data array, wherein the data array is used to store the initial data structure; The first buffer queue and the second buffer queue are determined based on the initial data structure in the data array.
5. The data acquisition method according to claim 4, characterized in that: The step of determining the first buffer queue and the second buffer queue based on the data index in the data array and the initial data structure comprises: Inserting the initial data structure stored in the data array into the second buffer queue; Determine the corresponding file handle according to the data index in the initial data structure; Determine the storage address of the camera video data according to the corresponding file handle; The storage address of the camera video data and the data index in the initial data structure are inserted into the first buffer queue.
6. The data acquisition method according to claim 1, characterized in that: The step of acquiring corresponding camera video data according to the file handle corresponding to the data index so as to associate the acquired camera status data with the camera video data comprises: Determine the storage address of the camera video data according to the file handle corresponding to the data index; The camera video data is acquired according to the storage address of the camera video data, so that the acquired camera status data is associated with the camera video data.
7. A data acquisition device, characterized in that: The data acquisition device comprises: A first acquisition module is used to acquire a target data structure provided by an operating system, wherein the target data structure includes camera status data and a data index of a buffer array, wherein the buffer array is used to store a file handle corresponding to the camera video data; The second acquisition module is used to acquire the corresponding camera video data according to the file handle corresponding to the data index, so that the acquired camera status data is associated with the camera video data.
8. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores program instructions, and the processor retrieves the program instructions from the memory to execute the data acquisition method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: include: Program data is stored, and when the program data is executed by a processor, it is used to implement the data acquisition method according to any one of claims 1 to 6.
10. A computer program product, characterized in that When the computer program product is executed by a processor, it is used to implement the data acquisition method according to any one of claims 1 to 6.
