By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,825 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

Variant to String. VideoCodec - Friendly name in DirectShow

P: n/a
Hi all!
I'm trying to write a console application which allows me to write out
all installed video-codecs.

I tried this one:
The code is at the end of this post.

My question is how do i get the friendly name (human readable) to the
console. VarName only delivers some codes.

following headers are used:
#include <iostream>
#include <tchar.h>
#include <dshow.h>
#include <cstring>

using namespace std;

#pragma comment(lib,"strmiids.lib")

THNX 4 any advice. MM


This is the code:
// Create the System Device Enumerator.
ICreateDevEnum *pSysDevEnum = NULL;
hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,
IID_ICreateDevEnum, (void **)&pSysDevEnum);
if (FAILED(hr))
return hr;

// Obtain a class enumerator for the video compressor category.
IEnumMoniker *pEnumCat = NULL;
hr = pSysDevEnum->CreateClassEnumerator(CLSID_VideoCompressorCatego ry,
&pEnumCat, 0);

if (hr == S_OK)
// Enumerate the monikers.
IMoniker *pMoniker = NULL;
ULONG cFetched;
while(pEnumCat->Next(1, &pMoniker, &cFetched) == S_OK)
IPropertyBag *pPropBag;
hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag,
(void **)&pPropBag);
if (SUCCEEDED(hr))
// To retrieve the filter's friendly name, do the following:
VARIANT varName;
hr = pPropBag->Read(L"FriendlyName", &varName, 0);
if (SUCCEEDED(hr))
// Display the name in your UI somehow.

// To create an instance of the filter, do the following:
IBaseFilter *pFilter;
hr = pMoniker->BindToObject(NULL, NULL, IID_IBaseFilter,
// Now add the filter to the graph.
//Remember to release pFilter later.
Sep 17 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.