Audio analysis method and electronic device

By skipping the file header information of the multimedia file in the electronic device of the smart terminal, directly traversing the data area to obtain the audio track information and decoding the audio data, the problem that the smart terminal cannot parse the audio data when playing the multimedia file is played, and the user experience is improved.

CN118870109BActive Publication Date: 2025-06-06HONOR DEVICE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410751506.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-11
Publication Date
2025-06-06
Estimated Expiration
2044-06-11

AI Technical Summary

Technical Problem

The smart terminal cannot successfully parse audio data when playing multimedia files, resulting in no sound playing when playing video screens, affecting the user experience.

Method used

When playing a multimedia file through the electronic device, the file header information is directly skipped, the data area of ​​the multimedia file is traversed to obtain at least one audio track information, and the audio data of the data area is decoded based on the audio track information to output sound.

Benefits of technology

Even if the file header information is corrupted or contains unrecognized special fields, electronic devices can still obtain audio track information and decode audio data by traversing the data area, solving the problem of inability to parse the file header information, which makes the sound unable to be played, and improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118870109B_ABST
    Figure CN118870109B_ABST
Patent Text Reader

Abstract

The present application provides an audio parsing method and an electronic device, which relates to the technical field of electronic devices. In the process of playing a multimedia file, if the file header information of the multimedia file is parsed and no audio track information is obtained, the file header information is directly skipped to directly traverse the data area of ​​the multimedia file to obtain at least one audio track information, and then the audio data in the data area is decoded based on the at least one audio track information, so as to output sound in the process of playing the multimedia file. In this way, the problem that the related technology cannot parse the file header information to generate the audio track information and cannot decode the audio data to output the sound can be solved, thereby improving the user experience of the electronic device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of electronic devices, and in particular to an audio analysis method and electronic device. Background Art

[0002] Nowadays, with the popularity of smart terminals, people use smart terminals to play multimedia files almost all the time. When smart terminals play multimedia files, they must parse the audio data in the multimedia files. If the smart terminal cannot successfully parse the audio data when playing multimedia files, the smart terminal will not play sound during the video playback process, thus affecting the user experience of the smart terminal. Summary of the invention

[0003] The embodiments of the present application provide an audio analysis method and an electronic device, which are used to solve the problem that a smart terminal does not output sound when playing multimedia files, thereby improving the user experience.

[0004] To achieve the above-mentioned purpose, an embodiment of the present application adopts the following technical solution: when an electronic device is playing a multimedia file, if no audio track information is obtained by parsing the file header information of the multimedia file, the file header information is directly skipped to directly traverse the data area of ​​the multimedia file to obtain at least one audio track information, and then the audio data in the data area is decoded based on the at least one audio track information, so as to output sound during the playback of the multimedia file.

[0005] In a first aspect, an audio parsing method is provided, which is applied to an electronic device, wherein a multimedia file that needs to be played is obtained by the electronic device, and then when the file header information of the multimedia file is parsed and no audio track information is obtained, the data area of ​​the multimedia file is directly traversed to obtain at least one audio track information. After obtaining the at least one audio track information, the electronic device decodes the audio data in the data area based on the audio track information, thereby outputting sound during the process of playing the multimedia file.

[0006] In the present application, when the electronic device cannot parse the file header information to generate the audio track information, it directly traverses the data area of ​​the multimedia file to obtain the audio track information, and decodes the audio data based on the audio track information to output the sound. This can solve the problem that the related art cannot parse the file header information to generate the audio track information and cannot decode the audio data to output the sound, thereby improving the user experience of the electronic device.

[0007] In a possible implementation of the first aspect, when the electronic device is playing a multimedia file, if the file header information of the multimedia file is damaged, so that the electronic device cannot read information from the file header information, the electronic device confirms that the current parsing of the file header information has not obtained the track information. The damage to the file header information may be caused by various factors, such as the electronic device being severely attacked by a virus, the multimedia file being abnormally interrupted during transmission, and the electronic device suddenly shutting down while using the multimedia file, etc., all of which may cause the damage to the file header information.

[0008] In another possible implementation of the first aspect, if the multimedia file compressor writes special fields into the file header information of the multimedia file by himself when compressing the multimedia file using a third-party tool, and these special fields are data segments that cannot be accurately identified by the electronic device through a conventional media file parsing tool, when the electronic device parses the file header information of the multimedia file through the conventional media file parsing tool, the file header information cannot be correctly identified and thus cannot be read from the file header information. In this way, the electronic device also confirms that no audio track information is currently obtained by parsing the file header information.

[0009] In another possible implementation of the first aspect, when the electronic device parses the file header information of the multimedia file through a conventional media file parsing tool, if the electronic device can read and obtain at least one audio data identifier by parsing the file header information, and read and obtain the decoding information corresponding to each audio data identifier, the electronic device can generate at least one audio track information. If the electronic device obtains at least one audio data identifier by parsing the file header information, but cannot read and obtain the decoding information corresponding to any audio data identifier, the electronic device also confirms that the audio track information cannot be obtained by parsing the file header information.

[0010] In a possible implementation of the first aspect, the electronic device can obtain multimedia files through a third-party music application, and play the obtained multimedia files through a multimedia player. When the electronic device plays the multimedia file through the multimedia player, the multimedia parser can be used as a conventional media file parsing tool, thereby calling the multimedia parser to parse the file header information of the multimedia file, and then in the case of parsing the file header information through the multimedia parser to obtain the track information, the electronic device passes the track information to the multimedia decoder through the multimedia parser, so that the track data in the multimedia file data area is decoded by the multimedia decoder based on the track information. For the decoded track data, the electronic device further synthesizes the decoded track data through a synthesizer and renders the decoded track data through an audio rendering service. Finally, the electronic device outputs the track data after a series of processing such as decoding, synthesis and rendering to the speaker and / or headphone interface through the audio driver in the kernel layer of the software system, thereby playing the sound corresponding to the track data.

[0011] In another possible implementation of the first aspect, the electronic device may also use an audio parsing application as a conventional media file parsing tool to parse the file header information of the multimedia file. Furthermore, when the electronic device parses the file header information through the audio parsing application to obtain the audio track information, the electronic device transmits the audio track information to the audio decoding application through the audio parsing application, so that the audio decoding application decodes the audio track data in the multimedia file data area based on the audio track information.

[0012] In a possible implementation of the first aspect, when the electronic device fails to obtain the audio track information by parsing the file header information through the multimedia parser, the electronic device directly traverses the data area of ​​the multimedia file through the audio parsing application to obtain at least one audio track information. Alternatively, when the electronic device fails to obtain the audio track information by parsing the file header information through the audio parsing application, the electronic device directly traverses the data area of ​​the multimedia file through the audio parsing application to obtain at least one audio track information. Then, the electronic device transmits the audio track information to the audio decoding application through the audio parsing application, so that the audio data is decoded based on the audio track information through the audio decoding application.

[0013] In another possible implementation of the first aspect, when the electronic device traverses the data area of ​​the multimedia file through the audio parsing application, the electronic device can obtain at least one audio data identifier by traversing the data area. When the at least one audio data identifier is obtained by traversing the data area, the electronic device generates at least one audio track information based on the at least one audio data identifier. The at least one audio track information corresponds to the at least one audio data identifier.

[0014] In a possible implementation of the first aspect, when the electronic device parses the file header information to obtain at least one track information, the multimedia decoder can use the at least one track information as an index to determine the track data corresponding to the at least one track information in the audio data in the data area. Afterwards, the electronic device decodes the at least one track data through the multimedia decoder, thereby outputting sound during the playback of the multimedia file. For example, when the electronic device traverses the data area of ​​the multimedia file through the audio parsing application to obtain N track information, the electronic device can determine the track data corresponding to each of the N track information in the audio data in the data area through the audio parsing application, that is, determine a total of N track data. Wherein, N is a positive integer greater than or equal to 1. Afterwards, when N is greater than 1, the electronic device can decode part of the N track data, or the electronic device can also decode all the N track data.

[0015] When the electronic device decodes a part of the N track data, the electronic device passes the M track data among the N track data to the audio decoding application through the audio parsing application, so that the M track data are decoded by the audio decoding application to play the sound. Among them, M is a positive integer greater than or equal to 1, but M is less than or equal to N. Alternatively, the electronic device can also pass the M track data among the N track data to the multimedia decoder through the audio parsing application, so that the M track data are decoded by the multimedia decoder. In addition, when the electronic device decodes all the N track data, the electronic device can pass the P track data among the N track data to the audio decoding application through the audio parsing application, and pass the NP track data to the multimedia decoder, so that the P track data are decoded by the audio decoding application, and the NP track data are decoded by the multimedia decoder. Among them, P is also a positive integer greater than or equal to 1, but P is less than N.

[0016] In the present application, when the electronic device parses the file header information and fails to obtain the track information, the data area of ​​the multimedia file is traversed by the audio parsing application of the application layer, and when at least one track information is obtained by traversing the data area, the audio decoding application of the application layer decodes the audio data based on the track information. In this way, the electronic device can directly traverse the data area of ​​the multimedia file using the audio parsing application to obtain the track information to decode the track data when the track information cannot be generated by parsing the file header information of the multimedia file, thereby playing the sound corresponding to the track data in the process of playing the multimedia file. In addition, the electronic device can have the function of the multimedia parser and the multimedia decoder of the framework layer to process the multimedia file respectively through the application of the application layer, which can not only ensure the performance of the framework layer of the electronic device software system, but also can use the method of updating the application in the software layer to achieve a more convenient update of the method of parsing the audio data of the electronic device when it is necessary to optimize or update other audio processing methods.

