BRAW SDK: how to use IBlackmagicRawConstants

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

fnordware

  • Posts: 8
  • Joined: Wed Sep 02, 2020 5:22 pm
  • Real Name: Brendan Bolles

BRAW SDK: how to use IBlackmagicRawConstants

PostWed Sep 02, 2020 5:38 pm

The docs tell us to use IBlackmagicRawConstants to get ranges for the various parameters, but how do we actually get an IBlackmagicRawConstants object? I see it in the header, but don't see a way to get one out of IBlackmagicRawFactory or IBlackmagicRawClip or something.
Offline

Hendrik Proosa

  • Posts: 1389
  • Joined: Wed Aug 22, 2012 6:53 am
  • Location: Estonia

Re: BRAW SDK: how to use IBlackmagicRawConstants

PostWed Sep 02, 2020 9:17 pm

Basically something like this:
Code: Select all
HRESULT result = S_OK;
IBlackmagicRawConstants* constants;
result = codec->QueryInterface(IID_IBlackmagicRawConstants, (void**)&constants);

codec is of type IBlackmagicRaw* here.

And then you can query the constants object for ranges and stuff. This is a piece I use for reading ranges and value lists from attributes in my player project:
Code: Select all
 HRESULT BrawDecoder2::updateClipProcessingAttribute(BlackmagicRawClipProcessingAttribute sdkAttribute, BrawProcessingAttribute* attribute)
{
    VARIANT valueMin;
    VARIANT valueMax;
    HRESULT result = S_OK;
    BOOL isReadOnly;

    BSTR cameraType;
    clip->GetCameraType(&cameraType);

    // First try to get attribute range
    result = constants->GetClipProcessingAttributeRange(cameraType, sdkAttribute, &valueMin, &valueMax, &isReadOnly);
    if (result == S_OK)
    {
        attribute->updateValueRange(valueMin, valueMax, isReadOnly);
    }

    // If range query fails, attribute uses value list, so retrieve that
    if (result == E_INVALIDARG)
    {
        std::vector<VARIANT> variantList;
        UINT variantListLen;

        result = constants->GetClipProcessingAttributeList(cameraType, sdkAttribute, nullptr, &variantListLen, &isReadOnly);
        if (result == S_OK)
        {
            variantList.resize(variantListLen);
            result = constants->GetClipProcessingAttributeList(cameraType, sdkAttribute, &variantList[0], &variantListLen, &isReadOnly);
            if (result == S_OK)
                attribute->updateValueList(&variantList[0], variantListLen, isReadOnly);
        }
    }

    // Finally retrieve actual values
    processingAttrs->GetClipAttribute(sdkAttribute, &attribute->value);

    return S_OK;
}
I do stuff.
Offline

fnordware

  • Posts: 8
  • Joined: Wed Sep 02, 2020 5:22 pm
  • Real Name: Brendan Bolles

Re: BRAW SDK: how to use IBlackmagicRawConstants

PostThu Sep 03, 2020 9:04 pm

Yep, that did it. Thanks, Hendrik!

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 2 guests