Group:  English: Entertainment ยป microsoft.public.windowsmedia.sdk
Thread: WMEncoder - detecting devices

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

WMEncoder - detecting devices
csharpDeveloper 05.07.2007 10:32:04
Dear Sirs,

I tried to run a sample code of the SDK but the program detect nothings. If
I used the windows media encder then it detect my Hauppauge card. Can you
help me please. Thanks.

Here's the codes:
....
// Create a WMEncoder object.
WMEncoder Encoder = new WMEncoder();

// Retrieve source and device plug-in info manager objects
from WMEncoder.
IWMEncSourcePluginInfoManager SrcPlugMgr =
Encoder.SourcePluginInfoManager;
IWMEncDeviceControlPluginInfoManager DCPlugMgr =
Encoder.DeviceControlPluginInfoManager;
// Loop through all the audio and video devices on the system.
IWMEncPluginInfo PlugInfo;
for (int i = 0; i < SrcPlugMgr.Count; i++)
{
// Set the IWMEncPluginInfo object to the current plug-in.
PlugInfo = SrcPlugMgr.Item(i);

// Find the device plug-ins that support resources.
if (PlugInfo.SchemeType == "DEVICE" &&
PlugInfo.Resources == true)
{
// Loop through the resources in the current plug-in.
for (int j = 0; j < PlugInfo.Count; j++)
{
// Add audio resources to the cboAudioSource
combo box.
if (PlugInfo.MediaType ==
WMENC_SOURCE_TYPE.WMENC_AUDIO) cboAudioSource.Items.Add(PlugInfo.Item(j));

// Add video resources to the cboVideoSource
combo box.
if (PlugInfo.MediaType ==
WMENC_SOURCE_TYPE.WMENC_VIDEO) cboVideoSource.Items.Add(PlugInfo.Item(j));

}
}
}

// This section shows how to enumerate digital devices such
as DV cameras and VTRs.
// Loop through the connected digital devices on the system.
for (int i = 0; i < DCPlugMgr.Count; i++)
{
// Set the IWMEncPluginInfo object to the current plug-in.
PlugInfo = DCPlugMgr.Item(i);

// Loop through the resources in the current plug-in
// and add them to the cboDevices combo box.
if (PlugInfo.SchemeType == "DeviceControl" &&
PlugInfo.Resources == true)
{
for (int j = 0; j < PlugInfo.Count; j++)
cboDevice.Items.Add(PlugInfo.Item(j));
}
}
}

catch (Exception ex)
{
// TODO: Handle exceptions.
}

--
Regards
csharpDeveloper
RE: WMEncoder - detecting devices
KBoek 05.07.2007 12:44:02
Hi!

Check if your Hauppage card works with WMEncoder (you can simply run the
WMEncoder application to see if you can use the card as an input). If it
works, then see if the SrcPlugMgr has actually items in it, so that
SrcPlugMgr.Count > 0

Furthermore I'd use some kind of debugging to:
- Check the PlugInfo.SchemeType
- see if PlugInfo.Resources = true
- Check the PlugInfo.MediaType

regards,
Karel

"csharpDeveloper" wrote:

[Quoted Text]
> Dear Sirs,
>
> I tried to run a sample code of the SDK but the program detect nothings. If
> I used the windows media encder then it detect my Hauppauge card. Can you
> help me please. Thanks.
>
> Here's the codes:
> ...
> // Create a WMEncoder object.
> WMEncoder Encoder = new WMEncoder();
>
> // Retrieve source and device plug-in info manager objects
> from WMEncoder.
> IWMEncSourcePluginInfoManager SrcPlugMgr =
> Encoder.SourcePluginInfoManager;
> IWMEncDeviceControlPluginInfoManager DCPlugMgr =
> Encoder.DeviceControlPluginInfoManager;
> // Loop through all the audio and video devices on the system.
> IWMEncPluginInfo PlugInfo;
> for (int i = 0; i < SrcPlugMgr.Count; i++)
> {
> // Set the IWMEncPluginInfo object to the current plug-in.
> PlugInfo = SrcPlugMgr.Item(i);
>
> // Find the device plug-ins that support resources.
> if (PlugInfo.SchemeType == "DEVICE" &&
> PlugInfo.Resources == true)
> {
> // Loop through the resources in the current plug-in.
> for (int j = 0; j < PlugInfo.Count; j++)
> {
> // Add audio resources to the cboAudioSource
> combo box.
> if (PlugInfo.MediaType ==
> WMENC_SOURCE_TYPE.WMENC_AUDIO) cboAudioSource.Items.Add(PlugInfo.Item(j));
>
> // Add video resources to the cboVideoSource
> combo box.
> if (PlugInfo.MediaType ==
> WMENC_SOURCE_TYPE.WMENC_VIDEO) cboVideoSource.Items.Add(PlugInfo.Item(j));
>
> }
> }
> }
>
> // This section shows how to enumerate digital devices such
> as DV cameras and VTRs.
> // Loop through the connected digital devices on the system.
> for (int i = 0; i < DCPlugMgr.Count; i++)
> {
> // Set the IWMEncPluginInfo object to the current plug-in.
> PlugInfo = DCPlugMgr.Item(i);
>
> // Loop through the resources in the current plug-in
> // and add them to the cboDevices combo box.
> if (PlugInfo.SchemeType == "DeviceControl" &&
> PlugInfo.Resources == true)
> {
> for (int j = 0; j < PlugInfo.Count; j++)
> cboDevice.Items.Add(PlugInfo.Item(j));
> }
> }
> }
>
> catch (Exception ex)
> {
> // TODO: Handle exceptions.
> }
>
> --
> Regards
> csharpDeveloper
RE: WMEncoder - detecting devices
csharpDeveloper 05.07.2007 14:24:05
Hi,

