1. It has problem to get the Singal in kworld card. but Prolink is working.
Origial code:
HRESULT spb_IEHIPbdaTV::GetSignalStatistics(long &iLOCKED, long &iSTRENGTH, long &iQUALITY, long &iSIGNAL,long &iFrequency )
{
HRESULT hr = S_OK;
BOOLEAN locked;
long strength;
long quality;
BOOLEAN present;
CComPtr
/*
The IBDA_Topology interface is implemented on BDA device filters.
A single filter may represent multiple hardware devices (called control nodes)
which may be connected in various ways within the filter itself.
These connections generally represent hardware paths on the card.
This interface provides methods that enable a Network Provider to
configure or discover the types of nodes within the filter, and how these nodes are connected.
The methods correspond closely to the Ring 0 property sets which are documented in the Windows DDK.
*/
hr = this->GpTUNERDEVICE.QueryInterface(&bdaNetTop);
if(SUCCEEDED(hr))
{
CComPtr
// Retrieves an IUnknown interface pointer for a specified control node.
hr = bdaNetTop->GetControlNode(0, 1, BDA_TWINHAN_DEMODULATOR_NODE, &unknown);
if (FAILED(hr))
{
this->CONSOLE_TEXT("Error : Code # %d - GetSignalStatistics : GetControlNode BDA_TWINHAN_DEMODULATOR_NODE",hr);
}
else
{
CComPtr
hr = unknown.QueryInterface(&pSigStats);
if (FAILED(hr))
{
this->CONSOLE_TEXT("Error : Code # %d - GetSignalStatistics : IBDA_SignalStatistics QI",hr);
}
else
{
long quality = -2;
hr = pSigStats->get_SignalQuality(&quality);
iQUALITY = quality;
if (FAILED(hr))
{
// this->CONSOLE_TEXT("Error : Code # %d - GetSignalStatistics : get_SignalQuality()",hr);
}
else
{
}
BOOLEAN locked = FALSE;
//long locked = -2;
hr = pSigStats->get_SignalLocked(&locked);
iLOCKED = locked;
if (FAILED(hr))
{
// this->CONSOLE_TEXT("Error : Code # %d - GetSignalStatistics : get_SignalLocked()",hr);
}
else
{
}
}
}
CComPtr
hr = bdaNetTop->GetControlNode(0, 1, BDA_TWINHAN_TUNER_NODE, &unknown2);
if (FAILED(hr))
{
this->CONSOLE_TEXT("Error : Code # %d - GetSignalStatistics : GetControlNode BDA_TWINHAN_TUNER_NODE",hr);
}
else
{
CComPtr
hr = unknown2.QueryInterface(&pSigStats2);
if (FAILED(hr))
{
this->CONSOLE_TEXT("Error : Code # %d - GetSignalStatistics : IBDA_SignalStatistics QI",hr);
}
else
{
long strength = -1;
hr = pSigStats2->get_SignalStrength(&strength);
if (FAILED(hr))
{
this->CONSOLE_TEXT("Error : Code # %d - GetSignalStatistics : get_SignalStrength()",hr);
}
else
{
iSTRENGTH = strength;
}
BOOLEAN present = FALSE;
hr = pSigStats2->get_SignalPresent(&present);
if (FAILED(hr))
{
this->CONSOLE_TEXT("Error : Code # %d - GetSignalStatistics : get_SignalPresent()",hr);
}
else
{
iSIGNAL = present;
}
}
}
}
else
{
this->CONSOLE_TEXT("Error : Code # %d - GetSignalStatistics : IBDA_Topology QI",hr);
}
/////////
// HRESULT hr;
TCHAR BUFFER[128];
// (*numFound) = 0;
ProgramINFO info;
CComPtr
if (this->GpNETWORKPROVIDER == NULL)
{
this->CONSOLE_TEXT("Error : Code # %d - ScanForProgramInfo : GpNETWORKPROVIDER NULL",E_FAIL);
return E_FAIL;
}
CComQIPtr
hr = LpTUNER->get_TuneRequest(&piTuneRequest);
if(FAILED(hr))
{
this->CONSOLE_TEXT("Error : Code # %d - ScanForProgramInfo : LpTUNER->get_TuneRequest(&piTuneRequest)",E_FAIL);
return hr;
}
CComPtr
hr = piTuneRequest->get_Locator(&pILocator);
if(FAILED(hr))
{
this->CONSOLE_TEXT("Error : Code # %d - ScanForProgramInfo : piTuneRequest->get_Locator()",E_FAIL);
return hr;
}
hr = pILocator->get_CarrierFrequency(&iFrequency);//info.FREQ);
if(FAILED(hr))
{
this->CONSOLE_TEXT("Error : Code # %d - ScanForProgramInfo : pATSCLocator->get_CarrierFrequency(&iFrequency)",hr); //info.TSID)",hr);
return hr;
}
hr = pILocator->get_SignalStrength(&iSIGNAL);//info.FREQ);
if(FAILED(hr))
{
this->CONSOLE_TEXT("Error : Code # %d - ScanForProgramInfo : pATSCLocator->get_CarrierFrequency(&iFrequency)",hr); //info.TSID)",hr);
return hr;
return hr;
}
-----------------------------------------------------------------------------------------------
Fixed solusion:
1. In fact, We just want have a auto scan function, and some hardware card doesn't 100% support the DirectShow function.
2. We can used the get the TV Major and Minor to get the right data.
if Major is some number and Minor is some number, we get the frequence is "-1" if ATSC Card get the Signal. otherwise is very big number, like xxx245
3. Don't waster time to check the Lock, Singal,... The vaule is not 100 % can reliable.
HRESULT spb_IEHIPbdaTV::GetATSCChannel(long* lPhysicalChannel, long* lMajorChannel, long* lMinorChannel,long* iLOCKED, long* iSTRENGTH, long* iQUALITY, long* iSIGNAL,long* iFrequency )
{
HRESULT hr = S_OK;
ProgramINFO info;
if (this->GpNETWORKPROVIDER == NULL)
{
this->CONSOLE_TEXT("Error : Code # %d - ChangeChannel : GpNETWORKPROVIDER NULL",E_FAIL);
return E_FAIL;
}
CComQIPtr
CComPtr
hr = LpTUNER->get_TuneRequest(&pTuneRequestForGet);
if (FAILED (hr))
{
this->CONSOLE_TEXT("Error : Code # %d - ChangeChannel : Cannot submit tune request",hr);
return hr;
}
//query for an IATSCChannelTuneRequest interface pointer
CComQIPtr
// Set the initial major and minor channels
//long lGetReturnMajorChannel;
hr = pATSCTuneRequest->get_Channel(lMajorChannel); //&lGetReturnMajorChannel);
if(FAILED(hr))
{
return hr;
}
hr = pATSCTuneRequest->get_MinorChannel(lMinorChannel); //&lGetReturnMajorChannel);
if(FAILED(hr))
{
return hr;
}
CComPtr
hr = pATSCTuneRequest->get_Locator(&pILocator);
if(FAILED(hr))
{
this->CONSOLE_TEXT("Error : Code # %d - ScanForProgramInfo : piTuneRequest->get_Locator()",E_FAIL);
return hr;
}
hr = pILocator->get_CarrierFrequency(iFrequency);
if(FAILED(hr))
{
this->CONSOLE_TEXT("Error : Code # %d - ScanForProgramInfo : pATSCLocator->get_CarrierFrequency(&info.TSID)",hr);
return hr;
}
CComQIPtr
if (pATSCLocator!=NULL)
{
hr = pATSCLocator->get_TSID(&info.TSID);
if(FAILED(hr))
{
this->CONSOLE_TEXT("Error : Code # %d - ScanForProgramInfo : pATSCLocator->get_TSID(&info.TSID)",hr);
return hr;
}
// hr = pATSCLocator->get_Locator(&pILocator);
hr = pATSCLocator->get_PhysicalChannel(lPhysicalChannel); //&lGetReturnMajorChannel);
if(FAILED(hr))
{
return hr;
}
hr = pATSCTuneRequest->get_Channel(lMajorChannel);
if(FAILED(hr))
{
this->CONSOLE_TEXT("Error : Code # %d - ScanForProgramInfo : pATSCTuneRequest->get_Channel(&info.MajorChannel)",hr);
return hr;
}
hr = pATSCTuneRequest->get_MinorChannel(lMinorChannel);
if(FAILED(hr))
{
this->CONSOLE_TEXT("Error : Code # %d - ScanForProgramInfo : pATSCTuneRequest->get_MinorChannel(&info.MinorChannel",hr);
return hr;
}
}
return S_OK;
}
void CDVBT_VIDEOMATE::OnButton3() //Auto Scan Function.
{
HRESULT hr;
TCHAR tmp[256];
CString lcstmp1,lcstmp2,lcstmp3;
if (bdaTV->GpNETWORKPROVIDER == NULL)
{
this->CONSOLE_TEXT("*** Plugin File not loaded. Click LOAD PLUGIN. ***");;
return;
}
this->mTUNINGLIST.ResetContent();
long t_iPhy=1;
long t_iMajor=-1;
long t_iMinor=1;
// Open a Log file for write the Channels info.
CString TV_CStingCurTime;
static FILE *pLogFile;
static int isNewLog = TRUE;
pLogFile = fopen("C:\\ATSC.log", "w"); //a+");
// This loop is for Scan the ATSC Channels,
//
for (t_iPhy=2; t_iPhy<=158;t_iPhy++) { t_iMajor=-1; for (t_iMinor=-1;t_iMinor<=12;t_iMinor++) { lcstmp1.Format("%d",t_iPhy); lcstmp2.Format("%d",t_iMajor); lcstmp3.Format("%d",t_iMinor); hr = bdaTV->ChangeATSCChannel(atol(lcstmp1),atol(lcstmp2),atol(lcstmp3)); //change Channel data
if (hr != S_OK)
{
break;
}
long iLOCKED, iSIGNAL;
long iQUALITY, iSTRENGTH,iFrequency;
TCHAR tmp1[128],tmp2[128],tmp3[128],tmp4[128],tmp5[128];
iLOCKED=-2;
iSTRENGTH=-2;
iQUALITY=-2;
iSIGNAL=-2;
iFrequency=-2;
::Sleep(1000); // It is for ATSC Hardware card process time, // if rip if out, the ATSC Card get vaule will be wrong.
hr = bdaTV->GetATSCChannel(&t_iPhy,&amp;t_iMajor,&t_iMinor,&iLOCKED, &iSTRENGTH, &iQUALITY, &iSIGNAL, &amp;iFrequency );
if (t_iMajor!=-1)
{
lcstmp1.Format("%d",t_iPhy);
lcstmp2.Format("%d",t_iMajor);
lcstmp3.Format("%d",t_iMinor);
hr = bdaTV->ChangeATSCChannel(atol(lcstmp1),atol(lcstmp2),atol(lcstmp3)); //change Channel data
::Sleep(1000); // It is for ATSC Hardware card process time, // if rip if out, the ATSC Card get vaule will be wrong.
hr = bdaTV->GetATSCChannel(&t_iPhy,&amp;t_iMajor,&t_iMinor,&iLOCKED, &iSTRENGTH, &iQUALITY, &iSIGNAL, &amp;iFrequency );
}
lcstmp1.Format("%d",t_iPhy);
lcstmp2.Format("%d",t_iMajor);
lcstmp3.Format("%d",t_iMinor);
this->CONSOLE_TEXT("*** Current Channels: Phy:"+lcstmp1+" ,Major:"+lcstmp2+ ",Minor:"+lcstmp3 );
if
(iFrequency==-1 && t_iMajor!=-1 )
{
this->CONSOLE_TEXT("**** Working... ");
CString msgStr="Current Channels: Phy:"+lcstmp1+" , Major:"+lcstmp2+ ", Minor:"+lcstmp3;
// msgStr=msgStr+" "+tmp1+tmp2+tmp3+tmp4+tmp5;
// Write the Phy, Major, minor data to a File.
if (isNewLog)
{
fprintf(pLogFile, "Beginning of log session\n");
isNewLog = FALSE;
}
fprintf(pLogFile, "%s\n",msgStr.GetBuffer(0));
}else
{
this->CONSOLE_TEXT(" Not Working... ");
break;
}
}
}
// Close the Log file.
fclose(pLogFile);
this->CONSOLE_TEXT("*** Finish Auto Scan.." );
}
3 comments:
It agree, this rather good idea is necessary just by the way
It seems remarkable idea to me is
I advise to you to come on a site where there is a lot of information on a theme interesting you. Will not regret. Hot Health
Body, hundreds of spectators, thousands of spectators, arrived at the ball field at that you have the the federal highway funds. Out, they?re going to assign morning television, answering earnest questions from David Hartman in a simulated still and thinking flu-related thoughts. That is constantly being enriched by a diverse and electromaggots Today?s science question that people give you for Christmas when they get desperate. Soon the excited england, not to mention that we lose a couple of airmen, to achieve the purpose catching Hell Call me a regular American guy if you want, but baseball season is kind of special. Great jokes angry letters from shouldn?t be too much trouble as long as you avoid Common Taxpayer Errors. The character that breeds tremendous pains couple agreed with that policy. League, I look for yet obnoxious?can this city face up to the multitude of problems besetting it and consisted of deciding that our band outfits should include sun glasses. Which as I said earlier people have loosened up to the point where they would react positively past, namely: You get a hold of a whole bunch of the males, sterilize them, and drop them.
[URL=http://buzzace.tk/art.php?n=980096]Yeast infections and diflucan and intercourse[/URL]
Post a Comment