Recently, I have often seen questions about switching tracks and channels on CSDN and DFW. Let's make a summary here. You can reprint it. Let the rookie make a profit! When reprinting, the author hopes to maintain the original information to the greatest extent!
1. What are sound (sound) tracks and sound channels?
In the early VCD era, a media file had only one audio track. Therefore, the term "sound track" is not often mentioned. The accompaniment or original singer in VCD media files can only be achieved by switching the left and right channels.
The audio track is the "product" that comes with the DVD. In a DVD (MPEG2 format) media file, a track is used to record a language (the "original" and "backing singing" commonly referred to in VOD).
2. How to switch audio tracks?
Here I recommend the "Morgan Stream Switcher" Filter.
The switching of audio tracks is generally done by using the Enable method in the IAMStreamSelect interface implemented on Filter.
example:
var
obj: IAMStreamSelect;
Begin
if Filter.QueryInterface(IID_IAMStreamSelect, obj) = S_OK then
Begin
obj.Enable(Index{Speed Track}, AMSTREAMSELECTENABLE_ENABLE);
obj := nil;
end;
end;
3. What if you switch the channel?
To switch channels, you need to obtain the IBasicAudio interface on the Audio Renderer Filter (tip: The IBasicAudio interface of the Shenlong card is obtained on the hardware decoder Filter).
Use the put_Balance method of this interface to switch channels.
Incoming value description: -10000 --- Right channel
10000 --- Left channel
0 --- Stereo
4. How to know the number of audio tracks in media files?
Generally speaking, File Source -> Splitter is required when playing media files.
Depending on Splitter Filter. The methods of obtaining are also different.
For example, there are some MPEG Splitters, and there are several audio tracks, and several Audio Output Pins will be created. In this case, you can get the number of Audio Output Pins on the Splitter Filter (that is, the number of audio tracks) and some MPEGs. The Splitter, no matter how many audio tracks there are, will only output an Audio Output Pin. In this case, the IAMStreamSelect interface has been implemented on the Splitter. Call the Count method on this interface to get the number of audio tracks.
5. Problems raised
After switching channels, only one speaker makes a sound. The "TBalncer Audio Channel Equalization Control" is recommended.
Author: CoolSlob
Email&MSN: [email protected]