CN110008179B - File storage method, automobile data recorder and readable storage medium - Google Patents
File storage method, automobile data recorder and readable storage medium Download PDFInfo
- Publication number
- CN110008179B CN110008179B CN201910262672.2A CN201910262672A CN110008179B CN 110008179 B CN110008179 B CN 110008179B CN 201910262672 A CN201910262672 A CN 201910262672A CN 110008179 B CN110008179 B CN 110008179B
- Authority
- CN
- China
- Prior art keywords
- file
- files
- storage
- allocation
- size
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/13—File access structures, e.g. distributed indices
-
- G—PHYSICS
- G07—CHECKING-DEVICES
- G07C—TIME OR ATTENDANCE REGISTERS; REGISTERING OR INDICATING THE WORKING OF MACHINES; GENERATING RANDOM NUMBERS; VOTING OR LOTTERY APPARATUS; ARRANGEMENTS, SYSTEMS OR APPARATUS FOR CHECKING NOT PROVIDED FOR ELSEWHERE
- G07C5/00—Registering or indicating the working of vehicles
- G07C5/08—Registering or indicating performance data other than driving, working, idle, or waiting time, with or without registering driving, working, idle or waiting time
- G07C5/0841—Registering performance data
- G07C5/085—Registering performance data using electronic data carriers
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Signal Processing For Digital Recording And Reproducing (AREA)
Abstract
The invention discloses a file storage method of a vehicle event data recorder, which comprises the following steps: acquiring the size of a prerecorded video, and selecting a file from a local memory to take the currently selected file size as a first storage capacity; subtracting the size of the pre-recorded video from the first storage capacity to obtain a first storage difference; and when the first storage difference value is greater than 0, deleting all selected files, and creating a pre-allocation file with the size of the first storage difference value and a pre-allocation file with the size of the pre-recorded video. The invention also discloses a vehicle event data recorder and a readable storage medium. The invention can fully utilize the storage space when storing the file, and can not generate storage fragments.
Description
Technical Field
The invention relates to the field of vehicle-mounted equipment, in particular to a file storage method of a vehicle recorder, the vehicle recorder and a readable storage medium.
Background
The automobile data recorder is an instrument for recording audio and video related data during the running process of a vehicle, and the core of the automobile data recorder is data storage, but because the data storage space of the automobile data recorder is limited, when the stored and recorded video data reach a certain preset value, the video data recorded later can cover the video data recorded first, a large amount of storage fragments can be generated during the data coverage, the storage space is wasted, and the video recording can be influenced, so that the equipment is abnormal.
Disclosure of Invention
The invention provides a file storage method of a vehicle data recorder, the vehicle data recorder and a readable storage medium, and aims to solve the problems that storage space is wasted and videos cannot be recorded due to storage fragments generated during data storage of the vehicle data recorder.
In order to achieve the above object, the present invention provides a file storage method of a vehicle event data recorder, the method comprising the steps of:
acquiring the size of a prerecorded video, and selecting a file from a local memory to take the currently selected file size as a first storage capacity;
subtracting the size of the pre-recorded video from the first storage capacity to obtain a first storage difference;
and when the first storage difference value is greater than 0, deleting all selected files, and creating a pre-allocation file with the size of the first storage difference value and a pre-allocation file with the size of the pre-recorded video.
Optionally, the step of selecting a file from the local storage to use the current selected file size as the first storage capacity includes:
determining whether a pre-allocation file exists in the local memory;
if yes, selecting one pre-allocation file from all pre-allocation files, and taking the size of the pre-allocation file selected currently as a first storage capacity;
if not, selecting one recording file from all recording files, and taking the size of the recording file currently selected as the first storage capacity.
Optionally, after the step of subtracting the size of the pre-recorded video from the first storage capacity to obtain the first storage difference, the method further includes:
when the pre-allocation files exist in the local memory and the first storage difference value is smaller than 0, judging whether unselected pre-allocation files exist in all the pre-allocation files;
when the unselected pre-allocation files do not exist in all the pre-allocation files, storing the pre-recorded video according to the recorded files in the local memory and all the pre-allocation files;
when the unselected pre-allocation files exist in all the pre-allocation files, continuing to select the next pre-allocation file from all the pre-allocation files, and adding the selected pre-allocation file size into the first storage capacity to update the first storage capacity so as to execute the steps of: and subtracting the size of the pre-recorded video from the first storage capacity to obtain a first storage difference.
Optionally, before the step of determining whether the unselected pre-allocation file exists in all the pre-allocation files, the method further includes:
when the pre-allocation file exists in the local memory and the first storage difference value is smaller than 0, judging whether the sum of the sizes of all the pre-allocation files is larger than or equal to the size of the pre-recorded file;
if yes, executing the steps of: judging whether unselected pre-allocation files exist in all the pre-allocation files;
if not, executing the steps of: and storing the pre-recorded video according to the recorded files and all pre-allocated files in the local memory.
Optionally, the step of storing the pre-recorded video according to the recorded file and all pre-allocated files in the local memory includes:
selecting one recording file from all recording files, and adding the size of the selected recording file with the first storage difference value to obtain a second storage difference value;
and when the second storage difference value is greater than 0, deleting all pre-allocation files and all selected recording files, and creating the pre-allocation files with the size of the second storage difference value and the pre-allocation files with the size of the pre-recorded video.
Optionally, after the step of selecting one recording file from all the recording files and adding the size of the selected recording file to the first storage difference value to obtain the second storage difference value, the method further includes:
and when the second storage difference value is smaller than 0, continuing to select the next recorded file from all the recorded files, and adding the second storage difference value to the selected recorded file size until the second storage difference value is larger than 0, executing: and deleting all the pre-allocated files and all the selected recorded files, and creating the pre-allocated files with the size of the second storage difference value and the pre-allocated files with the size of the pre-recorded video.
Optionally, after the step of subtracting the size of the pre-recorded video from the first storage capacity to obtain the first storage difference, the method further includes:
when the pre-allocation file does not exist in the local memory and the first storage difference value is smaller than 0, continuing to select the next recording file from all the recording files, adding the first storage difference value to the selected recording file size, and executing the steps until the first storage difference value is larger than 0: and deleting all the selected files, and creating a pre-allocation file with the size of the first storage difference value and a pre-allocation file with the size of the pre-recorded video.
Optionally, before the step of obtaining the pre-recorded video size, the method further includes:
acquiring a preset recording time length and a preset recording resolution of a pre-recorded video;
and calculating the size of the pre-recorded video according to the preset recording time and the preset recording resolution.
In addition, to achieve the above object, the present invention further provides a vehicle event data recorder, including: the system comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the computer program is executed by the processor to realize the file storage method of the automobile data recorder.
In addition, to achieve the above object, the present invention also provides a readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the file storage method of the automobile data recorder as described above.
The method comprises the steps of obtaining the size of a prerecorded video, and selecting a file from a local memory to take the size of the file currently selected as a first storage capacity; subtracting the size of the pre-recorded video from the first storage capacity to obtain a first storage difference; and when the first storage difference value is greater than 0, deleting all selected files, and creating a pre-allocation file with the size of the first storage difference value and a pre-allocation file with the size of the pre-recorded video. The invention can solve the problem of storing fragments, fully utilize the storage space and avoid the waste of the storage space.
Drawings
Fig. 1 is a schematic hardware structure of a vehicle recorder according to an embodiment of the present invention;
fig. 2 is a flowchart of a first embodiment of a file storage method of the automobile data recorder according to the present invention;
fig. 3 is a flowchart of a fifth embodiment of a file storage method of a vehicle event data recorder according to the present invention.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Referring to fig. 1, fig. 1 is a schematic hardware structure of a vehicle event data recorder according to the present invention. The automobile data recorder may include a processor 10, a memory 20, and the like. In the automobile data recorder, the processor 10 is respectively connected with the memory 20, and the memory 20 stores a computer program, and the computer program is executed by the processor 10 at the same time, and when executed, implements the steps of the method embodiments described below.
The processor 10, which is a control center of the vehicle recorder, connects various parts of the whole vehicle recorder by various interfaces and lines, and performs various functions and processes data of the vehicle recorder by running or executing software programs and/or modules stored in the memory 20 and calling data stored in the memory 20, thereby performing overall monitoring of the vehicle recorder. The processor 10 may include one or more processing units; alternatively, the processor 10 may integrate an application processor that primarily handles operating systems, user interfaces, applications, etc., with a modem processor that primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 10.
The memory 20 is used for storing software programs and various data. The memory 20 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function (such as acquiring a pre-recorded video size), etc.; the storage data area may include a database, may store data or information created according to the use of the system, and the like. In addition, the memory 20 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
Although not shown in fig. 1, the automobile data recorder may further include a circuit control module, configured to connect to a power supply, so as to ensure normal operation of other components; and the system also comprises a communication module which can be connected with external communication equipment through a network. The communication module can receive a request sent by external communication equipment and can also send the request, the instruction and the information to the external communication equipment. The external communication device may be a user terminal or other system server or the like.
It will be appreciated by those skilled in the art that the vehicle recorder structure shown in fig. 1 does not constitute a limitation of the vehicle recorder, and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
Based on the above hardware structure, various embodiments of the method of the present invention are presented.
Referring to fig. 2, fig. 2 is a flowchart of a first embodiment of a file storage method of a vehicle event data recorder according to the present invention, and in this embodiment, the method includes:
step S10, obtaining the size of a prerecorded video, and selecting a file from a local memory to take the size of the file currently selected as a first storage capacity;
the local memory of the implementation routine recorder comprises pre-allocation files and/or non-pre-allocation files (recording files), and can also comprise other operation files or media files required by the vehicle recorder, wherein the pre-allocation files can be pre-created in the local memory, are empty files without data, and can be the same or different in available size, for example, the pre-allocation files with the size of 60M are created; pre-allocation files of different sizes can also be created; or the pre-allocation file created may be a multiple of 60M, for example, creating a plurality of pre-allocation files of different sizes of 60M, 120M, 180M, 300M, etc. In addition, the pre-allocation file size may also be related to the pre-recorded video resolution and/or the playing duration preset by the automobile data recorder, for example, the pre-recorded video size of 1080P for one-minute playing time is 120M, and the pre-recorded video size of 720P for one-minute playing time is 60M.
It should be noted that, the local memory of the automobile data recorder is initially all pre-allocated files, and when the pre-allocated files are stored in the data, the types of the pre-allocated files are changed into non-pre-allocated files, and the non-pre-allocated files are files in which recorded video data are stored, and can also be called as recorded files. The pre-recorded video is video data to be recorded, the size of the pre-recorded video data can be obtained, a file is selected from the local memory, the file can be a pre-allocation file or a recording file, and the selected pre-allocation file or the recording file size is used as the first storage capacity. Optionally, other media files may also be used as selectable files in the current memory.
Step S20, subtracting the size of the pre-recorded video from the first storage capacity to obtain a first storage difference;
in this embodiment, the first storage capacity is subtracted from the size of the pre-recorded video to obtain a first storage difference, and the size of the selected pre-allocated file or the size of the selected recorded file can be determined by analyzing the first storage difference.
Step S30, deleting all files selected when the first storage difference value is larger than 0, and creating a pre-allocation file with the size of the first storage difference value and a pre-allocation file with the size of the pre-recorded video.
In this embodiment, when a file is selected, the difference between the selected file size and the pre-recorded video size is greater than 0, which indicates that the currently selected file size may satisfy the pre-recorded video size, and there is additional storage space. When redundant storage space exists, the selected files can be split, all the selected files are deleted, the storage space is released, and a pre-allocation file with a first storage difference value and a pre-allocation file with a pre-recorded video size are created, wherein the pre-allocation file created with the first storage difference value can be used for storing other pre-recorded video data; a pre-allocation file created at the pre-recorded video size is used to store the video data that is currently about to be recorded. The pre-allocation file created with the storage difference can also be used for storing other pre-recorded video data, thereby avoiding the waste of storage space and avoiding the influence of storage fragments on video recording.
Further, a second embodiment of the file storage method of the automobile data recorder is provided based on the first embodiment of the file storage method of the automobile data recorder, in this embodiment, the step of selecting a file from the local memory in the step S10 to use the current selected file size as the first storage capacity includes:
step S100, determining whether a pre-allocation file exists in a local memory; if yes, go to step S110; if not, step S120 is performed.
Step S110, selecting one pre-allocation file from all pre-allocation files, and taking the size of the pre-allocation file selected currently as a first storage capacity;
step S120, selecting one recording file from all recording files, and taking the size of the recording file currently selected as the first storage capacity.
In this embodiment, when video data is stored in the driving recorder, a pre-allocation file is preferentially used. Before video data is recorded, traversing a double linked list in a local memory to search for a preallocated file. The bidirectional linked list is a chain type storage structure, which can link a series of unconnected memories and can conveniently access the predecessor node and the successor node. The bidirectional linked list comprises a plurality of file nodes, each time the bidirectional linked list is traversed, the first file node is started, and each file node comprises a file type, a file size, a file name, video recording time in the file, recording duration, recording resolution and the like. Where file types are divided into pre-allocated files and non-pre-allocated files (recorded files), and file size refers to the available storage capacity size of the file.
Firstly traversing a double linked list in a local memory, selecting one pre-allocation file from all pre-allocation files when determining that the pre-allocation file exists in the local memory, traversing the double linked list according to the size of the pre-recorded file to find the pre-allocation file conforming to the current size of the pre-recorded file, generally traversing from a first file node until finding a first pre-allocation file with the same size as the pre-recorded file, and taking the selected pre-allocation file as a first storage capacity; if the pre-allocation file with the same size as the pre-recorded file is not found, the first pre-allocation file traversed can be selected, and the selected pre-allocation file is used as the first storage capacity. Or when the pre-allocation file is selected, directly selecting the first traversed pre-allocation file, taking the selected pre-allocation file as the first storage capacity, and when video data is stored, preferentially using the pre-allocation file can prolong the storage time of the recorded file.
In this embodiment, a doubly linked list in the local storage is traversed, when no pre-allocation file is found, which indicates that the pre-allocation file is used, and when it is determined that the pre-allocation file does not exist in the local storage, one recording file is selected from all recording files, a recording file conforming to the current size of the pre-recording file can be found by traversing the doubly linked list according to the size of the pre-recording file, generally, traversing from a first file node until a first recording file having the same size as the pre-recording file is found, taking the selected recording file as a first storage capacity, and if no recording file having the same size as the pre-recording file is found, selecting the traversed first recording file, and taking the selected recording file as the first storage capacity. Or when the recorded file is selected, directly selecting the traversed first recorded file, and taking the selected recorded file as the first storage capacity. Or selecting one recording file from all recording files according to the sequence from the early to the late of the recording time, taking the selected recording file as the first storage capacity, and selecting the recording file according to the sequence from the early to the late of the recording time can save the video data with relatively late of the recording time for a longer time.
Further, a third embodiment of the file storage method of the automobile data recorder according to the present invention is provided based on the second embodiment of the file storage method of the automobile data recorder, and in this embodiment, after step S20, the method further includes:
step S41, judging whether unselected pre-allocation files exist in all the pre-allocation files or not when the pre-allocation files exist in the local memory and the first storage difference value is smaller than 0;
step S42, when the unselected pre-allocation files do not exist in all the pre-allocation files, storing the pre-recorded video according to the recorded files and all the pre-allocation files in the local memory;
step S43, when the unselected pre-allocation files exist in all the pre-allocation files, continuing to select the next pre-allocation file from all the pre-allocation files, and adding the selected pre-allocation file size into the first storage capacity to update the first storage capacity, so as to return to executing step S20.
In this embodiment, when a pre-allocated file exists in the local memory and a first storage difference value obtained by subtracting the size of the pre-allocated file from the size of the pre-recorded video is smaller than 0, it is indicated that the size of the pre-allocated file selected currently cannot meet the size of the pre-recorded video, and it is necessary to determine whether there is an unselected pre-allocated file in all pre-allocated files. When there is no pre-allocation file that is not selected among all pre-allocation files, it means that all pre-allocation files in the current local storage are selected, and at this time, the requirement that the first storage difference is greater than 0 still cannot be satisfied, and the recording file is needed to be used, and the pre-recorded video data is stored according to the recording file in the local storage and the pre-allocation file.
When there are unselected preallocated files in all preallocated files, it means that there are unselected preallocated files in the local memory at this time, the bidirectional list can be traversed, preallocated files after the file node to which the current preallocated file belongs are selected, the preallocated file size is obtained, the preallocated file size is added into the first storage capacity to update the first storage capacity, and then step S20 is executed to continue to analyze the first storage difference value.
In this embodiment, when the pre-allocation file exists in the local memory and the first storage difference value is smaller than 0, by judging whether all the pre-allocation files have unselected pre-allocation files, when all the pre-allocation files have unselected pre-allocation files, the next pre-allocation file is continuously selected, the size of the selected pre-allocation file is added to the first storage capacity, and the first storage difference value is continuously analyzed. By analyzing the first stored difference, it is known whether the selected file size can meet the prerecorded video size. When the unselected pre-allocation files do not exist in all the pre-allocation files, the fact that no pre-allocation files can be used is indicated, the pre-recorded video can be stored according to the recorded files and all the pre-allocation files in the local memory, and the storage of the pre-recorded video can be met by combining the recorded files and all the pre-allocation files.
Further, before the step of determining whether the unselected pre-allocation file exists in all the pre-allocation files in step S41, the method further includes:
step S401, when the pre-allocation file exists in the local memory and the first storage difference value is smaller than 0, judging whether the sum of the sizes of all the pre-allocation files is larger than or equal to the size of the pre-recorded file; if yes: a step of judging whether or not there is an unselected pre-allocation file among all pre-allocation files in step S41; if no: the step of storing the pre-recorded video according to the recorded files and all pre-allocated files in the local storage in step S42 is performed.
In this embodiment, when the pre-allocation file exists in the local memory and the first storage difference is smaller than 0, it may be first determined whether the sum of all the pre-allocation file sizes satisfies the pre-recorded file size, and if all the pre-allocation file sizes are larger than or equal to the pre-recorded video file size, the pre-recorded video data may be stored only by using the pre-allocation file; if all the pre-allocation files are smaller than the pre-recorded video size, all the pre-allocation files and part of the recorded files need to be used to store the pre-recorded video data. When video data is stored, the pre-allocation file is preferentially used, and when the pre-allocation file which can be used is not available, the recording file is reused, so that the storage time of the recording file can be longer. In addition, by comparing the sum of all pre-allocated files in advance, the comparison time is saved, and the division speed of the file storage space is improved.
In this embodiment, when the pre-allocation file exists in the local memory and the first storage difference value is equal to 0, it is indicated that the size of the selected pre-allocation file is equal to the size of the pre-recorded video, and the size of the pre-allocation file selected currently just can meet the size of the pre-recorded video, so that the pre-recorded video data can be stored directly by using the selected pre-allocation file.
Further, after step S20, the method further includes:
and S201, when the pre-allocation file does not exist in the local memory and the first storage difference value is smaller than 0, continuing to select the next recording file from all the recording files, and adding the first storage difference value to the selected recording file size until the first storage difference value is larger than 0, executing the step S30 to delete all the selected files, and creating the pre-allocation file with the size of the first storage difference value and the pre-allocation file with the size of the pre-recorded video.
In this embodiment, when there is no pre-allocation file in the local storage, a recording file is used, and one recording file may be selected from all recording files according to a preset rule, preferably, the recording files may be selected according to a sequence from early to late, in addition, the recording file size may be selected from late to early or randomly, then the size of the selected recording file may be subtracted from the size of the pre-recording file to obtain a first storage difference value, when the first storage difference value is smaller than 0, the next recording file is selected from all recording files continuously, then the first storage difference value is determined according to the selected next updated first storage difference value, until the first storage difference value is larger than 0, all pre-allocation files and all selected recording files are deleted, and a pre-allocation file with a size of the second storage difference value and a pre-allocation file with a size of the pre-recording video size are created. The created pre-allocation file with the size of the second storage difference value can be used for storing other pre-recorded video data, the created pre-allocation file with the size of the pre-recorded video can be used for storing the video data to be recorded currently, the pre-recorded video data can be stored by creating a new pre-allocation file, and the redundant storage space is released for storing other pre-recorded videos, so that the waste of the storage space is avoided, and storage fragments cannot be generated to influence video recording.
Further, a fourth embodiment of the file storage method of the automobile data recorder is provided based on the third embodiment of the file storage method of the automobile data recorder, in this embodiment, the step of storing the pre-recorded video according to the recorded file and all pre-allocated files in the local memory in step S42 includes:
step S421: selecting one recording file from all recording files, and adding the size of the selected recording file with the first storage difference value to obtain a second storage difference value;
step S422: and when the second storage difference value is greater than 0, deleting all pre-allocation files and all selected recording files, and creating the pre-allocation files with the size of the second storage difference value and the pre-allocation files with the size of the pre-recorded video.
In this embodiment, when the sum of the storage sizes of all pre-allocated files cannot meet the requirement of pre-recording video data, a part of recording files needs to be used, each recording file includes recording time, file size, and the like, one recording file can be selected from all recording files according to the above embodiment, for example, the recording files are selected in the order of the recording time from early to late, and the selected recording file size is added to the first storage difference value, so that the second storage difference value can be obtained. And analyzing the second storage difference value, and deleting all pre-allocation files and all selected recorded files when the second storage difference value is larger than 0, and creating the pre-allocation files with the size of the second storage difference value and the pre-allocation files with the size of the pre-recorded video, wherein the pre-allocation files with the size of the second storage difference value are created to be used for storing other pre-recorded video data, and the pre-allocation files with the size of the pre-recorded video are created to be used for storing the video data which is currently to be recorded. By creating a new pre-allocation file, not only can pre-recorded video data be stored, but also redundant storage space is released for storing other pre-recorded videos, so that the waste of storage space is avoided, and storage fragments cannot be generated to influence video recording.
Further, after step S421, the method further includes:
step S423, when the second storage difference is smaller than 0, continuing to select the next recording file from all the recording files, and adding the second storage difference to the selected recording file size until the second storage difference is larger than 0, executing to delete all the pre-allocated files and all the selected recording files, and creating a pre-allocated file with the size of the second storage difference and a pre-allocated file with the size of the pre-recorded video.
In this embodiment, when the second storage difference is smaller than 0, it is indicated that the sum of the selected first recording file size and all pre-allocated file sizes cannot meet the pre-recorded video data size, preferably, the next recording file may be selected continuously from all recording files in the order from the early to the late of the recording time, the selected recording file size and the second storage difference are added until the second storage difference is larger than 0, all pre-allocated files and all selected recording files are deleted, and a pre-allocated file with the size of the second storage difference and a pre-allocated file with the size of the pre-recorded video size are created. Wherein creating a pre-allocation file of the second stored difference value may be used to store other pre-recorded video data and creating a pre-allocation file of the pre-recorded video size may be used to store video data that is currently to be recorded. By creating a new pre-allocation file, not only can pre-recorded video data be stored, but also redundant storage space is released for storing other pre-recorded videos, so that the waste of storage space is avoided, and storage fragments cannot be generated to influence video recording.
Further, after step S421, the method further includes:
when the second storage difference is equal to 0, deleting all pre-allocated files and all selected recorded files, and creating the pre-allocated files with the size of the pre-recorded video.
In this embodiment, when the sum of the sizes of all the pre-allocated files and the sizes of the selected recorded files is equal to the size of the pre-recorded file, it is indicated that the sizes of all the pre-allocated files and the selected recorded files just meet the pre-recorded video data, all the pre-allocated files and all the selected recorded files are deleted, and a pre-allocated file with the size of the pre-recorded video is created for storing the pre-recorded video data.
Further, referring to fig. 3, a fifth embodiment of the file storage method of the vehicle event data recorder according to the first embodiment of the file storage method of the vehicle event data recorder of the present invention is provided, and before step S10, the method further includes:
step S101, obtaining a preset recording time length and a preset recording resolution of a pre-recorded video;
step S102, calculating the size of the pre-recorded video according to the pre-recorded time and the pre-recorded resolution.
In this embodiment, the driving recorder may preset a recording time and a recording resolution, a recording duration may be set to 1min, 3min, 5min, and the like, and a recording resolution may be set to 720P, 1080P, and the like. The storage space occupied by the same resolution and different recording time lengths is in direct proportion to the recording time length, for example, the recording time length is set to be 1min, the recording resolution is set to be 720P, and the storage space occupied by video data recorded for 1min and 720P is 60M at most; the storage space occupied by video data recorded for 3min and 720P is 180M at most; the storage space occupied by video data recorded for 5min and 720P is 300M at maximum. The storage space occupied by 1080P with the same recording time length resolution is twice of the storage space occupied by 720P, for example, the recording time length is set to be 1min, the recording resolution is set to be 1080P, and the storage space occupied by video data recorded for 1min and 1080P is 120M at most; the storage space occupied by video data recorded for 3min and 1080P is 360M at most; video data recorded for 5min and 1080P occupy a memory space of 600M at maximum. The size of the pre-recorded video data can be calculated by acquiring the preset recording time length and recording resolution of the automobile data recorder, and a proper storage position is found for the video data to be stored by acquiring the size of the pre-recorded video data.
The present invention also proposes a computer-readable storage medium on which a computer program is stored. The computer readable storage medium may be a Memory in the terminal of fig. 1, or may be at least one of ROM (Read-Only Memory)/RAM (Random Access Memory ), magnetic disk, or optical disk, and the computer readable storage medium includes several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, a terminal, or a network device) having a processor to perform the methods according to the embodiments of the present invention.
In the present invention, the terms "first", "second", "third", "fourth", "fifth" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance, and the specific meaning of the above terms in the present invention will be understood by those of ordinary skill in the art depending on the specific circumstances.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
Although embodiments of the present invention have been shown and described above, the scope of the present invention is not limited thereto, and it should be understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications and substitutions of the above embodiments may be made by those skilled in the art within the scope of the present invention, and are intended to be included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (9)
1. The file storage method of the automobile data recorder is characterized by comprising the following steps of:
acquiring the size of a prerecorded video, and selecting a file from a local memory to take the currently selected file size as a first storage capacity;
subtracting the size of the pre-recorded video from the first storage capacity to obtain a first storage difference;
when the first storage difference value is larger than 0, deleting all selected files, and creating a pre-allocation file with the size of the first storage difference value and a pre-allocation file with the size of the pre-recorded video;
wherein the step of selecting a file from the local storage to use the currently selected file size as the first storage capacity comprises:
determining whether a pre-allocation file exists in the local memory;
if yes, selecting one pre-allocation file from all pre-allocation files, and taking the size of the pre-allocation file selected currently as a first storage capacity, wherein the size of the pre-allocation file is related to pre-recorded video resolution and/or playing duration preset by a vehicle recorder;
if not, selecting one recording file from all recording files, and taking the size of the recording file currently selected as the first storage capacity.
2. The method for storing files in a vehicle event data recorder according to claim 1, wherein after the step of subtracting the size of the pre-recorded video from the first storage capacity to obtain the first storage difference, the method further comprises:
when the pre-allocation files exist in the local memory and the first storage difference value is smaller than 0, judging whether unselected pre-allocation files exist in all the pre-allocation files;
when the unselected pre-allocation files do not exist in all the pre-allocation files, storing the pre-recorded video according to the recorded files in the local memory and all the pre-allocation files;
when the unselected pre-allocation files exist in all the pre-allocation files, continuing to select the next pre-allocation file from all the pre-allocation files, and adding the selected pre-allocation file size into the first storage capacity to update the first storage capacity so as to execute the steps of: and subtracting the size of the pre-recorded video from the first storage capacity to obtain a first storage difference.
3. The file storage method of the automobile data recorder according to claim 2, wherein before the step of determining whether the unselected pre-allocation file exists in all the pre-allocation files, further comprising:
when the pre-allocation file exists in the local memory and the first storage difference value is smaller than 0, judging whether the sum of the sizes of all the pre-allocation files is larger than or equal to the size of the pre-recorded file;
if yes, executing the steps of: judging whether unselected pre-allocation files exist in all the pre-allocation files;
if not, executing the steps of: and storing the pre-recorded video according to the recorded files and all pre-allocated files in the local memory.
4. A file storage method of a drive recorder according to claim 2 or 3, wherein the step of storing the pre-recorded video according to the recorded files and all pre-allocated files in the local storage comprises:
selecting one recording file from all recording files, and adding the size of the selected recording file with the first storage difference value to obtain a second storage difference value;
and when the second storage difference value is greater than 0, deleting all pre-allocation files and all selected recording files, and creating the pre-allocation files with the size of the second storage difference value and the pre-allocation files with the size of the pre-recorded video.
5. The method for storing files in a vehicle event data recorder according to claim 4, wherein after the step of selecting one recording file from all recording files and adding the size of the selected recording file to the first storage difference to obtain the second storage difference, the method further comprises:
and when the second storage difference value is smaller than 0, continuing to select the next recorded file from all the recorded files, and adding the second storage difference value to the selected recorded file size until the second storage difference value is larger than 0, executing: and deleting all the pre-allocated files and all the selected recorded files, and creating the pre-allocated files with the size of the second storage difference value and the pre-allocated files with the size of the pre-recorded video.
6. The method for storing files in a vehicle event data recorder according to claim 1, wherein after the step of subtracting the size of the pre-recorded video from the first storage capacity to obtain the first storage difference, the method further comprises:
when the pre-allocation file does not exist in the local memory and the first storage difference value is smaller than 0, continuing to select the next recording file from all the recording files, adding the first storage difference value to the selected recording file size, and executing the steps until the first storage difference value is larger than 0: and deleting all the selected files, and creating a pre-allocation file with the size of the first storage difference value and a pre-allocation file with the size of the pre-recorded video.
7. The file storage method of a vehicle event data recorder according to any one of claims 1 to 3, 5 and 6, wherein before the step of obtaining the pre-recorded video size, further comprising:
acquiring a preset recording time length and a preset recording resolution of a pre-recorded video;
and calculating the size of the pre-recorded video according to the preset recording duration and the preset recording resolution.
8. Vehicle event data recorder, its characterized in that, vehicle event data recorder includes: memory, a processor and a computer program stored on the memory and running on the processor, which when executed by the processor realizes the steps of the file storage method of the tachograph according to any of the claims 1-7.
9. A readable storage medium, characterized in that the readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the file storage method of a tachograph according to any of the claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910262672.2A CN110008179B (en) | 2019-04-02 | 2019-04-02 | File storage method, automobile data recorder and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910262672.2A CN110008179B (en) | 2019-04-02 | 2019-04-02 | File storage method, automobile data recorder and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110008179A CN110008179A (en) | 2019-07-12 |
CN110008179B true CN110008179B (en) | 2023-06-16 |
Family
ID=67169856
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910262672.2A Active CN110008179B (en) | 2019-04-02 | 2019-04-02 | File storage method, automobile data recorder and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110008179B (en) |
Citations (21)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1504895A (en) * | 2000-02-28 | 2004-06-16 | ���չ�˾ | File control method |
JP2005192096A (en) * | 2003-12-26 | 2005-07-14 | Casio Comput Co Ltd | Image pickup device, method for recording video file, and program |
WO2010108343A1 (en) * | 2009-03-21 | 2010-09-30 | 中兴通讯股份有限公司 | Method and device for recording mobile multimedia broadcast program |
CN102096722A (en) * | 2011-03-21 | 2011-06-15 | 成都市华为赛门铁克科技有限公司 | File storage method and device |
CN102508784A (en) * | 2011-11-02 | 2012-06-20 | 杭州海康威视数字技术股份有限公司 | Data storage method of flash memory card in video monitoring equipment, and system thereof |
WO2013111187A1 (en) * | 2012-01-25 | 2013-08-01 | Hitachi, Ltd. | Single instantiation method using file clone and file storage system utilizing the same |
CN104699815A (en) * | 2015-03-24 | 2015-06-10 | 北京嘀嘀无限科技发展有限公司 | Data processing method and system |
CN105681714A (en) * | 2016-02-26 | 2016-06-15 | 北京金山安全软件有限公司 | Video shooting method and device and electronic equipment |
CN105677742A (en) * | 2015-12-30 | 2016-06-15 | 深圳市瑞驰信息技术有限公司 | Method and apparatus for storing files |
CN106027934A (en) * | 2016-07-13 | 2016-10-12 | 深圳市爱培科技术股份有限公司 | Vehicle driving video storing method and system based on rearview mirror |
CN106294603A (en) * | 2016-07-29 | 2017-01-04 | 北京奇虎科技有限公司 | File memory method and device |
CN106599292A (en) * | 2016-12-26 | 2017-04-26 | 东方网力科技股份有限公司 | Method and system for storing real-time video data and image data |
CN106970812A (en) * | 2017-03-31 | 2017-07-21 | 广东欧珀移动通信有限公司 | upgrade file processing, device and terminal |
CN107122133A (en) * | 2017-04-24 | 2017-09-01 | 珠海全志科技股份有限公司 | Date storage method and device |
CN107302676A (en) * | 2017-07-28 | 2017-10-27 | 建荣半导体(深圳)有限公司 | A kind of videotape storage means, system, chip, storage device and drive recorder |
CN107609014A (en) * | 2017-08-02 | 2018-01-19 | 深圳市爱培科技术股份有限公司 | A kind of drive recorder and its video storage method, storage medium |
CN107741828A (en) * | 2017-09-19 | 2018-02-27 | 维沃移动通信有限公司 | A kind of memory space fill method and mobile terminal |
CN107861836A (en) * | 2016-09-22 | 2018-03-30 | 法乐第(北京)网络科技有限公司 | Drive recorder data back up method and device |
CN107885458A (en) * | 2017-09-28 | 2018-04-06 | 努比亚技术有限公司 | A kind of method for sorting of disk fragmentses, terminal and computer-readable recording medium |
CN108073361A (en) * | 2017-12-08 | 2018-05-25 | 佛山市章扬科技有限公司 | A kind of method and device of automatic recording audio and video |
CN108668096A (en) * | 2018-05-18 | 2018-10-16 | 京东方科技集团股份有限公司 | Management method, device and the video recording equipment of video data |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
FR2826141B1 (en) * | 2001-06-15 | 2003-09-19 | St Microelectronics Sa | METHOD AND DEVICE FOR MANAGING THE MEMORY SPACE OF A HARD DISK, PARTICULARLY FOR A DIGITAL SATELLITE TELEVISION SIGNAL RECEIVER |
US9111577B2 (en) * | 2013-09-12 | 2015-08-18 | International Business Machines Corporation | Storage space savings via partial digital stream deletion |
US20170208052A1 (en) * | 2016-01-19 | 2017-07-20 | Hope Bay Technologies, Inc | Hybrid cloud file system and cloud based storage system having such file system therein |
-
2019
- 2019-04-02 CN CN201910262672.2A patent/CN110008179B/en active Active
Patent Citations (21)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1504895A (en) * | 2000-02-28 | 2004-06-16 | ���չ�˾ | File control method |
JP2005192096A (en) * | 2003-12-26 | 2005-07-14 | Casio Comput Co Ltd | Image pickup device, method for recording video file, and program |
WO2010108343A1 (en) * | 2009-03-21 | 2010-09-30 | 中兴通讯股份有限公司 | Method and device for recording mobile multimedia broadcast program |
CN102096722A (en) * | 2011-03-21 | 2011-06-15 | 成都市华为赛门铁克科技有限公司 | File storage method and device |
CN102508784A (en) * | 2011-11-02 | 2012-06-20 | 杭州海康威视数字技术股份有限公司 | Data storage method of flash memory card in video monitoring equipment, and system thereof |
WO2013111187A1 (en) * | 2012-01-25 | 2013-08-01 | Hitachi, Ltd. | Single instantiation method using file clone and file storage system utilizing the same |
CN104699815A (en) * | 2015-03-24 | 2015-06-10 | 北京嘀嘀无限科技发展有限公司 | Data processing method and system |
CN105677742A (en) * | 2015-12-30 | 2016-06-15 | 深圳市瑞驰信息技术有限公司 | Method and apparatus for storing files |
CN105681714A (en) * | 2016-02-26 | 2016-06-15 | 北京金山安全软件有限公司 | Video shooting method and device and electronic equipment |
CN106027934A (en) * | 2016-07-13 | 2016-10-12 | 深圳市爱培科技术股份有限公司 | Vehicle driving video storing method and system based on rearview mirror |
CN106294603A (en) * | 2016-07-29 | 2017-01-04 | 北京奇虎科技有限公司 | File memory method and device |
CN107861836A (en) * | 2016-09-22 | 2018-03-30 | 法乐第(北京)网络科技有限公司 | Drive recorder data back up method and device |
CN106599292A (en) * | 2016-12-26 | 2017-04-26 | 东方网力科技股份有限公司 | Method and system for storing real-time video data and image data |
CN106970812A (en) * | 2017-03-31 | 2017-07-21 | 广东欧珀移动通信有限公司 | upgrade file processing, device and terminal |
CN107122133A (en) * | 2017-04-24 | 2017-09-01 | 珠海全志科技股份有限公司 | Date storage method and device |
CN107302676A (en) * | 2017-07-28 | 2017-10-27 | 建荣半导体(深圳)有限公司 | A kind of videotape storage means, system, chip, storage device and drive recorder |
CN107609014A (en) * | 2017-08-02 | 2018-01-19 | 深圳市爱培科技术股份有限公司 | A kind of drive recorder and its video storage method, storage medium |
CN107741828A (en) * | 2017-09-19 | 2018-02-27 | 维沃移动通信有限公司 | A kind of memory space fill method and mobile terminal |
CN107885458A (en) * | 2017-09-28 | 2018-04-06 | 努比亚技术有限公司 | A kind of method for sorting of disk fragmentses, terminal and computer-readable recording medium |
CN108073361A (en) * | 2017-12-08 | 2018-05-25 | 佛山市章扬科技有限公司 | A kind of method and device of automatic recording audio and video |
CN108668096A (en) * | 2018-05-18 | 2018-10-16 | 京东方科技集团股份有限公司 | Management method, device and the video recording equipment of video data |
Also Published As
Publication number | Publication date |
---|---|
CN110008179A (en) | 2019-07-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104808952B (en) | data cache method and device | |
CN107122133B (en) | Data storage method and device | |
CN109788068B (en) | Heartbeat state information reporting method, device and equipment and computer storage medium | |
JPH05189281A (en) | File assigning system for storage device | |
CN105786539B (en) | File downloading method and device | |
CN110018989A (en) | A kind of method and apparatus that snapshot compares | |
CN110460635A (en) | One kind is towards unpiloted edge discharging method and device | |
CN110704450B (en) | Method and device for realizing data processing, computer storage medium and terminal | |
CN103119567B (en) | For the system and method in managing virtual tape pool territory | |
CN110008179B (en) | File storage method, automobile data recorder and readable storage medium | |
CN113177033B (en) | Log data storage method and device, electronic equipment and medium | |
CN116663042B (en) | Access control method, device, equipment and storage medium of multi-user-level directory | |
US11698735B2 (en) | Common storage management device and common storage management method | |
CN110795396A (en) | Cold and hot data distinguishing method and system and storage medium thereof | |
CN111491040B (en) | IP distribution method and IP distribution device | |
CN113704190A (en) | Data writing method and device | |
CN118175362B (en) | ROM space recycling method and device, storage medium and set top box | |
CN113934692A (en) | File cleaning method and device, storage medium and equipment | |
CN118377434B (en) | Data processing method, device, equipment and storage medium | |
CN111524059A (en) | Memory utilization method, system, terminal and storage medium during image caching | |
JPH10260875A (en) | File management system and file managing method | |
CN113609076B (en) | File storage method and file reading method | |
EP1507219A2 (en) | Computer system and program for improved file system performance | |
US11886869B2 (en) | Information processing device and information processing method for updating a program by partially relocating the program | |
CN110943871B (en) | Resource interval adjusting method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |