Method, device and terminal for synchronously knowing DAC running state at audio playing background
By generating backup files in the audio playback process and parsing them using MQA format, the problem of difficulty in communicating with the MQA decoder and DAC is solved, the disguised understanding of the DAC state is achieved, and the coordination of the audio playback process is promoted. It is suitable for a variety of purposes. DAC hardware.
Patent Information
- Application Number
- CN202411185504.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-12-06
AI Technical Summary
During audio playback, the MQA decoder cannot communicate with the DAC, causing other processes to be unable to understand the decoding format and decoding stage of the DAC, affecting audio and video synchronization and process coordination.
By generating a backup file in the audio playback process, writing the PCM data stream to the file, and synchronously parsing the file using MQA format, outputting the parsing results to the audio playback process, allowing other processes to read the required MQA information and understanding it in disguise The decoding status of the DAC.
It realizes synchronous understanding of the DAC operating status of other processes, facilitates process collaboration, and is suitable for different DAC hardware devices. There is no need to directly obtain DAC information, which improves the scope of application of audio collaborative processing.
Smart Images

Figure CN119088333A_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to the technical field of audio playback, and in particular to a method, device and terminal for synchronously understanding the operating status of a DAC during audio playback. [Background technology]
[0002] At present, during the audio playback process, multiple processes may be involved in cooperation, that is, other processes need the decoding stage, status and other information of the DAC (Digital-to-Analog Converter) in the audio process to achieve effects such as audio and video synchronization. However, in many cases, the MQA (Master Quality Authenticated, an audio encoding and format) decoder cannot communicate with the DAC, does not know which module initiated the playback request, does not know the hardware information of the DAC, etc., resulting in other processes not knowing the decoding format and decoding stage of the DAC, which is not conducive to the cooperation between other processes and the audio playback process.
[0003] In view of this, it is necessary to provide a method, device and terminal for synchronously understanding the operating status of DAC in the background of audio playback to overcome the above-mentioned defects. [Summary of the invention]
[0004] The purpose of the present invention is to provide a method, device and terminal for synchronously understanding the DAC operating status in the background of audio playback, aiming to solve the problem of how to enable other processes to synchronously understand the DAC operating status, so as to facilitate the cooperation between other processes and the audio playback process.
[0005] In order to achieve the above object, the first aspect of the present invention provides a method for synchronously understanding the operating status of a DAC in the background of audio playback, comprising:
[0006] Step S10: receiving an audio playback request and generating an audio playback process;
[0007] Step S20: Open the system sound card, call ALSA to process the audio data, and generate a PCM data stream;
[0008] Step S30: writing the PCM data stream into the underlying hardware DAC for decoding and playback;
[0009] Wherein, in the step S20, it also includes:
[0010] Step S21: Generate a backup file, and synchronously fill the PCM data stream into the backup file;
[0011] Step S22: synchronously parse the backup file in MQA format, and synchronously output the parsing result to the terminal of the audio playback process, so as to facilitate other processes to read the MQA information required in the parsing result.
[0012] In a preferred embodiment, the step S21 includes:
[0013] Define a sample.raw file, and write the sampling format of the PCM data stream into a preset byte number header of the sample.raw file;
[0014] The data of the PCM data stream is continuously filled behind the byte number header to generate a sample.raw file.
[0015] In a preferred embodiment, the step S21 further includes:
[0016] Real-time detection of the current file size of the sample.raw file;
[0017] It is determined whether the current file size exceeds a preset file size threshold. If yes, the current sample.raw file is deleted and a new sample.raw file is regenerated.
[0018] In a preferred embodiment, the step S22 further includes the following steps:
[0019] Determine whether the current terminal supports MQA decoding. If the result is yes, run the MQA verification process and then parse the MQA format; if the result is no, stop executing step S22.
[0020] In a preferred embodiment, the byte header is the first 16 bytes of the sample.raw file.
[0021] A second aspect of the present invention provides a device for synchronously understanding the operating status of a DAC in the background of audio playback, comprising:
[0022] A playback process generation module, used to receive an audio playback request and generate an audio playback process;
[0023] The audio data processing module is used to open the system sound card, call ALSA to process the audio data, and generate a PCM data stream;
[0024] DAC decoding and playing module, used for writing the PCM data stream into the underlying hardware DAC for decoding and playing;
[0025] Among them, the audio data processing module also includes:
[0026] A backup file generating unit, used for generating a backup file and synchronously filling the PCM data stream into the backup file;
[0027] The MQA synchronous parsing unit is used to synchronously parse the backup file in MQA format and synchronously output the parsing result to the terminal of the audio playback process to facilitate other processes to read the MQA information required in the parsing result.
[0028] A third aspect of the present invention provides a terminal, which includes a memory, a processor, and a computer program stored in the memory. When the computer program is executed by the processor, the various steps of the method for synchronously understanding the DAC operating status in the background of audio playback as described in any of the above implementation modes are implemented.
[0029] A fourth aspect of the present invention provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the various steps of the method for synchronously understanding the DAC operating status in the background of audio playback as described in any of the above implementation modes.
[0030] A fifth aspect of the present invention provides a computer program product, including a computer program or instructions, which, when processed and executed, implement the various steps of the method for synchronously understanding the DAC operating status in the background of audio playback as described in any of the above-mentioned implementation modes.
[0031] The method, device and terminal for synchronously understanding the DAC operating status in the background of audio playback provided by the present invention write the PCM data stream into a backup file during the normal DAC decoding and playback process, and then synchronously parse the backup file separately through the MQA decoder, so that when other processes read the MQA parsing results, they understand the DAC decoding status in disguise, which is convenient for the needs of other processes. The MQA parsing process does not need to know the operating status of the DAC, so it can be applied to different DAC hardware devices.
Brief Description of the Drawings
[0032] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0033] Figure 1 A flowchart of a method for synchronously understanding the DAC operating status in the background of audio playback provided by the present invention;
[0034] Figure 2A framework diagram of a device for synchronously understanding the operating status of a DAC in the background of audio playback provided by the present invention. [Specific implementation method]
[0035] In order to make the purpose, technical solution and beneficial technical effect of the present invention clearer, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. It should be understood that the specific implementation methods described in this specification are only for explaining the present invention, not for limiting the present invention.
[0036] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0037] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0038] Embodiment 1
[0039] In an embodiment of the present invention, a method for synchronously understanding the operating status of DAC in the background of audio playback is provided, which is used to perform MQA synchronous parsing by generating a backup file in the normal audio decoding and playback process, so that other processes can know the operating status of DAC in the normal playback process in disguised form through the MQA parsing results, which is convenient for other processes.
[0040] like Figure 1 As shown, the method for synchronously understanding the DAC operating status during audio playback includes steps S10, S20, S21, S22, and S30.
[0041] Step S10: receiving an audio playback request and generating an audio playback process. Specifically, the background server receives the playback instruction and generates a normal audio playback process.
[0042] Step S20: Open the system sound card, call ALSA to process the audio data, and generate a PCM data stream. ALSA (Advanced Linux Sound Architecture) provides a unified, cross-platform audio interface that allows applications to access sound cards and other audio hardware in a standardized manner.
[0043] Step S30: Write the PCM data stream to the underlying hardware DAC for decoding and playback. PCM (Pulse Code Modulation) is a technology used for digital audio recording, transmission and storage. PCM converts analog signals into digital signals through sampling and quantization processes for easy processing and transmission in digital systems. It is a widely used audio coding format that is supported by almost all digital audio devices and technologies.
[0044] It can be understood that steps S10-S30 are a normal audio playback process, and the remaining processing procedures not specifically described can refer to the prior art and will not be repeated here.
[0045] Among them, since the DAC of the background server (such as an electronic computer, etc.) may not be able to communicate with the MQA decoder, other processes cannot directly read the decoding format and decoding stage of the DAC. Therefore, in step S20, steps S21-S22 are also included.
[0046] Step S21: Generate a backup file, and synchronously fill the PCM data stream into the backup file.
[0047] Specifically, the sample.raw file is defined, and the sampling format of the PCM data stream is written into the preset byte header of the sample.raw file. In this embodiment, the byte header is the first 16 bytes of the sample.raw file. When ALSA generates the PCM data stream and sends it to the DAC, it will also synchronously fill the data of the PCM data stream to the end of the byte header to generate the sample.raw file.
[0048] Furthermore, this step also includes: real-time detection of the current file size of the sample.raw file, and determination of whether the current file size exceeds a preset file size threshold (e.g., 512MB, 1GB, etc.); if yes, the current sample.raw file is deleted, and a new sample.raw file is regenerated, thereby preventing the backup file from being too large.
[0049] Step S22: synchronously parse the backup file in MQA format, and synchronously output the parsing result to the terminal of the audio playback process, so as to facilitate other processes to read the MQA information required in the parsing result.
[0050] That is, when the DAC is decoding the PCM data stream through its own decoding format, the MQA decoder is also performing synchronous MQA decoding on the backup file. The decoding of the two is synchronized. Therefore, other processes can read the MQA decoding results through the pipeline to know the decoding status of the DAC in disguised form without the need for direct DAC information, which is convenient for other processes and is not limited by the DAC information in the terminal, thereby improving the scope of application of audio collaborative processing in each terminal.
[0051] Furthermore, before step S22, the following steps are also included: determining whether the current terminal supports MQA decoding, if the result is yes, running the MQA verification process, and then parsing the MQA format; if the result is no, stopping the execution of step S22. That is, when the MQA synchronous decoding process needs to be executed, it will first determine whether the terminal supports MQA, if it does, run the MQA verification process, and then read the backup file and parse the MQA format.
[0052] Embodiment 2
[0053] The present invention provides a device 100 for synchronously understanding the operating status of a DAC in the background of audio playback, which is used to perform MQA synchronous parsing by generating a backup file in the normal audio decoding and playback process, so that other processes can know the operating status of the DAC in the normal playback process in disguised form through the analysis result of MQA, which is convenient for other processes. It should be noted that the implementation principle and specific implementation method of the device 100 for synchronously understanding the operating status of a DAC in the background of audio playback can refer to the above-mentioned method for synchronously understanding the operating status of a DAC in the background of audio playback, which will not be repeated below.
[0054] like Figure 2 As shown, the device 100 for synchronously understanding the DAC operating status in the background of audio playback includes:
[0055] The playback process generating module 10 is used to receive an audio playback request and generate an audio playback process;
[0056] The audio data processing module 20 is used to open the system sound card, call ALSA to process the audio data, and generate a PCM data stream;
[0057] DAC decoding and playing module 30, used for writing PCM data stream into the underlying hardware DAC for decoding and playing;
[0058] The audio data processing module 20 further includes:
[0059] A backup file generating unit 21 is used to generate a backup file and synchronously fill the PCM data stream into the backup file;
[0060] The MQA synchronous parsing unit 22 is used to synchronously parse the backup file in MQA format and synchronously output the parsing result to the terminal of the audio playback process to facilitate other processes to read the MQA information required in the parsing result.
[0061] Embodiment 3
[0062] The present invention provides a terminal, which includes a memory, a processor, and a computer program stored in the memory. When the computer program is executed by the processor, each step of the method for synchronously understanding the operating status of a DAC in the background of audio playback as described in any one of the above-mentioned implementation modes is implemented.
[0063] Embodiment 4
[0064] The present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the various steps of the method for synchronously understanding the operating status of a DAC in the background of audio playback as described in any one of the above-mentioned implementation modes are implemented.
[0065] Embodiment 5
[0066] The present invention provides a computer program product, including a computer program or an instruction, which, when processed and executed, implements the various steps of the method for synchronously understanding the DAC operating status in the background of audio playback as described in any of the above-mentioned implementation modes.
[0067] In summary, the method, device and terminal for synchronously understanding the DAC operating status in the background of audio playback provided by the present invention write the PCM data stream into a backup file during the normal DAC decoding and playback process, and then synchronously parse the backup file separately through the MQA decoder, so that when other processes read the MQA parsing results, they understand the DAC decoding status in disguise, which is convenient for the needs of other processes. The MQA parsing process does not need to know the operating status of the DAC, so it can be applied to different DAC hardware devices.
[0068] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the system can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0069] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0070] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0071] In the embodiments provided by the present invention, it should be understood that the disclosed systems or devices / terminal equipment and methods can be implemented in other ways. For example, the system or device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the system or unit can be electrical, mechanical or other forms.
[0072] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0073] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0074] The present invention is not limited to what is described in the specification and implementation modes, and therefore additional advantages and modifications can be easily realized by those skilled in the art. Therefore, without departing from the spirit and scope of the general concept defined by the claims and their equivalents, the present invention is not limited to the specific details, representative devices, and illustrative examples shown and described herein.
Claims
1. A method for synchronously understanding the DAC operating status in the background of audio playback, characterized in that: include: Step S10: receiving an audio playback request and generating an audio playback process; Step S20: Open the system sound card, call ALSA to process the audio data, and generate a PCM data stream; Step S30: writing the PCM data stream into the underlying hardware DAC for decoding and playback; Wherein, in the step S20, it also includes: Step S21: Generate a backup file, and synchronously fill the PCM data stream into the backup file; Step S22: synchronously parse the backup file in MQA format, and synchronously output the parsing result to the terminal of the audio playback process, so as to facilitate other processes to read the MQA information required in the parsing result.
2. The method for synchronously understanding the DAC operating status during audio playback as claimed in claim 1, characterized in that: The step S21 comprises: Define a sample.raw file, and write the sampling format of the PCM data stream into a preset byte number header of the sample.raw file; The data of the PCM data stream is continuously filled behind the byte number header to generate a sample.raw file.
3. The method for synchronously understanding the DAC operating status during audio playback as claimed in claim 2, characterized in that: The step S21 further includes: Real-time detection of the current file size of the sample.raw file; It is determined whether the current file size exceeds a preset file size threshold. If yes, the current sample.raw file is deleted and a new sample.raw file is regenerated.
4. The method for synchronously understanding the DAC operating status during audio playback as claimed in claim 1, characterized in that: The step S22 also includes the following steps: Determine whether the current terminal supports MQA decoding. If the result is yes, run the MQA verification process and then parse the MQA format; if the result is no, stop executing step S22.
5. The method for synchronously understanding the DAC operating status during audio playback as claimed in claim 2, characterized in that: The byte header is the first 16 bytes of the sample.raw file.
6. A device for synchronously understanding the DAC operating status in the background of audio playback, characterized in that: include: A playback process generation module, used to receive an audio playback request and generate an audio playback process; The audio data processing module is used to open the system sound card, call ALSA to process the audio data, and generate a PCM data stream; DAC decoding and playing module, used for writing the PCM data stream into the underlying hardware DAC for decoding and playing; Among them, the audio data processing module also includes: A backup file generating unit, used for generating a backup file and synchronously filling the PCM data stream into the backup file; The MQA synchronous parsing unit is used to synchronously parse the backup file in MQA format and synchronously output the parsing result to the terminal of the audio playback process to facilitate other processes to read the MQA information required in the parsing result.
7. A terminal, characterized in that: The terminal includes a memory, a processor, and a computer program stored in the memory. When the computer program is executed by the processor, the steps of the method for synchronously understanding the DAC operating status during audio playback in the background as described in any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the method for synchronously understanding the DAC operating status during audio playback in the background as described in any one of claims 1 to 5 are implemented.
