From: wpiyong on
I am developing a AVstream video capture driver following the example
avssamp from the DDK. I am using ksevent to notify clients the state of
the filter, such as run, pause, stop. I declared the events in the
filter description, and called KsFilterGenerateEvents in the routine of
DispatchSetState. As for client, IKsControl::ksevent is called
successfully, and followed by waitformultipleobjects, but the client
never received any events notification. Here is some code:

client:

HANDLE EventHandle[4];
KSEVENT Event[4];

KSEVENTDATA Data[4];
for (int ii = 0; ii <4; ii++)
{
EventHandle[ii] = CreateEvent(NULL, TRUE, FALSE, NULL);
Event[ii].Set = KSEVENTSETID_X;
Event[ii].Id = ii;
Event[ii].Flags = KSEVENT_TYPE_ENABLE;
Data[ii].NotificationType = KSEVENTF_EVENT_HANDLE;
Data[ii].EventHandle.Event = EventHandle[ii];
Data[ii].EventHandle.Reserved[0] = 0;
Data[ii].EventHandle.Reserved[1] = 0;
}

for (int ii=0; ii<4; ii++)
{
hr = pIKsControl -> KsEvent (&Event[ii], sizeof (Event[ii]),
&Data[ii],
sizeof(Data[ii]), &BytesReturned);
}
ASSERT(hr == S_OK);

DWORD EventRet = WaitForMultipleObjects(4, EventHandle, FALSE,
INFINITE);

driver:
Here is one item of events
DEFINE_KSEVENT_ITEM
(
KSEVENT_STOP, //2
sizeof(KSEVENTDATA),
0,
NULL,
NULL,
NULL
),


KsFilterGenerateEvents(pFilter->m_Filter, &KSEVENTSETID_X,
KSEVENT_STOP,
0, NULL, NULL, NULL);

Thanks in advance for your help.

From: wpiyong on
I solved the problem. The problem was that there were several instances
of filter, so I needed to generate the events from each filter
instance.

On Jan 23, 2:03 pm, "wpiyong" <ly.did...(a)gmail.com> wrote:
> I am developing a AVstream video capture driver following the example
> avssamp from the DDK. I am usingkseventto notify clients the state of
> the filter, such as run, pause, stop. I declared the events in the
> filter description, and called KsFilterGenerateEvents in the routine of
> DispatchSetState. As for client, IKsControl::kseventis called
> successfully, and followed by waitformultipleobjects, but the client
> never received any events notification. Here is some code:
>
> client:
>
> HANDLE EventHandle[4];KSEVENTEvent[4];
>
> KSEVENTDATA Data[4];
> for (int ii = 0; ii <4; ii++)
> {
> EventHandle[ii] = CreateEvent(NULL, TRUE, FALSE, NULL);
> Event[ii].Set = KSEVENTSETID_X;
> Event[ii].Id = ii;
> Event[ii].Flags = KSEVENT_TYPE_ENABLE;
> Data[ii].NotificationType = KSEVENTF_EVENT_HANDLE;
> Data[ii].EventHandle.Event = EventHandle[ii];
> Data[ii].EventHandle.Reserved[0] = 0;
> Data[ii].EventHandle.Reserved[1] = 0;
>
> }for (int ii=0; ii<4; ii++)
> {
> hr = pIKsControl ->KsEvent(&Event[ii], sizeof (Event[ii]),
> &Data[ii],
> sizeof(Data[ii]), &BytesReturned);}ASSERT(hr == S_OK);
>
> DWORD EventRet = WaitForMultipleObjects(4, EventHandle, FALSE,
> INFINITE);
>
> driver:
> Here is one item of events
> DEFINE_KSEVENT_ITEM
> (
> KSEVENT_STOP, //2
> sizeof(KSEVENTDATA),
> 0,
> NULL,
> NULL,
> NULL
> ),
>
> KsFilterGenerateEvents(pFilter->m_Filter, &KSEVENTSETID_X,
> KSEVENT_STOP,
> 0, NULL, NULL, NULL);
>
> Thanks in advance for your help.