WO2023124002A1 - Linux-based audio control method and apparatus, device, and storage medium - Google Patents

Linux-based audio control method and apparatus, device, and storage medium Download PDF

Info

Publication number
WO2023124002A1
WO2023124002A1 PCT/CN2022/104793 CN2022104793W WO2023124002A1 WO 2023124002 A1 WO2023124002 A1 WO 2023124002A1 CN 2022104793 W CN2022104793 W CN 2022104793W WO 2023124002 A1 WO2023124002 A1 WO 2023124002A1
Authority
WO
WIPO (PCT)
Prior art keywords
audio
linux
service
android
audio service
Prior art date
Application number
PCT/CN2022/104793
Other languages
French (fr)
Chinese (zh)
Inventor
张兴涛
Original Assignee
北京字节跳动网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京字节跳动网络技术有限公司 filed Critical 北京字节跳动网络技术有限公司
Publication of WO2023124002A1 publication Critical patent/WO2023124002A1/en

Links

Images

Classifications

    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B19/00Driving, starting, stopping record carriers not specifically of filamentary or web form, or of supports therefor; Control thereof; Control of operating function ; Driving both disc and head
    • G11B19/02Control of operating function, e.g. switching from recording to reproducing

Definitions

  • the present disclosure relates to the field of computer technology, for example, to a Linux-based audio control method, device, device, and storage medium.
  • the Linux system is a set of Unix-like operating systems that are free to use and spread freely. been widely used.
  • the Android system is currently the operating system with the highest proportion in the mobile terminal market, and has an excellent ecological environment in the field of mobile terminals.
  • the present disclosure provides a Linux-based audio control method, device, device, and storage medium to avoid the cumbersome and complicated situation that applications in the Linux system use audio devices when there is only an Android audio driver in the related art, and realize Convenient audio control.
  • the present disclosure provides a Linux-based audio control method applied to a Linux system, the method comprising:
  • control the audio device to execute the operation corresponding to the audio control instruction, and return the execution result of the audio device to the application program through the Linux audio service;
  • the Linux audio service is configured based on the audio channel configuration file on the Android side.
  • the present disclosure also provides a Linux-based audio control device, including:
  • the receiving module is configured to receive the audio control instruction sent by the application program in the Linux system through the Linux audio service;
  • the control module is configured to control the audio device to execute the operation corresponding to the audio control instruction based on the Linux audio service, and return the execution result of the audio device to the application program through the Linux audio service;
  • the Linux audio service is configured based on the audio channel configuration file on the Android side.
  • the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and operable on the processor.
  • the processor executes the program, it implements any one of the above-mentioned Linux-based Steps of an audio control method.
  • the present disclosure also provides a non-transitory computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the above-mentioned Linux-based audio control methods are implemented.
  • the present disclosure also provides a computer program product, including a computer program.
  • a computer program product including a computer program.
  • the steps of any one of the Linux-based audio control methods described above are implemented.
  • FIG. 1 is one of the schematic flow charts of the Linux-based audio control method provided by the present disclosure
  • FIG. 2 is a schematic structural diagram of a Linux-based audio control method provided by the present disclosure
  • FIG. 3 is the second schematic flow diagram of the Linux-based audio control method provided by the present disclosure.
  • FIG. 4 is the third schematic flow diagram of the Linux-based audio control method provided by the present disclosure.
  • FIG. 5 is the fourth schematic flow diagram of the Linux-based audio control method provided by the present disclosure.
  • FIG. 6 is a structural diagram of a Linux-based audio control device provided by the present disclosure.
  • FIG. 7 is a schematic structural diagram of an electronic device provided by the present disclosure.
  • the audio device is usually driven by alsa.
  • the audio device manufacturer only provides the Android driver, if the application program in the Linux system needs to use the audio device, it needs to be adapted to the Android device.
  • audio path configuration file for example, create the alsa profile and path in the corresponding audio path configuration file to use the audio device, which is very cumbersome and complicated.
  • the Linux system is installed in the terminal device, that is, the operating system of the terminal device is an operating system based on the Linux kernel.
  • any application program (Application, APP) is installed in the terminal device, and the application program needs to use an audio device, and the audio device can only be controlled through an Android audio driver.
  • the terminal device may be a mobile phone, a tablet computer, a notebook computer, a desktop computer, a server, an embedded system, etc., which are not specifically limited here.
  • Fig. 1 is one of the flow diagrams of the Linux-based audio control method provided by the present disclosure. As shown in Fig. 1, the Linux-based audio control method provided by the present disclosure includes the following steps 110-120:
  • Step 110 through the Linux audio service, receive the audio control instruction sent by the application program in the Linux system.
  • the Linux audio service is an audio framework in the Linux system, which is used for operation by applications in the Linux system, that is, it is an audio service process of Linux. Additionally, this Linux audio service resides in the user space of the Linux system.
  • the Linux audio service is an extensible audio framework that supports plug-in extensions.
  • the Linux audio service is the pulseaudio audio framework.
  • the pulseaudio audio framework supports plugin extensions, for example, a droid plugin can be implemented.
  • the Linux audio service is the pipewire audio framework.
  • the pipewire audio framework supports plugin extensions, for example, a droid plugin can be implemented.
  • the Linux-based audio control method before the above step 110, further includes:
  • the audio control instruction includes, but is not limited to: an instruction to start playing, an instruction to stop playing, an instruction to start recording, an instruction to turn off recording, and the like.
  • the audio control instruction includes all operation instructions of the audio device, or the audio control instruction includes instructions corresponding to all application program interfaces (Application Program Interface, API) of the Android audio service on the Android side.
  • API Application Program Interface
  • Step 120 based on the Linux audio service, control the audio device to execute the operation corresponding to the audio control instruction, and return the execution result of the audio device to the application program through the Linux audio service;
  • the Linux audio service is configured based on the audio channel configuration file on the Android side.
  • the way to obtain the Linux audio service is: read the audio channel configuration file on the Android side through the audio plug-in, analyze the audio channel configuration file, obtain the analysis result, and configure the Linux audio service based on the analysis result.
  • the execution result includes a control result and a data transmission result
  • the data transmission result includes but not limited to: audio data and audio device configuration parameters.
  • the execution result includes but not limited to: the execution result of the start playing instruction, the execution result of the stop playing instruction, the execution result of the start recording instruction, the execution result of the close recording instruction and so on.
  • the execution result of the start playing instruction includes an indication of a successful start of playing or an indication of failure of playing start.
  • the execution result of the stop playing instruction includes an indication of success in stopping playing or an indication of failure in stopping playing.
  • the execution result of the command to start recording includes an indication that the recording has been started successfully or an indication that the recording has been started failed.
  • the execution result of the record-off command includes an indication of successful record-off and audio data obtained from the recording, or an indicator of record-off failure.
  • the audio device is controlled to be turned on, and the audio data to be played is played, and the execution result of whether the audio device is successfully played and started is returned to the application program through the Linux audio service.
  • the audio control instruction is a start playback instruction
  • the audio device is controlled to be turned on, and the audio data to be played is played, and the playback start success flag or the playback start failure flag is returned to the application program through the Linux audio service.
  • the target audio data is transmitted to the audio device for playback.
  • the audio control instruction is a stop playing instruction
  • control the audio device to close, and stop playing the audio and return the execution result of whether the audio device is successfully played and closed to the application program through the Linux audio service.
  • the audio control instruction is an instruction to stop playing, control the audio device to shut down, and stop playing the audio, and return the flag of successful playback stop or failure flag to the application program through the Linux audio service.
  • the audio device is controlled to perform the recording operation, and the execution result of whether the recording is successfully started is returned to the application program through the Linux audio service.
  • the audio device is controlled to perform the recording operation, and the audio data recorded by the audio device in real time and the recording start success mark are returned to the application program through the Linux audio service, or the recording start failure mark is passed to the Linux
  • the audio service returns to the application.
  • the audio device is controlled to close the recording operation, and the execution result of whether the recording is successfully closed is returned to the application program through the Linux audio service.
  • the audio control command is a recording close command
  • the audio device is controlled to close the recording operation, and the record closing success mark is returned to the application program, or the recording close failure mark is returned to the application program through the Linux audio service.
  • the Linux system will communicate with the Android audio service on the Android side, and the communication lines are basically the same as the audio control commands, so we won't repeat them here. That is, the present disclosure can not only complete the transmission of control instructions, but also complete the transmission of data.
  • the transmitted data includes audio data, configuration parameters of audio equipment, and so on.
  • Embodiments of the present disclosure will be described by way of example for easy understanding.
  • the application uses an audio device in a Linux system
  • the application generates an audio control command, and then receives the audio control command sent by the application through the Linux audio service, and then forwards the audio control command from the Linux audio service to the Android audio service, to control the audio device to execute the operation corresponding to the audio control command through the Android audio service and the Android audio driver, and then return the execution result of the audio device to the Android audio driver and the Android audio service; through the audio plug-in, the execution result Forward from the Android audio service to the Linux audio service; return the execution result from the Linux audio service to the application.
  • an Android container is created, and then the Linux audio service is started, and the Android audio service is deployed in the Android container.
  • the method is applied to the Linux system, and receives the audio control instruction sent by the application program in the Linux system through the Linux audio service; based on the audio service, controls the audio device to execute the corresponding audio control instruction Operation, and return the execution result of the audio device to the application program through the Linux audio service; wherein, the Linux audio service is configured based on the audio path configuration file on the Android side.
  • the embodiment of the present disclosure receives the audio control command sent by the application program through the Linux audio service, and multiplexes the audio path configuration file on the Android side, so as to configure the Linux audio service according to the audio path configuration file, so that the application program can pass
  • the Linux audio service uses the audio device, so that when only the Android audio driver exists, the application can use the audio device without adapting the audio channel configuration file under Android, so as to achieve convenient audio control.
  • step 120 it also includes:
  • Step 130 through the Linux audio service, determine the audio control API corresponding to the audio control command, and the audio control API is used to access the Android audio service.
  • the Linux audio service determines the audio control API corresponding to the audio control command, and then accesses the Android audio service on the Android side based on the audio control API, thereby realizing the Android audio system between the Linux system and the Android side.
  • the purpose of the service to communicate, and then realize the purpose that the Linux system can use the Android audio driver.
  • the audio device is controlled to perform the operation corresponding to the audio control instruction, including:
  • Step 121 forward the audio control API from the Linux audio service to the Android audio service through an audio plug-in.
  • Step 122 through the Android audio service, control the audio device to perform the operation corresponding to the audio control instruction.
  • the audio plug-in is a plug-in extended by the Linux audio service.
  • the audio plug-in can be a droid plugin. This audio plugin resides in user space on Linux.
  • the audio control API passes through the audio plug-in, it can be processed or not, which is specifically set according to actual needs, and details will not be described here.
  • the audio control API corresponding to the start playback instruction is forwarded from the Linux audio service to the Android audio service, so that the Android audio service controls the audio device to perform the operation corresponding to the start playback instruction.
  • the audio control API corresponding to the stop playback instruction is forwarded from the Linux audio service to the Android audio service, so that the Android audio service controls the audio device to perform the operation corresponding to the stop playback instruction.
  • the audio control API corresponding to the instruction to enable recording is forwarded from the Linux audio service to the Android audio service, so that the Android audio service controls the audio device to perform the operation corresponding to the instruction to enable recording.
  • the audio control API corresponding to the instruction to close the recording is forwarded from the Linux audio service to the Android audio service, so that the Android audio service controls the audio device to perform the operation corresponding to the instruction to close the recording.
  • the method also includes:
  • the Linux system includes a user space layer; the user space layer includes the application program, the Linux audio service, the audio plug-in, and the Android audio service.
  • the Android audio service may include AudioFlinger service, Audio Server, Audio HAL Service and the like. Refer to FIG. 2 , which will not be repeated here.
  • the method is applied to a Linux system, and the audio control API corresponding to the audio control command is determined through the Linux audio service, and the audio control API is used to access the Android audio driver; through the audio plug-in, the The audio control API is forwarded from the Linux audio service to the Android audio service; through the Android audio service, the audio device is controlled to perform the corresponding operation of the audio control command.
  • the audio control command is forwarded through the audio plug-in to use the audio device through the Android audio service, so that the application can use the audio device through the Android audio service, so that when only the Android audio driver exists, the application The audio device can be used without adapting the audio channel configuration file under Android, so as to realize convenient audio control.
  • step 120 the execution result of the audio device is returned to the application program through the Linux audio service, including the following steps 123-125:
  • Step 123 returning the execution result of the audio device to the Android audio service.
  • Step 124 forward the execution result from the Android audio service to the Linux audio service through the audio plug-in.
  • Step 125 returning the execution result from the Linux audio service to the application program.
  • the audio plug-in is a plug-in extended by the Linux audio service.
  • the audio plug-in can be a droid plugin. This audio plugin resides in user space on Linux.
  • the audio control command is described by taking the start playback command as an example.
  • the signaling interaction diagram of the application, Linux audio service, audio plug-in, and Android audio service is shown in Figure 4:
  • the application program sends an instruction to start playing and audio data to the Linux audio service.
  • the Linux audio service sends the start playing instruction and audio data to the audio plug-in.
  • the audio plug-in sends the start playing instruction and audio data to the Android audio service.
  • the Android audio service returns an execution result to the audio plug-in, where the execution result includes: an indication of a successful playback start or an indication of a failure to start playback.
  • the execution result is described by taking the successful indication of playback start as an example.
  • the audio plug-in returns the playback start success indication to the Linux audio service.
  • the Linux audio service returns the playback start success indication to the application program.
  • the audio control instruction After playing for a period of time, the audio control instruction is described by taking the instruction of stopping playback as an example.
  • the application program sends a stop playing instruction to the Linux audio service.
  • the Linux audio service sends a playback stop instruction to the audio plug-in.
  • the audio plug-in sends an instruction to stop playing to the Android audio service.
  • the Android audio service returns an execution result to the audio plug-in, where the execution result includes: an indication of success in playback stop or an indication of failure in playback stop.
  • the execution result is described by taking the playback stop success flag as an example.
  • the audio plug-in returns a playback stop success indication to the Linux audio service.
  • the Linux audio service returns a playback stop success indication to the application program.
  • the audio control command is described by taking the start of the recording command as an example.
  • the signaling interaction diagram of the application, Linux audio service, audio plug-in, and Android audio service is shown in Figure 5:
  • the application program sends an instruction to start recording to the Linux audio service.
  • the Linux audio service sends an instruction to start recording to the audio plug-in.
  • the audio plug-in sends an instruction to start recording to the Android audio service.
  • the Android audio service returns an execution result to the audio plug-in, wherein the execution result includes: an indication of successful recording start and recording data obtained by real-time recording or an indication of failure to start recording.
  • the execution result will be explained by taking the recording start success flag and recording data as an example.
  • the audio plug-in returns the recording start success identification and recording data to the Linux audio service.
  • the Linux audio service returns the recording start success identification and recording data to the application program.
  • the audio control instruction is described by taking the instruction of turning off the recording as an example.
  • the application program sends an instruction to close the recording to the Linux audio service.
  • the Linux audio service sends an instruction to close the recording to the audio plug-in.
  • the audio plug-in sends an instruction to close the recording to the Android audio service.
  • the Android audio service returns an execution result to the audio plug-in, where the execution result includes: an indication of success in closing recording or an indication of failure in closing recording.
  • the execution result is described by taking the record closing success flag as an example.
  • the audio plug-in returns an indication that the recording is closed successfully to the Linux audio service.
  • the Linux audio service returns an indication that the recording is closed successfully to the application program.
  • the method also includes:
  • the Android container is first created, and the Android audio service is started, and then the Linux audio service is started, and the audio plug-in is loaded.
  • the Linux system includes a user space layer; the user space layer includes the application program, the Linux audio service, the audio plug-in, and the Android audio service.
  • the Android audio service may include AudioFlinger service, Audio Server, Audio HAL Service and the like. Refer to FIG. 2 , which will not be repeated here.
  • the method is applied to a Linux system, and the execution result of the audio device is returned to the Android audio service; through the audio plug-in, the execution result is forwarded from the Android audio service to the Linux audio service; Execution results are returned to the application from the Linux audio service.
  • the execution result of the audio device is forwarded through the audio plug-in, and the execution result is returned through the Linux audio service, so that the application program can receive the returned execution result, and the application program in the Linux system can use the Android audio service.
  • Use the audio device so that when only the Android audio driver exists, the application can use the audio device and return the execution result without adapting the audio channel configuration file under Android, so as to achieve convenient audio control.
  • the method further includes:
  • Step 140 read the audio channel configuration file on the Android side through the audio plug-in.
  • Step 150 configure Linux audio service based on the audio channel configuration file.
  • the audio plug-in read the audio channel configuration file corresponding to the audio service on the Android side, then analyze the audio channel configuration file, and convert the audio channel configuration file based on the analysis result to convert it to the available Linux audio service Audio channel configuration.
  • the audio plug-in is a plug-in extended by the Linux audio service.
  • the audio plug-in can be a droid plugin. This audio plugin resides in user space on Linux.
  • the method also includes:
  • Step 160 after the Linux system starts, start the Linux audio service and load the audio plug-in.
  • the Linux system includes a user space layer; the user space layer includes the application program, the Linux audio service, the audio plug-in, and the Android audio service.
  • the Android audio service may include AudioFlinger service, Audio Server, Audio HAL Service and the like. Refer to FIG. 2 , which will not be repeated here.
  • the method is applied to the Linux system, reads the audio path configuration file on the Android side through the audio plug-in, and converts the audio path configuration file to obtain the conversion result; based on the The conversion result configures the Linux audio service.
  • the embodiment of the present disclosure multiplexes the audio path configuration file on the Android side through the audio plug-in, so as to configure the Linux audio service according to the audio path configuration file on the Android side, so that the application program can use the audio device through the Linux audio service, In the case that only the Android audio driver exists, the application program can use the audio device without adapting the audio channel configuration file under Android, thereby realizing convenient audio control.
  • the Linux audio service communicates with the Android audio service on the Android side through an inter-process communication channel.
  • the inter-process communication channel can realize data transmission and information transmission between processes.
  • the inter-process communication channel realizes the transmission of control commands and processing data between the Linux audio service and the Android audio service.
  • the processed data includes, but is not limited to: audio data, configuration parameters of audio equipment, and the like.
  • Inter-Process Communication provides a variety of inter-process communication methods, such as binder, socket (socket), shared memory (shared memory), etc.
  • the Linux audio service communicates with the Android audio service on the Android side through an IPC channel.
  • the Linux audio service communicates with the Android audio service on the Android side through a binder.
  • the Linux audio service communicates with the Android audio service on the Android side via libgbinder.
  • libgbinder is a Linux implementation of binder, which is used for program-to-program communication between the Linux system and Android.
  • the Linux audio service communicates with the Android audio service on the Android side through a socket.
  • the Linux audio service communicates with the Android audio service on the Android side through shared memory.
  • the method is applied to the Linux system, and the embodiment of the disclosure uses the inter-process communication channel to realize the communication between the Linux audio service and the Android audio service, so as to be able to send the audio control command generated by Linux Provide Android audio service, and can perform data communication between Linux and Android, so that the application can use the audio device when only the Android audio driver exists, and there is no need to adapt the audio channel configuration file under Android, so as to achieve Convenient audio control.
  • the Linux-based audio control device includes:
  • the receiving module 610 is configured to receive the audio control instruction sent by the application program in the Linux system through the Linux audio service;
  • the control module 620 is configured to control the audio device to execute the operation corresponding to the audio control instruction based on the Linux audio service, and return the execution result of the audio device to the application program through the Linux audio service;
  • the Linux audio service is configured based on the audio channel configuration file on the Android side.
  • the audio control instruction sent by the application program in the Linux system is received through the Linux audio service; based on the audio service, the audio device is controlled to perform the operation corresponding to the audio control instruction, and the audio device's The execution result is returned to the application program through the Linux audio service; wherein, the Linux audio service is configured based on the audio channel configuration file on the Android side.
  • the embodiment of the present disclosure receives the audio control command sent by the application through the Linux audio service, and multiplexes the audio path configuration file on the Android side, so as to configure the Linux audio service according to the audio path configuration file on the Android side, and then makes the application
  • the program can use the audio device through the Linux audio service, so that when only the Android audio driver exists, the application can use the audio device, and there is no need to adapt the audio channel configuration file under Android, so as to achieve convenient audio control.
  • the Linux-based audio control device also includes:
  • the determination module is configured to determine the audio control API corresponding to the audio control instruction through the Linux audio service, and the audio control API is used to access the Android audio service.
  • control module 620 is also configured to forward the audio control API from the Linux audio service to the Android audio service through an audio plug-in; through the Android audio service, control the audio device to execute the audio control instruction corresponding operation.
  • control module 620 is also configured to return the execution result of the audio device to the Android audio service; forward the execution result from the Android audio service to the Linux audio service through an audio plug-in; The execution result is returned to the application program from the Linux audio service.
  • the Linux-based audio control device also includes:
  • the file reading module is set to read the audio channel configuration file on the Android side through the audio plug-in;
  • the service configuration module is configured to configure the Linux audio service based on the audio channel configuration file.
  • the Linux-based audio control device also includes:
  • the service startup module is configured to start the Linux audio service and load the audio plug-in after the Linux system is started.
  • the Linux audio service communicates with the Android audio service on the Android side through an inter-process communication channel.
  • FIG. 7 illustrates a schematic diagram of the physical structure of an electronic device.
  • the electronic device may include: a processor (processor) 710, a communication interface (Communications Interface) 720, a memory (memory) 730 and a communication bus 740, Wherein, the processor 710 , the communication interface 720 , and the memory 730 communicate with each other through the communication bus 740 .
  • processor processor
  • Communication interface Communication interface
  • memory memory
  • FIG. 740 illustrates a schematic diagram of the physical structure of an electronic device.
  • the electronic device may include: a processor (processor) 710, a communication interface (Communications Interface) 720, a memory (memory) 730 and a communication bus 740, Wherein, the processor 710 , the communication interface 720 , and the memory 730 communicate with each other through the communication bus 740 .
  • memory memory
  • the processor 710 can call the logic instruction in the memory 730 to execute the audio control method based on Linux, the method includes: receiving the audio control instruction sent by the application program in the Linux system through the Linux audio service; , controlling the audio device to execute the operation corresponding to the audio control instruction, and returning the execution result of the audio device to the application program through the Linux audio service; wherein, the Linux audio service is based on the audio channel on the Android side
  • the configuration file is obtained by configuring.
  • the above-mentioned logic instructions in the memory 730 may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as an independent product.
  • the computer software product is stored in a storage medium, including several The instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in multiple embodiments of the present disclosure.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc and other media that can store program codes. .
  • the present disclosure also provides a computer program product
  • the computer program product includes a computer program
  • the computer program can be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can Executing the audio control method based on Linux provided by the above-mentioned multiple methods, the method includes: receiving audio control instructions sent by the application program in the Linux system through the Linux audio service; based on the Linux audio service, controlling the audio device to execute the The operation corresponding to the audio control instruction, and the execution result of the audio device is returned to the application program through the Linux audio service; wherein, the Linux audio service is configured based on the audio path configuration file on the Android side to obtain of.
  • the present disclosure also provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it is implemented to perform the audio control method based on Linux provided by the above-mentioned various methods,
  • the method includes: receiving an audio control instruction sent by an application in the Linux system through a Linux audio service; based on the Linux audio service, controlling an audio device to perform an operation corresponding to the audio control instruction, and converting the audio device
  • the execution result is returned to the application program through the Linux audio service; wherein, the Linux audio service is configured based on the audio channel configuration file on the Android side.
  • the device embodiments described above are only illustrative, and 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 it can be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. It can be understood and implemented by those skilled in the art without any creative efforts.