[0017] In a possible implementation of the first aspect, the data area of ​​the multimedia file includes multiple data packets, and each data packet includes header data and source data. For example, a piece of audio track data or a piece of image track data in the data area is a data packet (in some embodiments, a data packet is also referred to as a data stream or a data segment). When the electronic device traverses the data area through the audio parsing application, it can traverse the data packets in the data area in multiple rounds to obtain at least one audio track information.

[0018] In a possible implementation of the first aspect, the electronic device may traverse only the header data of each data packet during the first round of traversal of the data area through the audio analysis application, so as to find at least one audio data identifier in the header data of each data packet. Afterwards, when at least one audio data identifier is obtained, the electronic device performs a second round of traversal of the data area through the audio analysis application, and when performing the second round of traversal of the data area, the electronic device only traverses the source data of all data packets through the audio analysis application, and at least one target source data corresponding to the at least one audio data identifier. When the electronic device traverses the target source data through the audio analysis application, if the decoding information is found in the target source data sheet, the electronic device generates the audio track information based on the audio data identifier corresponding to the target source data.

[0019] In the present application, when the electronic device parses the file header information of the multimedia file and fails to obtain the track information, it loops through the data area of ​​the multimedia file to find at least one audio data identifier and determines whether there is decoding information in the track data corresponding to the at least one data identifier. When there is decoding information in the track data corresponding to the at least one audio data identifier, the electronic device generates at least one track information. In this way, when the electronic device subsequently decodes the audio data in the data area based on the track information, it can use the track information to determine the corresponding track data, and decode the track data with reference to the decoding information in the track data, thereby avoiding the situation where the track data is found in the data area but cannot be decoded because the track data has no corresponding decoding information, that is, this embodiment ensures the stability of decoding the track data to play the sound.

[0020] In a possible implementation of the first aspect, when the electronic device traverses the data area of ​​the multimedia file, it can also completely traverse each data packet in turn, so as to find the second audio data identifier in a data packet, and at the same time, when the decoding information is found in the data packet, the second audio track information is generated based on the second audio data identifier. Then, the electronic device directly decodes the audio data in the data area based on the second audio track information, so as to play the sound in the process of playing the multimedia file. Among them, the second audio data identifier is the first audio data identifier found by the electronic device through the audio analysis application traversing the data area, and the second audio track information is the first audio track information generated by the electronic device traversing the data area. Then, the electronic device directly decodes the audio data in the data area based on the first audio track information, so as to output the sound in the process of playing the multimedia file.

[0021] In a possible implementation of the first aspect, after the electronic device traverses the data area of ​​the multimedia file to obtain the first audio track information, the electronic device can stop further traversing the data area because the electronic device can already decode the audio data in the data area based on the first audio track information to play the sound.

[0022] In the present application, when the electronic device finds the first audio data identifier while traversing the data area of ​​the multimedia file, it generates the first audio track information based on the first audio data identifier. Then, the electronic device stops traversing the data area, and directly decodes the audio data in the data area based on the first audio track data to output sound. In this way, it can not only avoid the waste of device resources caused by the electronic device continuing to traverse the data area when it is already able to decode the audio data and output sound, but also improve the response time of the electronic device traversing the data area to generate audio track information to decode the audio data and output sound, so that when the user uses the electronic device to play multimedia files, the electronic device can decode the audio data and output sound in a shorter time, thereby further improving the user's experience of the electronic device.

[0023] In another possible implementation of the first aspect, if the electronic device obtains multiple audio track information while traversing the data area of ​​a multimedia file, when the electronic device decodes the audio data in the data area based on the audio track information, it can directly decode the audio track data corresponding to each of the multiple audio track information, thereby playing sound simultaneously through multiple channels of the electronic device.

[0024] In the present application, when the electronic device finds multiple audio data identifiers while traversing the data area of ​​a multimedia file and generates multiple audio track information based on the multiple audio data identifiers, the electronic device can simultaneously decode the audio track data corresponding to the multiple audio track information based on the multiple audio track information to play the sound using the multiple channels of the speaker. This can improve the playback effect of the audio data, allowing the user to obtain a better auditory experience, thereby further improving the user's usage experience.

[0025] In another possible implementation of the first aspect, when the electronic device obtains multiple audio track information after traversing the data area of ​​the multimedia file, the electronic device can also determine the audio track data corresponding to each of the multiple audio track information in the data area, compare the data amounts of the multiple audio track data, thereby determining the audio track data with the largest data amount among the multiple audio track data, and then decode the audio track data with the largest data amount to play the sound.

[0026] In the present application, when the electronic device generates multiple audio track information by traversing the data area, it can also select the audio track data with the largest data volume from the audio track data corresponding to each of the multiple audio track information, and then decode the audio track data to play the sound. In this way, compared with decoding multiple audio track data, the decoding rate can be increased, thereby improving the response speed of decoding audio data and playing sound when the electronic device plays multimedia files, and by decoding the audio track data with the largest data volume among the multiple audio track data, the user can still obtain a relatively good auditory experience.

[0027] In a second aspect, the present application provides an electronic device having the function of implementing the method described in the first aspect. The function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.

[0028] In a third aspect, the present application provides an electronic device comprising: an audio module, a processor and a memory; the memory is used to store computer program code, the computer program code includes computer execution instructions, and when the electronic device is running, the processor executes the computer execution instructions to enable the electronic device to perform the method described in the first aspect above.

[0029] In a fourth aspect, the present application provides a computer-readable storage medium, in which computer instructions are stored. When the computer-readable storage medium is run on an electronic device, the electronic device can execute the method described in the first aspect above.

[0030] In a fifth aspect, the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the method described in the first aspect above.

[0031] In a sixth aspect, a device is provided, the device comprising a processor, configured to support an electronic device to implement the functions of the first aspect. In a possible design, the device further comprises a memory, the memory being configured to store necessary program instructions and data for the electronic device.

[0032] Among them, the technical effects brought about by any design method in the second to sixth aspects can refer to the technical effects brought about by different implementation methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 A schematic diagram of the structure of a multimedia file involved in an embodiment of the present application;

[0034] Figure 2 A schematic diagram of the structure of an electronic device involved in an embodiment of the present application;

[0035] Figure 3 A schematic diagram of an information display window of a multimedia file outputted by an electronic device through a display screen according to an embodiment of the present application;

[0036] Figure 4 A schematic diagram of the steps of the audio analysis method provided in an embodiment of the present application in a feasible embodiment;

[0037] Figure 5 A logical flow chart of the audio parsing method provided in some embodiments of the present application;

[0038] Figure 6 for Figure 5 A schematic diagram of a scenario for creating an audio data packet in the process shown;

[0039] Figure 7 A schematic diagram of a scenario in which an electronic device according to an embodiment of the present application decodes audio track data to play sound;

[0040] Figure 8 A schematic diagram of the software and hardware architecture of an electronic device involved in an embodiment of the present application;

[0041] Fig. 9 A schematic diagram of a scenario in which an electronic device according to an embodiment of the present application traverses a data area through an audio analysis application to obtain only one audio track information;

[0042] Fig.10 A schematic diagram of a scenario in which an electronic device according to an embodiment of the present application obtains information of multiple audio tracks by traversing a data area through an audio analysis application;

[0043] Fig.11 A schematic diagram of another scenario in which an electronic device according to an embodiment of the present application decodes audio track data to play sound;

[0044] Fig.12 A schematic diagram of a scenario in which an electronic device according to an embodiment of the present application successively performs a first round of traversal and a second round of traversal on a data area of ​​a multimedia file;

[0045] Fig.13 A schematic diagram of the composition structure of a data packet in a multimedia file data area involved in an embodiment of the present application;

[0046] Fig.14 A schematic diagram of a scenario in which header data of multiple data packets in a data area of ​​a multimedia file involved in an embodiment of the present application include audio data identifiers;

[0047] Fig.15 A schematic diagram of a scenario in which an electronic device involved in an embodiment of the present application traverses a data area of ​​a multimedia file;

[0048] Fig.16 A schematic diagram of a scenario in which an electronic device according to an embodiment of the present application decodes audio track data corresponding to each of a plurality of audio track information;

[0049] Fig.17 A schematic diagram of a scenario in which an electronic device involved in an embodiment of the present application selects audio track data with the largest data volume for decoding from audio track data corresponding to multiple audio track information. DETAILED DESCRIPTION

[0050] The technical solutions in the embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and the appended claims of the present application, the singular expressions "a", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear indication to the contrary in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one or more (including two). The term "and / or" is used to describe the association relationship of associated objects, indicating that three relationships can exist; for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in a "or" relationship.

[0051] References to "one embodiment" or "some embodiments" etc. described in this specification mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Thus, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways. The term "connection" includes direct connection and indirect connection, unless otherwise specified. "First" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.

