Re: Replace default audio renderer in Dshow video Graph ? C++
- From: "The March Hare [MVP]" <phil@xxxxxxxxx>
- Date: Sun, 15 May 2005 13:16:50 -0600
On Sun, 15 May 2005 20:48:44 +0200, Gaël Rosset wrote:
> I need to replace the audio renderer in a Dshow graph running on a video
> file.
>
> I first use :
>
> pGraph->RenderFile(UnicodeString, NULL);
>
> which will build the graph automatically since this is decode only and
> used on known types (.avi,.mpg) but I would like to be able to choose
> the audio renderer since the PC my program is running on has more than
> one sound card.
>
> How can I then simply (in c++) replace just the audio renderer in the
> graph ?
You need to enumerate the available audio devices as described in the quote
below and create an instance of the one you want to use (see the "Audio
Renderer (WaveOut) Filter" topic in the SDK help to review its limitations
compared with the DirectSound version).
Approach 1: You can use intelligent connect to build your graph which will
use the Default DirectSound Device (see quote below). Then you can remove
the default audio filter from the graph by disconnecting its input pin and
removing it from the graph.
Approach 2: Build your graph manually.
There are helper functions in the samples and baseclasses for disconnecting
and connecting filters.
>From the docs for DirectSound Renderer Filter:
This filter acts as a wrapper for an audio device. To enumerate the audio
devices available on the user's system, use the ICreateDevEnum interface
with the audio renderer category (CLSID_AudioRendererCategory). For each
audio device, the audio renderer category contains two filter instances.
One of these corresponds to the DirectSound Renderer, and the other
corresponds to the Audio Renderer (WaveOut) filter. The DirectSound
instance has the friendly name "DirectSound: DeviceName," where DeviceName
is the name of the device. The WaveOut instance has the friendly name
DeviceName.
The audio renderer category contains two additional filter instances, named
"Default DirectSound Device" and "Default WaveOut Device." These correspond
to the default sound device, as chosen by the user through the Control
Panel. They are actually mappings to one of the pairs described in the
previous paragraph. For example, if the system has two audio devices,
Device A and Device B, the audio renderer category will contain the
following:
Device A
DirectSound: Device A
Device B
DirectSound: Device B
Default DirectSound Device
Default WaveOut Device
If the user selected Device A as the default device, then "Default
DirectSound Device" is equivalent to "DirectSound: Device A," and "Default
WaveOut Device" is equivalent to "Device A." If the user selects Device B
as the default device, these mappings will change.
"Default DirectSound Device" is assigned a merit of MERIT_PREFERRED. The
others have merit MERIT_DO_NOT_USE. Therefore, Intelligent Connect will
always choose the default DirectSound device.
--
Please read this before replying:
1. Dshow & posting help: http://tmhare.mvps.org/help.htm
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others: follow up if you are helped or you found a solution
.
- Follow-Ups:
- Re: Replace default audio renderer in Dshow video Graph ? C++
- From: Alessandro Angeli [MVP::DigitalMedia]
- Re: Replace default audio renderer in Dshow video Graph ? C++
- Prev by Date: Twinhan MagicBox
- Next by Date: Source of the NullRenderer
- Previous by thread: Twinhan MagicBox
- Next by thread: Re: Replace default audio renderer in Dshow video Graph ? C++
- Index(es):
Relevant Pages
|