Abstract

Provided are a Linux-based audio control method and apparatus, a device, and a storage medium. The method comprises: receiving an audio control instruction sent by an application program in a Linux system by means of a Linux audio service; controlling an audio device to execute an operation corresponding to the audio control instruction on the basis of the Linux audio service, and returning an execution result of the audio device back to the application program by means of the Linux audio service, wherein the Linux audio service is obtained via performing configuration on the basis of a conversion result of an Android-side audio path configuration file.

Description

基于Linux的音频控制方法、装置、设备和存储介质Audio control method, device, equipment and storage medium based on Linux
本申请要求在2021年12月29日提交中国专利局、申请号为202111628456.9的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。This application claims priority to a Chinese patent application with application number 202111628456.9 filed with the China Patent Office on December 29, 2021, the entire contents of which are incorporated herein by reference.
技术领域technical field
本公开涉及计算机技术领域,例如涉及一种基于Linux的音频控制方法、装置、设备和存储介质。The present disclosure relates to the field of computer technology, for example, to a Linux-based audio control method, device, device, and storage medium.
背景技术Background technique
Linux系统是一套免费使用和自由传播的类Unix操作系统,其具备多用户、多任务、多线程、多中央处理器(Central Processing Unit Processor,CPU)和高安全性的特点,因此,Linux系统受到了广泛应用。另外,Android系统是目前移动终端市场中占比最高的操作系统,在移动终端领域具有极好的生态环境。The Linux system is a set of Unix-like operating systems that are free to use and spread freely. been widely used. In addition, the Android system is currently the operating system with the highest proportion in the mobile terminal market, and has an excellent ecological environment in the field of mobile terminals.
目前,在基于Linux内核的操作系统上,音频设备大多通过alsa驱动,然而,在音频设备厂商仅提供Android驱动的情况下,则需要适配alsa配置,才能驱动音频设备,十分繁琐复杂。At present, most audio devices are driven by alsa on Linux kernel-based operating systems. However, if the audio device manufacturer only provides Android drivers, it is necessary to adapt the alsa configuration to drive the audio device, which is very cumbersome and complicated.
发明内容Contents of the invention
本公开提供一种基于Linux的音频控制方法、装置、设备和存储介质,用以避免相关技术中在只存在Android音频驱动的情况下,Linux系统中的应用程序使用音频设备繁琐复杂的情况,实现便捷性高的音频控制。The present disclosure provides a Linux-based audio control method, device, device, and storage medium to avoid the cumbersome and complicated situation that applications in the Linux system use audio devices when there is only an Android audio driver in the related art, and realize Convenient audio control.
本公开提供一种基于Linux的音频控制方法,应用于Linux系统,所述方法包括:The present disclosure provides a Linux-based audio control method applied to a Linux system, the method comprising:
通过Linux音频服务,接收所述Linux系统中应用程序发送的音频控制指令;Receive the audio control instruction sent by the application program in the Linux system through the Linux audio service;
基于所述Linux音频服务,控制音频设备执行所述音频控制指令对应的操作,并将所述音频设备的执行结果通过所述Linux音频服务返回至所述应用程序;Based on the Linux audio service, control the audio device to execute the operation corresponding to the audio control instruction, and return the execution result of the audio device to the application program through the Linux audio service;
其中,所述Linux音频服务是基于Android侧的音频通路配置文件进行配置得到的。Wherein, the Linux audio service is configured based on the audio channel configuration file on the Android side.
本公开还提供一种基于Linux的音频控制装置,包括:The present disclosure also provides a Linux-based audio control device, including:
接收模块,设置为通过Linux音频服务,接收所述Linux系统中应用程序发送的音频控制指令;The receiving module is configured to receive the audio control instruction sent by the application program in the Linux system through the Linux audio service;
控制模块,设置为基于所述Linux音频服务,控制音频设备执行所述音频控制指令对应的操作,并将所述音频设备的执行结果通过所述Linux音频服务返回至所述应用程序;The control module is configured to control the audio device to execute the operation corresponding to the audio control instruction based on the Linux audio service, and return the execution result of the audio device to the application program through the Linux audio service;
其中,所述Linux音频服务是基于Android侧的音频通路配置文件进行配置得到的。Wherein, the Linux audio service is configured based on the audio channel configuration file on the Android side.
本公开还提供一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现如上述任一种所述基于Linux的音频控制方法的步骤。The present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and operable on the processor. When the processor executes the program, it implements any one of the above-mentioned Linux-based Steps of an audio control method.
本公开还提供一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如上述任一种所述基于Linux的音频控制方法的步骤。The present disclosure also provides a non-transitory computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the above-mentioned Linux-based audio control methods are implemented.
本公开还提供一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现如上述任一种所述基于Linux的音频控制方法的步骤。The present disclosure also provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps of any one of the Linux-based audio control methods described above are implemented.
附图说明Description of drawings
图1为本公开提供的基于Linux的音频控制方法的流程示意图之一;FIG. 1 is one of the schematic flow charts of the Linux-based audio control method provided by the present disclosure;
图2为本公开提供的基于Linux的音频控制方法的架构示意图;FIG. 2 is a schematic structural diagram of a Linux-based audio control method provided by the present disclosure;
图3为本公开提供的基于Linux的音频控制方法的流程示意图之二;FIG. 3 is the second schematic flow diagram of the Linux-based audio control method provided by the present disclosure;
图4为本公开提供的基于Linux的音频控制方法的流程示意图之三;FIG. 4 is the third schematic flow diagram of the Linux-based audio control method provided by the present disclosure;
图5为本公开提供的基于Linux的音频控制方法的流程示意图之四;FIG. 5 is the fourth schematic flow diagram of the Linux-based audio control method provided by the present disclosure;
图6为本公开提供的基于Linux的音频控制装置的结构意图;FIG. 6 is a structural diagram of a Linux-based audio control device provided by the present disclosure;
图7为本公开提供的电子设备的结构示意图。FIG. 7 is a schematic structural diagram of an electronic device provided by the present disclosure.
具体实施方式Detailed ways
相关技术中,在基于Linux内核的操作系统上,音频设备通常通过alsa驱动,在音频设备厂商仅提供Android驱动的情况下,若Linux系统中的应用程序需要使用音频设备,则需要适配Android下的音频通路配置文件,例如,创建对应的音频通路配置文件中的alsa profile及path,才能使用音频设备,十分繁琐复杂。In related technologies, on an operating system based on the Linux kernel, the audio device is usually driven by alsa. In the case that the audio device manufacturer only provides the Android driver, if the application program in the Linux system needs to use the audio device, it needs to be adapted to the Android device. audio path configuration file, for example, create the alsa profile and path in the corresponding audio path configuration file to use the audio device, which is very cumbersome and complicated.
为便于理解以下多个实施例,下面对本公开的应用场景做举例说明。In order to facilitate understanding of the following embodiments, the application scenarios of the present disclosure are illustrated below.
例如,在终端设备中安装Linux系统,即终端设备的操作系统为基于Linux内核的操作系统。同时,该终端设备中安装了任一应用程序(Application,APP),该应用程序需要使用音频设备,该音频设备只能通过Android音频驱动进行控制。其中,该终端设备可以为手机、平板电脑、笔记本电脑、台式电脑、服务器、嵌入式系统等等,此处不作具体限定。For example, the Linux system is installed in the terminal device, that is, the operating system of the terminal device is an operating system based on the Linux kernel. Meanwhile, any application program (Application, APP) is installed in the terminal device, and the application program needs to use an audio device, and the audio device can only be controlled through an Android audio driver. Wherein, the terminal device may be a mobile phone, a tablet computer, a notebook computer, a desktop computer, a server, an embedded system, etc., which are not specifically limited here.
本公开提供了一种应用于Linux系统的基于Linux的音频控制方法。图1为本公开提供的基于Linux的音频控制方法的流程示意图之一,如图1所示,本公开提供的基于Linux的音频控制方法,包括以下步骤110-120:The present disclosure provides a Linux-based audio control method applied to a Linux system. Fig. 1 is one of the flow diagrams of the Linux-based audio control method provided by the present disclosure. As shown in Fig. 1, the Linux-based audio control method provided by the present disclosure includes the following steps 110-120:
步骤110,通过Linux音频服务,接收所述Linux系统中应用程序发送的音频控制指令。 Step 110, through the Linux audio service, receive the audio control instruction sent by the application program in the Linux system.
其中,Linux音频服务是Linux系统中的一个音频框架,其用于供Linux系统中应用程序进行操作,即其为Linux的音频服务进程。此外,该Linux音频服务位于Linux系统的用户空间中。Wherein, the Linux audio service is an audio framework in the Linux system, which is used for operation by applications in the Linux system, that is, it is an audio service process of Linux. Additionally, this Linux audio service resides in the user space of the Linux system.
此处,Linux音频服务为可扩展的音频框架,其支持插件(plugin)扩展。Here, the Linux audio service is an extensible audio framework that supports plug-in extensions.
在一实施例中,Linux音频服务为pulseaudio音频框架。该pulseaudio音频框架支持plugin扩展,例如可以实现一个droid plugin。In one embodiment, the Linux audio service is the pulseaudio audio framework. The pulseaudio audio framework supports plugin extensions, for example, a droid plugin can be implemented.
在另一实施例中,Linux音频服务为pipewire音频框架。该pipewire音频框架支持plugin扩展,例如可以实现一个droid plugin。In another embodiment, the Linux audio service is the pipewire audio framework. The pipewire audio framework supports plugin extensions, for example, a droid plugin can be implemented.
在一实施例中,在上述步骤110之前,所述基于Linux的音频控制方法还包括:In one embodiment, before the above step 110, the Linux-based audio control method further includes:
在所述Linux系统启动后,启动所述Linux音频服务。After the Linux system is started, start the Linux audio service.
其中,音频控制指令包括但不限于:开始播放指令、停止播放指令、开启录音指令、关闭录音指令等等。当然,音频控制指令包括音频设备的所有操作指令,或者,音频控制指令包括Android侧的Android音频服务的所有应用程序接口(Application Program Interface,API) 所对应的指令。Wherein, the audio control instruction includes, but is not limited to: an instruction to start playing, an instruction to stop playing, an instruction to start recording, an instruction to turn off recording, and the like. Certainly, the audio control instruction includes all operation instructions of the audio device, or the audio control instruction includes instructions corresponding to all application program interfaces (Application Program Interface, API) of the Android audio service on the Android side.
步骤120,基于所述Linux音频服务,控制音频设备执行所述音频控制指令对应的操作,并将所述音频设备的执行结果通过所述Linux音频服务返回至所述应用程序; Step 120, based on the Linux audio service, control the audio device to execute the operation corresponding to the audio control instruction, and return the execution result of the audio device to the application program through the Linux audio service;
其中,所述Linux音频服务是基于Android侧的音频通路配置文件进行配置得到的。Wherein, the Linux audio service is configured based on the audio channel configuration file on the Android side.
此处,Linux音频服务的获取方式是:通过音频插件,读取Android侧的音频通路配置文件,将音频通路配置文件进行解析,得到解析结果,并基于解析结果配置Linux音频服务。Here, the way to obtain the Linux audio service is: read the audio channel configuration file on the Android side through the audio plug-in, analyze the audio channel configuration file, obtain the analysis result, and configure the Linux audio service based on the analysis result.
其中,执行结果包括控制结果和数据传输结果,该数据传输结果包括但不限于:音频数据和音频设备配置参数。例如,执行结果包括但不限于:开始播放指令的执行结果、停止播放指令的执行结果、开启录音指令的执行结果、关闭录音指令的执行结果等等。Wherein, the execution result includes a control result and a data transmission result, and the data transmission result includes but not limited to: audio data and audio device configuration parameters. For example, the execution result includes but not limited to: the execution result of the start playing instruction, the execution result of the stop playing instruction, the execution result of the start recording instruction, the execution result of the close recording instruction and so on.
此处,开始播放指令的执行结果包括播放开始成功标识或播放开始失败标识。停止播放指令的执行结果包括播放停止成功标识或播放停止失败标识。开启录音指令的执行结果包括录音开启成功标识或录音开启失败标识。关闭录音指令的执行结果包括录音关闭成功标识和录音得到的音频数据,或录音关闭失败标识。Here, the execution result of the start playing instruction includes an indication of a successful start of playing or an indication of failure of playing start. The execution result of the stop playing instruction includes an indication of success in stopping playing or an indication of failure in stopping playing. The execution result of the command to start recording includes an indication that the recording has been started successfully or an indication that the recording has been started failed. The execution result of the record-off command includes an indication of successful record-off and audio data obtained from the recording, or an indicator of record-off failure.
在一实施例中,若音频控制指令为开始播放指令,控制音频设备开启,并播放待播放的音频数据,将音频设备是否播放开启成功的执行结果通过Linux音频服务返回至应用程序。In one embodiment, if the audio control command is a start playing command, the audio device is controlled to be turned on, and the audio data to be played is played, and the execution result of whether the audio device is successfully played and started is returned to the application program through the Linux audio service.
例如,若音频控制指令为开始播放指令,控制音频设备开启,并播放待播放的音频数据,将播放开始成功标识或播放开始失败标识通过Linux音频服务返回至应用程序。For example, if the audio control instruction is a start playback instruction, the audio device is controlled to be turned on, and the audio data to be played is played, and the playback start success flag or the playback start failure flag is returned to the application program through the Linux audio service.
需要说明的是,若应用程序是需要播放其生成的目标音频数据,则将该目标音频数据传输至音频设备进行播放。It should be noted that, if the application program needs to play the target audio data generated by it, the target audio data is transmitted to the audio device for playback.
在另一实施例中,若音频控制指令为停止播放指令,控制音频设备关闭,并停止播放音频,将音频设备是否播放关闭成功的执行结果通过Linux音频服务返回至应用程序。In another embodiment, if the audio control instruction is a stop playing instruction, control the audio device to close, and stop playing the audio, and return the execution result of whether the audio device is successfully played and closed to the application program through the Linux audio service.
例如,若音频控制指令为停止播放指令,控制音频设备关闭,并停止播放音频,将播放停止成功标识或播放停止失败标识通过Linux音频服务返回至应用程序。For example, if the audio control instruction is an instruction to stop playing, control the audio device to shut down, and stop playing the audio, and return the flag of successful playback stop or failure flag to the application program through the Linux audio service.
在另一实施例中,若音频控制指令为录音开启指令,控制音频设备进行录音操作,将录音是否开启成功的执行结果通过Linux音频服务返回至应用程序。In another embodiment, if the audio control command is a recording start command, the audio device is controlled to perform the recording operation, and the execution result of whether the recording is successfully started is returned to the application program through the Linux audio service.
例如,若音频控制指令为录音开启指令,控制音频设备进行录音操作,将音频设备实时录取得到的音频数据和录音开启成功标识通过Linux音频服务返回至应用程序,或,将录音开启失败标识通过Linux音频服务返回至应用程序。For example, if the audio control command is a recording start command, the audio device is controlled to perform the recording operation, and the audio data recorded by the audio device in real time and the recording start success mark are returned to the application program through the Linux audio service, or the recording start failure mark is passed to the Linux The audio service returns to the application.
在另一实施例中,若音频控制指令为录音关闭指令,控制音频设备关闭录音操作,将录音是否关闭成功的执行结果通过Linux音频服务返回至应用程序。In another embodiment, if the audio control command is a recording close command, the audio device is controlled to close the recording operation, and the execution result of whether the recording is successfully closed is returned to the application program through the Linux audio service.
例如,若音频控制指令为录音关闭指令,控制音频设备关闭录音操作,将录音关闭成功标识返回至应用程序,或,将录音关闭失败标识通过Linux音频服务返回至应用程序。For example, if the audio control command is a recording close command, the audio device is controlled to close the recording operation, and the record closing success mark is returned to the application program, or the recording close failure mark is returned to the application program through the Linux audio service.
此外,Linux系统与Android侧的Android音频服务将会进行通信,其通信线路与音频控制指令基本相同,此处不再一一赘述。即本公开不仅可以完成控制指令的传输,还可以完成数据传输。传输的数据包括音频数据、音频设备的配置参数等等。In addition, the Linux system will communicate with the Android audio service on the Android side, and the communication lines are basically the same as the audio control commands, so we won't repeat them here. That is, the present disclosure can not only complete the transmission of control instructions, but also complete the transmission of data. The transmitted data includes audio data, configuration parameters of audio equipment, and so on.
为便于理解,对本公开的实施方式进行举例说明。在Linux系统中应用程序使用音频设备时,应用程序生成音频控制指令,然后,通过Linux音频服务,接收应用程序发送的音频控制指令,之后,通过音频插件,将音频控制指令从Linux音频服务转发至Android音频服务,以通过Android音频服务和Android音频驱动,控制音频设备执行音频控制指令对应的 操作,之后,将音频设备的执行结果返回至Android音频驱动和Android音频服务;通过音频插件,将执行结果从Android音频服务转发至Linux音频服务;将执行结果从Linux音频服务返回至应用程序。此外,在一情况下,创建Android容器,然后启动Linux音频服务,并将Android音频服务部署于Android容器。可参见图2,在图2中对本公开实施例进行了层的划分,应用程序、Linux音频服务、音频插件、Android容器属于用户空间层,Android音频驱动(audio driver)属于内核层,音频设备属于硬件层。Embodiments of the present disclosure will be described by way of example for easy understanding. When an application uses an audio device in a Linux system, the application generates an audio control command, and then receives the audio control command sent by the application through the Linux audio service, and then forwards the audio control command from the Linux audio service to the Android audio service, to control the audio device to execute the operation corresponding to the audio control command through the Android audio service and the Android audio driver, and then return the execution result of the audio device to the Android audio driver and the Android audio service; through the audio plug-in, the execution result Forward from the Android audio service to the Linux audio service; return the execution result from the Linux audio service to the application. Furthermore, in one case, an Android container is created, and then the Linux audio service is started, and the Android audio service is deployed in the Android container. Can refer to Fig. 2, in Fig. 2 the embodiment of the present disclosure has been divided into layers, application program, Linux audio service, audio plug-in, Android container belong to user space layer, Android audio driver (audio driver) belongs to kernel layer, and audio equipment belongs to hardware layer.
根据本公开实施例的基于Linux的音频控制方法,该方法应用于Linux系统,通过Linux音频服务,接收Linux系统中应用程序发送的音频控制指令;基于音频服务,控制音频设备执行音频控制指令对应的操作,并将音频设备的执行结果通过Linux音频服务返回至应用程序;其中,Linux音频服务是基于Android侧的音频通路配置文件进行配置得到的。通过上述方式,本公开实施例通过Linux音频服务,接收应用程序发送的音频控制指令,且复用Android侧的音频通路配置文件,以根据音频通路配置文件配置Linux音频服务,进而使应用程序可以通过Linux音频服务使用音频设备,以使在只存在Android音频驱动的情况下,应用程序可以使用音频设备,且无需适配Android下的音频通路配置文件,从而实现便捷性高的音频控制。According to the Linux-based audio control method according to the embodiment of the present disclosure, the method is applied to the Linux system, and receives the audio control instruction sent by the application program in the Linux system through the Linux audio service; based on the audio service, controls the audio device to execute the corresponding audio control instruction Operation, and return the execution result of the audio device to the application program through the Linux audio service; wherein, the Linux audio service is configured based on the audio path configuration file on the Android side. Through the above method, the embodiment of the present disclosure receives the audio control command sent by the application program through the Linux audio service, and multiplexes the audio path configuration file on the Android side, so as to configure the Linux audio service according to the audio path configuration file, so that the application program can pass The Linux audio service uses the audio device, so that when only the Android audio driver exists, the application can use the audio device without adapting the audio channel configuration file under Android, so as to achieve convenient audio control.
例如,基于上述实施例,提出本公开基于Linux的音频控制方法的另一实施例。上述步骤120之前,还包括:For example, based on the above embodiments, another embodiment of the Linux-based audio control method of the present disclosure is proposed. Before the above step 120, it also includes:
步骤130,通过所述Linux音频服务,确定所述音频控制指令对应的音频控制API,所述音频控制API用于访问Android音频服务。Step 130, through the Linux audio service, determine the audio control API corresponding to the audio control command, and the audio control API is used to access the Android audio service.
例如,Linux音频服务基于配置的音频通路配置文件的转换结果,确定音频控制指令对应的音频控制API,从而基于音频控制API,访问Android侧的Android音频服务,从而实现Linux系统与Android侧的Android音频服务进行通信的目的,进而实现Linux系统可以使用Android音频驱动的目的。For example, based on the conversion result of the configured audio channel configuration file, the Linux audio service determines the audio control API corresponding to the audio control command, and then accesses the Android audio service on the Android side based on the audio control API, thereby realizing the Android audio system between the Linux system and the Android side. The purpose of the service to communicate, and then realize the purpose that the Linux system can use the Android audio driver.
基于上述实施例,如图3所示,上述步骤120中,基于所述Linux音频服务,控制音频设备执行所述音频控制指令对应的操作,包括:Based on the above embodiment, as shown in FIG. 3, in the above step 120, based on the Linux audio service, the audio device is controlled to perform the operation corresponding to the audio control instruction, including:
步骤121,通过音频插件,将所述音频控制API从所述Linux音频服务转发至所述Android音频服务。 Step 121, forward the audio control API from the Linux audio service to the Android audio service through an audio plug-in.
步骤122,通过所述Android音频服务,控制音频设备执行所述音频控制指令对应的操作。 Step 122, through the Android audio service, control the audio device to perform the operation corresponding to the audio control instruction.
其中,音频插件为Linux音频服务扩展的插件。该音频插件可以为droid plugin。该音频插件位于Linux的用户空间。Wherein, the audio plug-in is a plug-in extended by the Linux audio service. The audio plug-in can be a droid plugin. This audio plugin resides in user space on Linux.
需要说明的是,音频控制API在经过音频插件时,可以做处理或不作处理,具体根据实际需要进行设定,此处不作具体赘述。It should be noted that, when the audio control API passes through the audio plug-in, it can be processed or not, which is specifically set according to actual needs, and details will not be described here.
例如,若音频控制指令为开始播放指令,则将开始播放指令对应的音频控制API从Linux音频服务转发至Android音频服务,以使Android音频服务,控制音频设备执行开始播放指令对应的操作。For example, if the audio control instruction is a start playback instruction, the audio control API corresponding to the start playback instruction is forwarded from the Linux audio service to the Android audio service, so that the Android audio service controls the audio device to perform the operation corresponding to the start playback instruction.
例如,若音频控制指令为停止播放指令,则将停止播放指令对应的音频控制API从Linux音频服务转发至Android音频服务,以使Android音频服务,控制音频设备执行停止播放指令对应的操作。For example, if the audio control instruction is a stop playback instruction, the audio control API corresponding to the stop playback instruction is forwarded from the Linux audio service to the Android audio service, so that the Android audio service controls the audio device to perform the operation corresponding to the stop playback instruction.
例如,若音频控制指令为开启录音指令,则将开启录音指令对应的音频控制API从Linux音频服务转发至Android音频服务,以使Android音频服务,控制音频设备执行开启录音指令对应的操作。For example, if the audio control instruction is an instruction to enable recording, the audio control API corresponding to the instruction to enable recording is forwarded from the Linux audio service to the Android audio service, so that the Android audio service controls the audio device to perform the operation corresponding to the instruction to enable recording.
例如,若音频控制指令为关闭录音指令,则将关闭录音指令对应的音频控制API从Linux音频服务转发至Android音频服务,以使Android音频服务,控制音频设备执行关闭录音指令对应的操作。For example, if the audio control instruction is an instruction to close the recording, the audio control API corresponding to the instruction to close the recording is forwarded from the Linux audio service to the Android audio service, so that the Android audio service controls the audio device to perform the operation corresponding to the instruction to close the recording.
例如,在上述步骤121之前,该方法还包括:For example, before the above step 121, the method also includes:
在所述Linux系统启动后,启动所述Linux音频服务,并加载所述音频插件。After the Linux system is started, start the Linux audio service and load the audio plug-in.
例如,在Linux系统启动后,启动Linux音频服务,并加载音频插件;通过音频插件读取Android侧的音频通路配置文件,并将音频通路配置文件进行转换,得到转换结果;基于转换结果配置Linux音频服务。For example, after the Linux system starts, start the Linux audio service and load the audio plug-in; read the audio path configuration file on the Android side through the audio plug-in, and convert the audio path configuration file to obtain the conversion result; configure the Linux audio based on the conversion result Serve.
在一实施例中,所述Linux系统包括用户空间层;所述用户空间层包括所述应用程序、所述Linux音频服务、所述音频插件、所述Android音频服务。In one embodiment, the Linux system includes a user space layer; the user space layer includes the application program, the Linux audio service, the audio plug-in, and the Android audio service.
例如,创建Android容器,并将Android音频服务部署于Android容器。该Android音频服务可以包括AudioFlinger service、Audio Server、Audio HAL Service等等。可参见图2,此处不再一一赘述。For example, create an Android container and deploy the Android audio service to the Android container. The Android audio service may include AudioFlinger service, Audio Server, Audio HAL Service and the like. Refer to FIG. 2 , which will not be repeated here.
根据本公开实施例的基于Linux的音频控制方法,该方法应用于Linux系统,通过Linux音频服务,确定音频控制指令对应的音频控制API,音频控制API用于访问Android音频驱动;通过音频插件,将音频控制API从Linux音频服务转发至Android音频服务;通过Android音频服务,控制音频设备执行音频控制指令对应的操作。通过上述方式,将音频控制指令通过音频插件进行转发,以通过Android音频服务使用音频设备,以使应用程序可以通过Android音频服务使用音频设备,以使在只存在Android音频驱动的情况下,应用程序可以使用音频设备,且无需适配Android下的音频通路配置文件,从而实现便捷性高的音频控制。According to the Linux-based audio control method according to an embodiment of the present disclosure, the method is applied to a Linux system, and the audio control API corresponding to the audio control command is determined through the Linux audio service, and the audio control API is used to access the Android audio driver; through the audio plug-in, the The audio control API is forwarded from the Linux audio service to the Android audio service; through the Android audio service, the audio device is controlled to perform the corresponding operation of the audio control command. In the above way, the audio control command is forwarded through the audio plug-in to use the audio device through the Android audio service, so that the application can use the audio device through the Android audio service, so that when only the Android audio driver exists, the application The audio device can be used without adapting the audio channel configuration file under Android, so as to realize convenient audio control.
例如,基于上述任一实施例,提出本公开基于Linux的音频控制方法的另一实施例。在本实施例中,上述步骤120中,将所述音频设备的执行结果通过所述Linux音频服务返回至所述应用程序,包括以下步骤123-125:For example, based on any of the above embodiments, another embodiment of the Linux-based audio control method of the present disclosure is proposed. In this embodiment, in the above step 120, the execution result of the audio device is returned to the application program through the Linux audio service, including the following steps 123-125:
步骤123,将所述音频设备的执行结果返回至所述Android音频服务。Step 123, returning the execution result of the audio device to the Android audio service.
步骤124,通过音频插件,将所述执行结果从所述Android音频服务转发至所述Linux音频服务。Step 124, forward the execution result from the Android audio service to the Linux audio service through the audio plug-in.
步骤125,将所述执行结果从所述Linux音频服务返回至所述应用程序。Step 125, returning the execution result from the Linux audio service to the application program.
其中,音频插件为Linux音频服务扩展的插件。该音频插件可以为droid plugin。该音频插件位于Linux的用户空间。Wherein, the audio plug-in is a plug-in extended by the Linux audio service. The audio plug-in can be a droid plugin. This audio plugin resides in user space on Linux.
需要说明的是,执行结果在经过音频插件和Linux音频服务时,可以做处理或不作处理,具体根据实际需要进行设定,此处不作具体赘述。It should be noted that, when the execution result passes through the audio plug-in and the Linux audio service, it can be processed or not. The specific setting is based on actual needs, and details will not be described here.
为便于理解,音频控制指令以开始播放指令为例进行说明,应用程序、Linux音频服务、音频插件、Android音频服务的信令交互图如图4所示:For ease of understanding, the audio control command is described by taking the start playback command as an example. The signaling interaction diagram of the application, Linux audio service, audio plug-in, and Android audio service is shown in Figure 4:
S401,应用程序向Linux音频服务发送开始播放指令和音频数据。S401, the application program sends an instruction to start playing and audio data to the Linux audio service.
S402,Linux音频服务向音频插件发送开始播放指令和音频数据。S402, the Linux audio service sends the start playing instruction and audio data to the audio plug-in.
S403,音频插件向Android音频服务发送开始播放指令和音频数据。S403, the audio plug-in sends the start playing instruction and audio data to the Android audio service.
S404,Android音频服务向音频插件返回执行结果,其中,执行结果包括:播放开始成功标识或播放开始失败标识。此处,执行结果以播放开始成功标识为例进行说明。S404. The Android audio service returns an execution result to the audio plug-in, where the execution result includes: an indication of a successful playback start or an indication of a failure to start playback. Here, the execution result is described by taking the successful indication of playback start as an example.
S405,音频插件向Linux音频服务返回播放开始成功标识。S405, the audio plug-in returns the playback start success indication to the Linux audio service.
S406,Linux音频服务向应用程序返回播放开始成功标识。S406, the Linux audio service returns the playback start success indication to the application program.
在播放一段时间之后,音频控制指令以停止播放指令为例进行说明。After playing for a period of time, the audio control instruction is described by taking the instruction of stopping playback as an example.
S407,应用程序向Linux音频服务发送停止播放指令。S407, the application program sends a stop playing instruction to the Linux audio service.
S408,Linux音频服务向音频插件发送停止播放指令。S408, the Linux audio service sends a playback stop instruction to the audio plug-in.
S409,音频插件向Android音频服务发送停止播放指令。S409, the audio plug-in sends an instruction to stop playing to the Android audio service.
S410,Android音频服务向音频插件返回执行结果,其中,执行结果包括:播放停止成功标识或播放停止失败标识。此处,执行结果以播放停止成功标识为例进行说明。S410, the Android audio service returns an execution result to the audio plug-in, where the execution result includes: an indication of success in playback stop or an indication of failure in playback stop. Here, the execution result is described by taking the playback stop success flag as an example.
S411,音频插件向Linux音频服务返回播放停止成功标识。S411, the audio plug-in returns a playback stop success indication to the Linux audio service.
S412,Linux音频服务向应用程序返回播放停止成功标识。S412, the Linux audio service returns a playback stop success indication to the application program.
为便于理解,音频控制指令以开启录音指令为例进行说明,应用程序、Linux音频服务、音频插件、Android音频服务的信令交互图如图5所示:For ease of understanding, the audio control command is described by taking the start of the recording command as an example. The signaling interaction diagram of the application, Linux audio service, audio plug-in, and Android audio service is shown in Figure 5:
S501,应用程序向Linux音频服务发送开启录音指令。S501. The application program sends an instruction to start recording to the Linux audio service.
S502,Linux音频服务向音频插件发送开启录音指令。S502. The Linux audio service sends an instruction to start recording to the audio plug-in.
S503,音频插件向Android音频服务发送开启录音指令。S503. The audio plug-in sends an instruction to start recording to the Android audio service.
S504,Android音频服务向音频插件返回执行结果,其中,执行结果包括:录音开启成功标识和实时录音得到的录音数据或录音开启失败标识。此处,执行结果以录音开启成功标识和录音数据为例进行说明。S504. The Android audio service returns an execution result to the audio plug-in, wherein the execution result includes: an indication of successful recording start and recording data obtained by real-time recording or an indication of failure to start recording. Here, the execution result will be explained by taking the recording start success flag and recording data as an example.
S505,音频插件向Linux音频服务返回录音开启成功标识和录音数据。S505. The audio plug-in returns the recording start success identification and recording data to the Linux audio service.
S506,Linux音频服务向应用程序返回录音开启成功标识和录音数据。S506, the Linux audio service returns the recording start success identification and recording data to the application program.
在录音一段时间之后,音频控制指令以关闭录音指令为例进行说明。After recording for a period of time, the audio control instruction is described by taking the instruction of turning off the recording as an example.
S507,应用程序向Linux音频服务发送关闭录音指令。S507, the application program sends an instruction to close the recording to the Linux audio service.
S508,Linux音频服务向音频插件发送关闭录音指令。S508, the Linux audio service sends an instruction to close the recording to the audio plug-in.
S509,音频插件向Android音频服务发送关闭录音指令。S509, the audio plug-in sends an instruction to close the recording to the Android audio service.
S510,Android音频服务向音频插件返回执行结果,其中,执行结果包括:录音关闭成功标识或录音关闭失败标识。此处,执行结果以录音关闭成功标识为例进行说明。S510. The Android audio service returns an execution result to the audio plug-in, where the execution result includes: an indication of success in closing recording or an indication of failure in closing recording. Here, the execution result is described by taking the record closing success flag as an example.
S511,音频插件向Linux音频服务返回录音关闭成功标识。S511. The audio plug-in returns an indication that the recording is closed successfully to the Linux audio service.
S512,Linux音频服务向应用程序返回录音关闭成功标识。S512. The Linux audio service returns an indication that the recording is closed successfully to the application program.
此外,还包括其他音频控制指令,其他音频控制指令与上述音频控制指令的执行过程基本相同,此处不再一一赘述。In addition, other audio control instructions are also included, and the execution process of other audio control instructions is basically the same as that of the above audio control instructions, and will not be repeated here.
例如,在上述步骤123之前,该方法还包括:For example, before the above step 123, the method also includes:
在所述Linux系统启动后,启动所述Linux音频服务,并加载所述音频插件。After the Linux system is started, start the Linux audio service and load the audio plug-in.
例如,在Linux系统启动后,启动Linux音频服务,并加载音频插件;通过音频插件读取Android侧的音频通路配置文件,并将音频通路配置文件进行转换,得到转换结果;基于转换结果配置Linux音频服务。For example, after the Linux system starts, start the Linux audio service and load the audio plug-in; read the audio path configuration file on the Android side through the audio plug-in, and convert the audio path configuration file to obtain the conversion result; configure the Linux audio based on the conversion result Serve.
在一情况下,在Linux系统启动后,先创建Android容器,并启动Android音频服务,之后,启动Linux音频服务,并加载音频插件。In one case, after the Linux system is started, the Android container is first created, and the Android audio service is started, and then the Linux audio service is started, and the audio plug-in is loaded.
在另一情况下,在Linux系统启动后,启动Linux音频服务,并加载音频插件,之后通过libhybris技术,直接加载Audio HAL库,进而直接操作音频硬件。In another case, after the Linux system is started, start the Linux audio service, and load the audio plug-in, and then directly load the Audio HAL library through the libhybris technology, and then directly operate the audio hardware.
在一实施例中,所述Linux系统包括用户空间层;所述用户空间层包括所述应用程序、所述Linux音频服务、所述音频插件、所述Android音频服务。In one embodiment, the Linux system includes a user space layer; the user space layer includes the application program, the Linux audio service, the audio plug-in, and the Android audio service.
例如,创建Android容器,并将Android音频服务部署于Android容器。该Android音频服务可以包括AudioFlinger service、Audio Server、Audio HAL Service等等。可参见图2,此处不再一一赘述。For example, create an Android container and deploy the Android audio service to the Android container. The Android audio service may include AudioFlinger service, Audio Server, Audio HAL Service and the like. Refer to FIG. 2 , which will not be repeated here.
根据本公开实施例的基于Linux的音频控制方法,该方法应用于Linux系统,将音频设备的执行结果返回至Android音频服务;通过音频插件,将执行结果从Android音频服务转发至Linux音频服务;将执行结果从Linux音频服务返回至应用程序。通过上述方式,将音频设备的执行结果通过音频插件进行转发,且通过Linux音频服务返回执行结果,以使应用程序可以接收到返回的执行结果,实现了Linux系统中的应用程序可以通过Android音频服务使用音频设备,以使在只存在Android音频驱动的情况下,应用程序可以使用音频设备,并返回执行结果,且无需适配Android下的音频通路配置文件,从而实现便捷性高的音频控制。According to the Linux-based audio control method according to an embodiment of the present disclosure, the method is applied to a Linux system, and the execution result of the audio device is returned to the Android audio service; through the audio plug-in, the execution result is forwarded from the Android audio service to the Linux audio service; Execution results are returned to the application from the Linux audio service. Through the above method, the execution result of the audio device is forwarded through the audio plug-in, and the execution result is returned through the Linux audio service, so that the application program can receive the returned execution result, and the application program in the Linux system can use the Android audio service. Use the audio device so that when only the Android audio driver exists, the application can use the audio device and return the execution result without adapting the audio channel configuration file under Android, so as to achieve convenient audio control.
例如,基于上述任一实施例,提出本公开基于Linux的音频控制方法的另一实施例。在本实施例中,在上述步骤110之前,该方法还包括:For example, based on any of the above embodiments, another embodiment of the Linux-based audio control method of the present disclosure is proposed. In this embodiment, before the above step 110, the method further includes:
步骤140,通过音频插件,读取Android侧的音频通路配置文件。Step 140, read the audio channel configuration file on the Android side through the audio plug-in.
步骤150,基于所述音频通路配置文件配置Linux音频服务。Step 150, configure Linux audio service based on the audio channel configuration file.
例如,通过音频插件,读取Android侧的音频服务对应的音频通路配置文件,然后对该音频通路配置文件进行解析,基于解析结果,将音频通路配置文件进行转换,以转换为Linux音频服务可用的音频通道配置。For example, through the audio plug-in, read the audio channel configuration file corresponding to the audio service on the Android side, then analyze the audio channel configuration file, and convert the audio channel configuration file based on the analysis result to convert it to the available Linux audio service Audio channel configuration.
其中,音频插件为Linux音频服务扩展的插件。该音频插件可以为droid plugin。该音频插件位于Linux的用户空间。Wherein, the audio plug-in is a plug-in extended by the Linux audio service. The audio plug-in can be a droid plugin. This audio plugin resides in user space on Linux.
例如,在上述步骤140之前,该方法还包括:For example, before the above step 140, the method also includes:
步骤160,在所述Linux系统启动后,启动所述Linux音频服务,并加载所述音频插件。Step 160, after the Linux system starts, start the Linux audio service and load the audio plug-in.
例如,在Linux系统启动后,启动Linux音频服务,并加载音频插件;通过音频插件读取Android侧的音频通路配置文件,并将音频通路配置文件进行转换,得到转换结果;基于转换结果配置Linux音频服务。For example, after the Linux system starts, start the Linux audio service and load the audio plug-in; read the audio path configuration file on the Android side through the audio plug-in, and convert the audio path configuration file to obtain the conversion result; configure the Linux audio based on the conversion result Serve.
在一实施例中,所述Linux系统包括用户空间层;所述用户空间层包括所述应用程序、所述Linux音频服务、所述音频插件、所述Android音频服务。In one embodiment, the Linux system includes a user space layer; the user space layer includes the application program, the Linux audio service, the audio plug-in, and the Android audio service.
例如,创建Android容器,并将Android音频服务部署于Android容器。该Android音频服务可以包括AudioFlinger service、Audio Server、Audio HAL Service等等。可参见图2,此处不再一一赘述。For example, create an Android container and deploy the Android audio service to the Android container. The Android audio service may include AudioFlinger service, Audio Server, Audio HAL Service and the like. Refer to FIG. 2 , which will not be repeated here.
根据本公开实施例的基于Linux的音频控制方法,该方法应用于Linux系统,通过音频插件,读取Android侧的音频通路配置文件,并将音频通路配置文件进行转换,得到转换结果;基于所述转换结果配置Linux音频服务。通过上述方式,本公开实施例通过音频插件,复用Android侧的音频通路配置文件,以根据Android侧的音频通路配置文件,配置Linux音频服务,进而使应用程序可以通过Linux音频服务使用音频设备,以使在只存在Android 音频驱动的情况下,应用程序可以使用音频设备,且无需适配Android下的音频通路配置文件,从而实现便捷性高的音频控制。According to the Linux-based audio control method of the embodiment of the present disclosure, the method is applied to the Linux system, reads the audio path configuration file on the Android side through the audio plug-in, and converts the audio path configuration file to obtain the conversion result; based on the The conversion result configures the Linux audio service. Through the above method, the embodiment of the present disclosure multiplexes the audio path configuration file on the Android side through the audio plug-in, so as to configure the Linux audio service according to the audio path configuration file on the Android side, so that the application program can use the audio device through the Linux audio service, In the case that only the Android audio driver exists, the application program can use the audio device without adapting the audio channel configuration file under Android, thereby realizing convenient audio control.
例如,基于上述任一实施例,提出本公开基于Linux的音频控制方法的另一实施例。在本实施例中,所述Linux音频服务通过进程间通信通道与Android侧的Android音频服务进行通信。For example, based on any of the above embodiments, another embodiment of the Linux-based audio control method of the present disclosure is proposed. In this embodiment, the Linux audio service communicates with the Android audio service on the Android side through an inter-process communication channel.
其中,进程间通信通道能够实现进程间的数据传递和信息传递。例如,进程间通信通道实现Linux音频服务与Android音频服务进行控制指令的传输和处理数据的传输。该处理数据包括但不限于:音频数据、音频设备的配置参数等等。Wherein, the inter-process communication channel can realize data transmission and information transmission between processes. For example, the inter-process communication channel realizes the transmission of control commands and processing data between the Linux audio service and the Android audio service. The processed data includes, but is not limited to: audio data, configuration parameters of audio equipment, and the like.
进程间通信(Inter-Process Communication,IPC),提供了多种进程间的通信方法,例如,binder,套接字(socket),共享内存(shared memory)等。Inter-Process Communication (IPC) provides a variety of inter-process communication methods, such as binder, socket (socket), shared memory (shared memory), etc.
例如,Linux音频服务通过IPC通道与Android侧的Android音频服务进行通信。For example, the Linux audio service communicates with the Android audio service on the Android side through an IPC channel.
在一实施例中,Linux音频服务通过binder与Android侧的Android音频服务进行通信。例如,Linux音频服务通过libgbinder与Android侧的Android音频服务进行通信。libgbinder是binder的一种Linux实现,其用于Linux系统与Android之间进行程序间的通信。In an embodiment, the Linux audio service communicates with the Android audio service on the Android side through a binder. For example, the Linux audio service communicates with the Android audio service on the Android side via libgbinder. libgbinder is a Linux implementation of binder, which is used for program-to-program communication between the Linux system and Android.
在另一实施例中,Linux音频服务通过socket与Android侧的Android音频服务进行通信。In another embodiment, the Linux audio service communicates with the Android audio service on the Android side through a socket.
在另一实施例中,Linux音频服务通过shared memory与Android侧的Android音频服务进行通信。In another embodiment, the Linux audio service communicates with the Android audio service on the Android side through shared memory.
根据本公开实施例的基于Linux的音频控制方法,该方法应用于Linux系统,本公开实施例利用进程间通信通道实现Linux音频服务和Android音频服务的通信,以能够将Linux生成的音频控制指令发送给Android音频服务,且能够在Linux和Android之间进行数据通信,以使在只存在Android音频驱动的情况下,应用程序可以使用音频设备,且无需适配Android下的音频通路配置文件,从而实现便捷性高的音频控制。According to the Linux-based audio control method of the embodiment of the disclosure, the method is applied to the Linux system, and the embodiment of the disclosure uses the inter-process communication channel to realize the communication between the Linux audio service and the Android audio service, so as to be able to send the audio control command generated by Linux Provide Android audio service, and can perform data communication between Linux and Android, so that the application can use the audio device when only the Android audio driver exists, and there is no need to adapt the audio channel configuration file under Android, so as to achieve Convenient audio control.
下面对本公开提供的基于Linux的音频控制装置进行描述,下文描述的基于Linux的音频控制装置与上文描述的基于Linux的音频控制方法可相互对应参照,重复之处不再赘述,如图6所示,该基于Linux的音频控制装置包括:The following describes the Linux-based audio control device provided by the present disclosure. The Linux-based audio control device described below and the Linux-based audio control method described above can be referred to each other, and the repetitions will not be repeated, as shown in FIG. 6 As shown, the Linux-based audio control device includes:
接收模块610,设置为通过Linux音频服务,接收所述Linux系统中应用程序发送的音频控制指令;The receiving module 610 is configured to receive the audio control instruction sent by the application program in the Linux system through the Linux audio service;
控制模块620,设置为基于所述Linux音频服务,控制音频设备执行所述音频控制指令对应的操作,并将所述音频设备的执行结果通过所述Linux音频服务返回至所述应用程序;The control module 620 is configured to control the audio device to execute the operation corresponding to the audio control instruction based on the Linux audio service, and return the execution result of the audio device to the application program through the Linux audio service;
其中,所述Linux音频服务是基于Android侧的音频通路配置文件进行配置得到的。Wherein, the Linux audio service is configured based on the audio channel configuration file on the Android side.
根据本公开实施例的基于Linux的音频控制装置,通过Linux音频服务,接收Linux系统中应用程序发送的音频控制指令;基于音频服务,控制音频设备执行音频控制指令对应的操作,并将音频设备的执行结果通过Linux音频服务返回至应用程序;其中,Linux音频服务是基于Android侧的音频通路配置文件进行配置得到的。通过上述方式,本公开实施例通过Linux音频服务,接收应用程序发送的音频控制指令,且复用Android侧的音频通路配置文件,以根据Android侧的音频通路配置文件配置Linux音频服务,进而使应用程序可以通过Linux音频服务使用音频设备,以使在只存在Android音频驱动的情况下,应用程序可以使用音频设备,且无需适配Android下的音频通路配置文件,从而实现便捷性高的音频控制。According to the audio control device based on Linux in the embodiment of the present disclosure, the audio control instruction sent by the application program in the Linux system is received through the Linux audio service; based on the audio service, the audio device is controlled to perform the operation corresponding to the audio control instruction, and the audio device's The execution result is returned to the application program through the Linux audio service; wherein, the Linux audio service is configured based on the audio channel configuration file on the Android side. Through the above method, the embodiment of the present disclosure receives the audio control command sent by the application through the Linux audio service, and multiplexes the audio path configuration file on the Android side, so as to configure the Linux audio service according to the audio path configuration file on the Android side, and then makes the application The program can use the audio device through the Linux audio service, so that when only the Android audio driver exists, the application can use the audio device, and there is no need to adapt the audio channel configuration file under Android, so as to achieve convenient audio control.
例如,所述基于Linux的音频控制装置还包括:For example, the Linux-based audio control device also includes:
确定模块,设置为通过所述Linux音频服务,确定所述音频控制指令对应的音频控制API,所述音频控制API用于访问Android音频服务。The determination module is configured to determine the audio control API corresponding to the audio control instruction through the Linux audio service, and the audio control API is used to access the Android audio service.
例如,所述控制模块620还设置为通过音频插件,将所述音频控制API从所述Linux音频服务转发至所述Android音频服务;通过所述Android音频服务,控制音频设备执行所述音频控制指令对应的操作。For example, the control module 620 is also configured to forward the audio control API from the Linux audio service to the Android audio service through an audio plug-in; through the Android audio service, control the audio device to execute the audio control instruction corresponding operation.
例如,所述控制模块620还设置为将所述音频设备的执行结果返回至所述Android音频服务;通过音频插件,将所述执行结果从所述Android音频服务转发至所述Linux音频服务;将所述执行结果从所述Linux音频服务返回至所述应用程序。For example, the control module 620 is also configured to return the execution result of the audio device to the Android audio service; forward the execution result from the Android audio service to the Linux audio service through an audio plug-in; The execution result is returned to the application program from the Linux audio service.
例如,所述基于Linux的音频控制装置还包括:For example, the Linux-based audio control device also includes:
文件读取模块,设置为通过音频插件,读取Android侧的音频通路配置文件;The file reading module is set to read the audio channel configuration file on the Android side through the audio plug-in;
服务配置模块,设置为基于所述音频通路配置文件配置Linux音频服务。The service configuration module is configured to configure the Linux audio service based on the audio channel configuration file.
例如,所述基于Linux的音频控制装置还包括:For example, the Linux-based audio control device also includes:
服务启动模块,设置为在所述Linux系统启动后,启动所述Linux音频服务,并加载所述音频插件。The service startup module is configured to start the Linux audio service and load the audio plug-in after the Linux system is started.
例如,所述Linux音频服务通过进程间通信通道与Android侧的Android音频服务进行通信。For example, the Linux audio service communicates with the Android audio service on the Android side through an inter-process communication channel.
图7示例了一种电子设备的实体结构示意图,如图7所示,该电子设备可以包括:处理器(processor)710、通信接口(Communications Interface)720、存储器(memory)730和通信总线740,其中,处理器710,通信接口720,存储器730通过通信总线740完成相互间的通信。处理器710可以调用存储器730中的逻辑指令,以执行基于Linux的音频控制方法,该方法包括:通过Linux音频服务,接收所述Linux系统中应用程序发送的音频控制指令;基于所述Linux音频服务,控制音频设备执行所述音频控制指令对应的操作,并将所述音频设备的执行结果通过所述Linux音频服务返回至所述应用程序;其中,所述Linux音频服务是基于Android侧的音频通路配置文件,进行配置得到的。FIG. 7 illustrates a schematic diagram of the physical structure of an electronic device. As shown in FIG. 7, the electronic device may include: a processor (processor) 710, a communication interface (Communications Interface) 720, a memory (memory) 730 and a communication bus 740, Wherein, the processor 710 , the communication interface 720 , and the memory 730 communicate with each other through the communication bus 740 . The processor 710 can call the logic instruction in the memory 730 to execute the audio control method based on Linux, the method includes: receiving the audio control instruction sent by the application program in the Linux system through the Linux audio service; , controlling the audio device to execute the operation corresponding to the audio control instruction, and returning the execution result of the audio device to the application program through the Linux audio service; wherein, the Linux audio service is based on the audio channel on the Android side The configuration file is obtained by configuring.
此外,上述的存储器730中的逻辑指令可以通过软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本公开的技术方案本质上或者说对相关技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本公开多个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等多种可以存储程序代码的介质。In addition, the above-mentioned logic instructions in the memory 730 may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the essence of the technical solution of the present disclosure or the part that contributes to the related technology or the part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several The instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in multiple embodiments of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc and other media that can store program codes. .
另一方面,本公开还提供一种计算机程序产品,所述计算机程序产品包括计算机程序,计算机程序可存储在非暂态计算机可读存储介质上,所述计算机程序被处理器执行时,计算机能够执行上述多种方法所提供的基于Linux的音频控制方法,该方法包括:通过Linux音频服务,接收所述Linux系统中应用程序发送的音频控制指令;基于所述Linux音频服务,控制音频设备执行所述音频控制指令对应的操作,并将所述音频设备的执行结果通过所述Linux音频服务返回至所述应用程序;其中,所述Linux音频服务是基于Android侧的音频通 路配置文件,进行配置得到的。On the other hand, the present disclosure also provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can Executing the audio control method based on Linux provided by the above-mentioned multiple methods, the method includes: receiving audio control instructions sent by the application program in the Linux system through the Linux audio service; based on the Linux audio service, controlling the audio device to execute the The operation corresponding to the audio control instruction, and the execution result of the audio device is returned to the application program through the Linux audio service; wherein, the Linux audio service is configured based on the audio path configuration file on the Android side to obtain of.
又一方面,本公开还提供一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现以执行上述多种方法提供的基于Linux的音频控制方法,该方法包括:通过Linux音频服务,接收所述Linux系统中应用程序发送的音频控制指令;基于所述Linux音频服务,控制音频设备执行所述音频控制指令对应的操作,并将所述音频设备的执行结果通过所述Linux音频服务返回至所述应用程序;其中,所述Linux音频服务是基于Android侧的音频通路配置文件,进行配置得到的。In yet another aspect, the present disclosure also provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it is implemented to perform the audio control method based on Linux provided by the above-mentioned various methods, The method includes: receiving an audio control instruction sent by an application in the Linux system through a Linux audio service; based on the Linux audio service, controlling an audio device to perform an operation corresponding to the audio control instruction, and converting the audio device The execution result is returned to the application program through the Linux audio service; wherein, the Linux audio service is configured based on the audio channel configuration file on the Android side.
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。The device embodiments described above are only illustrative, and 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 it can be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. It can be understood and implemented by those skilled in the art without any creative efforts.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到多个实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行多个实施例或者实施例的某些部分所述的方法。Through the above description of the implementations, those skilled in the art can clearly understand that multiple implementations can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware. Based on this understanding, the essence of the above technical solutions or the part that contributes to related technologies can be embodied in the form of software products, and the computer software products can be stored in computer-readable storage media, such as ROM/RAM, disk , CD, etc., including several instructions to make a computer device (which may be a personal computer, server, or network device, etc.) execute the methods described in multiple embodiments or some parts of the embodiments.