[0052] In the embodiments of the present application, the words "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.

[0053] Before introducing the embodiments of the present application, a brief introduction to the relevant technical terms involved in the embodiments of the present application is first given here.

[0054] 1. Multimedia file analysis.

[0055] Since electronic devices store media encoding data in the form of multimedia files, and most multimedia files follow specific rules for file naming. For example, multimedia files generally consist of two parts: a main name and an extension. The main name and the extension are separated by a ".", and the extension is used to indicate the format type of the file. Based on this, electronic devices can confirm the format type of the file by parsing the file name of the multimedia file. In addition, since multimedia files are represented as a collection of binary data in electronic devices, when the electronic device confirms the format type of the file, it can determine the encoded data of the media such as audio and images contained in the multimedia file by identifying the binary data, and then decode the audio data and image data to play the multimedia file. Among them, such as Figure 1 As shown, in a multimedia file, the file header information is located at the head of the entire file, and after the file header information is the data area of ​​the entire file, which contains audio data and image data. Among them, the file header information encapsulates the sampling rate, encoding method and decoding method of the audio data and image data. In the data area, the audio data is audio track data 1, audio track data 2 and audio track data 3, and the image data is image track data 1, image track data 2 and image track data 3.

[0056] 2. Conventional media file parsing tools.

[0057] Electronic devices can use media file parsing tools to parse multimedia files. Generally speaking, electronic devices will have one or more parsing tools integrated in their own software systems. Conventional media file parsing tools are applications that electronic devices integrate into software systems to parse multimedia files. For example, conventional media file parsing tools may include multimedia players, multimedia parsers, and multimedia decoders. When an electronic device uses a multimedia player to play a multimedia file, the multimedia parser can parse the file header information of the multimedia file to generate audio information, and then the multimedia decoder can decode the audio data in the multimedia file according to the audio information, thereby playing the sound corresponding to the audio data during the playback of the multimedia file.

[0058] 3. FFmpeg.

[0059] The full name of FFmpeg is Fast Forward Moving Picture Experts Group. FFmpeg contains many components and library files, the most commonly used of which is its command line tool. The command line tools included in FFmpeg include: codec tool + multimedia analyzer + player. In addition, in addition to the command line tool, FFmpeg also includes a module library. Among them, the module library includes: AVFormat (used for the generation and parsing of various audio and video packaging formats, audio and video packaging formats include: audio video interleaved (AVI), multimedia packaging format, Moving Picture Experts Group 4 (MP4) format, ...), AVCodec (used for various types of sound / image encoding and decoding, sound / image types include H.264, H.265, VP9, ​​...), AVFilter (used for filter processing), AVUtil (including some common tool functions) and swscale (used for video scene scaling, color mapping conversion), etc. In some embodiments, the electronic device can integrate FFmpeg into the software system as an application for parsing multimedia files. Alternatively, in other embodiments, the electronic device may also integrate FFmpeg into the software system as a conventional media file parsing tool.

[0060] 4. Audio track information.

[0061] Track information can define the position, encoding and decoding method, and channel of one or more track data in the data area of ​​the multimedia file. Generally speaking, the electronic device can parse the file header information of the multimedia file through a conventional media parsing tool or FFmpeg, and can read the number of track data in the data area, the position, encoding and decoding method, and channel of each track data from the file header information, thereby generating the track information corresponding to each track data. In some embodiments, when the electronic device plays the multimedia file, if the track information can be generated by parsing the file header information, the electronic device can read the track data from a specific position in the data area based on the track information and decode the track data, and then synthesize, render, and push the decoded track data to the corresponding channel, thereby playing the sound corresponding to the track data. Among them, when there are multiple track data in the data area of ​​the multimedia file, if the electronic device can parse the file header information of the multimedia file to generate the track information corresponding to each of the multiple track data, the electronic device can decode each track data according to each track information to play the sound corresponding to each track data.

[0062] The implementation of the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0063] First, please refer to Figure 2 , Figure 2 FIG. 1 is a schematic diagram of the structure of an electronic device 100 provided in an embodiment of the present application. Figure 2 As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, an antenna 1, an antenna 2, a mobile communication module 140, a wireless communication module 150, an audio module 160, a speaker 160A, an earphone interface 160B, a sensor module 170 and a display screen 180, etc.

[0064] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0065] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural-network processing unit (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. Among them, the controller can be the nerve center and command center of the electronic device 100. The controller can generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.

[0066] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0067] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0068] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0069] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 140, the wireless communication module 150, the modem processor and the baseband processor.

[0070] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0071] The mobile communication module 140 can provide solutions for wireless communications including 2G / 3G / 4G / 5G / 6G applied to the electronic device 100. The modulation and demodulation processor may include a modulator and a demodulator. The wireless communication module 150 can provide solutions for wireless communications including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc. applied to the electronic device 100.

[0072] The electronic device 100 implements the display function through a GPU, a display screen 180, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 180 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.

[0073] The display screen (or screen) 180 is used to display images, videos, etc. The display screen 180 includes a display panel. The display panel may include, but is not limited to, a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), a mini organic light-emitting diode (MINILED), a micro organic light-emitting diode (MicroLed), a quantum dot light emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 180, where N is a positive integer greater than 1.

[0074] The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 200. The internal memory 121 may be used to store computer executable program codes, which include instructions.

[0075] The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0076] The electronic device 100 can implement audio functions through the audio module 160, the speaker 160A, the headphone interface 160B, and the application processor. For example, music playback. In some embodiments, the electronic device 100 can process the audio data in the multimedia file through the audio module 160 and play it using the speaker or the headphone. For example, the electronic device 100 parses the multimedia file through the audio module 160 to generate at least one audio track information, and then reads at least one audio track data from the data area of ​​the multimedia file according to the at least one audio track information, and then performs packaging, decoding, synchronization (such as synchronizing the playback timestamps of the audio track data and the image track data when the multimedia file also contains image track data) and rendering for each audio track data read, and then outputs it to the speaker 160A or the headphone interface 160B, thereby achieving the playback of the audio data.

[0077] Based on the above brief description of the electronic device involved in the embodiment of the present application, the overall concept of the audio analysis method provided in the embodiment of the present application is proposed.

[0078] In the related art, when playing a multimedia file, an electronic device usually first parses the file header information of the multimedia file to generate audio track information, then reads the audio track data from the data area of ​​the multimedia file according to the audio track information, decodes the audio track data, and pushes it to the corresponding channel for playing. Alternatively, when a multimedia file contains both audio data and image data, when playing a multimedia file, the electronic device also first parses the file header information of the multimedia file to generate audio track information and image track information, then decodes the audio data in the data area according to the audio track information, decodes the image data in the data area according to the image track information, and synchronizes the decoded audio data and the decoded image data before playing.

[0079] It can be seen that the relevant technology needs to parse the file header information of the multimedia file to generate the audio track information, and then read the audio track data according to the audio track information for decoding, so as to play the sound corresponding to the audio track data in the process of playing the multimedia file. In this case, once the file header information of the multimedia file is damaged, or once the file header information contains a special field that the electronic device cannot recognize, the electronic device may not be able to correctly parse the file header information to generate the audio track information. In this way, the electronic device cannot complete the decoding of the audio track data in the data area of ​​the multimedia file to play the sound, so that the electronic device will directly report an error when playing the multimedia file, or only play the image data in the multimedia file but not the sound.

