none
Microsoft Network Provider doesn't accept IATSCTunningSpace

    Question

  • Hi, I'm trying to get my TV tuner card working on my Windows 2012R2 server, following this article on MSDN, https://msdn.microsoft.com/en-us/library/windows/desktop/dd695268(v=vs.85).aspx

    I created the generic Microsoft Network Provider BDA filter and it connects with my TV card fine. But I can't get the provider filter to accept a tunning space, nor can I send a tune request on it. Could you let me know what I'm doing wrong? 

    thanks!

    David

    // Create Microsoft Network Provider
    BOOL CreateNetworkProvider()
    {
    HRESULT hr = S_OK;
    hr = CoCreateInstance(CLSID_NetworkProvider, NULL, CLSCTX_INPROC_SERVER,
    IID_IBaseFilter, (void**)&gcap.pNetworkProvider);
    if (FAILED(hr))
    {
    ErrMsg(TEXT("Error %x: Cannot create Microsoft Network Provider"), hr);
    return FALSE;
    }

    return TRUE;
    }

    // Create ATSC TuningSpace
    BOOL CreateATSCTuningSpace()
    {
    HRESULT hr = S_OK;
    SmartPtr<IEnumTuningSpaces> pTuningSpaceEnum;
    SmartPtr<ITuningSpace> pTuningSpace;
    SmartPtr<ITuner> pTuner;
    SmartPtr<IATSCLocator> pATSCLocator;
    SmartPtr<IScanningTuner> pScanningTuner;
    SmartPtr<ITuningSpaceContainer> pTuningSpaceContainer;

    if (gcap.pTuningSpace != NULL)
    {
    ErrMsg(TEXT("Error %x: pTuningSpace is not NULL"), hr);
    goto lFail2CreateTuningSpace;
    }

    if (gcap.pNetworkProvider == NULL)
    {
    ErrMsg(TEXT("Error %x: Network Provider is not created yet", hr));
    goto lFail2CreateTuningSpace;
    }

    hr = gcap.pNetworkProvider->QueryInterface(__uuidof(ITuner), (void**)&pTuner);
    if (FAILED(hr))
    {
    ErrMsg(TEXT("Error %x: Cannot get the Tuner from Network Provider"), hr);
    goto lFail2CreateTuningSpace;
    }

    hr = CoCreateInstance(__uuidof(SystemTuningSpaces), NULL, CLSCTX_INPROC_SERVER, __uuidof(ITuningSpaceContainer), (void**)&pTuningSpaceContainer);
    if (FAILED(hr))
    {
    ErrMsg(TEXT("Error %x: Cannot create tuning space container"), hr);
    goto lFail2CreateTuningSpace;
    }

    // Get the enumerator for the collection.
    hr = pTuningSpaceContainer->get_EnumTuningSpaces(&pTuningSpaceEnum);
    if (hr == S_OK)
    {
    // Loop through the collection.
    while (S_OK == pTuningSpaceEnum->Next(1, &pTuningSpace, NULL))
    {
    //check the network type
    BSTR friendlyName;

    hr = pTuningSpace->get_FriendlyName(&friendlyName);
    if (SUCCEEDED(hr))
    {
    if (wcsstr(friendlyName, TEXT("ATSC Digital Antenna")) != NULL)
    {
    // Found the digital antenna tuning space. 
    hr = pTuningSpace->QueryInterface(__uuidof(IATSCTuningSpace), (void**)&gcap.pTuningSpace);
    if (FAILED(hr))
    {
    ErrMsg(TEXT("Error %x: Cannot get ATSC tuning space"), hr);
    goto lFail2CreateTuningSpace;
    }
    SysFreeString(friendlyName);

    BSTR guid = SysAllocString(L"{B2F3A67C-29DA-4C78-8831-091ED509A475}");
    hr = pTuningSpace->put_NetworkType(guid);
    SysFreeString(guid);

    hr = gcap.pTuningSpace->put_InputType(TunerInputAntenna);
    hr = gcap.pTuningSpace->put_MinChannel(4);
    hr = gcap.pTuningSpace->put_MaxChannel(68);
    hr = gcap.pTuningSpace->put_MinMinorChannel(1);
    hr = gcap.pTuningSpace->put_MaxMinorChannel(23);
    hr = gcap.pTuningSpace->put_CountryCode(1);
    hr = gcap.pTuningSpace->put_MinPhysicalChannel(4);
    hr = gcap.pTuningSpace->put_MaxPhysicalChannel(51);

    break;
    }
    SysFreeString(friendlyName);
    }
    }
    }
    else
    {
    ErrMsg(TEXT("Error %x: Cannot enumerate Tuning spaces on the Network Provider"), hr);
    goto lFail2CreateTuningSpace;
    }

    if (gcap.pTuningSpace != NULL)
    {
    hr = pTuner->get_TuningSpace((ITuningSpace**)&pTuningSpace);  //<------ This fails with E_NOINTERFACE
    hr = pTuner->put_TuningSpace(gcap.pTuningSpace);                       //<------- This fails with E_INVALIDARG
    if (FAILED(hr))
    {
    ErrMsg(TEXT("Error %x: Can't set the Network Provider's ITuner to use ATSC antenna tuning space"), hr);
    goto lFail2CreateTuningSpace;
    }

    //set the default locator
    hr = gcap.pTuningSpace->get_DefaultLocator((ILocator**)&pATSCLocator);
    if (FAILED(hr))
    {
    ErrMsg(TEXT("Error %x: Can't get the Default Locator on the Tuning Space"), hr);
    }

    pATSCLocator->put_PhysicalChannel(35); //fox-4

    return TRUE;
    }
    else
    ErrMsg(TEXT("Error %x: Tuning Space is invalid"), hr);

    lFail2CreateTuningSpace:
    return FALSE;
    }


    Tuesday, February 07, 2017 4:16 PM

All replies

  • You're quite sure your tuner card supports ATSC?  What tuner are you using?

    Tim Roberts, Driver MVP Providenza & Boekelheide, Inc.

    Thursday, February 09, 2017 11:24 PM
  • Yes it does support ATSC. I tried the same code on a Windows 7 machine and it worked. I bought it from Amazon. https://www.amazon.com/gp/product/B00H5CB1RM/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1

    Windows 2012R2 doesn't seem to support BDA drivers out-of-box for some reason, so I had to grab those from a Windows 8.1 machine and install them on 2012R2. Still the "Microsoft Network Provider" doesn't like the ATSC tuning space, or any tuning space for that matter. 

    Friday, February 10, 2017 3:03 PM
  • The Server systems by default do not include a lot "entertainment" subsystems, because they don't expect you to want those on a Server system.  You might check the Programs & Features control panel to make sure the multimedia subsystems are all installed.

    Tim Roberts, Driver MVP Providenza & Boekelheide, Inc.

    Wednesday, February 15, 2017 12:07 AM