thanks for reply.

I've checked allready. I can encode some of the Hauppauge card with the
Encoder application. And in debugging mode I can see the properties and
collection of SrcPlugMgr, DCPlugMgr and PlugInfo but there was nothings of
Hauppauge :(. Any Ideas more?

--
Regards
csharpDeveloper


"KBoek" wrote:

[Quoted Text]
> Hi!
>
> Check if your Hauppage card works with WMEncoder (you can simply run the
> WMEncoder application to see if you can use the card as an input). If it
> works, then see if the SrcPlugMgr has actually items in it, so that
> SrcPlugMgr.Count > 0
>
> Furthermore I'd use some kind of debugging to:
> - Check the PlugInfo.SchemeType
> - see if PlugInfo.Resources = true
> - Check the PlugInfo.MediaType
>
> regards,
> Karel

RE: WMEncoder - detecting devices
KBoek 05.07.2007 16:02:03
If your SrcPlugMgr has some PlugInfo items in it, then the name of these
should start with "DEVICE". Those items can be used with the WM Encoder.

If you have more questions, drop me an email (kboek[ at ]hotmail.com) and I can
try to help you out. You might also be interested in my encoder products that
perform Windows Media encoding (Masaro, see www.raskenlund.com)

"csharpDeveloper" wrote:

[Quoted Text]
> Hi,
>
> thanks for reply.
>
> I've checked allready. I can encode some of the Hauppauge card with the
> Encoder application. And in debugging mode I can see the properties and
> collection of SrcPlugMgr, DCPlugMgr and PlugInfo but there was nothings of
> Hauppauge :(. Any Ideas more?
>
> --
> Regards
> csharpDeveloper
>
>
> "KBoek" wrote:
>
> > Hi!
> >
> > Check if your Hauppage card works with WMEncoder (you can simply run the
> > WMEncoder application to see if you can use the card as an input). If it
> > works, then see if the SrcPlugMgr has actually items in it, so that
> > SrcPlugMgr.Count > 0
> >
> > Furthermore I'd use some kind of debugging to:
> > - Check the PlugInfo.SchemeType
> > - see if PlugInfo.Resources = true
> > - Check the PlugInfo.MediaType
> >
> > regards,
> > Karel
>
RE: WMEncoder - detecting devices
csharpDeveloper 06.07.2007 10:00:01
The problem is that there was no item found in the collection, but the
WMEncoder application found some

--
Regards
csharpDeveloper


"KBoek" wrote:

[Quoted Text]
> If your SrcPlugMgr has some PlugInfo items in it, then the name of these
> should start with "DEVICE". Those items can be used with the WM Encoder.
>
> If you have more questions, drop me an email (kboek[ at ]hotmail.com) and I can
> try to help you out. You might also be interested in my encoder products that
> perform Windows Media encoding (Masaro, see www.raskenlund.com)
>

RE: WMEncoder - detecting devices
KBoek 06.07.2007 10:32:03
I created a C# console application in Visual Studio 2005 and added the
following code to program.cs - in the static void Main(). This code worked
fine and showed me the audio and video devices I had on my system:

// Create a WMEncoder object.
WMEncoder Encoder = new WMEncoder();

// Retrieve source and device plug-in info manager objects from WMEncoder.
IWMEncSourcePluginInfoManager SrcPlugMgr =
Encoder.SourcePluginInfoManager;
IWMEncDeviceControlPluginInfoManager DCPlugMgr =
Encoder.DeviceControlPluginInfoManager;

// Loop through all the audio and video devices on the system.
IWMEncPluginInfo PlugInfo;

for (int i = 0; i < SrcPlugMgr.Count; i++)
{
// Set the IWMEncPluginInfo object to the current plug-in.
PlugInfo = SrcPlugMgr.Item(i);

// Find the device plug-ins that support resources.
if (PlugInfo.SchemeType == "DEVICE" && PlugInfo.Resources == true)
{
// Loop through the resources in the current plug-in.
for (int j = 0; j < PlugInfo.Count; j++)
{
// Add audio resources to the cboAudioSource combo box.
Console.WriteLine("Found audio device: " + PlugInfo.Item(j));

// Add video resources to the cboVideoSource combo box.
Console.WriteLine("Found audio device: " + PlugInfo.Item(j));
}
}
}

// This section shows how to enumerate digital devices such as DV cameras
and VTRs.
// Loop through the connected digital devices on the system.
for (int i = 0; i < DCPlugMgr.Count; i++)
{
// Set the IWMEncPluginInfo object to the current plug-in.
PlugInfo = DCPlugMgr.Item(i);

// Loop through the resources in the current plug-in and add them to the
cboDevices combo box.
if (PlugInfo.SchemeType == "DeviceControl" && PlugInfo.Resources == true)
{
for (int j = 0; j < PlugInfo.Count; j++)
{
Console.WriteLine("Found control device: " + PlugInfo.Item(j));
}
}
}

Console.WriteLine("Press any key to continue...");
Console.ReadLine();

RE: WMEncoder - detecting devices
csharpDeveloper 09.07.2007 11:40:02
Hi,

now I found the error :-)

I was searching for video device by comparing with
WMENC_SOURCE_TYPE.WMENC_VIDEO but it's wrong. Because
WMENC_SOURCE_TYPE.WMENC_VIDEO = 2 but the device I'm looking for is of type
6. Now I checked by

if (PlugInfo.MediaType == (WMENC_SOURCE_TYPE)6 || PlugInfo.MediaType ==
WMENC_SOURCE_TYPE.WMENC_VIDEO)

and I've now theo right one.

Thanks for your help.

--
Regards
csharpDeveloper


"KBoek" wrote:

[Quoted Text]
> I created a C# console application in Visual Studio 2005 and added the
> following code to program.cs - in the static void Main(). This code worked
> fine and showed me the audio and video devices I had on my system:
>
> // Create a WMEncoder object.
> WMEncoder Encoder = new WMEncoder();
>
> // Retrieve source and device plug-in info manager objects from WMEncoder.
> IWMEncSourcePluginInfoManager SrcPlugMgr =
> Encoder.SourcePluginInfoManager;
> IWMEncDeviceControlPluginInfoManager DCPlugMgr =
> Encoder.DeviceControlPluginInfoManager;
>
> // Loop through all the audio and video devices on the system.
> IWMEncPluginInfo PlugInfo;
>
> for (int i = 0; i < SrcPlugMgr.Count; i++)
> {
> // Set the IWMEncPluginInfo object to the current plug-in.
> PlugInfo = SrcPlugMgr.Item(i);
>
> // Find the device plug-ins that support resources.
> if (PlugInfo.SchemeType == "DEVICE" && PlugInfo.Resources == true)
> {
> // Loop through the resources in the current plug-in.
> for (int j = 0; j < PlugInfo.Count; j++)
> {
> // Add audio resources to the cboAudioSource combo box.
> Console.WriteLine("Found audio device: " + PlugInfo.Item(j));
>
> // Add video resources to the cboVideoSource combo box.
> Console.WriteLine("Found audio device: " + PlugInfo.Item(j));
> }
> }
> }
>
> // This section shows how to enumerate digital devices such as DV cameras
> and VTRs.
> // Loop through the connected digital devices on the system.
> for (int i = 0; i < DCPlugMgr.Count; i++)
> {
> // Set the IWMEncPluginInfo object to the current plug-in.
> PlugInfo = DCPlugMgr.Item(i);
>
> // Loop through the resources in the current plug-in and add them to the
> cboDevices combo box.
> if (PlugInfo.SchemeType == "DeviceControl" && PlugInfo.Resources == true)
> {
> for (int j = 0; j < PlugInfo.Count; j++)
> {
> Console.WriteLine("Found control device: " + PlugInfo.Item(j));
> }
> }
> }
>
> Console.WriteLine("Press any key to continue...");
> Console.ReadLine();
>

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net