Claims (10)

  1. 一种基于Linux的音频控制方法,应用于Linux系统,所述方法包括:A Linux-based audio control method applied to a Linux system, the method comprising:
    通过Linux音频服务,接收所述Linux系统中应用程序发送的音频控制指令;Receive the audio control instruction sent by the application program in the Linux system through the Linux audio service;
    基于所述Linux音频服务,控制音频设备执行所述音频控制指令对应的操作,并将所述音频设备的执行结果通过所述Linux音频服务返回至所述应用程序;Based on the Linux audio service, control the audio device to execute the operation corresponding to the audio control instruction, and return the execution result of the audio device to the application program through the Linux audio service;
    其中,所述Linux音频服务是基于安卓Android侧的音频通路配置文件进行配置得到的。Wherein, the Linux audio service is configured based on the audio channel configuration file on the Android side.
  2. 根据权利要求1所述的方法,所述基于所述Linux音频服务,控制音频设备执行所述音频控制指令对应的操作之前,还包括:The method according to claim 1, before controlling the audio device based on the Linux audio service to perform the operation corresponding to the audio control instruction, further comprising:
    通过所述Linux音频服务,确定所述音频控制指令对应的音频控制应用程序接口API,所述音频控制API用于访问Android音频服务。Through the Linux audio service, determine the audio control API corresponding to the audio control instruction, and the audio control API is used to access the Android audio service.
  3. 根据权利要求2所述的方法,其中,所述基于所述Linux音频服务,控制音频设备执行所述音频控制指令对应的操作,包括:The method according to claim 2, wherein the controlling the audio device to perform the operation corresponding to the audio control instruction based on the Linux audio service includes:
    通过音频插件,将所述音频控制API从所述Linux音频服务转发至所述Android音频服务;The audio control API is forwarded from the Linux audio service to the Android audio service through an audio plug-in;
    通过所述Android音频服务,控制音频设备执行所述音频控制指令对应的操作。Through the Android audio service, the audio device is controlled to perform the operation corresponding to the audio control instruction.
  4. 根据权利要求1所述的方法,其中,所述将所述音频设备的执行结果通过所述Linux音频服务返回至所述应用程序,包括:The method according to claim 1, wherein the returning the execution result of the audio device to the application program through the Linux audio service includes:
    将所述音频设备的执行结果返回至所述Android音频服务;Return the execution result of the audio device to the Android audio service;
    通过音频插件,将所述执行结果从所述Android音频服务转发至所述Linux音频服务;Through the audio plug-in, the execution result is forwarded from the Android audio service to the Linux audio service;
    将所述执行结果从所述Linux音频服务返回至所述应用程序。Returning the execution result from the Linux audio service to the application program.
  5. 根据权利要求1至4任一项所述的方法,所述通过Linux音频服务,接收所述Linux系统中应用程序发送的音频控制指令之前,还包括:According to the method according to any one of claims 1 to 4, before receiving the audio control instruction sent by the application program in the Linux system through the Linux audio service, it also includes:
    通过音频插件,读取Android侧的音频通路配置文件;Read the audio channel configuration file on the Android side through the audio plug-in;
    基于所述音频通路配置文件配置Linux音频服务。Configure the Linux audio service based on the audio path configuration file.
  6. 根据权利要求5所述的方法,所述通过音频插件,读取Android侧的音频通路配置文件之前,还包括:The method according to claim 5, before reading the audio channel configuration file on the Android side through the audio plug-in, it also includes:
    在所述Linux系统启动后,启动所述Linux音频服务,并加载所述音频插件。After the Linux system is started, start the Linux audio service and load the audio plug-in.
  7. 根据权利要求1至4任一项所述的方法,其中,所述Linux音频服务通过进程间通信通道与Android侧的Android音频服务进行通信。The method according to any one of claims 1 to 4, wherein the Linux audio service communicates with the Android audio service on the Android side through an inter-process communication channel.
  8. 一种基于Linux的音频控制装置,包括:A Linux-based audio control device comprising:
    接收模块,设置为通过Linux音频服务,接收所述Linux系统中应用程序发送的音频控制指令;The receiving module is configured to receive the audio control instruction sent by the application program in the Linux system through the Linux audio service;
    控制模块,设置为基于所述Linux音频服务,控制音频设备执行所述音频控制指令对应的操作,并将所述音频设备的执行结果通过所述Linux音频服务返回至所述应用程序;The control module is configured to control the audio device to execute the operation corresponding to the audio control instruction based on the Linux audio service, and return the execution result of the audio device to the application program through the Linux audio service;
    其中,所述Linux音频服务是基于Android侧的音频通路配置文件进行配置得到的。Wherein, the Linux audio service is configured based on the audio channel configuration file on the Android side.
  9. 一种电子设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述程序时实现如权利要求1至7任一项所述基于Linux的音频控制方法的步骤。An electronic device, comprising a memory, a processor, and a computer program stored on the memory and operable on the processor, when the processor executes the program, the computer program described in any one of claims 1 to 7 is implemented. Describe the steps of the Linux-based audio control method.
  10. 一种非暂态计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述基于Linux的音频控制方法的步骤。A non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the Linux-based audio control method according to any one of claims 1 to 7 are realized.
PCT/CN2022/104793 2021-12-29 2022-07-11 Linux-based audio control method and apparatus, device, and storage medium WO2023124002A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111628456.9 2021-12-29
CN202111628456.9A CN113990354B (en) 2021-12-29 2021-12-29 Audio control method, device, equipment and storage medium based on Linux

Publications (1)

Publication Number Publication Date
WO2023124002A1 true WO2023124002A1 (en) 2023-07-06

Family

ID=79734852

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/104793 WO2023124002A1 (en) 2021-12-29 2022-07-11 Linux-based audio control method and apparatus, device, and storage medium

Country Status (2)

Country Link
CN (1) CN113990354B (en)
WO (1) WO2023124002A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117176705A (en) * 2023-11-03 2023-12-05 成都阿加犀智能科技有限公司 Industrial camera video stream display method, device, equipment and medium

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113990354B (en) * 2021-12-29 2022-06-17 北京鲸鲮信息系统技术有限公司 Audio control method, device, equipment and storage medium based on Linux
CN114242105A (en) * 2022-02-24 2022-03-25 麒麟软件有限公司 Method and system for implementing recording and noise reduction on Android application
CN114879932B (en) * 2022-07-12 2022-09-02 北京麟卓信息科技有限公司 Android system audio output optimization method based on automatic switching of output modes

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130061141A1 (en) * 2009-01-14 2013-03-07 Gibby Media Group Optimizing playback of media content
CN108062237A (en) * 2017-11-23 2018-05-22 上海博泰悦臻电子设备制造有限公司 Compatibility method and system, the storage medium and car-mounted terminal of linux system and android system
US20190227765A1 (en) * 2018-01-19 2019-07-25 Microsoft Technology Licensing, Llc Processing digital audio using audio processing plug-ins executing in a distributed computing environment
CN110196707A (en) * 2019-04-23 2019-09-03 珠海全志科技股份有限公司 A kind of method, apparatus, system and program product acquiring reference signal
CN113821359A (en) * 2021-07-12 2021-12-21 北京鲸鲮信息系统技术有限公司 Audio-driven system compatible method, device and equipment
CN113835672A (en) * 2021-11-23 2021-12-24 北京鲸鲮信息系统技术有限公司 Linux-compatible Android audio control method, system and device
CN113990354A (en) * 2021-12-29 2022-01-28 北京鲸鲮信息系统技术有限公司 Audio control method, device, equipment and storage medium based on Linux

