GetStreamOfSections stops responding after SubmitTuneRequest  
Author Message
Richard_Mason





PostPosted: DirectShow Development, GetStreamOfSections stops responding after SubmitTuneRequest Top

I'm developing a BDA based TV application using GetStreamOfSections on the standard "MPEG-2 Sections and Tables" filter to retrieve the MPEG2 information tables. Everything works correctly at first, however when I submit a new tune request to the tuner the GetStreamOfSections stops sending data. The symptoms are not consistent - If I am listening to multiple tables then sometimes all of them stop responding. Sometimes only some of them. Similarly, even with 1 table it doesn't alway stop responding, however it does most of the time.

Does anybody have any suggestions on what may be happening and how to avoid it



Software Development for Windows Vista9  
 
 
godock





PostPosted: DirectShow Development, GetStreamOfSections stops responding after SubmitTuneRequest Top

I had the same problem with GetStreamOfSections.

I solved it, by inserting a separate method for the section filter.

Some codeā€¦.

HRESULT FIL_FilterAddFilter(...){

...
AfxBeginThread (FIL_ThreadProc, _param);
}

UINT FIL_ThreadProc( LPVOID lpParam ) {
...
While(1){
FIL_GetSection(pid, tid, pPidBuffer, pSizeOfData);
}

//parse section or
return 0;
}

HRESULT FIL_GetSection(int pid, int tid, unsigned char* pPidBuffer, int* pSizeOfData){

CComPtr <IMpeg2Stream> pStream;
hr = m_pMPEG->GetStreamOfSections(pid, tid, NULL,
m_hScanningStopEvent,
&pStream);

MPEG_STREAM_BUFFER streamBuffer;
ZeroMemory(&streamBuffer, sizeof(MPEG_STREAM_BUFFER));

streamBuffer.dwDataBufferSize = m_BufferSize;
streamBuffer.pDataBuffer = (BYTE*)m_pDataBuffer;
if FAILED(hr = pStream->SupplyDataBuffer(&streamBuffer)) return E_FAIL;

DWORD dwWait = WaitForSingleObject(m_hScanningStopEvent, 5000);

if (dwWait == WAIT_OBJECT_0){
*pSizeOfData = streamBuffer.dwSizeOfDataRead;
memcpy(pPidBuffer, streamBuffer.pDataBuffer, streamBuffer.dwSizeOfDataRead);

return S_OK;

}

return E_FAIL; //timeout or something else

}


godock