Search code examples
c++enumsdirectshowdirectshow.net

Is this C++ [out] parameter a pointer to an enumeration, or just a single value?


Currently I'm working with DirectShow.NET, an unofficial .NET "port" for Microsoft's DirectShow (C++).

Both IAMAnalogVideoDecoder and IAMTVTuner declare the method get_AvailableVideoFormats. This is how the method is defined in the official docs:

HRESULT get_AvailableTVFormats(
  [out]  long *lAnalogVideoStandard
);

It's not clear to me if this parameter is a pointer to a single AnalogVideoStandard, or a enumeration. Unfortunatelly I'm too inexperienced with C++ to fully understand the docs. Because of the methods name, I would expect it to be a enumeration, but is it?

The reason I'm asking this, is because in the .NET library, this parameter is not a enumeration, just a single value. I find this very strange, since I'm expecting to get multiple "available video formats" here.


By the way, AnalogVideoStandard is an enum.


Solution

  • It's not clear to me if this parameter is a pointer to a single AnalogVideoStandard, or a enumeration.

    It's neither1:

    Pointer to a variable that receives a bitwise OR of zero or more flags from the AnalogVideoStandard enumeration.

    It's a pointer to a value that represents zero or more AnalogVideoStandards.

    This answer should explain the rest. You should be able to apply this answer to your .NET code.

    1 Technically it could be an enumeration value in C# because enum types can have a FlagsAttribute applied to them but there's no equivalent in C++, you just | values together with no special fanfare.