Multimedia processing method and device, equipment, storage medium and program product
By generating and verifying the subfile of the multimedia file and then writing it to the hardware memory, the problem of the inability to guarantee transaction atomicity during the multimedia file writing process is solved, and the atomicity and stability of processing operations are achieved.
Patent Information
- Application Number
- CN202410198305.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-22
- Publication Date
- 2025-08-22
AI Technical Summary
In the prior art, during the writing process of multimedia files to hardware memory, the atomicity of the transaction cannot be guaranteed, resulting in the transaction being aborted.
Generate multiple sub-files corresponding to the processing operation of the multimedia file, read the first version file, save the sub-files to the second version file, and write the second version file to the hardware memory after confirming that all sub-files have no exceptions.
By ensuring that all subfiles have no exceptions and then written to the hardware memory, transaction abortion is avoided and the atomicity of processing operations is ensured.
Smart Images

Figure CN120523970A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of computer technology, and in particular to a multimedia processing method, apparatus, device, storage medium, and program product. Background Art
[0002] Typically, a transaction includes multiple operations, and the atomicity of a transaction means that all operations of the transaction are indivisible. The successful execution of all operations can ensure the atomicity of the transaction and prevent the transaction from being aborted. In other words, if any operation fails to execute, its atomicity is destroyed, causing the transaction to be aborted.
[0003] For example, if a user edits the content of a text file through an application on a terminal device, then for multiple operations of the transaction (editing the content of the text file) (such as adding new content and changing the font color), the terminal device generates multiple sub-files to record the modified content corresponding to each operation respectively, and correctly writes the multiple sub-files corresponding to the transaction into the hardware memory. However, during the process of writing to the hardware memory, the atomicity of the transaction cannot be guaranteed, and there is a situation where the sub-files of the transaction fail to be written to the hardware memory.
[0004] Therefore, for transactions involving operations written into hardware memory, how to ensure the atomicity of the transaction so as to ensure that the transaction is not aborted is an urgent problem to be solved. Summary of the Invention
[0005] The embodiments of the present disclosure provide a multimedia processing method, apparatus, device, storage medium, and program product, which can ensure the atomicity of transactions involving operations of writing to hardware memory and avoid aborting the transactions.
[0006] In a first aspect, an embodiment of the present disclosure provides a multimedia processing method, including:
[0007] In response to a processing operation on a multimedia file, generating a plurality of sub-files corresponding to the processing operation;
[0008] Reading a first version file of the multimedia file;
[0009] Saving the multiple sub-files to the first version file of the multimedia file to obtain a second version file of the multimedia file;
[0010] determining whether there is an anomaly among the plurality of sub-files in the second version file of the multimedia file;
[0011] If no abnormality occurs in the plurality of sub-files in the second version file of the multimedia file, the second version file of the multimedia file is written into the hardware memory.
[0012] In a second aspect, an embodiment of the present disclosure provides a multimedia processing device, including:
[0013] a generating module, configured to generate, in response to a processing operation on a multimedia file, a plurality of sub-files corresponding to the processing operation;
[0014] A reading module, configured to read a first version file of the multimedia file;
[0015] a saving module, configured to save the plurality of sub-files to the first version file of the multimedia file to obtain a second version file of the multimedia file;
[0016] A determination module, configured to determine whether there is an anomaly in the plurality of sub-files in the second version file of the multimedia file;
[0017] The storage module is configured to write the second version file of the multimedia file into a hardware memory if none of the multiple sub-files in the second version file of the multimedia file are abnormal.
[0018] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: a processor and a memory;
[0019] The memory stores computer-executable instructions;
[0020] The processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the multimedia processing method as described in the first aspect above.
[0021] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the multimedia processing method described in the first aspect above is implemented.
[0022] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which implements the multimedia processing method described in the first aspect above when executed by a processor.
[0023] The multimedia processing method, apparatus, device, storage medium, and program product provided in this embodiment, in response to a processing operation on a multimedia file, generates multiple sub-files corresponding to the processing operation, reads a first version file of the multimedia file, saves the multiple sub-files to the first version file of the multimedia file to obtain a second version file of the multimedia file, and then determines whether there are any anomalies in the multiple sub-files in the second version file of the multimedia file. If no anomalies occur in the multiple sub-files in the second version file, the second version file is written to the hardware memory. This can avoid the failure of some sub-files, ensure the atomicity of the processing operation, and prevent the processing operation from being terminated. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0025] Figure 1 A flowchart of a multimedia processing method provided by an embodiment of the present disclosure;
[0026] Figure 2 A flowchart of another multimedia processing method provided by an embodiment of the present disclosure;
[0027] Figure 3 A flowchart of another multimedia processing method provided by an embodiment of the present disclosure;
[0028] Figure 4 A schematic diagram of a file migration process exemplified in an embodiment of the present disclosure;
[0029] Figure 5 A flowchart of another multimedia processing method provided by an embodiment of the present disclosure;
[0030] Figure 6 A flowchart of another multimedia processing method provided by an embodiment of the present disclosure;
[0031] Figure 7 A flowchart of another multimedia processing method provided by an embodiment of the present disclosure;
[0032] Figure 8 A schematic structural diagram of a multimedia processing device provided in an embodiment of the present disclosure;
[0033] Figure 9 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0034] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present disclosure without making any creative efforts shall fall within the scope of protection of the present disclosure.
[0035] For transactions involving operations written to hardware memory, such as multimedia file editing, where a user modifies part of the content of a text file through a terminal device application, such as adding two words at a certain location and then changing the font color of the two words from black to red, the terminal device can generate multiple subfiles for the multiple operations (adding two words at a certain location and changing the font color) of this transaction (modifying part of the content of the text file) to record the modified content corresponding to each operation.
[0036] For example, the terminal device may generate a sub-file for adding two characters at a certain position and another sub-file for the modified font colors of the two characters.
[0037] For the multiple sub-files generated, they need to be written into the hardware memory. During the writing process, the following two situations may occur:
[0038] 1. A sub-file fails to be written to the hardware storage.
[0039] 2. A sub-file is abnormal, for example, the sub-file is damaged and cannot be read normally, and / or the sub-file is not the sub-file corresponding to the current editing operation, and the sub-file is disordered due to program abnormality.
[0040] If the above situation occurs, the content editing will fail, and the transaction will be aborted. In other words, to ensure the atomicity of the above transaction, the following two points need to be guaranteed:
[0041] 1. Successfully stored multiple sub-files in the hardware memory.
[0042] 2. Each sub-file stored in the hardware memory is the sub-file corresponding to this editing operation.
[0043] For example, for encrypted resources downloaded from a web page, the encrypted resource and its key can be written to the same or different directories. However, since writing the encrypted resource and key to disk is not atomic, it is possible that the encrypted resource is written to disk, but the web page encounters an exception, resulting in the key not being successfully written to disk. As a result, the encrypted resource has no key and cannot be decrypted and used. Writing to disk can be understood as writing to hardware storage.
[0044] Then, for this transaction (downloading the encrypted resource), the corresponding multiple operations (writing the encrypted resource to disk and writing the key to disk) can generate two sub-files, one containing the encrypted resource and the other containing the key. If the sub-file corresponding to the encrypted resource is successfully written to disk, but the sub-file corresponding to the key is not successfully written to disk, the transaction will be aborted.
[0045] Therefore, the present disclosure provides a multimedia processing method, which determines whether the sub-file corresponding to the processing operation of the multimedia file is abnormal before writing it into the hardware memory. When all sub-files are abnormal, all sub-files are written into the hardware memory, thereby ensuring the atomic operation of the transaction and avoiding the transaction being terminated.
[0046] For ease of understanding, the embodiments of the present disclosure describe transactions as processing operations. For example, for the editing scenario of a multimedia file, the editing operation A is a transaction, and for the downloading scenario of an encrypted multimedia file, downloading the multimedia file is a transaction.
[0047] The application scenario of the present disclosure can be resource downloading, such as encrypted multimedia file downloading, or it can also be the editing of multimedia files, or it can be other scenarios corresponding to transactions involving hard disk writing operations. It can be understood that the multimedia processing method provided by the present disclosure includes but is not limited to the above application scenarios.
[0048] It can be understood that multimedia files may include text, audio, image, video, etc., and the present disclosure does not limit this.
[0049] The following detailed description of the technical solution of the present disclosure and how the technical solution of the present disclosure solves the above-mentioned technical problems is provided with specific embodiments. The following specific embodiments can exist independently or in combination with each other. For some embodiments, the same or similar concepts or processes may not be described in detail. The following embodiments of the present disclosure are described in conjunction with the accompanying drawings.
[0050] Figure 1 A flowchart of a multimedia processing method provided by an embodiment of the present disclosure is provided. The method can be applied in a terminal device, such as Figure 1 As shown, the method may include the following steps:
[0051] S101 : In response to a processing operation on a multimedia file, generate a plurality of sub-files corresponding to the processing operation.
[0052] In response to a processing operation on a multimedia file, a terminal device may generate multiple sub-files corresponding to the processing operation. In one possible implementation, the multimedia file is a multimedia editing draft, and accordingly, the processing operation is an editing operation. That is, in the multimedia file editing scenario, the multimedia file may be a multimedia editing draft, and accordingly, the processing operation on the multimedia file may be an editing operation.
[0053] For example, if the multimedia file is a text file on a terminal device, the user can open the text file and perform corresponding editing operations on the text file, and the terminal device can respond to the editing operations on the multimedia file. Accordingly, the editing operations can be multiple modification operations performed by the user, such as adding the word "target" to a certain location and changing the font of "target" from black to red. In this case, the terminal device can generate two sub-files, one for recording the addition of "target" to the location and the change of the font of "target" to red.
[0054] In a possible implementation, the multimedia file is an encrypted multimedia file, and the processing operation may be a download operation. That is, in the encrypted multimedia file download scenario, the multimedia file may be an encrypted multimedia file, and accordingly, the processing operation for the multimedia file may be a download operation.
[0055] Exemplarily, the multimedia file is a file in an encrypted resource on a webpage (e.g., a compressed video file). When the terminal device responds to a user's download operation on the multimedia file, it generates multiple sub-files corresponding to the download operation. Exemplarily, the download operation may include writing the encrypted resource to the hard disk and writing the key for the encrypted resource to the hard disk. In this case, the terminal device may generate two sub-files, one for recording the encrypted resource and the other for recording the key for the encrypted resource.
[0056] S102: Obtain a first version file of the multimedia file.
[0057] After generating multiple sub-files corresponding to the processing operation of the multimedia file, the terminal device can obtain a first version file of the multimedia file. The first version file can be an empty file or can be used to store multiple sub-files corresponding to the current processing operation of the multimedia file.
[0058] S103: Save the multiple sub-files to the first version file of the multimedia file to obtain a second version file of the multimedia file.
[0059] The terminal device may save the multiple sub-files into the first version file to obtain the second version file, so that the terminal device can determine whether there are any abnormalities in the multiple sub-files in the second version file.
[0060] S104: Determine whether there is an abnormality in the plurality of sub-files in the second version file of the multimedia file.
[0061] Exemplarily, the terminal device may determine whether there is an abnormality in any sub-file among the multiple sub-files based on the file information of the sub-file.
[0062] In one possible implementation, the architecture of the operating system of the terminal device may include a user layer and an I / O (input / output) layer, wherein the user layer can be used to generate multiple sub-files for the processing operation of the multimedia file. After the user layer completes generating the multiple sub-files, a determination instruction can be sent to the I / O layer, where the determination instruction is used to indicate that the multiple sub-files of the processing operation have been generated, and the I / O layer can perform corresponding write operations on the multiple sub-files of the processing operation.
[0063] Exemplarily, the confirmation instruction may be generated by a user. For example, when a user modifies a text file, the user presses a save button to trigger the generation of the confirmation instruction.
[0064] Alternatively, the confirmation instruction may be generated when the webpage detects that the download task has been completed after the user clicks on the instruction to download the multimedia file.
[0065] The present disclosure does not limit the generation of the determination instruction. The instruction can be used to ensure that the terminal device executes the operation of writing multiple sub-files to the hard disk only after multiple sub-files of the processing operation are generated, which can further ensure the atomic operation of the processing operation.
[0066] S105: If no abnormality occurs in the plurality of sub-files in the second version file of the multimedia file, the second version file of the multimedia file is written into the hardware memory.
[0067] If the multiple sub-files are all valid, the terminal device may write the second version file into the hardware memory.
[0068] It can be understood that after the terminal device writes the second version file into the hardware memory, it can be determined that the processing operation of the multimedia file is completed.
[0069] For example, after the second version of the multimedia file is written into the hardware memory, the multimedia file can be used normally. For example, the user can normally open the multimedia file of the version corresponding to the processing operation, or the user can normally decrypt and use the multimedia file.
[0070] In this embodiment, in response to a processing operation on a multimedia file, multiple sub-files corresponding to the processing operation are generated, a first version file of the multimedia file is read, and the multiple sub-files are saved to the first version file of the multimedia file to obtain a second version file of the multimedia file. A determination is then made as to whether the multiple sub-files in the second version file of the multimedia file are abnormal. If none of the multiple sub-files in the second version file are abnormal, the second version file is written to the hardware memory. This prevents failures due to some sub-files being invalid, ensures the atomicity of the processing operation, and prevents the processing operation from being aborted.
[0071] The following describes in detail whether there are abnormalities in the plurality of sub-files in the second version file.
[0072] Figure 2 This is a flow chart of another multimedia processing method provided by an embodiment of the present disclosure, which can be applied in a terminal device, such as Figure 2 As shown, the method may include the following steps:
[0073] S201: Read any one of the multiple sub-files.
[0074] S202: Determine whether the sub-file can be opened normally.
[0075] In one possible implementation, the terminal device can determine that the sub-file can be opened normally if the sub-file can be opened normally without any abnormal prompt, such as "the file is damaged and cannot be opened." If an abnormal prompt, such as a prompt that the file may be missing or incomplete, is displayed when opening the sub-file, it can be determined that the sub-file cannot be opened normally.
[0076] Illustratively, the operation of opening the sub-file by the terminal device may be, for example, reading the content of the sub-file, or other methods, which are not limited in the present disclosure.
[0077] If the sub-file can be opened normally, then S203 is executed; if the sub-file cannot be opened normally, then S205 is executed.
[0078] S203: Determine whether the first identifier is consistent with the identifier of the processing operation.
[0079] If the first identifier is consistent with the identifier of the processing operation, it means that the subfile is the file corresponding to the processing operation, and S204 can be executed. If the first identifier is inconsistent with the identifier of the processing operation, it means that the subfile is not the subfile corresponding to the processing operation, and S205 can be executed.
[0080] It is understood that since the present disclosure describes a transaction as a processing operation for ease of understanding, the identifier of the processing operation is the transaction identifier. The terminal device can obtain the first identifier by obtaining the file information of the subfile, and the file information includes the first identifier.
[0081] S204: Determine that there is no abnormality in the sub-file.
[0082] S205: Determine if there is an abnormality in the sub-file.
[0083] In this embodiment, by determining whether a subfile can be opened normally and comparing the first identifier of the subfile with the identifier of the processing operation to determine whether the first identifier and the identifier of the processing operation are consistent, it is possible to determine whether a subfile has an abnormality. If multiple subfiles are valid, the multiple subfiles can be written to the hardware memory. This can avoid the failure of some subfiles, ensure the atomicity of the transaction, and prevent the transaction from being aborted.
[0084] The following describes in detail how the terminal device writes the second version file into the hardware memory.
[0085] Figure 3 A flowchart of another multimedia processing method provided by an embodiment of the present disclosure is provided. The method can be applied in a terminal device, such as Figure 3 As shown, the method may include the following steps:
[0086] S301: Determine a target backup partition among multiple backup partitions.
[0087] The multiple backup partitions are respectively used to store multiple historical version files of the multimedia file, wherein each historical version file includes multiple sub-files corresponding to its corresponding processing operation, and the target backup partition is used to store the oldest historical version file among the multiple historical version files. The oldest historical version file is the one that was first written to the hardware memory among the multiple historical version files.
[0088] For example, if the multimedia file is a text file on the terminal device, then multiple historical version files may correspond to multiple historical processing operations of the multimedia file, that is, the terminal device may generate a historical version file of the multimedia file for one historical processing operation.
[0089] If the multimedia file is a file in the encrypted resources on the web page, then the multiple backup partitions can be empty storage areas, or, if the multimedia file is a file with a version number (that is, a file that can be updated through version upgrades), the multiple backup partitions can be used to store the content and keys corresponding to multiple historical versions of the multimedia file.
[0090] S302: Clear the target backup partition.
[0091] After determining the target backup partition, the terminal device can clear the target backup partition, that is, delete the oldest historical version file among the multiple historical version files.
[0092] S303: Write the second version file into the target backup partition.
[0093] After clearing the target backup partition, the second version file can be written to the target backup partition for temporary storage, so as to facilitate subsequent storage in the target directory of the hardware storage. For example, the target directory can be the root directory
[0094] S304: Move the latest version of the multimedia file in the target directory to a preset partition, which is an empty storage area.
[0095] The target directory may be cleared by moving the current version file of the multimedia file in the target directory to the preset partition, wherein the current version file of the multimedia file may be the latest version file of the multimedia file before the processing operation occurs.
[0096] For ease of understanding, Table 1 shows the correspondence between the historical version files stored in each partition before the latest version of the multimedia file is moved to the preset partition:
[0097] Table 1
[0098] Target Directory Latest version file Backup Partition 1 Historical version file 1 Backup Partition 2 Historical version file 2 Backup Partition 3 Historical version file 3
[0099] S305: Move the second version file stored in the target backup partition to the target directory.
[0100] After clearing the target directory, the terminal device may move the second version file stored in the target backup partition to the target directory.
[0101] For example, Figure 4 As shown, Figure 4 The following is a schematic diagram of the file migration process of an example embodiment of the present disclosure. After the file migration is completed according to steps ①, ②, and ③, the latest version of the file in the preset partition can be migrated to the target backup partition to free up the preset partition to facilitate the writing of sub-files for subsequent processing operations. It can be understood that after the file migration is completed, the historical file version of backup partition 2 is the oldest historical version file of the multimedia file. When the next processing operation of the multimedia file is triggered, if there are no abnormalities in the multiple sub-files corresponding to the next processing operation, then when the sub-files are written to the target directory, backup partition 2 will be the target backup partition.
[0102] In this embodiment, multiple historical version files of multimedia files are stored in multiple backup partitions, and then the backup partition data is rotated to clear the data corresponding to the oldest transaction (i.e., the earliest processing operation) to store the sub-files of the current processing operation in the target directory, so that the current processing operation can be executed successfully.
[0103] In order to avoid problems such as writing errors when the terminal device writes the second version file to the target backup partition, multiple sub-files in the second version file can be further verified. When it is determined that the contents of the multiple sub-files are correct, the latest version file of the target directory is moved. This can ensure that when the content of one sub-file in the multiple sub-files of the second version file is incorrect, the current version of the multimedia file is not affected, and it can also avoid storing sub-files with incorrect file contents in the second version file in the target directory.
[0104] Figure 5 A flowchart of another multimedia processing method provided by an embodiment of the present disclosure is provided. The method can be applied in a terminal device, such as Figure 5 As shown, the method may include the following steps:
[0105] S501: Determine a target backup partition among multiple backup partitions.
[0106] S502: Clear the target backup partition.
[0107] S503: Write the second version file into the target backup partition.
[0108] For the specific implementation of S501 to S503, reference may be made to the above embodiment, which will not be described in detail here.
[0109] S504: Using a hash algorithm, determine whether the contents of the plurality of sub-files in the second version file are correct.
[0110] If the contents of multiple sub-files in the second version file are correct, execute S505. If the content of any sub-file in the multiple sub-files in the second version file is incorrect, the latest version file of the target directory may not be migrated, or the second version file may be rewritten to the target backup partition. For details, please refer to the following embodiment.
[0111] Exemplarily, the file information of each sub-file may further include a target hash value, which may be generated by the terminal device according to the content of the sub-file when generating the sub-file through a hash algorithm.
[0112] After writing the second version file into the target backup partition, the terminal device may generate a first hash value based on the content of the sub-file in the second version file written into the target backup partition using a hash algorithm.
[0113] The terminal device can then determine whether the content of the sub-file is correct based on the target hash value and the first hash value. Specifically, if the target hash value is inconsistent with the first hash value, it can be determined that the content of the sub-file is incorrect. If the target hash value is consistent with the first hash value, it can be determined that the content of the sub-file is correct.
[0114] S505: Move the latest version of the files in the target directory to the preset partition.
[0115] In this embodiment, when storing the second version file in the target directory, a hash algorithm may be used to determine whether the content of the sub-file is correct, thereby avoiding storing a sub-file with incorrect file content in the target directory.
[0116] In a possible implementation, if the content of any one of the multiple sub-files in the second version file is incorrect, the multiple sub-files in the second version file may be rewritten to the target backup partition, as follows:
[0117] Figure 6 A flowchart of another multimedia processing method provided by an embodiment of the present disclosure is provided. The method can be applied in a terminal device, such as Figure 6 As shown, the method may include the following steps:
[0118] S601: Clear the second version file stored in the target backup partition.
[0119] S602: Write the second version file to the target backup partition again, and increase the number of rewrites by 1.
[0120] S603: Determine whether the number of rewriting times is less than or equal to a preset number.
[0121] If the number of restarts is less than or equal to the preset number, S604 is executed. If the number of restarts is greater than the preset number, the latest file in the target directory is not migrated, that is, the operation of writing the second version file into the target directory is not executed.
[0122] Exemplarily, the preset number of times may be 3 times.
[0123] S604: Using a hash algorithm, determine whether the contents of the multiple sub-files in the second version file written into the target backup partition are correct.
[0124] If the contents of multiple sub-files in the second version file written to the target backup partition this time are correct, execute S605. If the content of any sub-file in the multiple sub-files in the second version file written to the target backup partition this time is incorrect, the target backup partition can be cleared again, and then the second version file can be written to the target backup partition again until the number of rewrites is greater than the preset number of times, or the contents of multiple sub-files in the second version file rewritten to the target backup partition are correct.
[0125] S605: Move the latest version of the files in the target directory to the preset partition.
[0126] In this embodiment, if the content of one of the multiple subfiles in the second version file is incorrect, the second version file can be rewritten to the target backup partition to avoid incorrect subfile content caused by an abnormal write operation. If the number of rewrites exceeds a preset number, it can be ruled out that the abnormal subfile content is caused by the write operation.
[0127] In a possible implementation, there may be other processing operations being executed on the multimedia file. When the terminal device writes the second version file to the target directory, it can determine whether the other processing operations being executed are submitted, that is, whether the sub-file is generated.
[0128] For example, the processing operation corresponding to the second version file is to add new text and change the color of the text font from black to red. The other processing operations being executed may be to insert a video into the multimedia file. Then, when generating the sub-file of this processing operation, since the video needs to be downloaded, which takes a long time, it can be determined whether the sub-files of other processing operations have been generated before writing the second version file to the target directory.
[0129] Specifically, Figure 7 A flowchart of another multimedia processing method provided by an embodiment of the present disclosure is provided. The method can be applied in a terminal device, such as Figure 7 As shown, the method may include the following steps:
[0130] S701: Before writing the second version file into the hardware memory, determine whether there is at least one other processing operation being executed on the multimedia file.
[0131] If yes, execute S702; if no, execute S703.
[0132] S702: Determine whether the sub-files corresponding to other processing operations being executed have been generated.
[0133] If the sub-files corresponding to all other processing operations being executed on the multimedia file are generated completely, S703 is executed; if the sub-file corresponding to any one of all other processing operations being executed on the multimedia file is not generated completely, S704 is executed.
[0134] S703: Write the second version file into the hardware memory.
[0135] S704: Wait until all sub-files corresponding to other processing operations being executed are generated.
[0136] In this embodiment, before writing the second version file to the target directory, it can be determined whether a sub-file of other processing operations being executed has been generated. If so, the operation of writing the second version file to the hardware memory is executed to avoid the impact of other processing operations being executed on the processing operations corresponding to the second version file.
[0137] In one possible implementation, the terminal device may record the execution time of a processing operation. If the execution time exceeds a preset time, the terminal device may send a report to a target server. The report includes the identifier of the processing operation and the execution time. The report is used by the target server to analyze the cause of the processing operation timeout. The target server may be a backend server serving an application corresponding to the multimedia file.
[0138] Figure 8 A schematic diagram of the structure of a multimedia processing device provided by an embodiment of the present disclosure is shown in FIG. Figure 8 As shown, the device 80 includes a generating module 801 , a reading module 802 , a saving module 803 , a determining module 804 and a storage module 805 .
[0139] The generating module 801 is configured to generate a plurality of sub-files corresponding to a processing operation on a multimedia file in response to the processing operation.
[0140] The reading module 802 is configured to read a first version file of the multimedia file.
[0141] The saving module 803 is configured to save the multiple sub-files to the first version file of the multimedia file to obtain a second version file of the multimedia file.
[0142] The determination module 804 is configured to determine whether there are any abnormalities in the plurality of sub-files in the second version file of the multimedia file.
[0143] The storage module 805 is configured to write the second version file of the multimedia file into the hardware memory if no abnormality occurs in the plurality of sub-files in the second version file of the multimedia file.
[0144] In a possible implementation, the determining module 804 is specifically configured to:
[0145] Get any one of multiple sub-files.
[0146] Determine whether the subfile can be opened normally.
[0147] If the sub-file cannot be opened normally, it is determined that there is an abnormality in the sub-file.
[0148] If the sub-file can be opened normally, it is determined whether the first identifier of the sub-file is consistent with the identifier of the processing operation.
[0149] If so, it is determined that there is no abnormality in the sub-file.
[0150] If not, it is determined that there is an abnormality in the sub-file.
[0151] In a possible implementation, the storage module 805 is specifically configured to:
[0152] A target backup partition among multiple backup partitions is determined, where the multiple backup partitions are respectively used to store multiple historical version files of the multimedia file, and the target backup partition is used to store the oldest historical version file among the multiple historical version files.
[0153] Clear the target backup partition.
[0154] Write the second version file to the target backup partition.
[0155] The latest version of the multimedia file in the target directory of the hardware storage is moved to a preset partition, which is an empty storage area.
[0156] Move the second version of the file stored in the target backup partition to the target directory.
[0157] In a possible implementation, the storage module 805 is specifically configured to:
[0158] Use a hash algorithm to determine whether the contents of multiple sub-files in the second version file are correct.
[0159] If the contents of the multiple sub-files in the second version file are correct, the latest version file of the multimedia file in the target directory is moved to the preset partition.
[0160] In a possible implementation, the storage module 805 is further configured to:
[0161] If the content of one of the multiple sub-files in the second version file is incorrect, the second version file stored in the target backup partition is cleared.
[0162] Write the second version of the file to the target backup partition again, and increase the number of rewrites by 1.
[0163] If the number of rewrites is less than or equal to the preset number, a hash algorithm is used to determine whether the contents of the multiple sub-files in the second version file written into the target backup partition are correct.
[0164] If the contents of the multiple sub-files in the second version file written into the target backup partition this time are all correct, the latest version file of the multimedia file in the target directory is moved to the preset partition.
[0165] In a possible implementation, if at least one other processing operation is being executed on the multimedia file, before writing the second version file into the hardware memory, the storage module 805 is further configured to:
[0166] Determine whether the sub-file corresponding to at least one processing operation is generated.
[0167] If not, wait until at least one sub-file corresponding to the processing operation is generated.
[0168] In a possible implementation, the device 80 further includes a processing module, which is specifically configured to:
[0169] Records the execution time of the processing operation.
[0170] If the execution time is longer than the preset time, a report message is sent to the target server. The report message includes the identification of the processing operation and the execution time. The report message is used by the target server to analyze the reason for the timeout of the processing operation.
[0171] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effects are similar and will not be described in detail in this embodiment.
[0172] In order to implement the above embodiment, the embodiment of the present disclosure further provides an electronic device.
[0173] refer to Figure 9 , which shows a schematic structural diagram of an electronic device 900 suitable for implementing the embodiments of the present disclosure. The electronic device 900 may be a terminal device. The terminal device may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 9The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0174] like Figure 9 As shown, the electronic device 900 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 into a random access memory (RAM) 903. Various programs and data required for the operation of the electronic device 900 are also stored in the RAM 903. The processing device 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0175] Typically, the following devices may be connected to the I / O interface 905: an input device 906 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 907 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 908 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 909. The communication device 909 may allow the electronic device 900 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 9 The electronic device 900 is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead.
[0176] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network via the communication device 909, or installed from the storage device 908, or installed from the ROM 902. When the computer program is executed by the processing device 901, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0177] It should be noted that the computer-readable storage medium described above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory, where EPROM stands for Erasable Programmable Read-Only Memory), optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal transmitted in baseband or as part of a carrier wave, which carries computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on a computer-readable storage medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, radio frequency (RF), etc., or any suitable combination thereof.
[0178] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0179] The computer-readable medium carries computer-executable instructions. When the computer-executable instructions are executed by the processor of the electronic device, the electronic device executes the method shown in the above embodiment.
[0180] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0181] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0182] The units involved in the embodiments described in this disclosure may be implemented in software or hardware. In some cases, the name of a unit does not limit the unit itself. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses."
[0183] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0184] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0185] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0186] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0187] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
[0188] In this disclosure, "at least one" means one or more. "Multiple" means two or more. The descriptions "first," "second," and so on, appearing in the embodiments of this disclosure are merely for illustration and to distinguish the objects being described. They are not in any particular order and do not represent a specific limitation on the number of devices in the embodiments of this disclosure. They do not constitute any limitation on the embodiments of this disclosure. For example, the first threshold and the second threshold are merely for distinguishing between different thresholds and do not represent a difference in size, priority, or importance between the two thresholds.
[0189] Throughout this disclosure, the terms "exemplary," "in some embodiments," "in other embodiments," and the like are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this disclosure as "exemplary" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of the word "exemplary" is intended to present concepts in a concrete manner.
Claims
1. A multimedia processing method, characterized in that: include: In response to a processing operation on a multimedia file, generating a plurality of sub-files corresponding to the processing operation; Reading a first version file of the multimedia file; Saving the multiple sub-files to the first version file of the multimedia file to obtain a second version file of the multimedia file; determining whether there is an anomaly among the plurality of sub-files in the second version file of the multimedia file; If no abnormality occurs in the plurality of sub-files in the second version file of the multimedia file, the second version file of the multimedia file is written into the hardware memory.
2. The method according to claim 1, characterized in that The determining whether the plurality of sub-files in the second version file of the multimedia file are abnormal includes: Obtain any one of the multiple sub-files; Determine whether the sub-file can be opened normally; If the sub-file fails to open normally, it is determined that there is an abnormality in the sub-file; If the sub-file can be opened normally, determining whether the first identifier of the sub-file is consistent with the identifier of the processing operation; If so, it is determined that there is no anomaly in the sub-file; If not, it is determined that there is an abnormality in the sub-file.
3. The method according to claim 1 or 2, characterized in that Writing the second version file of the multimedia file into the hardware memory includes: Determining a target backup partition among a plurality of backup partitions, the plurality of backup partitions being respectively used to store a plurality of historical version files of the multimedia file, the target backup partition being used to store the oldest historical version file among the plurality of historical version files; Clearing the target backup partition; Writing the second version file into the target backup partition; Moving the latest version of the multimedia file in the target directory of the hardware storage to a preset partition, where the preset partition is an empty storage area; The second version file stored in the target backup partition is moved to the target directory.
4. The method according to claim 3, characterized in that The step of moving the current version file of the multimedia file in the target directory of the hardware storage to a preset partition includes: Determining whether the contents of the plurality of sub-files in the second version file are correct by using a hash algorithm; If the contents of the multiple sub-files in the second version file are all correct, the latest version file of the multimedia file in the target directory is moved to a preset partition.
5. The method according to claim 4, characterized in that The method further comprises: If the content of one of the multiple sub-files in the second version file is incorrect, clearing the second version file stored in the target backup partition; Writing the second version file to the target backup partition again, with the number of rewrites increased by 1; If the number of rewrites is less than or equal to the preset number, determining whether the contents of the multiple sub-files written into the second version file of the target backup partition are correct by using the hash algorithm; If the contents of the multiple sub-files in the second version file written into the target backup partition this time are all correct, the latest version file of the multimedia file in the target directory is moved to the preset partition.
6. The method according to any one of claims 1 to 5, characterized in that If at least one other processing operation is being executed on the multimedia file, before writing the second version file into the hardware memory, the method further includes: Determining whether the sub-file corresponding to the at least one processing operation is generated; If not, wait until the sub-file corresponding to the at least one processing operation is generated.
7. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Recording the duration of execution of the processing operation; If the execution time is longer than the preset time, a report message is sent to the target server, where the report message includes the identifier of the processing operation and the execution time. The report message is used by the target server to analyze the timeout reason of the processing operation.
8. The method according to any one of claims 1 to 7, characterized in that The multimedia file is a multimedia editing draft, and accordingly, the processing operation is an editing operation.
9. A multimedia processing device, characterized in that: include: a generating module, configured to generate, in response to a processing operation on a multimedia file, a plurality of sub-files corresponding to the processing operation; A reading module, configured to read a first version file of the multimedia file; a saving module, configured to save the plurality of sub-files to the first version file of the multimedia file to obtain a second version file of the multimedia file; A determination module, configured to determine whether there is an anomaly in the plurality of sub-files in the second version file of the multimedia file; The storage module is configured to write the second version file of the multimedia file into a hardware memory if none of the multiple sub-files in the second version file of the multimedia file are abnormal.
10. An electronic device, characterized in that: include: processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the multimedia processing method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the multimedia processing method according to any one of claims 1 to 8 is implemented.
12. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the multimedia processing method according to any one of claims 1 to 8 is implemented.