DirectShow User Guide

DirectShow User Guide

How to use DirectShow Applications with ON Semiconductor Cameras.

Introduction

In order to use DirectShow applications with ON Semiconductor cameras, it is necessary to use SW tools to first convert them to USB Video Class (UVC) devices.

Usage

To enable the use of a DirectShow application, the camera is temporarily converted to be a UVC device.

  • For Demo2X, please refer to the AVStream Switch User Guide for usage information. It will also provide information on how to install the AVStream driver.
  • For Demo3, please refer to the Flex Config User Guide for usage information. The standard Windows UVC driver is used, so no driver installation is required.

Note: The Demo2X platform is no longer manufactured, so most applications will be using the Demo3. It is included here only for completeness.

After the demo camera has been configured, it will appear as a UVC device, available for use by any DirectShow or other UVC-based application.

Supported Demoboards and Sensors

Supported sensors on Demo2X;

AS0260, ASX340, MT9D112, MT9M112, MT9M114, MT9P111, MT9V111, MT9V112, MT9V113, MT9V114, MT9V115, MT9V117, MT9V124.

Supported sensors on Demo3;

AS0260, ASX340, ASX370, MT9M114, MT9V114, MT9V115, MT9V117, MT9V124, MT9V128.
AP1302 and AP010x/AP20x are also supported when their configuration is sorted in on-board Flash.

DirectShow Applications

A sample program is available that demonstrates how to select ON Semiconductor's device as a DirectShow source filter and render its capture pin to show a preview window. It can be found at:

C:\Aptina Imaging\samples\DirectShowSample

The following is sample code showing how to find ON Semiconductor's device as a DirectShow filter. If for any reason you need to change the value of "FriendlyName" in your INF file, please replace "Aptina Camera" string in the following code with the string you are using in your own INF file.


ICreateDevEnum *pCreateDevEnum;
IEnumMoniker *pEM;
ULONG cFetched;
IMoniker *pM;
BOOL fFound = FALSE;
HRESULT hr;


if (FAILED(hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **) &pCreateDevEnum)))
   return;


hr = pCreateDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEM, 0);
pCreateDevEnum->Release();
if (FAILED(hr))
   return;


pEM->Reset();


while (hr = pEM->Next(1, &pM, &cFetched), hr == S_OK) {
   IPropertyBag *pBag;
   if (SUCCEEDED(hr = pM->BindToStorage(0, 0, IID_IPropertyBag, (void **) &pBag))) {
      VARIANT var;
      var.vt = VT_BSTR;
      if (SUCCEEDED(hr = pBag->Read(L"FriendlyName", &var, NULL))) {
         char achName[80];


         WideCharToMultiByte(CP_ACP, 0, var.bstrVal, -1, achName, 80, NULL, NULL);


         if (_strcmpi("Aptina Camera", achName) == 0) { 


            if (FAILED(hr = pM->BindToObject(0,0,IID_IBaseFilter,(void **) ppCap)) {
               *ppCap = NULL;
               return;
            }
            fFound = TRUE;
         }
         SysFreeString(var.bstrVal);
      }
      pBag->Release();
   }
   pM->Release();
   if (fFound)
      break;
}


pEM->Release();
return;

Related pages