September 07, 2008

How to get the string from GUID in DirectShow?

There is a very useful global array that contains strings representing the GUIDs defined in Uuids.h

char* GuidNames[guid]

Example:
const char* GetMajorTypeString(CMediaType* pMediaType)
{
  return GuidNames[*(pMediaType->Type())];
}

Reference:
http://msdn.microsoft.com/en-us/library/ms783758.aspx