- About capture stream data in bda
- Posted by WilliamX on April 20th, 2005
Hi,
I wrote two bda filters (tuner/demod, and capture), but now, I puzzled
where could I capture the stream from device.
First, I thought that it should be in tuner/demod filter. So I
reviewed the generictuner, the sample with ddk, but I failed to find
any usefull information whithin it.
And I reviewed the capturesample too, it seemed that the routine
Process dealt with the stream data, but I don't know where the stream
came from.
Could you give me some instructions?
Any comments are welcome!
Advance thanks!
William
- Posted by Max Paklin on April 22nd, 2005
What is the device that you are writing the driver for?
Frequently the way you get the bits from the device is specific to that
particular piece of hardware.
BDA samples that you are referring to won't help you much with this
particular problem simply because they are samples for VIRTUAL device.
The last I checked they were loading the data from file. I assume that you
are writing a driver for real device.
But anyway this is hardly an issue at all as the way you get the data from
the device in BDA driver is no different from how you would get the data
under any other driver model. What's specific in BDA is how the data is
moved up to user land to clients. Hardware access logic is the same.
-- Max.
"WilliamX" <fantast_xue@hotmail.com.discuss> wrote in message
news:uy8bdanv5.fsf@hotmail.com.discuss...
- Posted by WilliamX on April 26th, 2005
I have studied the ddk samples and it seems to use stream pointer to
transmit the data in routine 'Process'.
If it is true, how to fill the stream pointer? The sample is using DMA
and mapping, but my driver is without DMA.
I filled the parameter 'data' of 'stream header' of 'stream pointer',
but it seems that nothing happened.
And, my driver is a pin-centric minidriver.
So, how to transmit the data to the next filter?
Thanks!
WilliamX <fantast_xue@hotmail.com.discuss> writes:
- Posted by Max Paklin on April 26th, 2005
Did you put the size of the data in DataUsed?
"WilliamX" <fantast_xue@hotmail.com.discuss> wrote in message
news:ufyxdin57.fsf@hotmail.com.discuss...
- Posted by WilliamX on April 27th, 2005
I coded the process routine as following:
Is there something wrong with my codes?
NTSTATUS
CCapturePin:
ispatchProcess(IN PKSPIN p_ks_pin)
{
NTSTATUS status = STATUS_SUCCESS;
PKSSTREAM_POINTER p_ks_sp_leading =
KsPinGetLeadingEdgeStreamPointer(p_ks_pin,
KSSTREAM_POINTER_STATE_LOCKED);
PKSSTREAM_POINTER p_ks_sp_clone;
status = KsStreamPointerClone(p_ks_sp_leading,
NULL,
0,//sizeof(STREAM_POINTER_CONTEXT),
&p_ks_sp_clone);
KsStreamPointerUnlock(p_ks_sp_leading, FALSE);
KsStreamPointerAdvance(p_ks_sp_leading);
m_p_smaple_buf = p_ks_sp_clone->StreamHeader->Data;
ULONG ul_data_Len = 0;
while (NT_SUCCESS(status) && p_ks_sp_clone != NULL
&& ul_data_Len < p_ks_sp_clone->OffsetOut.Count)
{
if (m_p_dev_obj == NULL)
{
break;
}
ReadDataFromUsb(m_p_dev_obj,
PIPE_DATA,
m_p_smaple_buf,
READ_DATA_SIZE);
ul_data_Len += READ_DATA_SIZE;
m_p_smaple_buf = (PVOID)((PUCHAR)m_p_smaple_buf + READ_DATA_SIZE);
p_ks_sp_clone->StreamHeader->DataUsed += READ_DATA_SIZE;
LARGE_INTEGER li_wait;
li_wait.QuadPart = -(10000); // 1 ms
KeDelayExecutionThread(KernelMode,
FALSE,
&li_wait);
}
return status;
}
"Max Paklin" <mpaklin@hotmail.com> writes:
- Posted by Max Paklin on April 27th, 2005
I don't really understand what you are trying to do here. Why do you think
you need to create a clone?
Unless I miss something I don't see where you unlock the clone that you
created. No wonder no data gets delivered.
I think what you should do is
1. call KsPinGetLeadingEdgeStreamPointer to get p_ks_sp_leading. Check it
for NULL is NULL is valid result of KsPinGetLeadingEdgeStreamPointer.
2. run your "while" cycle filling p_ks_sp_leading with data.
3. once done complete and eject stream pointer (thus completing the
underlying IRP) by calling KsStreamPointerUnlock(p_ks_sp_leading, TRUE).
-- Max.
"WilliamX" <fantast_xue@hotmail.com.discuss> wrote in message
news:u64y8hpto.fsf@hotmail.com.discuss...
- Posted by WilliamX on April 27th, 2005
Yes, that's right!
Thanks very much!
"Max Paklin" <mpaklin@hotmail.com> writes: