Summary of the invention
The broadcast of two absolute coding audio files that the objective of the invention is to generate and the problem of control poor effect to existing once conversation; Invent a kind of multiple coded format is mixed and play the play handling method of the audio data file of the multiple coded format of mixing of unified displaying, unified control.
Technical scheme of the present invention is:
A kind of play handling method of mixing the audio data file of multiple coded format is characterized in that it may further comprise the steps:
At first, in the audio data file gatherer process, independently add audio coding mode and play code rate information in the audio file to two in advance, enable in broadcast, to be identified;
Secondly, before can playing, each item controlled variable is carried out initialization, and obtain the audio coding and broadcast code rate information of interpolation from audio file;
The 3rd, the interface that the process of playing is controlled is provided, supply external call, and the detailed process of voice playing is encapsulated in playout software inside;
The 4th; In playing process to two audio data files gathering audio mixing of decoding; Make two audio data files use left and right acoustic channels to play respectively, session operational scenarios that is virtually reality like reality is used independently decoding unit respectively to two audio data files in decode procedure; In the audio mixing process,, make the both direction audio frequency can play equal duration to the processing that unitizes of decoded data;
The 5th, the whole process that the decoding audio mixing is play adopt many memory shared with the transmission of carrying out data with synchronously.
The said interface that the process of playing is controlled comprises:
(1), the interface that begins to play is provided, can make file begin to be play;
(2), provide and play the interface stop, can stop in progress content, and restPose;
(3), the interface of quick broadcast is provided, broadcasting speed is accelerated, and played out all the elements;
(4), the interface that drags broadcast is provided, the optional position that can navigate to file begins to play;
(5), the interface of suspend playing and continuing to play is provided, can temporarily stop in progress content, and keep broadcast state, wait for the content before beginning when continuing to play to continue to play;
(6), the interface of positioning playing progress is provided, make the user can experience the ratio that play content accounts for full content;
Independently audio data file is in full accord to two in the control of once playing; Begin just to play and begin simultaneously; Just suspend and suspend simultaneously, F.F. is F.F. simultaneously just, stops just to stop simultaneously; Drag and just be dragged to the position that equates playout length apart from the starting position simultaneously, the positioning playing progress is to be that carry out on the basis with the maximum length that two files can be play.
Described two audio data files audio mixing of decoding is meant:
(1), system externally decodes to two audio data files interaction message notice broadcast beginning back;
(2), to the decoding of two audio data files according to coded message respectively piecemeal read the data in each file, and encoding format information and data to be decoded are delivered to each self-corresponding decoding unit, and after decoding is accomplished, output to each self-corresponding internal memory;
(3), audio mixing be with two independently two audio streams decoding of audio data file be integrated into the process of an audio stream of can left and right acoustic channels playing simultaneously; It reads isometric data respectively in order and carries out audio mixing from two decode memories, generate the WAV form PCM sign indicating number that supplies left and right acoustic channels to play simultaneously;
The voice data of a direction of (4), in the audio mixing process, reproduction time being lacked carries out necessary quiet data and replenishes; Make it to be consistent, but do not increase the sonorific interfering data of ability with the broadcast of reproduction time than the voice data of a long direction;
The data of two audio data files are independently decoded; The bottom decoding storehouse that the audio file of different coding adopts is different; Decoding is adopted different decoding processes in the storehouse, selects to call according to encoding format information, and the method for real-time reading of data real-time decoding is adopted in the decoding of data; Avoid once reading the too much internal memory of mass data consumption, decoded portion is that the voice data with coding is decoded into and unpressedly can directly be sent to the PCM sign indicating number that sound device is play.
The whole process that described decoding audio mixing is play adopts many memory shared to carry out the transmission of data and be meant synchronously:
(1), adopting the decoding audio mixing to play the multithreading that separates isolates each relatively independent part, guarantees that the mutual harmonious orderly of playing of whole process carries out, and improve maintainability and extensibility;
(2), the decoding audio mixing plays three parts and adopts the mode of shared drive to carry out synchronously, decoding is shared two internal memories with audio mixing, audio mixing and shared another piece internal memory of broadcast;
(3), decoded portion reads each file and corresponding internal memory is put in decoding, puts into and play shared memory block behind the audio mixing part audio mixing, plays the control of part according to the outside, from memory block, reads final data, is sent to broadcast; The shared drive piece is reusable, and does not completely have under the situation of remaining space at memory block, and the processing of last layer can be waited for, until there being memory headroom to be released out.
Beneficial effect of the present invention:
Utilize the displaying of method of the present invention, can be indifferent to inner realization, decoding storehouse and the coding that is adopted only need be provided the voice data that gets access at the network intermediate node in monitoring; Make the decoding of voice data simpler; Simultaneously, the process of audio mixing makes that the displaying of audio frequency can communication effect that is virtually reality like reality, and the voice data processing mode of multithreading shared drive makes that each stage of playing is separate; Improve processing performance, and made maintainability better.
The inventive method is simple, is easy to realize, in practical application, has portable preferably.
Embodiment
Below in conjunction with accompanying drawing and embodiment the present invention is further described.
Like Fig. 1,2, shown in 3.
A kind of play handling method of mixing the audio data file of multiple coded format, it may further comprise the steps:
At first, in the audio data file gatherer process, independently add audio coding mode and play code rate information in the audio file to two in advance, enable in broadcast, to be identified;
Secondly, before can playing, each item controlled variable is carried out initialization, and obtain the audio coding and broadcast code rate information of interpolation from audio file;
The 3rd, the interface that the process of playing is controlled is provided, supply external call, and the detailed process of voice playing is encapsulated in playout software inside;
The interface that the process of playing is controlled is meant:
(1), the interface that begins to play is provided, can make file begin to be play;
(2), provide and play the interface stop, can stop in progress content, and restPose;
(3), the interface of quick broadcast is provided, broadcasting speed is accelerated, and played out all the elements;
(4), the interface that drags broadcast is provided, the optional position that can navigate to file begins to play;
(5), the interface of suspend playing and continuing to play is provided, can temporarily stop in progress content, and keep broadcast state, wait for the content before beginning when continuing to play to continue to play;
(6), the interface of positioning playing progress is provided, make the user can experience the ratio that play content accounts for full content;
Independently audio file is in full accord to two in the control of once playing; Begin just to play and begin simultaneously; Just suspend and suspend simultaneously, F.F. is F.F. simultaneously just, stops just to stop simultaneously; Drag and just be dragged to the position that equates playout length apart from the starting position simultaneously, the positioning playing progress is to be that carry out on the basis with the maximum length that two files can be play.
The 4th; In playing process to two audio data files gathering audio mixing of decoding; Make two audio data files use left and right acoustic channels to play respectively, session operational scenarios that is virtually reality like reality is used independently decoding unit respectively to two audio data files in decode procedure; In the audio mixing process,, make the both direction audio frequency can play equal duration to the processing that unitizes of decoded data;
The decoding audio mixing is meant:
(1), system externally decodes to two audio files interaction message notice broadcast beginning back;
(2), the decoding of two audio files is carried out based on coded message; Piecemeal is read the data in each file respectively; And encoding format information and data to be decoded delivered to each self-corresponding decoding unit, and, decoding outputs to each self-corresponding internal memory after accomplishing;
(3), audio mixing is the process that two audio streams that two unique files decode is integrated into an audio stream of can left and right acoustic channels playing simultaneously; It reads isometric data respectively in order and carries out audio mixing from two decode memories, generate the WAV form PCM sign indicating number that supplies left and right acoustic channels to play simultaneously;
The voice data of a direction of (4), in the audio mixing process, reproduction time being lacked carries out necessary quiet data and replenishes; Make it to be consistent, but do not increase the sonorific interfering data of ability with the broadcast of reproduction time than the voice data of a long direction;
The data of two files are independently decoded; The bottom decoding storehouse that the audio file of different coding adopts is different; Decoding is adopted different decoding processes in the storehouse, selects to call according to encoding format information, and the method for real-time reading of data real-time decoding is adopted in the decoding of data; Avoided once reading the too much internal memory of mass data consumption, decoded portion is that the voice data with coding is decoded into and unpressedly can directly be sent to the PCM sign indicating number that sound device is play.
The 5th, the whole process that the decoding audio mixing is play adopt many memory shared with the transmission of carrying out data with synchronously;
(1), adopt the decoding audio mixing to play the multithreading that separates, isolate each relatively independent part, guarantee that the mutual harmonious orderly of playing of whole process carries out, and improve maintainability and extensibility;
(2), the decoding audio mixing plays three parts and adopts the mode of shared drive to carry out synchronously, decoding is shared two internal memories with audio mixing, audio mixing and shared another piece internal memory of broadcast;
(3), decoded portion reads each file and corresponding internal memory is put in decoding, puts into and play shared memory block behind the audio mixing part audio mixing, plays the control of part according to the outside, from memory block, reads final data, is sent to broadcast.The shared drive piece is reusable, and does not completely have under the situation of remaining space at memory block, and the processing of last layer can be waited for, until there being memory headroom to be released out.
Therefore; The audio data file play handling method of the multiple coded format of mixing that the present invention proposes is utilized sharing of many internal memories; Separate the decoding audio mixing and play three parts, the audio data file of two absolute codings is decoded into the PCM sign indicating number according to information encoded separately, carry out audio mixing then; Form the data that finally can play, can control the external presentation form of its broadcast arbitrarily by outside interactive action.Can support multiple different audio coding form, and can expand.It is synchronous fully to have guaranteed that a plurality of files are play.
Can realize above-mentioned steps through the foundation of following four modules during concrete the operation:
A, Audio Processing initialization module; From two audio data files, obtain coded audio data code check and file layout respectively, the data block size that at every turn from each file, reads is set, and according to all kinds of parameters of the data initialization that reads; Comprise the memory allocated space; And file content surveyed, estimate playing duration, judge whether file is legal.And each item content all after the initialization success with the set of initialization success mark.
B, audio file decoder module according to the file essential information that gets access in the initialization, read a blocks of data respectively from two files, decode according to corresponding coded format separately; Decoded result is delivered in each self-corresponding output internal memory, and it selects decoding interface automatically according to the coding that indicates in the file, does not need foreign intervention; Two output internal memories are loop configuration, a head mark are arranged, the starting position that designation data has been stored; A trailer label, the end position of data has been stored in indication, and the two overlaps expression does not have data; Trailer label is in the adjacent last position of head mark, and the expression memory block is full, needs to wait for the release of data space.
C, audio mixing module, as input, as outgoing position, as follows two-way being imported that audio mixing becomes can be by the data of left and right acoustic channels form broadcast with an other memory block with the output of the two-way of audio file decoder module:
If the input of c1 two-way all has data, reading of data is carried out audio mixing from the two-way input respectively;
If c2 has only one tunnel input that data are arranged, think that then the input of another road still has data, but carry out audio mixing for complete 0 quiet PCM code data;
If c3 output memory headroom is full, then wait for the release of internal memory;
C4, output internal memory are loop configuration still, have and the similar use-pattern of decoding output internal memory;
D, broadcast and control interface module; Play thread and from the input of audio mixing module, fetch data, be sent to sound device, the Play Control interface is controlled the thread that starts in playing; Start all thread entry into service total systems when beginning to play; Drag the notice decoder module and begin decoding from ad-hoc location, Play Control audio playing device acceleration broadcast fast suspends and continues to play and notifies the broadcast thread temporarily to stop to import data with continuing to playback equipment to playback equipment input data.
Details are as follows:
A kind of audio data file play handling method of mixing multiple coded format, it comprises decoding, the process of audio mixing and broadcast:
The decode procedure of one of them audio file is as shown in Figure 1, and a pair of file moves this decode procedure respectively, and it may further comprise the steps:
Step 101 is obtained initialized filename;
Step 102 reads file content, judges whether file content is legal, and whether form meets the requirements;
Step 103 is obtained the information encoded that audio frequency adopts from file content;
Step 104 is obtained sampling rate information from file content;
Step 105 is provided with the basic parameter that need use in the broadcast;
Whether step 106 judges audio file all decoding completion;
Step 107 if all accomplished decoding, is then put this direction completion decoding and is labeled as 1, and waits for that the data file decoding of another direction finishes, and both direction is all decoded and can be withdrawed from when finishing;
Step 108, if also do not accomplish decoding, judging whether to export in addition internal memory can use, the output internal memory partly uses the back to discharge by audio mixing;
Step 109, if there is not available output internal memory, the audio mixing section processes of then the waiting for Fig. 2 releasing memory that finishes;
Step 110 can be used if export internal memory in addition, then from file, reads a blocks of data;
Step 111, the coded message that the data block that reads and step 103 are read is delivered to decoding interface and is decoded;
Step 112, the PCM sign indicating number that obtains after the decoding is stored in the internal memory of correspondence, supplies the audio mixing of Fig. 2 to use, and whole process finishes until decoding by above-mentioned steps 106 to 112 circulations;
The audio mixing process is as shown in Figure 2, and it may further comprise the steps:
Step 201 judges that two files all have decoding output;
Step 202 all has decoding output if not two files, has judged whether that then a file has decoding output;
Step 203 if two files all have decoding output, then respectively reads two bits from two decoding outputs;
Step 204 is put into audio mixing output to the data merging of reading;
Step 205 if a file has output, then reads two bits from this decoding output;
Step 206 finds out 0 with the decoding output of another file, merges with the data of reading, and puts into audio mixing output:
Step 207 if two files all have decoding output, is judged whether file has all decoded to finish;
Step 208 is labeled as 1 if all decoded to finish and do not have decoding output then put the audio mixing completion;
Playing process is as shown in Figure 3, and it may further comprise the steps:
Step 301 judges whether to finish, if finish then execution in step 307, does not finish then execution in step 302;
Step 302 has judged whether that audio mixing output can supply to play;
Step 303 if audio mixing output is arranged, then judges whether to continue to play;
Step 304 if can continue to play, then reads one piece of data;
Step 305 is delivered to sound device with data and is play;
Step 306, if do not have audio mixing output or can not continue to play then wait:
Step 307 if finish, then need be put the mark that finishes playing;
The present invention does not relate to all identical with the prior art prior art that maybe can adopt of part and realizes.