Hi

can anyone tell me that how to verify PCM format in
SRB_GET_DATA_INTERSECTION??

my PCM Foramt is define like this,just only one format.

KSDATAFORMAT_WAVEFORMATEX PCMAudioFormat = {
{
sizeof (KSDATAFORMAT_WAVEFORMATEX),
0,
1,
0,
STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO),
STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM),
STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX)
},
{
WAVE_FORMAT_PCM,
1, // channels
8000, // sampling rate
8000, // byte rate
1, // alignment = nChannels * ( wBitsPerSample / 8 );
8, // bit resolution
0 // extra
}
};

I have write a function like this , can you tell me what's going wrong
??

BOOL
STREAMAPI
AdapterFormatFromRange(
IN PHW_STREAM_REQUEST_BLOCK pSrb
)
{
PSTREAM_DATA_INTERSECT_INFO IntersectInfo;
PKSDATARANGE DataRange;
BOOL OnlyWantsSize;
BOOL MatchFound = FALSE;
ULONG FormatSize;
ULONG StreamNumber;
ULONG j;
ULONG NumberOfFormatArrayEntries;
PKSDATAFORMAT *pAvailableFormats;

IntersectInfo = pSrb->CommandData.IntersectInfo;
StreamNumber = IntersectInfo->StreamNumber;
DataRange = IntersectInfo->DataRange;

NumberOfFormatArrayEntries = Streams
[StreamNumber].hwStreamInfo.NumberOfFormatArrayEntries;

pAvailableFormats =
Streams[StreamNumber].hwStreamInfo.StreamFormatsArray;

OnlyWantsSize = (IntersectInfo->SizeOfDataFormatBuffer ==
sizeof(ULONG));

for (j = 0; j < NumberOfFormatArrayEntries; j++,
pAvailableFormats++) {

if (!AdapterCompareGUIDsAndFormatSize(
DataRange,
*pAvailableFormats,
TRUE /* CompareFormatSize */)) {
continue;
}

if (IsEqualGUID (&DataRange->Specifier,
&KSDATAFORMAT_SPECIFIER_WAVEFORMATEX)) {

PKSDATAFORMAT_WAVEFORMATEX DataRangeAudio =
(PKSDATAFORMAT_WAVEFORMATEX) DataRange;
PWAVEFORMATEX pWaveFormatEx = (PWAVEFORMATEX)
((PKSDATAFORMAT)DataRangeAudio + 1);

if (IsEqualGUID (&DataRange->SubFormat ,
&KSDATAFORMAT_SUBTYPE_PCM))
DataRangeAudio = (PKSDATAFORMAT_WAVEFORMATEX)
&PCMAudioFormat;
else
DataRangeAudio =
(PKSDATAFORMAT_WAVEFORMATEX)*pAvailableFormats;

MatchFound = TRUE;
FormatSize = sizeof (KSDATAFORMAT_WAVEFORMATEX);

if (OnlyWantsSize) {
break;
}

if (IntersectInfo->SizeOfDataFormatBuffer < FormatSize) {
pSrb->Status = STATUS_BUFFER_TOO_SMALL;
return FALSE;
}

RtlCopyMemory(IntersectInfo->
DataFormatBuffer,DataRangeAudio,sizeof
(KSDATAFORMAT_WAVEFORMATEX));

((PKSDATAFORMAT)IntersectInfo->DataFormatBuffer)->
FormatSize = FormatSize;

}

else {
pSrb->Status = STATUS_NO_MATCH;
return FALSE;
}

} // End of loop on all formats for this stream

if (OnlyWantsSize) {
*(PULONG) IntersectInfo->DataFormatBuffer = FormatSize;
pSrb->ActualBytesTransferred = sizeof(ULONG);
return TRUE;
}
pSrb->ActualBytesTransferred = FormatSize;
return TRUE;
}

Second :

can anyone tell me what is this error "CO_E_ACESINWRONGORDER"
meaning,
and how to slove it??


Thanks a lot

Re: How to Verify PCM Format in SRB_GET_DATA_INTERSECTION?? by paullee

paullee
Tue Jul 20 04:15:34 CDT 2004

> Hi
>
> can anyone tell me that how to verify PCM format in
> SRB_GET_DATA_INTERSECTION??


The Avssamp sample code hsa a AudioIntersectHandler function
seem could be slove my problem, FYI


Second:
I try to use follow code to capture sound,but RenderStream return
0x80070057 E_INVALIDARG,I have try to another audio driver ,the follow
is work fine,can anyone tell me ,what's wrong with my video capture driver??
when RenderStream is working ,what is the necessary thing that driver need
to do ??

hr = pGraph->AddFilter(pSrc, L"Capture");

CComPtr<IBaseFilter> ppf;
hr = pBuilder->SetOutputFileName(&MEDIASUBTYPE_WAVE,
L"C:\\Example.wav", &ppf, NULL);

hr = pBuilder->RenderStream(
&PIN_CATEGORY_CAPTURE, // Pin category
&MEDIATYPE_Audio, // Media type
pSrc, // Capture filter
NULL, // Compression filter (optional)
ppf // Multiplexer or renderer filter
);


Thanks a lot