locked
Setting brightness ks property issue

    Question

  • Hi,

    I am trying to set camera brightness through KS property method. Here is the code snippet:

    HRESULT hr = S_OK;
    KSPROPERTY ksprop;   
    ZeroMemory(&ksprop, sizeof(ksprop));
    PVOID pData = NULL;
    ULONG valueSize = 0;
    ULONG dataLength = 0;

    KSPROPERTY_VIDEOPROCAMP_S procAmpValue;
    ZeroMemory(&procAmpValue, sizeof(procAmpValue));

    ksprop.Set = PROPSETID_VIDCAP_VIDEOPROCAMP;
    ksprop.Id = KSPROPERTY_VIDEOPROCAMP_BRIGHTNESS;
    ksprop.Flags = KSPROPERTY_TYPE_SET;

    procAmpValue.Property = ksprop;
    procAmpValue.Flags = KSPROPERTY_VIDEOPROCAMP_FLAGS_MANUAL;
    procAmpValue.Capabilities = KSPROPERTY_VIDEOPROCAMP_FLAGS_MANUAL;
    procAmpValue.Value = Value1.intVal;
    pData = &procAmpValue;
    dataLength = sizeof(procAmpValue);

    hr = m_pCamSourceIKSCtrl->KsProperty(
                &ksprop, sizeof(ksprop),
                pData, dataLength, &valueSize);

    As a result the following is returned:

    hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) : The data area passed to a system call is too small.             

     Can anyone point where the issue is?

    Monday, March 26, 2012 11:35 PM

All replies

  • Hi - I'm working on this. I'll update you when I know more.
       
    Mark Stanley - Microsoft Escalation Engineer - Forum Moderator
    Wednesday, March 28, 2012 9:40 PM
    Moderator
  • Thank you Mark.

    Please let me know if you need more details related to the implementation.

    Wednesday, March 28, 2012 10:21 PM
  • Thank you, while i research it could be very helpful if you attach a small sample project of the failure to this thread. Do you get the same problem with other cameras? thanks - Mark
    Wednesday, March 28, 2012 10:28 PM
    Moderator
  • I do not see the way to attach the whole project through this reply form (link, HTML and code block). I could still bring over pieces of code that are related to this call flow.

    I am having the issue with USB camera. Getting or setting KS property is returned with the same error as indicated above.

    • Edited by batam2601 Thursday, March 29, 2012 4:50 PM
    Thursday, March 29, 2012 12:31 AM
  • Hi,

    I think I may have mistakenly assumed that you are trying to do this from a Metro style app.

    Could you please confirm if you are developing a Metro style app?

    Mark Stanley - Microsoft Escalation Engineer - Forum Moderator

    Saturday, April 7, 2012 1:13 AM
    Moderator
  • I am developing Metro App that communicates with a driver through WinRT interface. The portion of a code, provided above, belongs to WinRT implementation.

     
    Saturday, April 7, 2012 9:46 PM
  • I am writing a desktop program and get the same error of HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) using IKsControl->KsProperty

    The following is my code:

     

    HRESULT hr = S_OK;
    IMFMediaSource  *pSource = NULL;

    // Create the media source for the device.
    if (SUCCEEDED(hr))
        hr = pActivate->ActivateObject(__uuidof(IMFMediaSource),(void**)&pSource);

    IKsControl *pKsctl;
    hr = pSource->QueryInterface(IID_IKsControl, (void **)&pKsctl);

    LONG RetValue = 0;
    ULONG RetCount = 0;
    KSPROPERTY_VIDEOPROCAMP_S Property;

    Property.Property.Set = PROPSETID_VIDCAP_VIDEOPROCAMP;
    Property.Property.Id = KSPROPERTY_VIDEOPROCAMP_BRIGHTNESS;
    Property.Property.Flags = KSPROPERTY_TYPE_GET;
    Property.Value = 0;
    Property.Flags = 0;
    Property.Capabilities = 0;

    NTSTATUS  ntret = 0;

    PKSPROPERTY pbuf = (PKSPROPERTY) &Property;
    ULONG bufsize = sizeof(KSPROPERTY_VIDEOPROCAMP_S);
    ntret = pKsctl->KsProperty(pbuf,
            bufsize,
            NULL,
            0,
            &RetCount);  

    The ntret should return HRESULT_FROM_WIN32(ERROR_MORE_DATA) but instead it returns

    HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)

    Monday, January 7, 2013 12:18 PM
  • Any luck on this....I am facing the same problem.

    Chris V R

    Wednesday, April 3, 2013 11:54 AM
  • how to include IKsControl interface definition in Metro Style Application(C++)
    Wednesday, May 8, 2013 6:15 AM