[0080] It should be noted that if Figure 3 As shown, Figure 3 The figure is a schematic diagram of the information display window of the multimedia file output by the electronic device through the display screen. If the electronic device cannot generate the audio track information by parsing the file header information of the multimedia file, then in the file information display window output by the electronic device, the audio information display area ( Figure 3 For example, the information about the audio sampling rate, encoding method, audio track, and the audio channel corresponding to the audio track that the electronic device should generate by parsing the file header information is empty.

[0081] In addition, the special fields that the above-mentioned electronic device cannot recognize may be the field contents that are independently entered by the compression personnel of the multimedia file in the file header information. Since the field contents independently entered by the compression personnel may affect the standard structure and format of the file header information, or disrupt the data encoding order in the file header information, the electronic device using conventional media file parsing tools may not be able to correctly identify the file header information, and thus cannot obtain information about the audio track data to generate audio track information.

[0082] In combination with the above, in the related technology, when an electronic device plays a multimedia file, if the electronic device cannot generate audio track information by parsing the file header information, it cannot decode the audio data in the multimedia file to play the sound, thereby affecting the user experience of the electronic device.

[0083] To this end, an embodiment of the present application provides an audio parsing method. When an electronic device needs to play a multimedia file, if the electronic device does not obtain audio track information when parsing the file header information of the multimedia file, the electronic device directly skips the file header information and traverses the data area of ​​the multimedia file to obtain at least one audio track information. Then, during the process of playing the multimedia file, the electronic device decodes the audio data in the data area based on the at least one audio track information to play the sound.

[0084] Thus, compared to the method of the related art that needs to parse the file header information of the multimedia file to generate the track information in order to decode the track data to play the sound, the audio parsing method provided by the embodiment of the present application can obtain the track information by directly traversing the data area of ​​the multimedia file even if the file header information is damaged or the file header information contains a special field that the electronic device cannot recognize, resulting in the electronic device being unable to generate the track information by parsing the file header information, thereby decoding the track data based on the track information to play the sound. In other words, the audio parsing method provided by the embodiment of the present application can solve the problem that the related art cannot decode the track data to play the sound because it cannot parse the file header information to generate the track information, thereby improving the user experience of the electronic device.

[0085] Based on the overall conceptual description of the audio analysis method provided in the embodiment of the present application, a plurality of specific embodiments of the audio analysis method provided in the embodiment of the present application are further proposed.

[0086] Please refer to Figure 4 , Figure 4 The following is a flowchart of the steps of the audio parsing method provided in the embodiment of the present application in a feasible embodiment. It should be understood that although Figure 4 The execution order of some method steps is shown in the figure, but the audio parsing method provided in the embodiment of the present application can adopt an execution order different from the method steps shown in the figure based on different design requirements of actual applications. That is, Figure 4 The order of the steps in the method shown does not constitute a limitation on the execution logic order of the audio parsing method provided in the embodiment of the present application. Figure 4 Reasonable changes in the order of the method steps shown should be included in the protection scope of the audio analysis method provided in the embodiments of the present application.

[0087] like Figure 4As shown, when an electronic device applies the audio parsing method provided in an embodiment of the present application, the electronic device obtains the multimedia file that needs to be played currently by executing S1: the acquisition step. The electronic device parses the file header information in the multimedia file by executing S2: the parsing step. Among them, there are two results when the electronic device parses the file header information, that is, parsing the file header information without obtaining the track information and parsing the file header information to obtain the track information. In the case where the track information is not obtained by parsing the file header information, the electronic device executes S3: the traversal step to directly traverse the data area of ​​the multimedia file to obtain at least one track information. In the case of obtaining at least one track information, the electronic device executes S4: the decoding step to decode the audio data in the data area based on the track information, thereby achieving the playing of sound during the playing of the multimedia file.

[0088] In addition, in some embodiments, when the electronic device parses the file header information to obtain the audio track information, the electronic device can directly execute S5: decoding step, thereby decoding the audio data in the data area based on the audio track information, thereby achieving the playback of sound during the playback of multimedia files.

[0089] Please refer to Figure 5 and Figure 6 , Figure 5 is a logical flow chart of an audio parsing method provided by an embodiment of the present application in some embodiments, Figure 6 yes Figure 5 Schematic diagram of the scenario of creating an audio data packet in the process shown.

[0090] like Figure 5 As shown, after the electronic device obtains the multimedia file that needs to be played, it calls the playback engine through the audio module to play the multimedia file. The playback engine first starts the function of extracting audio and video data to enter the preparation stage for playing the multimedia file. Then, in the preparation stage, the playback engine first calls a conventional media file parsing tool to parse the file header information of the multimedia file, and determines whether the audio track information can be obtained by parsing the file header information.

[0091] In some embodiments, when the electronic device parses the file header information of a multimedia file using a conventional media file parsing tool, if the conventional media file parsing tool cannot read information from the file header information, the electronic device can determine that the file header information is damaged and confirm that no audio track information is currently obtained by parsing the file header information.

[0092] It should be noted that the damage to the file header information of the multimedia file may be caused by various factors, such as the electronic device being seriously attacked by a virus, the abnormal interruption of the multimedia file during transmission, and the sudden shutdown of the electronic device when using the multimedia file, etc., which may all cause the damage to the file header information. In addition, the information that the electronic device cannot read when parsing the file header information may specifically be information related to the audio, such as the audio sampling rate, encoding method, decoding method, audio track and the channel corresponding to the audio track, etc.

[0093] In other embodiments, if the multimedia file compression personnel write special fields into the file header information of the multimedia file by themselves when compressing the multimedia file using a third-party tool, and these special fields are data segments that cannot be accurately identified by the electronic device through conventional media file parsing tools, when the electronic device parses the file header information of the multimedia file through conventional media file parsing tools, the file header information cannot be correctly identified and thus cannot be read from the file header information. In this way, the electronic device also confirms that no audio track information is currently obtained by parsing the file header information.

[0094] In some other embodiments, when the electronic device parses the file header information of the multimedia file through a conventional media file parsing tool, if the electronic device can read and obtain at least one audio data identifier by parsing the file header information, and read and obtain the decoding information corresponding to each audio data identifier, the electronic device can generate at least one audio track information. If the electronic device reads and obtains at least one audio data identifier by parsing the file header information, but cannot read and obtain the decoding information corresponding to any audio data identifier, the electronic device also confirms that the audio track information cannot be obtained by parsing the file header information.

[0095] It should be noted that the audio data identifier is a character or string used in a multimedia file to indicate that a data segment belongs to the audio track data. For example, the audio data identifier may specifically be "AVMEDIA_TYPE_AUDIO". In addition, the audio data identifier may exist in the file header information of the multimedia file or in the data area of ​​the multimedia file. In a multimedia file, an audio data identifier usually corresponds to a decoding information, and the decoding information is used to indicate which decoder or decoding method is used to decode the audio track data represented by the audio data identifier. For example, the decoding information may specifically be "AV_CODEC_ID".

[0096] like Figure 5As shown, when the electronic device fails to obtain the audio track information by parsing the file header information through the conventional media parsing tool, it determines whether the conventional media file parsing tool prompts that the audio track information is not obtained. When the conventional media file parsing tool directly prompts that the audio track information is not obtained, the electronic device starts to traverse the data area, thereby directly skipping the file header information of the multimedia file and traversing the data area of ​​the multimedia file.

[0097] In some embodiments, the electronic device traverses the data area of ​​the multimedia file, which may start from the location where the audio track data and the image track data are recorded in the data area, and traverses all the data in the data area in sequence.

[0098] In some embodiments, when the electronic device traverses all the data in the data area, it can find at least one audio track data in the data area by searching for the audio data identifier. For example, when the electronic device traverses all the data in the data area, after finding the audio data identifier, it can determine that the segment of data from the position where the current audio data identifier is located to the position where the next audio data identifier is located is the audio track data corresponding to the current audio data identifier. In addition, after the electronic device finds at least one audio track data by searching for the audio data identifier, it also traverses each audio track data to determine whether there is decoding information in the audio track data.

[0099] like Figure 5 As shown, after the electronic device traverses the data area, it generates the audio track information when the audio data identifier and the decoding information are found. For example, the electronic device finds an audio data identifier and determines that there is decoding information in the audio track data corresponding to the audio data identifier, and the electronic device can determine that the audio track data can be decoded later. Thus, the electronic device confirms that it can currently generate an audio track information at least to indicate the location of the audio track data in the data area, so as to facilitate the subsequent extraction of the audio track data and decoding of the audio track data. In this way, the electronic device can generate an audio track information based on the audio data identifier, so that the audio track information and the audio track data corresponding to the audio data identifier also correspond one-to-one.

[0100] like Figure 5As shown, after the electronic device generates the track information, it performs an operation of selecting the track data based on the generated track information, thereby selecting the track data corresponding to the track information in the data area as the track data to be finally decoded. In addition, after the electronic device uses the track data corresponding to the track information as the track data to be finally decoded, it also creates an audio data packet for the track data to be finally decoded, so as to package the track data to be finally decoded into an audio data packet. For the packaged audio data packet, the electronic device can decode each track data in the audio data packet, and then output the decoded track data to the corresponding channel of each track data in the speaker or headphone interface, thereby playing sound during the playback of multimedia files.

[0101] like Figure 6 As shown, in some embodiments, the electronic device traverses the data area to generate track information, and then determines track data 1, track data 2, and track data 3 in the data area as the final track data to be decoded based on the track information, and then obtains an audio data packet by packaging track data 1, track data 2, and track data 3. The audio data packet will be further decoded, synchronized, and rendered before being sent to the corresponding channel in the speaker or headphone interface, thereby playing sound during the playback of multimedia files.

[0102] Similarly, since the data area of ​​the multimedia file also includes image track data 1, image track data 2, and image track data 3, the electronic device also packages image track data 1, image track data 2, and image track data 3 to obtain an image data packet. The image data packet will be further decoded, synthesized, synchronized, and rendered before being sent to the display screen of the electronic device, so that the images corresponding to image track data 1, image track data 2, and image track data 3 are played on the display screen.

[0103] In some embodiments, when a conventional media file parsing tool parses file header information of a multimedia file, if the conventional media file parsing tool cannot determine information such as the number of audio track data contained in the data area, the position of each audio track data in the data area, and the size of each audio track data by parsing the file header information, the conventional media file parsing tool will directly prompt that the audio track information has not been obtained. If the conventional media file parsing tool can determine information such as the number, position, and size of the audio track data in the data area by parsing the file header information, but cannot parse out the decoding information corresponding to each audio track data, the conventional media file parsing tool will not directly prompt that the audio track information has not been obtained, but will prompt that there is no decoding information.

[0104] Therefore, if Figure 5As shown, when the electronic device determines whether the conventional media file parsing tool prompts that the audio track information is not obtained, if the conventional media file parsing tool still does not prompt that the audio track information is not obtained after the electronic device waits for a certain period of time, the electronic device determines whether the conventional media file parsing tool prompts that there is no decoding information.

[0105] like Figure 5 As shown, when the conventional media file parsing tool neither provides the information of the unobtained audio track nor prompts the absence of decoding information, the electronic device confirms that the audio track information cannot be obtained by parsing the file header information, and thus performs traversal of the data area and subsequent operations. The traversal of the data area and subsequent operations performed by the electronic device when the conventional media file parsing tool does not prompt the absence of decoding information are the same as the traversal of the data area and subsequent operations performed by the above-mentioned electronic device when the conventional media file parsing tool directly prompts the absence of audio track information, and the same content will not be elaborated on here.

[0106] In addition, if Figure 5 As shown, when the conventional media file parsing tool prompts that there is no decoding information, the electronic device can directly select the track data. In some embodiments, when the electronic device parses the file header information of the multimedia file through the conventional media parsing tool, if the conventional media parsing tool can read the number, position and data size of the track data from the file header information, the conventional media parsing tool will not directly prompt that the track information is not obtained, but because the conventional media parsing tool cannot read the decoding information of any track data from the file header information, the conventional media parsing tool will prompt that there is no decoding information, and the electronic device can confirm that the data area of ​​the multimedia file at least stores the track data, but it is not sure which track data can be successfully decoded. In this way, the electronic device can assume that all the track data in the data area are successfully decoded, so as to directly select all the track data in the data area as the track data to be decoded in the end, and pack all the track data to form an audio data packet. In this way, when the electronic device decodes the packaged audio data packet, as long as any track data in the audio data packet can be successfully decoded, the electronic device can play the sound in the process of playing the multimedia file.

[0107] In an embodiment of the present application, when the electronic device does not obtain the audio track data by parsing the file header information of the multimedia file, the file header information is directly skipped to traverse the data area of ​​the multimedia file to obtain at least one audio track information, thereby decoding the audio data in the data area based on the at least one audio track information to play the sound. In this way, even if the file header information of the multimedia file is damaged or the file header information contains a special field that the electronic device cannot recognize, so that the electronic device cannot generate audio information by parsing the file header information, the electronic device can also obtain the audio track information and play the audio data based on the audio track information. That is, the audio parsing method provided in the embodiment of the present application solves the problem in the related art that the audio data cannot be played if the file header information cannot be parsed, thereby improving the user's experience of using the electronic device.

[0108] Please refer to Figure 7 , Figure 7 It is a schematic diagram of a scenario in which an electronic device decodes audio track data to play sound.

[0109] like Figure 7 As shown, in some embodiments, when the electronic device obtains the multimedia file that needs to be played currently and calls the playback engine to play the multimedia file through the audio module, the playback engine starts the function of extracting audio and video data and can also directly extract audio data from the data area of ​​the multimedia file, thereby obtaining all the track data such as track data 1, track data 2 and track data 3 in the data area. Then, the electronic device can obtain at least one track information by traversing all the track data in sequence, and select the track data that needs to be decoded in the end based on the track information. After the electronic device selects track data 1 from all the track data based on the track information, the electronic device creates an audio data packet for track data 1 to package track data 1 into an audio data packet. Finally, the electronic device decodes track data 1 in the audio data packet and outputs the decoded track data to the channel corresponding to track data 1 in the speaker or headphone interface, so that the sound corresponding to track data 1 can be played in the process of playing the multimedia file.

[0110] Please refer to Figure 8 , Fig. 9 , Fig.10 and Fig.11 , Figure 8 It is a schematic diagram of the hardware and software architecture of an electronic device. Fig. 9 This is a schematic diagram of a scenario in which an electronic device obtains only one audio track by traversing the data area through an audio analysis application. Fig.10 It is a schematic diagram of a scenario in which an electronic device obtains information of multiple audio tracks by traversing a data area through an audio analysis application. Fig.11 It is another schematic diagram of a scenario in which an electronic device decodes audio track data to play sound.

[0111] like Figure 8 As shown, in some embodiments, the hardware and software architecture of the electronic device can be designed in layers. For example, the software system of the electronic device includes an application layer (application layer, APP Layer), a framework layer (application framework layer, FWK Layer). And a hardware abstraction layer (hardware abstraction layer, HAL) and a kernel layer (kernel layer). In some embodiments, the application layer may include various applications running in the electronic device, such as: third-party music applications, video applications, music applications, playback engines, video parsing applications, audio parsing applications, and audio decoding applications. Among them, the video parsing application can be a command line tool for parsing image data in the above-mentioned FFmpeg, the audio parsing application can specifically be a command line tool for parsing audio data in the above-mentioned FFmpeg, and the audio decoding application can specifically be a command line tool for decoding audio data in FFmpeg. The framework layer may include a multimedia player, a multimedia parser, a multimedia decoder, a synthesizer, and a service for processing multimedia files, such as: an image rendering service (surface flinger, SF) for rendering image data, and an audio rendering service (audio flinger, AF) for rendering audio data. In addition, the hardware layer of the electronic device mainly includes a speaker, a headphone jack, and a display screen.

[0112] like Figure 8 As shown, in some embodiments, the electronic device can obtain multimedia files through a third-party music application, and play the obtained multimedia files through a multimedia player. When playing multimedia files through a multimedia player, the electronic device can use a multimedia parser as a conventional media file parsing tool, thereby calling the multimedia parser to parse the file header information of the multimedia file, and then in the case of parsing the file header information through the multimedia parser to obtain the track information, the electronic device passes the track information to the multimedia decoder through the multimedia parser, so that the track data of the multimedia file data area is decoded by the multimedia decoder based on the track information. For the decoded track data, the electronic device further synthesizes the decoded track data through a synthesizer and renders the decoded track data through an audio rendering service. Finally, the electronic device outputs the track data after a series of processing such as decoding, synthesis and rendering to a speaker and / or a headphone interface through the audio driver in the kernel layer of the software system, thereby playing the sound corresponding to the track data.

[0113] In addition, if Figure 8As shown, in other embodiments, the electronic device may also use an audio parsing application as a conventional media file parsing tool to parse the file header information of the multimedia file. Furthermore, when the electronic device parses the file header information through the audio parsing application to obtain the audio track information, the electronic device then transmits the audio track information to the audio decoding application through the audio parsing application, so that the audio track data in the multimedia file data area is decoded by the audio decoding application based on the audio track information.

[0114] like Figure 8 As shown, in some embodiments, when the electronic device does not obtain the audio track information by parsing the file header information through the multimedia parser, the electronic device directly traverses the data area of ​​the multimedia file through the audio parsing application to obtain at least one audio track information. Alternatively, when the electronic device does not obtain the audio track information by parsing the file header information through the audio parsing application, the electronic device directly traverses the data area of ​​the multimedia file through the audio parsing application to obtain at least one audio track information. Then, the electronic device passes the audio track information to the audio decoding application through the audio parsing application, so that the audio data is decoded based on the audio track information through the audio decoding application.

[0115] It should be noted that the process of synthesizing and rendering the decoded audio track data after the electronic device decodes the audio track data in the multimedia file data area through the audio decoding application is the same as the process of synthesizing the decoded audio track data through the synthesizer after decoding the audio track data through the multimedia decoder, and rendering the decoded audio track data through the audio rendering service and then outputting it to the speaker and / or headphone interface to play the sound. The same content will not be elaborated here and in the following text.

[0116] In some embodiments, when the electronic device traverses the data area of ​​the multimedia file through the audio parsing application, it can obtain at least one audio data identifier by traversing the data area. Among them, the audio data identifier is used to distinguish the audio track, different audio tracks correspond to different audio data identifiers, and the same audio track corresponds to the same audio data identifier. In this way, when the electronic device traverses the data area to obtain at least one audio data identifier, it can generate at least one audio track information based on the at least one audio data identifier, so that the audio track information and the audio track data also correspond one to one, so that when the electronic device subsequently decodes the audio track data, it can use the audio track information as an index to determine the audio track data that needs to be decoded.

[0117] It should be noted that at least one audio track information corresponds to at least one audio data identifier. For example, when the electronic device traverses the data area of ​​the multimedia file and obtains only one audio data identifier, the electronic device directly generates an audio track information corresponding to the audio data identifier based on the audio data identifier. Alternatively, when the electronic device traverses the data area and obtains two audio data identifiers, the electronic device first generates the first audio track information based on the first audio data identifier, and then generates the second audio track information based on the second audio data identifier.

[0118] In some embodiments, the electronic device may generate audio track information corresponding to the audio data identifiers one by one based on the traversed audio data identifiers in chronological order.

[0119] For example, when the electronic device traverses the data area through the audio parsing application, it first senses the number of data streams nb_streams that can be actually parsed in the multimedia file, and then sequentially traverses the data segments of the data area such as audio track data 1, image track data 1, audio track data 2, image track data 2, audio track data 3, and image track data 3 to find at least one audio data identifier in audio track data 1, audio track data 2, and audio track data 3. Then, as Fig. 9 As shown, the electronic device finds AVMEDIA_TYPE_AUDIO3 ( Fig. 9 The track data with fill lines in the middle is the track data with audio data identification. In this case, when the electronic device generates the track information, it generates a track information 3 based on AVMEDIA_TYPE_AUDIO3. Or, Fig.10 As shown, the electronic device finds AVMEDIA_TYPE_AUDIO1 in audio track data 1 through the audio parsing application, finds AVMEDIA_TYPE_AUDIO2 in audio track data 2, and finds AVMEDIA_TYPE_AUDIO3 in audio track data 3 ( Fig.10 The track data with fill lines in the middle are all track data with audio data identifiers. In this case, the electronic device generates track information 1 based on AVMEDIA_TYPE_AUDIO1, generates track information 2 based on AVMEDIA_TYPE_AUDIO2, and generates track information 3 based on AVMEDIA_TYPE_AUDIO3.

[0120] In some embodiments, when the electronic device generates the track information corresponding to the audio data identifier based on the audio data identifier, the audio data identifier can be encoded to make the encoded audio data identifier correspond to the track data one-to-one, and then the encoded audio data identifier can be directly encapsulated as the track information. In this way, the track information, the track data, and the audio data identifier in the track data can all correspond one-to-one, so that when the electronic device subsequently decodes the track data based on the track information, it can determine the track data corresponding to the track information from the multiple track data in the data area. After that, the electronic device can create an audio data packet by packaging the track data corresponding to the track information, and pass the audio data packet to an audio decoding application or a multimedia decoder to decode the track data in the audio data packet.

[0121] It should be noted that, since there is decoding information in the audio track data, after the electronic device packages the audio track data corresponding to the audio track information and transmits it to the audio analysis application, the electronic device can decode the audio track data according to the decoding information in the audio track data through the audio analysis application. Alternatively, after the electronic device packages the audio track data corresponding to the audio track information and transmits it to the audio multimedia decoder, the electronic device can decode the audio track data according to the decoding information in the audio track data through the multimedia decoder.

[0122] For example, Fig.11 As shown, when the electronic device finds AVMEDIA_TYPE_AUDIO1 in the audio track data 1 through the audio analysis application, and the audio track data 1 contains the decoding information AV_CODEC_ID, the AVMEDIA_TYPE_AUDIO1 in the audio track data 1 is encapsulated as the corresponding audio track information 1. In this way, since the audio track information 1, AVMEDIA_TYPE_AUDIO1 and the audio track data 1 are one-to-one corresponding to each other, the electronic device can determine that the audio track data 1 in the data area is the audio track data that needs to be decoded in the end based on the audio track information 1, and extract the audio track data 1 from the data area, and then package the audio track data 1 to create an audio data packet. For the created audio data packet, the electronic device transmits the audio data packet to the audio decoding application or the multimedia decoder through the audio analysis application to decode the audio track data 1 in the audio data packet to play the sound.

[0123] It should be noted that, taking the audio decoding application as an example, after receiving the audio data packet transmitted by the audio analysis application, the audio decoding application can first confirm that the audio data currently to be decoded is the audio track data 1, and then find the decoding information AV_CODEC_ID from the audio track data 1, so as to decode the audio track data 1 according to the AV_CODEC_ID. In addition, the decoded audio track data 1 will be sent to the corresponding channel in the speaker or headphone interface after further synchronization and rendering, so as to play the sound corresponding to the audio track data 1.

[0124] like Figure 8 As shown, in some embodiments, the electronic device may first parse the file header information of the multimedia file through the multimedia parser. If the electronic device obtains the audio track information by parsing the file header information through the multimedia parser, the electronic device passes the audio track information and the multimedia file to the multimedia decoder through the multimedia parser, so that the multimedia decoder decodes the audio data in the data area of ​​the multimedia file based on the audio track information. If the electronic device does not obtain the audio track information by parsing the file header information through the multimedia parser, the electronic device directly skips the file header information of the multimedia file through the audio parsing application to traverse the data area of ​​the multimedia file, and then, when at least one audio track information is obtained through the traversal, the at least one audio track information is passed to the audio decoding application through the audio parsing application, so that the audio data is decoded based on the audio track information by the audio decoding application.

[0125] In some embodiments, when the electronic device obtains at least one track information by traversing the data area of ​​the multimedia file through the audio parsing application, the electronic device can determine the track data corresponding to the at least one track information in the audio data by using the at least one track information as an index through the audio parsing application. Afterwards, the at least one track data is sent to the audio decoding application through the audio parsing application to decode the at least one track data through the audio decoding application. Alternatively, the electronic device can also send at least one track data to the multimedia decoder through the audio parsing application, so as to decode the at least one track data through the multimedia decoder. For example, when the electronic device obtains N track information by traversing the data area of ​​the multimedia file through the audio parsing application, the electronic device can determine the track data corresponding to each of the N track information in the audio data of the data area through the audio parsing application, that is, determine a total of N track data. Wherein, N is a positive integer greater than or equal to 1. Afterwards, when N is greater than 1, the electronic device can decode part of the N track data, or the electronic device can also decode all the N track data.

[0126] When the electronic device decodes a part of the N track data, the electronic device passes the M track data among the N track data to the audio decoding application through the audio parsing application, so that the M track data are decoded by the audio decoding application to play the sound. Among them, M is a positive integer greater than or equal to 1, but M is less than or equal to N. Alternatively, the electronic device can also pass the M track data among the N track data to the multimedia decoder through the audio parsing application, so that the M track data are decoded by the multimedia decoder. In addition, when the electronic device decodes all the N track data, the electronic device can pass the P track data among the N track data to the audio decoding application through the audio parsing application, and pass the NP track data to the multimedia decoder, so that the P track data are decoded by the audio decoding application, and the NP track data are decoded by the multimedia decoder. Among them, P is also a positive integer greater than or equal to 1, but P is less than N.

[0127] In some embodiments, Figure 8 As shown, the electronic device can also obtain the multimedia file to be played through its own video application or music application, and then call the audio analysis application through the playback engine to parse the file header information of the multimedia file, and when the audio track information is obtained by parsing the file header information, the audio analysis application transmits the multimedia file and the audio track information to the multimedia decoder, so that the multimedia decoder decodes the audio data in the data area of ​​the multimedia file based on the audio track information. Alternatively, the electronic device can also transmit the multimedia file and the audio track information to the audio decoding application through the audio analysis application, so that the audio data is decoded based on the audio track information by the audio decoding application.

[0128] It should be noted that if Figure 8 As shown, in the process of parsing the audio data in the multimedia file, if the multimedia file also contains image data, the electronic device also parses the image data synchronously. The electronic device can parse the file header information of the multimedia file through the video parsing application to generate at least one image track information, and then pass the multimedia file and the image track information to the multimedia decoder through the video parsing application, so that the multimedia decoder decodes the image track data in the data area of ​​the multimedia file based on the image track information. Afterwards, the electronic device synthesizes the decoded image track data through the synthesizer, and then renders the decoded image track data through the audio rendering service. Finally, the electronic device outputs the image track data after decoding, synthesis and rendering to the display screen of the hardware layer through the image display driver in the kernel layer, so that the image corresponding to the image track data is played through the display screen.

[0129] In this embodiment, when the electronic device does not obtain the track information by parsing the file header information, the data area of ​​the multimedia file is traversed by the audio parsing application of the application layer, and when at least one track information is obtained by traversing the data area, the audio decoding application of the application layer decodes the audio data based on the track information. In this way, the electronic device can directly traverse the data area of ​​the multimedia file using the audio parsing application to obtain the track information to decode the track data when it is unable to generate the track information by parsing the file header information of the multimedia file, thereby playing the sound corresponding to the track data in the process of playing the multimedia file. In addition, the electronic device can have the function of the multimedia parser and the multimedia decoder of the framework layer to process the multimedia file respectively through the application of the application layer, which can not only ensure the performance of the framework layer of the electronic device software system, but also can use the method of updating the application in the software layer to achieve a more convenient update of the method of parsing the audio data of the electronic device when it is necessary to optimize or update other audio processing methods.

[0130] Please refer to Fig.12 , Fig.13 and Fig.14 , Fig.12 It is a schematic diagram of a scenario in which an electronic device successively performs a first round of traversal and a second round of traversal on a data area of ​​a multimedia file. Fig.13 It is a schematic diagram of the composition structure of a data packet in the multimedia file data area. Fig.14 It is a schematic diagram of a scenario in which header data of multiple data packets in a data area of ​​a multimedia file include audio data identifiers.

[0131] In some embodiments, the data area of ​​the multimedia file includes multiple data packets, and each data packet includes header data and source data. For example, a piece of audio track data or a piece of image track data in the data area is a data packet (in some embodiments, a data packet is also referred to as a data stream or a data segment). When the electronic device traverses the data area through the audio parsing application, it can traverse the data packets in the data area in multiple rounds to obtain at least one audio track information.

[0132] like Fig.12 As shown, the electronic device can use the audio analysis application to traverse the data area in the first round, and only traverse the header data of each data packet such as audio track data 1, image track data 1, audio track data 2, image track data 2, audio track data 3 and image track data 3 in sequence ( Fig.12In the multimedia file on the left, the portion indicated by the fill line in each data packet is the header data of the data packet) to find at least one audio data identifier. Afterwards, when the electronic device finds an audio data identifier 1 (first audio data identifier) ​​in the header data of the data packet of track data 1 after traversing, the electronic device determines the source data in the data packet of track data 1 as the target source data that needs to be traversed in the second round of traversal. Moreover, when the electronic device continues to traverse to the header data of track data 3 and finds another track data identifier 2 (first audio data identifier), the electronic device also determines the source data of the data packet of track data 3 as the target source data that needs to be traversed in the second round of traversal. Afterwards, when the electronic device has traversed the header data of all data packets and has not found other audio data identifiers, the electronic device only traverses the target source data in the two data packets of track data 1 and track data 3 through the audio analysis application. Thus, if the electronic device finds decoding information in the target source data of track data 1 through the audio analysis application, the electronic device confirms that the track data 1 can be decoded with reference to the decoding information, thereby generating a first track information based on the audio data identifier 1 corresponding to the track data 1. In addition, if the electronic device also finds decoding information in the target source data of track data 3 through the audio analysis application, the electronic device also confirms that the track 3 can be decoded with reference to the decoding information, thereby generating another first track information based on the audio data identifier 2 corresponding to the track data 3.

[0133] like Fig.13 As shown, in some embodiments, each data packet in the data area of ​​the multimedia file is composed of multiple Boxes, where Box1 is the header data of the data packet, and Box2 to Boxn are the source data of the data packet. A certain Box in the source data can store the decoding information (AV_CODEC_ID) corresponding to the data packet. When the electronic device traverses the data area through the audio parsing application, the first round of traversal is only performed on Box1 of each data packet, so as to find the first audio data identifier AVMEDIA_TYPE_AUDIO in the header data of the data packet. Afterwards, the electronic device performs a second round of traversal of the data area, and only traverses Box2 to Boxn of the data packet with AVMEDIA_TYPE_AUDIO in the header data, so as to find AV_CODEC_ID in the target source data. When the electronic device performs a second round of traversal of the data area, if AV_CODEC_ID is found in the target source data, the electronic device confirms that it can decode the data packet to which the target source data belongs based on AV_CODEC_ID through the audio analysis application or the multimedia decoder, and thus the electronic device generates the first audio track information based on AVMEDIA_TYPE_AUDIO.

[0134] In addition, in some embodiments, in the data area of ​​the multimedia file, if the data volume of a certain audio track data is large, the audio track data may be recorded through two (or even more than two) data packets, and the header data of the two data packets contain the same audio data identifier to indicate that the two data packets record one audio track data. At this time, when the electronic device traverses the header data of the data packets, if the same audio data identifier is found in the header data of different data packets, the electronic device uses the two same audio data identifiers as one audio data identifier, so that when the source data of the two data packets are traversed, as long as the decoding information is found in the source data of any one of the data packets, the electronic device confirms that the audio track data recorded in the two data packets can be decoded with reference to the decoding information, thereby generating a first audio track information based on any one of the two same audio data identifiers.

[0135] like Fig.14 As shown, during the first round of traversal of the data area by the audio parsing application, if the electronic device finds a first audio data identifier (A) when traversing the header data of the data packet Track Data 1, and finds the same first audio data identifier (A) when traversing the header data of the data packet Track Data 2, the electronic device will use these two first audio data identifiers (A) as one audio data identifier, thereby treating the two track data packets Track Data 1 and Track Data 2 as one track data. Afterwards, the electronic device continues to traverse the header data of other data packets, and only finds another first audio data identifier (B) in the header data of the data packet Track Data 3. Afterwards, the electronic device performs a second round of traversal of the data area by the audio parsing application to traverse the target source data in the three data packets Track Data 1, Track Data 2, and Track Data 3. Furthermore, when the electronic device traverses the target source data of the two data packets of track data 1 and track data 2, as long as the decoding information is found in any of the target source data, the electronic device confirms that the track data 1 and the track data 2 can be decoded with reference to the decoding information, thereby generating a first track information based on any first audio data identifier (A). In addition, if the electronic device also finds the decoding information in the target source data of track data 3 through the audio analysis application, the electronic device also generates another first track information based on the first audio data identifier (B).

[0136] In this embodiment, when the electronic device parses the file header information of the multimedia file and fails to obtain the track information, it loops through the data area of ​​the multimedia file to find at least one audio data identifier and determines whether there is decoding information in the track data corresponding to the at least one data identifier. When there is decoding information in the track data corresponding to the at least one audio data identifier, the electronic device generates at least one track information. In this way, when the electronic device subsequently decodes the audio data in the data area based on the track information, it can use the track information to determine the corresponding track data, and decode the track data with reference to the decoding information in the track data, thereby avoiding the situation where the track data is found in the data area but cannot be decoded because the track data has no corresponding decoding information, that is, this embodiment ensures the stability of decoding the track data to play the sound.

[0137] Please refer to Fig.15 , Fig.15 It is a schematic diagram of a scenario in which an electronic device traverses a data area of ​​a multimedia file.

[0138] In some embodiments, when the electronic device traverses the data area of ​​the multimedia file, it can also traverse each data packet in turn, so as to find the second audio data identifier in a data packet, and at the same time, generate the second track information based on the second audio data identifier when the decoding information is found in the data packet. Then, the electronic device directly decodes the audio data in the data area based on the second track information, so as to play the sound in the process of playing the multimedia file. Among them, the second audio data identifier is the first audio data identifier found by the electronic device through the audio parsing application to traverse the data area, and the second track information is the first track information generated by the electronic device through the data area. For example, when the electronic device traverses the data area of ​​the multimedia file through the audio parsing application, if the first audio data identifier is found in the header data of the track data 1 in the traversal data area, the electronic device continues to traverse the source data of the track data 1 to determine whether there is decoding information in the source data of the track data 1. Thus, when it is determined that there is decoding information in the source data of the track data 1, the electronic device confirms that the track data 1 can be decoded with reference to the decoding information in the track data 1. In this way, the electronic device directly encapsulates the first audio data identifier as the first audio track information, so that the first audio track information corresponds to the audio track data 1. Afterwards, when the electronic device decodes the audio data in the data area, it can use the audio decoding application to use the first audio track information as an index in the audio data in the data area to determine the audio track data 1 corresponding to the first audio track data, and then call the corresponding decoder according to the decoding information in the audio track data 1 to decode the audio track data 1 to play the sound.

[0139] For example, Fig.15 As shown, when the electronic device traverses the data area through the audio analysis application, for the data packets such as track data 1, image track data 1, track data 2, image track data 2, track data 3 and image track data 3 in the data area, the electronic device traverses each data in turn, and finds the first audio data identifier AV_CODEC_ID3 and decoding information AV_CODEC_ID in track data 3, and generates track information 3 based on AVMEDIA_TYPE_AUDIO3 (track information 3 is the first track information generated by the electronic device through the audio analysis application traversing the data area). Afterwards, the electronic device determines the track data 3 in the data area as the track data that needs to be decoded currently through the audio analysis application with track information 3, and encapsulates the audio data 3 as an audio data packet. Finally, the electronic device sends the audio data packet to the audio decoding application or multimedia decoder through the audio analysis application to decode the track data 3 in the audio data packet, so as to play the sound corresponding to the track data 3.

[0140] In some embodiments, after the electronic device traverses the data area of ​​the multimedia file to obtain the first audio track information, the electronic device can stop traversing the data area further because the electronic device can already decode the audio data in the data area based on the first audio track information to play the sound. Figure 1 When playing the multimedia file shown in the figure, the electronic device traverses the data packets of the data area such as the audio track data 1, the image track data 1, the audio track data 2, the image track data 2, the audio track data 3 and the image track data 3 in sequence through the audio parsing application when parsing the file header information and fails to obtain the audio track information. If the electronic device finds the first audio data identifier by traversing the header data of the audio track data 1 through the audio parsing application, and finds the decoding information when continuing to traverse the source data of the audio track data 1, the electronic device generates the first audio track information based on the first audio data identifier, and stops traversing other data packets such as the audio track data 2.

[0141] In this embodiment, when the electronic device finds the first audio data identifier while traversing the data area of ​​the multimedia file, it generates the first audio track information based on the first audio data identifier. Then, the electronic device stops traversing the data area, and directly decodes the audio data in the data area based on the first audio track data to play the sound. In this way, it can not only avoid the waste of device resources caused by the electronic device continuing to traverse the data area when it is already able to decode the audio data and play the sound, but also improve the response time of the electronic device traversing the data area to generate the audio track information to decode the audio data and play the sound, so that when the user uses the electronic device to play the multimedia file, the electronic device can decode the audio data and play the sound in a shorter time, thereby further improving the user's experience of the electronic device.

[0142] Please refer to Fig.16 and Fig.17 , Fig.16 It is a schematic diagram of a scenario in which an electronic device decodes the audio track data corresponding to each of a plurality of audio track information. Fig.17 It is a schematic diagram of a scenario in which an electronic device selects the audio track data with the largest data volume for decoding from the audio track data corresponding to multiple audio track information.

[0143] In some embodiments, if the electronic device obtains multiple audio track information while traversing the data area of ​​a multimedia file, when the electronic device decodes the audio data in the data area based on the audio track information, it can directly decode the audio track data corresponding to each of the multiple audio track information, thereby playing sound simultaneously through multiple channels of the electronic device.

[0144] like Fig.16As shown, when the speaker of the electronic device is a speaker system equipped with two channels, if the electronic device generates three track information when traversing the data packets of track data 1, image track data 1, track data 2, image track data 2, track data 3 and image track data 3 in the data area through the audio analysis application (in the three track information, track information 1 corresponds to track data 1, track information 2 corresponds to track data 2, and track information 3 corresponds to track data 3), the electronic device can first extract the track data in the data area using the generated track information as an index, for example, extract track data 1 from the data area using track information 1 as an index, extract track data 2 from the data area using track information 2 as an index, and extract track data 3 from the data area using track information 3 as an index. Then, the electronic device uses track data 1, track data 2 and track data 3 as the track data currently required to be decoded. Thus, the electronic device packages track data 1, track data 2, and track data 3 together as an audio data packet through an audio parsing application, and then decodes track data 1, track data 2, and track data 3 in the audio data packet simultaneously through an audio decoding application or a multimedia decoder to play the sound. Exemplarily, the electronic device sends the audio data obtained by decoding track data 1 to the first channel of the speaker system for sound playback after synchronization and rendering, and sends the audio data obtained by decoding track data 2 and track data 3 to the second channel of the speaker system for playback after synchronization and rendering.

[0145] In this embodiment, when the electronic device finds multiple audio data identifiers while traversing the data area of ​​the multimedia file and generates multiple audio track information based on the multiple audio data identifiers, it can simultaneously decode the audio track data corresponding to the multiple audio track information based on the multiple audio track information to play the sound using the multiple channels of the speaker. This can improve the playback effect of the audio data, allowing the user to obtain a better auditory experience, thereby further improving the user's usage experience.

[0146] In other embodiments, when the electronic device obtains multiple audio track information after traversing the data area of ​​the multimedia file, the electronic device can also determine the audio track data corresponding to each of the multiple audio track information in the data area, compare the data amounts of the multiple audio track data, thereby determining the audio track data with the largest data amount among the multiple audio track data, and then decode the audio track data with the largest data amount to play the sound.

[0147] like Fig.17As shown, the electronic device generates three track information by traversing the data area of ​​the multimedia file through the audio parsing application, and extracts the track data in the data area with the generated track information as the index, exemplarily, extracts the track data 1 from the data area with the track information 1 as the index, extracts the track data 2 from the data area with the track information 2 as the index, and extracts the track data 3 from the data area with the track information 3 as the index. Afterwards, the electronic device compares the data volume of the track data 1, the track data 2 and the track data 3 through the audio parsing application to determine the track data with the largest data volume among the track data 1, the track data 2 and the track data 3. For example, in the case of determining that the track data 1 is the track data with the largest data volume, the electronic device uses the track data 1 as the track data currently to be decoded. Then, the electronic device packages the audio data 1 as an audio data packet through the audio parsing application, and then decodes the track data 1 in the audio data packet through the audio decoding application or the multimedia decoder to play the sound.

[0148] In this embodiment, when the electronic device generates multiple audio track information by traversing the data area, it can also select the audio track data with the largest data volume from the audio track data corresponding to each of the multiple audio track information, and then decode the audio track data to play the sound. In this way, compared with decoding multiple audio track data, the decoding rate can be increased, thereby improving the response speed of decoding audio data and playing sound when the electronic device plays multimedia files, and by decoding the audio track data with the largest data volume among the multiple audio track data, the user can still obtain a relatively good auditory experience.

[0149] In some embodiments, an embodiment of the present application provides an electronic device, including: an audio module, a display screen, a processor and a memory; the memory is used to store computer program code, the computer program code includes computer execution instructions, and when the electronic device is running, the processor executes the computer execution instructions to enable the electronic device to perform the audio analysis method described in the above embodiments.

[0150] In some embodiments, the embodiments of the present application provide a computer-readable storage medium, including computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the audio parsing method as described above.

[0151] In some embodiments, the embodiments of the present application provide a computer program product. When the computer program product is run on an electronic device, the electronic device executes the audio parsing method described in the above embodiments.

[0152] In some embodiments, the embodiments of the present application provide a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the audio parsing method described in the above embodiments.

[0153] In some embodiments, the present application provides a device including a processor for supporting an electronic device to implement the functions of the audio parsing method described in the above embodiments. In one possible design, the device also includes a memory for storing program instructions and data necessary for the electronic device.

[0154] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0155] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The unit described as a separate component may or may not be physically separated, and the component displayed as a unit may be a physical unit or multiple physical units, that is, it may be located in one place, or it may be distributed in multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the scheme of this embodiment.

[0156] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0157] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. An audio analysis method, characterized in that: The method is applied to an electronic device, and the method comprises: When the electronic device parses the file header information of the multimedia file and fails to obtain the audio track information, the electronic device traverses the data area of ​​the multimedia file to obtain at least one audio track information; The electronic device decodes the audio data in the data area based on the at least one audio track information; Wherein, the data area includes a plurality of data packets, each of which includes header data and source data; The traversing the data area of ​​the multimedia file to obtain at least one audio track information includes: The electronic device traverses the header data of each data packet to obtain at least one audio data identifier; the audio data identifier is used to distinguish audio tracks, different audio tracks correspond to different audio data identifiers, and the same audio track corresponds to the same audio data identifier; The electronic device traverses at least one target source data in the data area to determine whether there is decoding information in the at least one target source data; the target source data is source data in a data packet to which header data containing a first audio data identifier belongs, and the first audio data identifier is any one of the at least one audio data identifier; In a case where there is decoding information in the at least one target source data, the electronic device generates first audio track information based on the first audio data identifier.

2. The method according to claim 1, characterized in that The traversing the data area of ​​the multimedia file to obtain at least one audio track information includes: The electronic device traverses the data area of ​​the multimedia file to obtain a second audio data identifier, and generates second audio track information based on the second audio data identifier; the second audio data identifier is the audio data identifier first obtained by traversing the data area; The electronic device decodes the audio data in the data area based on the at least one audio track information, including: The electronic device determines the audio track data corresponding to the second audio track information in the audio data in the data area, and decodes the audio track data using the second audio track information.

3. The method according to claim 2, characterized in that After the electronic device traverses the data area of ​​the multimedia file to obtain the second audio data identifier and generates the second audio track information based on the second audio data identifier, the method further includes: The electronic device stops traversing the data area of ​​the multimedia file.

4. The method according to any one of claims 1 to 3, characterized in that When the number of the audio track information is greater than 1, the electronic device decodes the audio data in the data area based on the at least one audio track information, including: The electronic device determines, in the audio data in the data area, the audio track data corresponding to each of the plurality of audio track information; The electronic device decodes the plurality of audio track data; or, the electronic device decodes the audio track data with the largest data volume among the plurality of audio track data.

5. The method according to any one of claims 1 to 3, characterized in that The electronic device fails to obtain the audio track information after parsing the file header information of the multimedia file, including: When playing a multimedia file, the electronic device parses the file header information of the multimedia file; The electronic device confirms that no audio track information is obtained by parsing the file header information when the information cannot be read from the file header information; or, when the electronic device reads the file header information and there is an unrecognized data segment, the electronic device confirms that no audio track information is obtained by parsing the file header information.

6. The method according to claim 5, characterized in that The electronic device, when parsing the file header information of the multimedia file and failing to obtain the audio track information, further comprises: When the electronic device obtains at least one audio data identifier by parsing the file header information and fails to obtain decoding information corresponding to any audio data identifier, the electronic device confirms that no audio track information is obtained by parsing the file header information.

7. The method according to any one of claims 1 to 3, characterized in that The electronic device comprises a multimedia parser and an audio parsing application, wherein the multimedia parser is located at a framework layer of a software system of the electronic device, and the audio parsing application is located at an application layer of the software system; When the electronic device parses the file header information of the multimedia file and fails to obtain the audio track information, traversing the data area of ​​the multimedia file to obtain at least one audio track information includes: When the electronic device fails to obtain the audio track information by parsing the file header information of the multimedia file through the multimedia parser, the electronic device traverses the data area of ​​the multimedia file through the audio parsing application to obtain at least one audio track information.

8. The method according to claim 7, characterized in that The electronic device further comprises a multimedia decoder and an audio decoding application, wherein the multimedia decoder is located in the framework layer and the audio decoding application is located in the application layer; The electronic device decodes the audio data in the data area based on the at least one audio track information, including: The electronic device determines N audio track data corresponding to N audio track information in the audio data in the data area; N is a positive integer greater than or equal to 1; The electronic device sends the M audio track data to the audio decoding application through the audio parsing application, so that the M audio track data is decoded by the audio decoding application; or, the electronic device sends the M audio track data to the multimedia decoder through the audio parsing application, so that the M audio track data is decoded by the multimedia decoder; M is a positive integer greater than or equal to 1, and M is less than or equal to N.

9. An electronic device, characterized in that: The electronic device comprises: an audio module, a processor and a memory, wherein the processor is coupled to the memory; the memory is used to store computer program code; the computer program code comprises computer instructions, and when the processor executes the computer instructions, the electronic device executes the method as described in any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the method according to any one of claims 1 to 8.

11. A computer program product, characterized in that The computer program product comprises computer instructions, and when the computer instructions are executed on an electronic device, the electronic device is caused to execute the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Method and system for content delivery

    CN101849261A