ReactOS  0.4.13-dev-464-g6b95727
pin_wavecyclic.cpp
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS Kernel Streaming
4  * FILE: drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp
5  * PURPOSE: WaveCyclic IRP Audio Pin
6  * PROGRAMMER: Johannes Anderwald
7  */
8 
9 #include "private.hpp"
10 
11 #ifndef YDEBUG
12 #define NDEBUG
13 #endif
14 
15 #include <debug.h>
16 
17 class CPortPinWaveCyclic : public IPortPinWaveCyclic,
18  public IServiceSink
19 {
20 public:
22 
24  {
26  return m_Ref;
27  }
29  {
31 
32  if (!m_Ref)
33  {
34  delete this;
35  return 0;
36  }
37  return m_Ref;
38  }
41  CPortPinWaveCyclic(IUnknown *OuterUnknown){}
42  virtual ~CPortPinWaveCyclic(){}
43 
44 protected:
45 
46  VOID UpdateCommonBuffer(ULONG Position, ULONG MaxTransferCount);
49 
57 
58  IPortWaveCyclic * m_Port;
59  IPortFilterWaveCyclic * m_Filter;
60  KSPIN_DESCRIPTOR * m_KsPinDescriptor;
68 
72 
73  IIrpQueue * m_IrpQueue;
74 
77 
83 
86 
88 
90 
92 };
93 
94 
95 typedef struct
96 {
100 
101 typedef struct
102 {
105 
106 
107 
115 
116 
120 
122 {
124  sizeof(KSEVENTDATA),
127  0,
128  0
129 };
130 
132 {
137  0,
138  0
139 };
140 
141 
142 KSPROPERTY_SET PinWaveCyclicPropertySet[] =
143 {
144  {
146  sizeof(PinWaveCyclicConnectionSet) / sizeof(KSPROPERTY_ITEM),
147  (const KSPROPERTY_ITEM*)&PinWaveCyclicConnectionSet,
148  0,
149  NULL
150  },
151  {
153  sizeof(PinWaveCyclicAudioSet) / sizeof(KSPROPERTY_ITEM),
154  (const KSPROPERTY_ITEM*)&PinWaveCyclicAudioSet,
155  0,
156  NULL
157  },
158  {
160  sizeof(PinWaveCyclicDRMSet) / sizeof(KSPROPERTY_ITEM),
161  (const KSPROPERTY_ITEM*)&PinWaveCyclicDRMSet,
162  0,
163  NULL
164  }
165 };
166 
167 KSEVENT_SET PinWaveCyclicEventSet[] =
168 {
169  {
171  sizeof(PinWaveCyclicStreamingEventSet) / sizeof(KSEVENT_ITEM),
172  (const KSEVENT_ITEM*)&PinWaveCyclicStreamingEventSet
173  },
174  {
176  sizeof(PinWaveCyclicConnectionEventSet) / sizeof(KSEVENT_ITEM),
177  (const KSEVENT_ITEM*)&PinWaveCyclicConnectionEventSet
178  }
179 };
180 
181 
182 //==================================================================================================================================
183 
184 NTSTATUS
185 NTAPI
187  IN REFIID refiid,
188  OUT PVOID* Output)
189 {
190  DPRINT("IServiceSink_fnQueryInterface entered\n");
191 
192  if (IsEqualGUIDAligned(refiid, IID_IIrpTarget) ||
194  {
195  *Output = PVOID(PUNKNOWN((IIrpTarget*)this));
196  PUNKNOWN(*Output)->AddRef();
197  return STATUS_SUCCESS;
198  }
199 
200  if (IsEqualGUIDAligned(refiid, IID_IServiceSink))
201  {
202  *Output = PVOID(PUNKNOWN(PSERVICESINK(this)));
203  PUNKNOWN(*Output)->AddRef();
204  return STATUS_SUCCESS;
205  }
206 
207  return STATUS_UNSUCCESSFUL;
208 }
209 
210 NTSTATUS
211 NTAPI
213  IN PIRP Irp,
215  IN OUT PVOID Data)
216 {
217  DPRINT1("PinWaveCyclicDRMHandler\n");
218  ASSERT(0);
220 }
221 
222 
223 NTSTATUS
224 NTAPI
226  IN PIRP Irp,
227  IN PKSEVENTDATA EventData,
228  IN PKSEVENT_ENTRY EventEntry)
229 {
233 
234  // get sub device descriptor
235  Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
236 
237  // sanity check
239  PC_ASSERT(Descriptor->PortPin);
241 
242  // cast to pin impl
243  Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
244 
245  // get extra size
246  Entry = (PENDOFSTREAM_EVENT_CONTEXT)(EventEntry + 1);
247 
248  // not a looped event
249  Entry->bLoopedStreaming = FALSE;
250 
251  // insert item
252  (void)ExInterlockedInsertTailList(&Pin->m_EventList, &EventEntry->ListEntry, &Pin->m_EventListLock);
253 
254  // done
255  return STATUS_SUCCESS;
256 }
257 
258 NTSTATUS
259 NTAPI
261  IN PIRP Irp,
262  IN PKSEVENTDATA EventData,
263  IN PKSEVENT_ENTRY EventEntry)
264 {
269 
270  // get sub device descriptor
271  Descriptor = (PSUBDEVICE_DESCRIPTOR)KSEVENT_ITEM_IRP_STORAGE(Irp);
272 
273  // sanity check
275  PC_ASSERT(Descriptor->PortPin);
277 
278  // cast to pin impl
279  Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
280 
281  // cast to looped event
283 
284  // get extra size
285  Entry = (PLOOPEDSTREAMING_EVENT_CONTEXT)(EventEntry + 1);
286 
287  Entry->bLoopedStreaming = TRUE;
288  Entry->Position = Data->Position;
289 
290  DPRINT1("Added event\n");
291 
292  // insert item
293  (void)ExInterlockedInsertTailList(&Pin->m_EventList, &EventEntry->ListEntry, &Pin->m_EventListLock);
294 
295  // done
296  return STATUS_SUCCESS;
297 }
298 
299 NTSTATUS
300 NTAPI
302  IN PIRP Irp,
304  IN OUT PVOID Data)
305 {
308 
309  // get sub device descriptor
310  Descriptor = (PSUBDEVICE_DESCRIPTOR)KSEVENT_ITEM_IRP_STORAGE(Irp);
311 
312  // sanity check
314  PC_ASSERT(Descriptor->PortPin);
316 
317  // cast to pin impl
318  Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
319 
320 
321  if (Request->Flags & KSPROPERTY_TYPE_GET)
322  {
323  // copy pin framing
324  RtlMoveMemory(Data, &Pin->m_AllocatorFraming, sizeof(KSALLOCATOR_FRAMING));
325 
326  Irp->IoStatus.Information = sizeof(KSALLOCATOR_FRAMING);
327  return STATUS_SUCCESS;
328  }
329 
330  // not supported
331  return STATUS_NOT_SUPPORTED;
332 }
333 
334 NTSTATUS
335 NTAPI
337  IN PIRP Irp,
339  IN OUT PVOID Data)
340 {
344 
345  // get sub device descriptor
346  Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
347 
348  // sanity check
350  PC_ASSERT(Descriptor->PortPin);
352 
353  // cast to pin impl
354  Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
355 
356  //sanity check
357  PC_ASSERT(Pin->m_Stream);
358 
359  if (Request->Flags & KSPROPERTY_TYPE_GET)
360  {
361  // FIXME non multithreading-safe
362  // copy audio position
363 
365 
366  if (Pin->m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_STREAMING)
367  {
368  RtlMoveMemory(Data, &Pin->m_Position, sizeof(KSAUDIO_POSITION));
369  DPRINT("Play %lu Record %lu\n", Pin->m_Position.PlayOffset, Pin->m_Position.WriteOffset);
370  }
371  else if (Pin->m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING)
372  {
373  Position->PlayOffset = Pin->m_Position.PlayOffset;
374  Position->WriteOffset = (ULONGLONG)Pin->m_IrpQueue->GetCurrentIrpOffset();
375  DPRINT("Play %lu Write %lu\n", Position->PlayOffset, Position->WriteOffset);
376  }
377 
378  Irp->IoStatus.Information = sizeof(KSAUDIO_POSITION);
379  return STATUS_SUCCESS;
380  }
381 
382  // not supported
383  return STATUS_NOT_SUPPORTED;
384 }
385 
386 typedef struct
387 {
392 
394 
395 VOID
396 CALLBACK
399  IN PVOID Context)
400 {
401  PSETPIN_CONTEXT PinWorkContext = (PSETPIN_CONTEXT)Context;
403 
404  // try set stream
405  Status = PinWorkContext->Pin->m_Stream->SetState(PinWorkContext->NewState);
406 
407  DPRINT1("Setting state %u %x\n", PinWorkContext->NewState, Status);
408  if (NT_SUCCESS(Status))
409  {
410  // store new state
411  PinWorkContext->Pin->m_State = PinWorkContext->NewState;
412 
413  if (PinWorkContext->Pin->m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING && PinWorkContext->Pin->m_State == KSSTATE_STOP)
414  {
415  /* FIXME complete pending irps with successful state */
416  PinWorkContext->Pin->m_IrpQueue->CancelBuffers();
417  }
418  //HACK
419  //PinWorkContext->Pin->m_IrpQueue->CancelBuffers();
420  }
421 
422  // store result
423  PinWorkContext->Irp->IoStatus.Information = sizeof(KSSTATE);
424  PinWorkContext->Irp->IoStatus.Status = Status;
425 
426  // complete irp
427  IoCompleteRequest(PinWorkContext->Irp, IO_NO_INCREMENT);
428 
429  // free work item
430  IoFreeWorkItem(PinWorkContext->WorkItem);
431 
432  // free work context
433  FreeItem(PinWorkContext, TAG_PORTCLASS);
434 
435 }
436 
437 
438 NTSTATUS
439 NTAPI
441  IN PIRP Irp,
443  IN OUT PVOID Data)
444 {
449 
450  // get sub device descriptor
451  Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
452 
453  // sanity check
455  PC_ASSERT(Descriptor->PortPin);
457 
458  // cast to pin impl
459  Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
460 
461  //sanity check
462  PC_ASSERT(Pin->m_Stream);
463 
464  if (Request->Flags & KSPROPERTY_TYPE_SET)
465  {
466  // try set stream
467  Status = Pin->m_Stream->SetState(*State);
468 
469  DPRINT("Setting state %u %x\n", *State, Status);
470  if (NT_SUCCESS(Status))
471  {
472  // store new state
473  Pin->m_State = *State;
474 
475  if (Pin->m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING && Pin->m_State == KSSTATE_STOP)
476  {
477  // FIXME
478  // complete with successful state
479  Pin->m_Stream->Silence(Pin->m_CommonBuffer, Pin->m_CommonBufferSize);
480  Pin->m_IrpQueue->CancelBuffers();
481  Pin->m_Position.PlayOffset = 0;
482  Pin->m_Position.WriteOffset = 0;
483  }
484  else if (Pin->m_State == KSSTATE_STOP)
485  {
486  Pin->m_Stream->Silence(Pin->m_CommonBuffer, Pin->m_CommonBufferSize);
487  Pin->m_IrpQueue->CancelBuffers();
488  Pin->m_Position.PlayOffset = 0;
489  Pin->m_Position.WriteOffset = 0;
490  }
491  // store result
492  Irp->IoStatus.Information = sizeof(KSSTATE);
493  }
494  return Status;
495  }
496  else if (Request->Flags & KSPROPERTY_TYPE_GET)
497  {
498  // get current stream state
499  *State = Pin->m_State;
500  // store result
501  Irp->IoStatus.Information = sizeof(KSSTATE);
502 
503  return STATUS_SUCCESS;
504  }
505 
506  // unsupported request
507  return STATUS_NOT_SUPPORTED;
508 }
509 
510 NTSTATUS
511 NTAPI
513  IN PIRP Irp,
515  IN OUT PVOID Data)
516 {
520  PIO_STACK_LOCATION IoStack;
521 
522  // get current irp stack location
524 
525  // get sub device descriptor
526  Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
527 
528  // sanity check
530  PC_ASSERT(Descriptor->PortPin);
531 
532  // cast to pin impl
533  Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
534 
535  //sanity check
536  PC_ASSERT(Pin->m_Stream);
537  PC_ASSERT(Pin->m_Format);
538 
539  if (Request->Flags & KSPROPERTY_TYPE_SET)
540  {
541  // try to change data format
542  PKSDATAFORMAT NewDataFormat, DataFormat = (PKSDATAFORMAT)Irp->UserBuffer;
543  ULONG Size = min(Pin->m_Format->FormatSize, DataFormat->FormatSize);
544 
545  if (RtlCompareMemory(DataFormat, Pin->m_Format, Size) == Size)
546  {
547  // format is identical
548  Irp->IoStatus.Information = DataFormat->FormatSize;
549  return STATUS_SUCCESS;
550  }
551 
552  // new change request
553  PC_ASSERT(Pin->m_State != KSSTATE_RUN);
554  // FIXME queue a work item when Irql != PASSIVE_LEVEL
556 
557  // allocate new data format
558  NewDataFormat = (PKSDATAFORMAT)AllocateItem(NonPagedPool, DataFormat->FormatSize, TAG_PORTCLASS);
559  if (!NewDataFormat)
560  {
561  // not enough memory
562  return STATUS_NO_MEMORY;
563  }
564 
565  // copy new data format
566  RtlMoveMemory(NewDataFormat, DataFormat, DataFormat->FormatSize);
567 
568  // set new format
569  Status = Pin->m_Stream->SetFormat(NewDataFormat);
570  if (NT_SUCCESS(Status))
571  {
572  // free old format
573  FreeItem(Pin->m_Format, TAG_PORTCLASS);
574 
575  // store new format
576  Pin->m_Format = NewDataFormat;
577  Irp->IoStatus.Information = NewDataFormat->FormatSize;
578 
579 #if 0
580  PC_ASSERT(NewDataFormat->FormatSize == sizeof(KSDATAFORMAT_WAVEFORMATEX));
584 
585 
586  DPRINT("NewDataFormat: Channels %u Bits %u Samples %u\n", ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.nChannels,
587  ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.wBitsPerSample,
588  ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.nSamplesPerSec);
589 #endif
590 
591  }
592  else
593  {
594  // failed to set format
595  FreeItem(NewDataFormat, TAG_PORTCLASS);
596  }
597 
598 
599  // done
600  return Status;
601  }
602  else if (Request->Flags & KSPROPERTY_TYPE_GET)
603  {
604  // get current data format
605  PC_ASSERT(Pin->m_Format);
606 
607  if (Pin->m_Format->FormatSize > IoStack->Parameters.DeviceIoControl.OutputBufferLength)
608  {
609  // buffer too small
610  Irp->IoStatus.Information = Pin->m_Format->FormatSize;
611  return STATUS_MORE_ENTRIES;
612  }
613  // copy data format
614  RtlMoveMemory(Data, Pin->m_Format, Pin->m_Format->FormatSize);
615  // store result size
616  Irp->IoStatus.Information = Pin->m_Format->FormatSize;
617 
618  // done
619  return STATUS_SUCCESS;
620  }
621 
622  // unsupported request
623  return STATUS_NOT_SUPPORTED;
624 }
625 
626 VOID
629  IN ULONGLONG NewOffset)
630 {
632  PKSEVENT_ENTRY EventEntry;
634 
635  // acquire event lock
637 
638  // point to first entry
640 
641  while(Entry != &m_EventList)
642  {
643  // get event entry
644  EventEntry = (PKSEVENT_ENTRY)CONTAINING_RECORD(Entry, KSEVENT_ENTRY, ListEntry);
645 
646  // get event entry context
647  Context = (PLOOPEDSTREAMING_EVENT_CONTEXT)(EventEntry + 1);
648 
649  if (Context->bLoopedStreaming != FALSE)
650  {
651  if (NewOffset > OldOffset)
652  {
653  /* buffer progress no overlap */
654  if (OldOffset < Context->Position && Context->Position <= NewOffset)
655  {
656  /* when someone eventually fixes sprintf... */
657  DPRINT("Generating event at OldOffset %I64u\n", OldOffset);
658  DPRINT("Context->Position %I64u\n", Context->Position);
659  DPRINT("NewOffset %I64u\n", NewOffset);
660  /* generate event */
661  KsGenerateEvent(EventEntry);
662  }
663  }
664  else
665  {
666  /* buffer wrap-arround */
667  if (OldOffset < Context->Position || NewOffset > Context->Position)
668  {
669  /* when someone eventually fixes sprintf... */
670  DPRINT("Generating event at OldOffset %I64u\n", OldOffset);
671  DPRINT("Context->Position %I64u\n", Context->Position);
672  DPRINT("NewOffset %I64u\n", NewOffset);
673  /* generate event */
674  KsGenerateEvent(EventEntry);
675  }
676  }
677  }
678 
679  // move to next entry
680  Entry = Entry->Flink;
681  }
682 
683  // release lock
685 }
686 
687 VOID
689  ULONG Position,
690  ULONG MaxTransferCount)
691 {
695  ULONG Gap;
696  PUCHAR Buffer;
698 
700  BufferLength = min(BufferLength, MaxTransferCount);
701 
702  while(BufferLength)
703  {
704  Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
705  if (!NT_SUCCESS(Status))
706  {
708  if (Gap > BufferLength)
709  {
710  // insert silence samples
711  DPRINT("Inserting Silence Buffer Offset %lu GapLength %lu\n", m_CommonBufferOffset, BufferLength);
713 
715  }
716  break;
717  }
718 
720 
721  if (m_Capture)
722  {
724  }
725  else
726  {
728  }
729 
730  m_IrpQueue->UpdateMapping(BytesToCopy);
732 
735 
737  {
739  {
740  // normalize position
742  }
743  }
744  }
745 }
746 
747 VOID
749  ULONG Position,
750  ULONG MaxTransferCount)
751 {
752  ULONG BufferLength, Length, Gap;
755  PUCHAR Buffer;
757 
758 
760  BufferLength = Length = min(BufferLength, MaxTransferCount);
761  while(BufferLength)
762  {
763  Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
764  if (!NT_SUCCESS(Status))
765  {
767  if (Gap > BufferLength)
768  {
769  // insert silence samples
770  DPRINT("Overlap Inserting Silence Buffer Size %lu Offset %lu Gap %lu Position %lu\n", m_CommonBufferSize, m_CommonBufferOffset, Gap, Position);
772 
774  }
775  break;
776  }
777 
779 
780  if (m_Capture)
781  {
782  m_DmaChannel->CopyFrom(Buffer,
784  BytesToCopy);
785  }
786  else
787  {
789  Buffer,
790  BytesToCopy);
791  }
792 
793  m_IrpQueue->UpdateMapping(BytesToCopy);
796 
798 
800  {
802  {
803  // normalize position
805  }
806  }
807  }
808 
809  if (Gap == Length)
810  {
812 
813  MaxTransferCount -= Length;
814 
815  if (MaxTransferCount)
816  {
817  UpdateCommonBuffer(Position, MaxTransferCount);
818  }
819  }
820 }
821 
822 VOID
823 NTAPI
824 CPortPinWaveCyclic::RequestService()
825 {
826  ULONG Position;
827  ULONGLONG OldOffset, NewOffset;
828 
830 
832  {
833  m_Stream->GetPosition(&Position);
834 
836 
838  {
840  }
841  else if (Position >= m_CommonBufferOffset)
842  {
844  }
845 
846  NewOffset = m_Position.PlayOffset;
847 
848  GeneratePositionEvents(OldOffset, NewOffset);
849  }
850 }
851 
852 NTSTATUS
853 NTAPI
854 CPortPinWaveCyclic::NewIrpTarget(
855  OUT struct IIrpTarget **OutTarget,
856  IN PCWSTR Name,
860  IN PIRP Irp,
861  IN KSOBJECT_CREATE *CreateObject)
862 {
864  return STATUS_UNSUCCESSFUL;
865 }
866 
867 NTSTATUS
868 NTAPI
871  IN PIRP Irp)
872 {
873  PIO_STACK_LOCATION IoStack;
877  ULONG Data = 0;
878  KSRESET ResetValue;
879 
880  /* get current irp stack location */
882 
883  if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY)
884  {
885  /* handle property with subdevice descriptor */
887 
888  if (Status == STATUS_NOT_FOUND)
889  {
890  Property = (PKSPROPERTY)IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
891 
893  DPRINT("Unhandled property Set |%S| Id %u Flags %x\n", GuidString.Buffer, Property->Id, Property->Flags);
895  }
896  }
897  else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_ENABLE_EVENT)
898  {
900  }
901  else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_DISABLE_EVENT)
902  {
904  }
905  else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_RESET_STATE)
906  {
907  Status = KsAcquireResetValue(Irp, &ResetValue);
908  DPRINT("Status %x Value %u\n", Status, ResetValue);
909  /* check for success */
910  if (NT_SUCCESS(Status))
911  {
912  //determine state of reset request
913  if (ResetValue == KSRESET_BEGIN)
914  {
915  // start reset process
916  // incoming read/write requests will be rejected
918 
919  // cancel existing buffers
920  m_IrpQueue->CancelBuffers();
921  }
922  else if (ResetValue == KSRESET_END)
923  {
924  // end of reset process
926  }
927  }
928  }
929  else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_WRITE_STREAM || IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_READ_STREAM)
930  {
931  /* increment total number of packets */
933 
934  DPRINT("New Packet Total %u State %x MinData %u\n", m_TotalPackets, m_State, m_IrpQueue->NumData());
935 
936  /* is the device not currently reset */
937  if (m_ResetState == KSRESET_END)
938  {
939  /* add the mapping */
940  Status = m_IrpQueue->AddMapping(Irp, &Data);
941 
942  /* check for success */
943  if (NT_SUCCESS(Status))
944  {
947  }
948  }
949  else
950  {
951  /* reset request is currently in progress */
953  DPRINT1("NotReady\n");
954  }
955  }
956  else
957  {
959  }
960 
961  if (Status != STATUS_PENDING)
962  {
963  Irp->IoStatus.Status = Status;
965  }
966 
967  return Status;
968 }
969 
970 NTSTATUS
971 NTAPI
974  IN PIRP Irp)
975 {
977 }
978 
979 NTSTATUS
980 NTAPI
983  IN PIRP Irp)
984 {
986 }
987 
988 NTSTATUS
989 NTAPI
992  IN PIRP Irp)
993 {
995 }
996 
997 NTSTATUS
998 NTAPI
1001  IN PIRP Irp)
1002 {
1003  DPRINT("CPortPinWaveCyclic::Close entered\n");
1004 
1006 
1007  if (m_Format)
1008  {
1009  // free format
1011 
1012  // format is freed
1013  m_Format = NULL;
1014  }
1015 
1016  if (m_IrpQueue)
1017  {
1018  // cancel remaining irps
1019  m_IrpQueue->CancelBuffers();
1020 
1021  // release irp queue
1022  m_IrpQueue->Release();
1023 
1024  // queue is freed
1025  m_IrpQueue = NULL;
1026  }
1027 
1028  if (m_ServiceGroup)
1029  {
1030  // remove member from service group
1031  m_ServiceGroup->RemoveMember(PSERVICESINK(this));
1032 
1033  // do not release service group, it is released by the miniport object
1034  m_ServiceGroup = NULL;
1035  }
1036 
1037  if (m_Stream)
1038  {
1039  if (m_State != KSSTATE_STOP)
1040  {
1041  // stop stream
1042  NTSTATUS Status = m_Stream->SetState(KSSTATE_STOP);
1043  if (!NT_SUCCESS(Status))
1044  {
1045  DPRINT("Warning: failed to stop stream with %x\n", Status);
1046  PC_ASSERT(0);
1047  }
1048  }
1049  // set state to stop
1051 
1052  DPRINT("Closing stream at Irql %u\n", KeGetCurrentIrql());
1053 
1054  // release stream
1055  m_Stream->Release();
1056 
1057  // stream is now freed
1058  m_Stream = NULL;
1059  }
1060 
1061 
1062  if (m_Filter)
1063  {
1064  // disconnect pin from filter
1065  m_Filter->FreePin((PPORTPINWAVECYCLIC)this);
1066 
1067  // release filter reference
1068  m_Filter->Release();
1069 
1070  // pin is done with filter
1071  m_Filter = NULL;
1072  }
1073 
1074  if (m_Port)
1075  {
1076  // release reference to port driver
1077  m_Port->Release();
1078 
1079  // work is done for port
1080  m_Port = NULL;
1081  }
1082 
1083  Irp->IoStatus.Information = 0;
1084  Irp->IoStatus.Status = STATUS_SUCCESS;
1086 
1087  delete this;
1088 
1089  return STATUS_SUCCESS;
1090 }
1091 
1092 NTSTATUS
1093 NTAPI
1094 CPortPinWaveCyclic::QuerySecurity(
1096  IN PIRP Irp)
1097 {
1099 }
1100 
1101 NTSTATUS
1102 NTAPI
1103 CPortPinWaveCyclic::SetSecurity(
1105  IN PIRP Irp)
1106 {
1108 }
1109 
1110 BOOLEAN
1111 NTAPI
1112 CPortPinWaveCyclic::FastDeviceIoControl(
1114  IN BOOLEAN Wait,
1120  OUT PIO_STATUS_BLOCK StatusBlock,
1122 {
1124 }
1125 
1126 
1127 BOOLEAN
1128 NTAPI
1129 CPortPinWaveCyclic::FastRead(
1132  IN ULONG Length,
1133  IN BOOLEAN Wait,
1134  IN ULONG LockKey,
1135  IN PVOID Buffer,
1136  OUT PIO_STATUS_BLOCK StatusBlock,
1138 {
1140 }
1141 
1142 
1143 BOOLEAN
1144 NTAPI
1145 CPortPinWaveCyclic::FastWrite(
1148  IN ULONG Length,
1149  IN BOOLEAN Wait,
1150  IN ULONG LockKey,
1151  IN PVOID Buffer,
1152  OUT PIO_STATUS_BLOCK StatusBlock,
1154 {
1156 }
1157 
1158 
1159 NTSTATUS
1160 NTAPI
1164  IN KSPIN_CONNECT * ConnectDetails,
1165  IN KSPIN_DESCRIPTOR * KsPinDescriptor)
1166 {
1167  NTSTATUS Status;
1169  //PDEVICE_OBJECT DeviceObject;
1170  BOOLEAN Capture;
1171  PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor = NULL;
1172  //IDrmAudioStream * DrmAudio = NULL;
1173 
1174  m_KsPinDescriptor = KsPinDescriptor;
1175  m_ConnectDetails = ConnectDetails;
1177 
1178  //DeviceObject = GetDeviceObject(Port);
1179 
1180  DataFormat = (PKSDATAFORMAT)(ConnectDetails + 1);
1181 
1182  DPRINT("CPortPinWaveCyclic::Init entered Size %u\n", DataFormat->FormatSize);
1183 
1185  if (!NT_SUCCESS(Status))
1186  return Status;
1187 
1188  if (KsPinDescriptor->Communication == KSPIN_COMMUNICATION_SINK && KsPinDescriptor->DataFlow == KSPIN_DATAFLOW_IN)
1189  {
1190  Capture = FALSE;
1191  }
1192  else if (KsPinDescriptor->Communication == KSPIN_COMMUNICATION_SINK && KsPinDescriptor->DataFlow == KSPIN_DATAFLOW_OUT)
1193  {
1194  Capture = TRUE;
1195  }
1196  else
1197  {
1198  DPRINT("Unexpected Communication %u DataFlow %u\n", KsPinDescriptor->Communication, KsPinDescriptor->DataFlow);
1199  DbgBreakPoint();
1200  while(TRUE);
1201  }
1202 
1203 
1204  Status = m_Miniport->NewStream(&m_Stream,
1205  NULL,
1206  NonPagedPool,
1207  ConnectDetails->PinId,
1208  Capture,
1209  DataFormat,
1210  &m_DmaChannel,
1211  &m_ServiceGroup);
1212 #if 0
1213  Status = m_Stream->QueryInterface(IID_IDrmAudioStream, (PVOID*)&DrmAudio);
1214  if (NT_SUCCESS(Status))
1215  {
1217  DPRINT("Got IID_IDrmAudioStream interface %p\n", DrmAudio);
1218 
1220  DrmRights.Reserved = 0;
1222 
1223  Status = DrmAudio->SetContentId(1, &DrmRights);
1224  DPRINT("Status %x\n", Status);
1225  }
1226 #endif
1227 
1228  DPRINT1("CPortPinWaveCyclic::Init Status %x PinId %u Capture %u\n", Status, ConnectDetails->PinId, Capture);
1229 
1230  if (!NT_SUCCESS(Status))
1231  return Status;
1232 
1233  ISubdevice * Subdevice = NULL;
1234  // get subdevice interface
1235  Status = Port->QueryInterface(IID_ISubdevice, (PVOID*)&Subdevice);
1236 
1237  if (!NT_SUCCESS(Status))
1238  return Status;
1239 
1240  Status = Subdevice->GetDescriptor(&SubDeviceDescriptor);
1241  if (!NT_SUCCESS(Status))
1242  {
1243  // failed to get descriptor
1244  Subdevice->Release();
1245  return Status;
1246  }
1247 
1248  /* initialize event management */
1251 
1253  SubDeviceDescriptor->InterfaceCount,
1254  SubDeviceDescriptor->Interfaces,
1255  0, /* FIXME KSINTERFACE_STANDARD with KSINTERFACE_STANDARD_STREAMING / KSINTERFACE_STANDARD_LOOPED_STREAMING */
1256  NULL,
1257  sizeof(PinWaveCyclicPropertySet) / sizeof(KSPROPERTY_SET),
1259  0,
1260  0,
1261  0,
1262  NULL,
1263  sizeof(PinWaveCyclicEventSet) / sizeof(KSEVENT_SET),
1265  SubDeviceDescriptor->DeviceDescriptor);
1266 
1268  m_Descriptor->UnknownMiniport = SubDeviceDescriptor->UnknownMiniport;
1269  m_Descriptor->PortPin = (PVOID)this;
1272 
1273  // initialize reset state
1275 
1276  // release subdevice descriptor
1277  Subdevice->Release();
1278 
1279  // add ourselves to service group
1280  Status = m_ServiceGroup->AddMember(PSERVICESINK(this));
1281  if (!NT_SUCCESS(Status))
1282  {
1283  DPRINT("Failed to add pin to service group\n");
1284  return Status;
1285  }
1286 
1287  m_Stream->SetState(KSSTATE_STOP);
1290  m_CommonBufferSize = m_DmaChannel->AllocatedBufferSize();
1291  m_CommonBuffer = m_DmaChannel->SystemAddress();
1292  m_Capture = Capture;
1293  // delay of 10 millisec
1294  m_Delay = Int32x32To64(10, -10000);
1295 
1296  // sanity checks
1299 
1300  Status = m_Stream->SetNotificationFreq(10, &m_FrameSize);
1303 
1304  DPRINT1("Bits %u Samples %u Channels %u Tag %u FrameSize %u CommonBufferSize %lu, CommonBuffer %p\n", ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.wBitsPerSample, ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.nSamplesPerSec, ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.nChannels, ((PKSDATAFORMAT_WAVEFORMATEX)(DataFormat))->WaveFormatEx.wFormatTag, m_FrameSize, m_CommonBufferSize, m_DmaChannel->SystemAddress());
1305 
1306 
1307  /* set up allocator framing */
1314 
1316 
1317  Status = m_IrpQueue->Init(ConnectDetails, KsPinDescriptor, m_FrameSize, 0, FALSE);
1318  if (!NT_SUCCESS(Status))
1319  {
1320  m_IrpQueue->Release();
1321  return Status;
1322  }
1323 
1325  if (!m_Format)
1327 
1329 
1330  Port->AddRef();
1331  Filter->AddRef();
1332 
1333  m_Port = Port;
1334  m_Filter = Filter;
1335 
1336  return STATUS_SUCCESS;
1337 }
1338 
1339 
1340 ULONG
1341 NTAPI
1342 CPortPinWaveCyclic::GetCompletedPosition()
1343 {
1344  UNIMPLEMENTED;
1345  return 0;
1346 }
1347 
1348 
1349 ULONG
1350 NTAPI
1351 CPortPinWaveCyclic::GetCycleCount()
1352 {
1353  UNIMPLEMENTED;
1354  return 0;
1355 }
1356 
1357 
1358 ULONG
1359 NTAPI
1360 CPortPinWaveCyclic::GetDeviceBufferSize()
1361 {
1362  return m_CommonBufferSize;
1363 }
1364 
1365 
1366 PVOID
1367 NTAPI
1368 CPortPinWaveCyclic::GetIrpStream()
1369 {
1370  return (PVOID)m_IrpQueue;
1371 }
1372 
1373 
1374 PMINIPORT
1375 NTAPI
1376 CPortPinWaveCyclic::GetMiniport()
1377 {
1378  return (PMINIPORT)m_Miniport;
1379 }
1380 
1381 
1382 NTSTATUS
1384  OUT IPortPinWaveCyclic ** OutPin)
1385 {
1387 
1389  if (!This)
1391 
1392  This->AddRef();
1393 
1394  // store result
1395  *OutPin = (IPortPinWaveCyclic*)This;
1396 
1397  return STATUS_SUCCESS;
1398 }
1399 
KSDDKAPI NTSTATUS NTAPI KsDefaultDeviceIoCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1172
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
IServiceGroup * PSERVICEGROUP
Definition: portcls.h:614
BOOL DigitalOutputDisable
Definition: drmk.h:21
NTSTATUS NTAPI PinWaveCyclicAddLoopedStreamEvent(IN PIRP Irp, IN PKSEVENTDATA EventData, IN PKSEVENT_ENTRY EventEntry)
static PWSTR GuidString
Definition: apphelp.c:91
CPPORT Port[4]
Definition: headless.c:34
#define IOCTL_KS_PROPERTY
Definition: ks.h:150
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define IN
Definition: typedefs.h:38
#define KSPROPSETID_DrmAudioStream
Definition: ksmedia.h:1051
_In_ BOOLEAN Read
Definition: strmini.h:479
friend NTSTATUS NTAPI PinWaveCyclicAudioPosition(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
Definition: drmk.h:18
IDmaChannel * PDMACHANNEL
Definition: portcls.h:772
#define IOCTL_KS_WRITE_STREAM
Definition: ks.h:157
NTSTATUS NTAPI PcHandlePropertyWithTable(IN PIRP Irp, IN ULONG PropertySetCount, IN PKSPROPERTY_SET PropertySet, IN PSUBDEVICE_DESCRIPTOR Descriptor)
Definition: undoc.cpp:81
#define REFIID
Definition: guiddef.h:113
#define TRUE
Definition: types.h:120
KSPIN_INTERFACE Interface
Definition: ks.h:2630
#define IOCTL_KS_DISABLE_EVENT
Definition: ks.h:127
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define KSDATAFORMAT_SUBTYPE_PCM
Definition: ksmedia.h:921
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define PC_ASSERT(exp)
Definition: usbehci.h:17
NTSTATUS NTAPI PinWaveCyclicAddEndOfStreamEvent(IN PIRP Irp, IN PKSEVENTDATA EventData, IN PKSEVENT_ENTRY EventEntry)
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG IoControlCode
Definition: fltkernel.h:1383
PKSPIN_LOCK EventListLock
Definition: interfaces.hpp:215
struct _Entry Entry
Definition: kefuncs.h:640
_In_ BOOLEAN Release
Definition: classpnp.h:929
#define FILE_64_BYTE_ALIGNMENT
Definition: nt_native.h:792
_In_ PIRP Irp
Definition: csq.h:116
KSEVENT_ITEM PinWaveCyclicConnectionEventSet
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
IUnknown * PUNKNOWN
Definition: com_apitest.h:45
#define IOCTL_KS_READ_STREAM
Definition: ks.h:164
#define TAG_PORTCLASS
Definition: private.hpp:24
#define KSPROPSETID_Audio
Definition: ksmedia.h:951
static COORD Position
Definition: mouse.c:34
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG OldOffset
Definition: shell.c:90
PLIST_ENTRY NTAPI ExInterlockedInsertTailList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:140
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
VOID NTAPI KeAcquireSpinLockAtDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:192
LONG NTSTATUS
Definition: precomp.h:26
DEFINE_KSPROPERTY_DRMSET(PinWaveCyclicDRMSet, PinWaveCyclicDRMHandler)
#define CALLBACK
Definition: compat.h:27
#define KSEVENTSETID_Connection
Definition: ksmedia.h:1036
VOID UpdateCommonBuffer(ULONG Position, ULONG MaxTransferCount)
KSAUDIO_POSITION m_Position
PMINIPORTWAVECYCLIC GetWaveCyclicMiniport(IN IPortWaveCyclic *iface)
KSDDKAPI BOOLEAN NTAPI KsDispatchFastIoDeviceControlFailure(IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, IN PVOID InputBuffer OPTIONAL, IN ULONG InputBufferLength, OUT PVOID OutputBuffer OPTIONAL, IN ULONG OutputBufferLength, IN ULONG IoControlCode, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: irp.c:1218
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG _In_ ULONG OutputBufferLength
Definition: fltkernel.h:1374
IServiceSink * PSERVICESINK
Definition: portcls.h:569
CPortPinWaveCyclic(IUnknown *OuterUnknown)
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
PLIST_ENTRY EventList
Definition: interfaces.hpp:214
PIO_WORKITEM WorkItem
BOOL Init(PUSERCONNECT UserCon)
Definition: dllmain.c:367
CPortPinWaveCyclic * Pin
KSALLOCATOR_FRAMING m_AllocatorFraming
static BOOL Write(PBYTE Address, PBYTE Data, SIZE_T Size)
Definition: vmhorizon.c:15
void DbgBreakPoint()
Definition: mach.c:558
VOID NTAPI IoFreeWorkItem(IN PIO_WORKITEM IoWorkItem)
Definition: iowork.c:64
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
NTSTATUS NTAPI PinWaveCyclicDataFormat(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
ULONG Reserved
Definition: drmk.h:20
VOID UpdateCommonBufferOverlap(ULONG Position, ULONG MaxTransferCount)
#define KSPROPSETID_Connection
Definition: ks.h:376
KSPIN_LOCK m_EventListLock
CHAR InputBuffer[80]
Definition: conmgr.c:33
_In_ UINT _In_ UINT BytesToCopy
Definition: ndis.h:3167
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define IOCTL_KS_RESET_STATE
Definition: ks.h:171
#define KSDATAFORMAT_SPECIFIER_WAVEFORMATEX
Definition: ksmedia.h:931
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:233
_In_ NDIS_HANDLE _In_ PNDIS_REQUEST Request
Definition: ndis.h:5173
struct SETPIN_CONTEXT * PSETPIN_CONTEXT
NTSTATUS NewPortPinWaveCyclic(OUT IPortPinWaveCyclic **OutPin)
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
IIrpQueue * m_IrpQueue
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
enum KSSTATE * PKSSTATE
#define KSALLOCATOR_REQUIREMENTF_SYSTEM_MEMORY
Definition: ks.h:1715
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
_In_ ULONG BufferLength
Definition: usbdlib.h:225
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
NTSTATUS NTAPI PcHandleDisableEventWithTable(IN PIRP Irp, IN PSUBDEVICE_DESCRIPTOR Descriptor)
Definition: undoc.cpp:67
#define STDMETHODIMP
Definition: basetyps.h:43
friend NTSTATUS NTAPI PinWaveCyclicDataFormat(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
struct _KSEVENT_ENTRY KSEVENT_ENTRY
Definition: ks.h:2131
IPortPinWaveCyclic * PPORTPINWAVECYCLIC
Definition: interfaces.hpp:797
ULONG RequirementsFlags
Definition: ks.h:1693
friend NTSTATUS NTAPI PinWaveCyclicAddEndOfStreamEvent(IN PIRP Irp, IN PKSEVENTDATA EventData, IN PKSEVENT_ENTRY EventEntry)
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
const GUID KSEVENTSETID_LoopedStreaming
Definition: capturebuffer.c:18
NTSTATUS NTAPI PinWaveCyclicState(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
unsigned char BOOLEAN
NTSTATUS NTAPI PcCreateSubdeviceDescriptor(OUT SUBDEVICE_DESCRIPTOR **OutSubdeviceDescriptor, IN ULONG InterfaceCount, IN GUID *InterfaceGuids, IN ULONG IdentifierCount, IN KSIDENTIFIER *Identifier, IN ULONG FilterPropertiesCount, IN KSPROPERTY_SET *FilterProperties, IN ULONG Unknown1, IN ULONG Unknown2, IN ULONG PinPropertiesCount, IN KSPROPERTY_SET *PinProperties, IN ULONG EventSetCount, IN KSEVENT_SET *EventSet, IN PPCFILTER_DESCRIPTOR FilterDescription)
Definition: undoc.cpp:730
smooth NULL
Definition: ftsmooth.c:416
struct LOOPEDSTREAMING_EVENT_CONTEXT * PLOOPEDSTREAMING_EVENT_CONTEXT
ULONG Frames
Definition: ks.h:1700
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:778
#define IoCompleteRequest
Definition: irp.c:1240
STDMETHODIMP_(ULONG) AddRef()
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
void * PVOID
Definition: retypes.h:9
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
friend VOID CALLBACK PinSetStateWorkerRoutine(IN PDEVICE_OBJECT DeviceObject, IN PVOID Context)
KSDDKAPI NTSTATUS NTAPI KsGenerateEvent(IN PKSEVENT_ENTRY EntryEvent)
Definition: event.c:608
NTSTATUS NTAPI PinWaveCyclicAudioPosition(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2650
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:359
#define STATUS_NOT_FOUND
Definition: shellext.h:67
NTSTATUS NTAPI PinWaveCyclicDRMHandler(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
DWORDLONG PlayOffset
Definition: ksmedia.h:1150
BOOL CopyProtect
Definition: drmk.h:19
KSDDKAPI NTSTATUS NTAPI KsDispatchInvalidDeviceRequest(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1156
#define KSALLOCATOR_REQUIREMENTF_PREFERENCES_ONLY
Definition: ks.h:1718
ULONG Id
Definition: dmksctrl.h:77
if(!(yy_init))
Definition: macro.lex.yy.c:714
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:415
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
STDMETHODIMP_(ULONG) Release()
INT POOL_TYPE
Definition: typedefs.h:76
uint64_t ULONGLONG
Definition: typedefs.h:65
const GUID IID_IUnknown
VOID NTAPI KeReleaseSpinLockFromDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:215
IMiniportWaveCyclicStream * PMINIPORTWAVECYCLICSTREAM
Definition: portcls.h:1468
PMINIPORTWAVECYCLICSTREAM m_Stream
ULONG Reserved
Definition: ks.h:1703
#define BufferSize
Definition: classpnp.h:419
nsrefcnt Release()
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
* PFILE_OBJECT
Definition: iotypes.h:1954
KSEVENT_SET PinWaveCyclicEventSet[]
ULONG AddRef()
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
IPortFilterWaveCyclic * m_Filter
#define InterlockedDecrement
Definition: armddk.h:52
#define IOCTL_KS_ENABLE_EVENT
Definition: ks.h:134
Definition: arc.h:85
IPortWaveCyclic * m_Port
Definition: typedefs.h:117
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define KSDATAFORMAT_TYPE_AUDIO
Definition: ksmedia.h:883
PDMACHANNEL m_DmaChannel
#define STATUS_MORE_ENTRIES
Definition: udferr_usr.h:124
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG InputBufferLength
Definition: fltkernel.h:1372
Status
Definition: gdiplustypes.h:24
ULONG PoolType
Definition: ks.h:1698
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
_In_ DWORD Property
Definition: setupapi.h:1545
KSPIN_DESCRIPTOR * m_KsPinDescriptor
friend NTSTATUS NTAPI PinWaveCyclicState(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
VOID CALLBACK PinSetStateWorkerRoutine(IN PDEVICE_OBJECT DeviceObject, IN PVOID Context)
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
IMiniportWaveCyclic * PMINIPORTWAVECYCLIC
Definition: portcls.h:1524
enum State_ State
Definition: pofuncs.h:54
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define InterlockedIncrement
Definition: armddk.h:53
KSSTATE
Definition: ks.h:1244
DWORDLONG WriteOffset
Definition: ksmedia.h:1151
Definition: sacdrv.h:267
KSDDKAPI BOOLEAN NTAPI KsDispatchFastReadFailure(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: irp.c:1238
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:151
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
friend NTSTATUS NTAPI PinWaveCyclicAddLoopedStreamEvent(IN PIRP Irp, IN PKSEVENTDATA EventData, IN PKSEVENT_ENTRY EventEntry)
PMINIPORTWAVECYCLIC m_Miniport
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
DEFINE_KSPROPERTY_CONNECTIONSET(PinWaveCyclicConnectionSet, PinWaveCyclicState, PinWaveCyclicDataFormat, PinWaveCyclicAllocatorFraming)
PKSDATAFORMAT m_Format
#define min(a, b)
Definition: monoChain.cc:55
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
KSEVENT_ITEM PinWaveCyclicStreamingEventSet
virtual ~CPortPinWaveCyclic()
#define DPRINT1
Definition: precomp.h:8
PKSPIN_CONNECT m_ConnectDetails
VOID GeneratePositionEvents(IN ULONGLONG OldOffset, IN ULONGLONG NewOffset)
struct ENDOFSTREAM_EVENT_CONTEXT * PENDOFSTREAM_EVENT_CONTEXT
PSUBDEVICE_DESCRIPTOR m_Descriptor
#define OUT
Definition: typedefs.h:39
KSPROPERTY_SET PinWaveCyclicPropertySet[]
struct tagContext Context
Definition: acpixf.h:1012
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:565
#define UNIMPLEMENTED
Definition: debug.h:114
PPCFILTER_DESCRIPTOR DeviceDescriptor
Definition: interfaces.hpp:217
struct KSIDENTIFIER * PKSPROPERTY
struct _KSEVENT_ENTRY * PKSEVENT_ENTRY
Definition: ks.h:2131
_Out_ PDRMRIGHTS DrmRights
Definition: drmk.h:84
NTSTATUS NTAPI NewIrpQueue(IN IIrpQueue **Queue)
Definition: irpstream.cpp:808
PKSPROPERTY_SET FilterPropertySet
Definition: interfaces.hpp:210
PSERVICEGROUP m_ServiceGroup
IPortFilterWaveCyclic * PPORTFILTERWAVECYCLIC
Definition: interfaces.hpp:760
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
ULONG FileAlignment
Definition: ks.h:1702
KSDDKAPI NTSTATUS NTAPI KsAcquireResetValue(IN PIRP Irp, OUT KSRESET *ResetValue)
Definition: api.c:23
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2777
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T _In_ POOL_TYPE PoolType
Definition: fltkernel.h:1444
signed int * PLONG
Definition: retypes.h:5
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
struct SUBDEVICE_DESCRIPTOR * PSUBDEVICE_DESCRIPTOR
IPortWaveCyclic * PPORTWAVECYCLIC
Definition: portcls.h:1172
ULONG FrameSize
Definition: ks.h:1701
base of all file and directory entries
Definition: entries.h:82
#define Int32x32To64(a, b)
struct KSAUDIO_POSITION * PKSAUDIO_POSITION
friend NTSTATUS NTAPI PinWaveCyclicAllocatorFraming(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
NTSTATUS NTAPI PcHandleEnableEventWithTable(IN PIRP Irp, IN PSUBDEVICE_DESCRIPTOR Descriptor)
Definition: undoc.cpp:54
#define PC_ASSERT_IRQL(x)
Definition: private.hpp:30
DEFINE_KSPROPERTY_AUDIOSET(PinWaveCyclicAudioSet, PinWaveCyclicAudioPosition)
KSDATAFORMAT * PKSDATAFORMAT
KSRESET
Definition: ks.h:1256
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:65
IN BOOLEAN Wait
Definition: fatprocs.h:1529
NTSTATUS NTAPI PinWaveCyclicAllocatorFraming(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966