Family Cites Families (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8726294B2 (en) * 2010-10-01 2014-05-13 Z124 Cross-environment communication using application space API
US8495236B1 (en) * 2012-02-29 2013-07-23 ExXothermic, Inc. Interaction of user devices and servers in an environment
CN104333808B (en) * 2014-11-14 2017-10-10 复旦大学 For the universal player on Android and Linux smart television machine
CN104484181B (en) * 2014-12-23 2018-05-18 北京元心科技有限公司 The method, apparatus of Android camera and mobile equipment are controlled under glibc environment
CN106294147A (en) * 2016-08-09 2017-01-04 上海盈方微电子有限公司 A kind of adjustment method of linux operating system
CN108762815B (en) * 2018-05-16 2021-01-01 北京麟卓信息科技有限公司 Method for realizing Android running environment based on non-virtualization system architecture
KR20200042793A (en) * 2018-10-16 2020-04-24 삼성전자주식회사 Electronic device for executing a plurality of operating systems and controlling method thereof
CN109194698A (en) * 2018-11-01 2019-01-11 浩云科技股份有限公司 A kind of Real-time Video Processing System and method based on GStreamer frame
CN109669691B (en) * 2018-12-05 2022-05-13 思必驰科技股份有限公司 Platform general control method and system based on embedded Linux audio player
CN109947387B (en) * 2019-03-28 2022-10-21 阿波罗智联(北京)科技有限公司 Audio acquisition method, audio playing method, system, device and storage medium
CN111625293B (en) * 2020-05-15 2023-04-11 武汉蓝星科技股份有限公司 Terminal dual system based on linux kernel and hardware access management method thereof
CN111698489B (en) * 2020-06-22 2021-04-02 深圳市亿兆创新科技有限公司 Projection method and projection equipment based on Linux system
CN111930340B (en) * 2020-09-21 2021-06-01 北京技德系统技术有限公司 Virtual audio device and method based on Linux and Android compatible technology
CN112860364A (en) * 2021-02-07 2021-05-28 麒麟软件有限公司 Android graph display method based on Linux kernel
CN112988675B (en) * 2021-03-12 2023-02-21 麒麟软件有限公司 Linux file manager-based Android file classified display method
CN113157362B (en) * 2021-04-27 2022-09-06 麒麟软件有限公司 Android multi-window display method applied to Linux
CN113282271A (en) * 2021-07-22 2021-08-20 北京麟卓信息科技有限公司 Audio processing method and device for android application on Linux platform
CN113840271B (en) * 2021-09-27 2024-04-19 北京字节跳动网络技术有限公司 NFC data transmission method and device, electronic equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130061141A1 (en) * 2009-01-14 2013-03-07 Gibby Media Group Optimizing playback of media content
CN108062237A (en) * 2017-11-23 2018-05-22 上海博泰悦臻电子设备制造有限公司 Compatibility method and system, the storage medium and car-mounted terminal of linux system and android system
US20190227765A1 (en) * 2018-01-19 2019-07-25 Microsoft Technology Licensing, Llc Processing digital audio using audio processing plug-ins executing in a distributed computing environment
CN110196707A (en) * 2019-04-23 2019-09-03 珠海全志科技股份有限公司 A kind of method, apparatus, system and program product acquiring reference signal
CN113821359A (en) * 2021-07-12 2021-12-21 北京鲸鲮信息系统技术有限公司 Audio-driven system compatible method, device and equipment
CN113835672A (en) * 2021-11-23 2021-12-24 北京鲸鲮信息系统技术有限公司 Linux-compatible Android audio control method, system and device
CN113990354A (en) * 2021-12-29 2022-01-28 北京鲸鲮信息系统技术有限公司 Audio control method, device, equipment and storage medium based on Linux

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117176705A (en) * 2023-11-03 2023-12-05 成都阿加犀智能科技有限公司 Industrial camera video stream display method, device, equipment and medium
CN117176705B (en) * 2023-11-03 2024-01-26 成都阿加犀智能科技有限公司 Industrial camera video stream display method, device, equipment and medium

Also Published As

Publication number Publication date
CN113990354A (en) 2022-01-28
CN113990354B (en) 2022-06-17

Similar Documents

Publication Publication Date Title
WO2023124002A1 (en) Linux-based audio control method and apparatus, device, and storage medium
TWI476586B (en) Cloud-based test system, method and computer readable storage medium storing thereof
US8966499B2 (en) Virtual switch extensibility
US8635656B2 (en) Real-time video transmission system and method
CN110417641B (en) Method and equipment for sending session message
US10509758B1 (en) Emulated switch with hot-plugging
US9614931B2 (en) Identifying a resource set require for a requested application and launching the resource set in a container for execution in a host operating system
JP5957634B2 (en) Ordering multiple write commands associated with a storage device
US9843619B2 (en) System and method for accessing disk image files using HTML5 KVM/vmedia client running in a web browser
EP3197130B1 (en) Method, system and management system for constructing virtual non-volatile storage medium
WO2010115366A1 (en) Method, device and communication system for driving equipment
JP2005182798A5 (en)
CN105378646A (en) Multiple concurrent audio modes
US9892074B2 (en) System and method to support USB devices in an unsupported operating system in VDI environments
US10135954B2 (en) Access dock device content on a remote client device wirelessly
CN107526616B (en) Method and device for writing and reading data of BMC by host
WO2017177892A1 (en) Installation of operating system
US20170068462A1 (en) System and method to attach a local file system to a remote disk stack
WO2016070690A1 (en) Method, device and system for realizing communication between application and webpage on terminal device
US9483285B2 (en) Systems and methods of optimizing resources for emulation
CN105550046B (en) Virtual control method, device and system
US11231881B2 (en) Raid data storage device multi-step command coordination system
US9965431B2 (en) System and method to improve USB mass storage device arrival acceleration for redirected USB mass storage devices
WO2023116438A1 (en) Data access method and apparatus, and device
US20140325174A1 (en) Access control apparatus, access control method, and computer program product

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22913291

Country of ref document: EP

Kind code of ref document: A1