ReactOS  0.4.14-dev-583-g2a1ba2c
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:
21  inline
22  PVOID
23  operator new(
24  size_t Size,
26  ULONG Tag)
27  {
29  if (P)
31  return P;
32  }
33 
35 
37  {
39  return m_Ref;
40  }
42  {
44 
45  if (!m_Ref)
46  {
47  delete this;
48  return 0;
49  }
50  return m_Ref;
51  }
54  CPortPinWaveCyclic(IUnknown *OuterUnknown){}
55  virtual ~CPortPinWaveCyclic(){}
56 
57 protected:
58 
59  VOID UpdateCommonBuffer(ULONG Position, ULONG MaxTransferCount);
62 
70 
71  IPortWaveCyclic * m_Port;
72  IPortFilterWaveCyclic * m_Filter;
73  KSPIN_DESCRIPTOR * m_KsPinDescriptor;
81 
85 
86  IIrpQueue * m_IrpQueue;
87 
90 
96 
99 
101 
103 
105 };
106 
107 
108 typedef struct
109 {
113 
114 typedef struct
115 {
118 
119 
120 
128 
129 
133 
135 {
137  sizeof(KSEVENTDATA),
140  0,
141  0
142 };
143 
145 {
150  0,
151  0
152 };
153 
154 
155 KSPROPERTY_SET PinWaveCyclicPropertySet[] =
156 {
157  {
159  sizeof(PinWaveCyclicConnectionSet) / sizeof(KSPROPERTY_ITEM),
160  (const KSPROPERTY_ITEM*)&PinWaveCyclicConnectionSet,
161  0,
162  NULL
163  },
164  {
166  sizeof(PinWaveCyclicAudioSet) / sizeof(KSPROPERTY_ITEM),
167  (const KSPROPERTY_ITEM*)&PinWaveCyclicAudioSet,
168  0,
169  NULL
170  },
171  {
173  sizeof(PinWaveCyclicDRMSet) / sizeof(KSPROPERTY_ITEM),
174  (const KSPROPERTY_ITEM*)&PinWaveCyclicDRMSet,
175  0,
176  NULL
177  }
178 };
179 
180 KSEVENT_SET PinWaveCyclicEventSet[] =
181 {
182  {
184  sizeof(PinWaveCyclicStreamingEventSet) / sizeof(KSEVENT_ITEM),
185  (const KSEVENT_ITEM*)&PinWaveCyclicStreamingEventSet
186  },
187  {
189  sizeof(PinWaveCyclicConnectionEventSet) / sizeof(KSEVENT_ITEM),
190  (const KSEVENT_ITEM*)&PinWaveCyclicConnectionEventSet
191  }
192 };
193 
194 
195 //==================================================================================================================================
196 
197 NTSTATUS
198 NTAPI
200  IN REFIID refiid,
201  OUT PVOID* Output)
202 {
203  DPRINT("IServiceSink_fnQueryInterface entered\n");
204 
205  if (IsEqualGUIDAligned(refiid, IID_IIrpTarget) ||
207  {
208  *Output = PVOID(PUNKNOWN((IIrpTarget*)this));
209  PUNKNOWN(*Output)->AddRef();
210  return STATUS_SUCCESS;
211  }
212 
213  if (IsEqualGUIDAligned(refiid, IID_IServiceSink))
214  {
215  *Output = PVOID(PUNKNOWN(PSERVICESINK(this)));
216  PUNKNOWN(*Output)->AddRef();
217  return STATUS_SUCCESS;
218  }
219 
220  return STATUS_UNSUCCESSFUL;
221 }
222 
223 NTSTATUS
224 NTAPI
226  IN PIRP Irp,
228  IN OUT PVOID Data)
229 {
230  DPRINT1("PinWaveCyclicDRMHandler\n");
231  ASSERT(0);
233 }
234 
235 
236 NTSTATUS
237 NTAPI
239  IN PIRP Irp,
240  IN PKSEVENTDATA EventData,
241  IN PKSEVENT_ENTRY EventEntry)
242 {
246 
247  // get sub device descriptor
248  Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
249 
250  // sanity check
252  PC_ASSERT(Descriptor->PortPin);
254 
255  // cast to pin impl
256  Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
257 
258  // get extra size
259  Entry = (PENDOFSTREAM_EVENT_CONTEXT)(EventEntry + 1);
260 
261  // not a looped event
262  Entry->bLoopedStreaming = FALSE;
263 
264  // insert item
265  (void)ExInterlockedInsertTailList(&Pin->m_EventList, &EventEntry->ListEntry, &Pin->m_EventListLock);
266 
267  // done
268  return STATUS_SUCCESS;
269 }
270 
271 NTSTATUS
272 NTAPI
274  IN PIRP Irp,
275  IN PKSEVENTDATA EventData,
276  IN PKSEVENT_ENTRY EventEntry)
277 {
282 
283  // get sub device descriptor
284  Descriptor = (PSUBDEVICE_DESCRIPTOR)KSEVENT_ITEM_IRP_STORAGE(Irp);
285 
286  // sanity check
288  PC_ASSERT(Descriptor->PortPin);
290 
291  // cast to pin impl
292  Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
293 
294  // cast to looped event
296 
297  // get extra size
298  Entry = (PLOOPEDSTREAMING_EVENT_CONTEXT)(EventEntry + 1);
299 
300  Entry->bLoopedStreaming = TRUE;
301  Entry->Position = Data->Position;
302 
303  DPRINT1("Added event\n");
304 
305  // insert item
306  (void)ExInterlockedInsertTailList(&Pin->m_EventList, &EventEntry->ListEntry, &Pin->m_EventListLock);
307 
308  // done
309  return STATUS_SUCCESS;
310 }
311 
312 NTSTATUS
313 NTAPI
315  IN PIRP Irp,
317  IN OUT PVOID Data)
318 {
321 
322  // get sub device descriptor
323  Descriptor = (PSUBDEVICE_DESCRIPTOR)KSEVENT_ITEM_IRP_STORAGE(Irp);
324 
325  // sanity check
327  PC_ASSERT(Descriptor->PortPin);
329 
330  // cast to pin impl
331  Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
332 
333 
334  if (Request->Flags & KSPROPERTY_TYPE_GET)
335  {
336  // copy pin framing
337  RtlMoveMemory(Data, &Pin->m_AllocatorFraming, sizeof(KSALLOCATOR_FRAMING));
338 
339  Irp->IoStatus.Information = sizeof(KSALLOCATOR_FRAMING);
340  return STATUS_SUCCESS;
341  }
342 
343  // not supported
344  return STATUS_NOT_SUPPORTED;
345 }
346 
347 NTSTATUS
348 NTAPI
350  IN PIRP Irp,
352  IN OUT PVOID Data)
353 {
357 
358  // get sub device descriptor
359  Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
360 
361  // sanity check
363  PC_ASSERT(Descriptor->PortPin);
365 
366  // cast to pin impl
367  Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
368 
369  //sanity check
370  PC_ASSERT(Pin->m_Stream);
371 
372  if (Request->Flags & KSPROPERTY_TYPE_GET)
373  {
374  // FIXME non multithreading-safe
375  // copy audio position
376 
378 
379  if (Pin->m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_STREAMING)
380  {
381  RtlMoveMemory(Data, &Pin->m_Position, sizeof(KSAUDIO_POSITION));
382  DPRINT("Play %lu Record %lu\n", Pin->m_Position.PlayOffset, Pin->m_Position.WriteOffset);
383  }
384  else if (Pin->m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING)
385  {
386  Position->PlayOffset = Pin->m_Position.PlayOffset;
387  Position->WriteOffset = (ULONGLONG)Pin->m_IrpQueue->GetCurrentIrpOffset();
388  DPRINT("Play %lu Write %lu\n", Position->PlayOffset, Position->WriteOffset);
389  }
390 
391  Irp->IoStatus.Information = sizeof(KSAUDIO_POSITION);
392  return STATUS_SUCCESS;
393  }
394 
395  // not supported
396  return STATUS_NOT_SUPPORTED;
397 }
398 
399 typedef struct
400 {
405 
407 
408 VOID
409 CALLBACK
412  IN PVOID Context)
413 {
414  PSETPIN_CONTEXT PinWorkContext = (PSETPIN_CONTEXT)Context;
416 
417  // try set stream
418  Status = PinWorkContext->Pin->m_Stream->SetState(PinWorkContext->NewState);
419 
420  DPRINT1("Setting state %u %x\n", PinWorkContext->NewState, Status);
421  if (NT_SUCCESS(Status))
422  {
423  // store new state
424  PinWorkContext->Pin->m_State = PinWorkContext->NewState;
425 
426  if (PinWorkContext->Pin->m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING && PinWorkContext->Pin->m_State == KSSTATE_STOP)
427  {
428  /* FIXME complete pending irps with successful state */
429  PinWorkContext->Pin->m_IrpQueue->CancelBuffers();
430  }
431  //HACK
432  //PinWorkContext->Pin->m_IrpQueue->CancelBuffers();
433  }
434 
435  // store result
436  PinWorkContext->Irp->IoStatus.Information = sizeof(KSSTATE);
437  PinWorkContext->Irp->IoStatus.Status = Status;
438 
439  // complete irp
440  IoCompleteRequest(PinWorkContext->Irp, IO_NO_INCREMENT);
441 
442  // free work item
443  IoFreeWorkItem(PinWorkContext->WorkItem);
444 
445  // free work context
446  FreeItem(PinWorkContext, TAG_PORTCLASS);
447 
448 }
449 
450 
451 NTSTATUS
452 NTAPI
454  IN PIRP Irp,
456  IN OUT PVOID Data)
457 {
462 
463  // get sub device descriptor
464  Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
465 
466  // sanity check
468  PC_ASSERT(Descriptor->PortPin);
470 
471  // cast to pin impl
472  Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
473 
474  //sanity check
475  PC_ASSERT(Pin->m_Stream);
476 
477  if (Request->Flags & KSPROPERTY_TYPE_SET)
478  {
479  // try set stream
480  Status = Pin->m_Stream->SetState(*State);
481 
482  DPRINT("Setting state %u %x\n", *State, Status);
483  if (NT_SUCCESS(Status))
484  {
485  // store new state
486  Pin->m_State = *State;
487 
488  if (Pin->m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_LOOPED_STREAMING && Pin->m_State == KSSTATE_STOP)
489  {
490  // FIXME
491  // complete with successful state
492  Pin->m_Stream->Silence(Pin->m_CommonBuffer, Pin->m_CommonBufferSize);
493  Pin->m_IrpQueue->CancelBuffers();
494  Pin->m_Position.PlayOffset = 0;
495  Pin->m_Position.WriteOffset = 0;
496  }
497  else if (Pin->m_State == KSSTATE_STOP)
498  {
499  Pin->m_Stream->Silence(Pin->m_CommonBuffer, Pin->m_CommonBufferSize);
500  Pin->m_IrpQueue->CancelBuffers();
501  Pin->m_Position.PlayOffset = 0;
502  Pin->m_Position.WriteOffset = 0;
503  }
504  // store result
505  Irp->IoStatus.Information = sizeof(KSSTATE);
506  }
507  return Status;
508  }
509  else if (Request->Flags & KSPROPERTY_TYPE_GET)
510  {
511  // get current stream state
512  *State = Pin->m_State;
513  // store result
514  Irp->IoStatus.Information = sizeof(KSSTATE);
515 
516  return STATUS_SUCCESS;
517  }
518 
519  // unsupported request
520  return STATUS_NOT_SUPPORTED;
521 }
522 
523 NTSTATUS
524 NTAPI
526  IN PIRP Irp,
528  IN OUT PVOID Data)
529 {
533  PIO_STACK_LOCATION IoStack;
534 
535  // get current irp stack location
537 
538  // get sub device descriptor
539  Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
540 
541  // sanity check
543  PC_ASSERT(Descriptor->PortPin);
544 
545  // cast to pin impl
546  Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
547 
548  //sanity check
549  PC_ASSERT(Pin->m_Stream);
550  PC_ASSERT(Pin->m_Format);
551 
552  if (Request->Flags & KSPROPERTY_TYPE_SET)
553  {
554  // try to change data format
555  PKSDATAFORMAT NewDataFormat, DataFormat = (PKSDATAFORMAT)Irp->UserBuffer;
556  ULONG Size = min(Pin->m_Format->FormatSize, DataFormat->FormatSize);
557 
558  if (RtlCompareMemory(DataFormat, Pin->m_Format, Size) == Size)
559  {
560  // format is identical
561  Irp->IoStatus.Information = DataFormat->FormatSize;
562  return STATUS_SUCCESS;
563  }
564 
565  // new change request
566  PC_ASSERT(Pin->m_State != KSSTATE_RUN);
567  // FIXME queue a work item when Irql != PASSIVE_LEVEL
569 
570  // allocate new data format
571  NewDataFormat = (PKSDATAFORMAT)AllocateItem(NonPagedPool, DataFormat->FormatSize, TAG_PORTCLASS);
572  if (!NewDataFormat)
573  {
574  // not enough memory
575  return STATUS_NO_MEMORY;
576  }
577 
578  // copy new data format
579  RtlMoveMemory(NewDataFormat, DataFormat, DataFormat->FormatSize);
580 
581  // set new format
582  Status = Pin->m_Stream->SetFormat(NewDataFormat);
583  if (NT_SUCCESS(Status))
584  {
585  // free old format
586  FreeItem(Pin->m_Format, TAG_PORTCLASS);
587 
588  // store new format
589  Pin->m_Format = NewDataFormat;
590  Irp->IoStatus.Information = NewDataFormat->FormatSize;
591 
592 #if 0
593  PC_ASSERT(NewDataFormat->FormatSize == sizeof(KSDATAFORMAT_WAVEFORMATEX));
597 
598 
599  DPRINT("NewDataFormat: Channels %u Bits %u Samples %u\n", ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.nChannels,
600  ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.wBitsPerSample,
601  ((PKSDATAFORMAT_WAVEFORMATEX)NewDataFormat)->WaveFormatEx.nSamplesPerSec);
602 #endif
603 
604  }
605  else
606  {
607  // failed to set format
608  FreeItem(NewDataFormat, TAG_PORTCLASS);
609  }
610 
611 
612  // done
613  return Status;
614  }
615  else if (Request->Flags & KSPROPERTY_TYPE_GET)
616  {
617  // get current data format
618  PC_ASSERT(Pin->m_Format);
619 
620  if (Pin->m_Format->FormatSize > IoStack->Parameters.DeviceIoControl.OutputBufferLength)
621  {
622  // buffer too small
623  Irp->IoStatus.Information = Pin->m_Format->FormatSize;
624  return STATUS_MORE_ENTRIES;
625  }
626  // copy data format
627  RtlMoveMemory(Data, Pin->m_Format, Pin->m_Format->FormatSize);
628  // store result size
629  Irp->IoStatus.Information = Pin->m_Format->FormatSize;
630 
631  // done
632  return STATUS_SUCCESS;
633  }
634 
635  // unsupported request
636  return STATUS_NOT_SUPPORTED;
637 }
638 
639 VOID
642  IN ULONGLONG NewOffset)
643 {
645  PKSEVENT_ENTRY EventEntry;
647 
648  // acquire event lock
650 
651  // point to first entry
653 
654  while(Entry != &m_EventList)
655  {
656  // get event entry
657  EventEntry = (PKSEVENT_ENTRY)CONTAINING_RECORD(Entry, KSEVENT_ENTRY, ListEntry);
658 
659  // get event entry context
660  Context = (PLOOPEDSTREAMING_EVENT_CONTEXT)(EventEntry + 1);
661 
662  if (Context->bLoopedStreaming != FALSE)
663  {
664  if (NewOffset > OldOffset)
665  {
666  /* buffer progress no overlap */
667  if (OldOffset < Context->Position && Context->Position <= NewOffset)
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  else
678  {
679  /* buffer wrap-arround */
680  if (OldOffset < Context->Position || NewOffset > Context->Position)
681  {
682  /* when someone eventually fixes sprintf... */
683  DPRINT("Generating event at OldOffset %I64u\n", OldOffset);
684  DPRINT("Context->Position %I64u\n", Context->Position);
685  DPRINT("NewOffset %I64u\n", NewOffset);
686  /* generate event */
687  KsGenerateEvent(EventEntry);
688  }
689  }
690  }
691 
692  // move to next entry
693  Entry = Entry->Flink;
694  }
695 
696  // release lock
698 }
699 
700 VOID
702  ULONG Position,
703  ULONG MaxTransferCount)
704 {
708  ULONG Gap;
709  PUCHAR Buffer;
711 
713  BufferLength = min(BufferLength, MaxTransferCount);
714 
715  while(BufferLength)
716  {
717  Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
718  if (!NT_SUCCESS(Status))
719  {
721  if (Gap > BufferLength)
722  {
723  // insert silence samples
724  DPRINT("Inserting Silence Buffer Offset %lu GapLength %lu\n", m_CommonBufferOffset, BufferLength);
726 
728  }
729  break;
730  }
731 
733 
734  if (m_Capture)
735  {
737  }
738  else
739  {
741  }
742 
743  m_IrpQueue->UpdateMapping(BytesToCopy);
745 
748 
750  {
752  {
753  // normalize position
755  }
756  }
757  }
758 }
759 
760 VOID
762  ULONG Position,
763  ULONG MaxTransferCount)
764 {
765  ULONG BufferLength, Length, Gap;
768  PUCHAR Buffer;
770 
771 
773  BufferLength = Length = min(BufferLength, MaxTransferCount);
774  while(BufferLength)
775  {
776  Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize);
777  if (!NT_SUCCESS(Status))
778  {
780  if (Gap > BufferLength)
781  {
782  // insert silence samples
783  DPRINT("Overlap Inserting Silence Buffer Size %lu Offset %lu Gap %lu Position %lu\n", m_CommonBufferSize, m_CommonBufferOffset, Gap, Position);
785 
787  }
788  break;
789  }
790 
792 
793  if (m_Capture)
794  {
795  m_DmaChannel->CopyFrom(Buffer,
797  BytesToCopy);
798  }
799  else
800  {
802  Buffer,
803  BytesToCopy);
804  }
805 
806  m_IrpQueue->UpdateMapping(BytesToCopy);
809 
811 
813  {
815  {
816  // normalize position
818  }
819  }
820  }
821 
822  if (Gap == Length)
823  {
825 
826  MaxTransferCount -= Length;
827 
828  if (MaxTransferCount)
829  {
830  UpdateCommonBuffer(Position, MaxTransferCount);
831  }
832  }
833 }
834 
835 VOID
836 NTAPI
837 CPortPinWaveCyclic::RequestService()
838 {
839  ULONG Position;
840  ULONGLONG OldOffset, NewOffset;
841 
843 
845  {
846  m_Stream->GetPosition(&Position);
847 
849 
851  {
853  }
854  else if (Position >= m_CommonBufferOffset)
855  {
857  }
858 
859  NewOffset = m_Position.PlayOffset;
860 
861  GeneratePositionEvents(OldOffset, NewOffset);
862  }
863 }
864 
865 NTSTATUS
866 NTAPI
867 CPortPinWaveCyclic::NewIrpTarget(
868  OUT struct IIrpTarget **OutTarget,
869  IN PCWSTR Name,
873  IN PIRP Irp,
874  IN KSOBJECT_CREATE *CreateObject)
875 {
877  return STATUS_UNSUCCESSFUL;
878 }
879 
880 NTSTATUS
881 NTAPI
884  IN PIRP Irp)
885 {
886  PIO_STACK_LOCATION IoStack;
890  ULONG Data = 0;
891  KSRESET ResetValue;
892 
893  /* get current irp stack location */
895 
896  if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY)
897  {
898  /* handle property with subdevice descriptor */
900 
901  if (Status == STATUS_NOT_FOUND)
902  {
903  Property = (PKSPROPERTY)IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
904 
906  DPRINT("Unhandled property Set |%S| Id %u Flags %x\n", GuidString.Buffer, Property->Id, Property->Flags);
908  }
909  }
910  else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_ENABLE_EVENT)
911  {
913  }
914  else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_DISABLE_EVENT)
915  {
917  }
918  else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_RESET_STATE)
919  {
920  Status = KsAcquireResetValue(Irp, &ResetValue);
921  DPRINT("Status %x Value %u\n", Status, ResetValue);
922  /* check for success */
923  if (NT_SUCCESS(Status))
924  {
925  //determine state of reset request
926  if (ResetValue == KSRESET_BEGIN)
927  {
928  // start reset process
929  // incoming read/write requests will be rejected
931 
932  // cancel existing buffers
933  m_IrpQueue->CancelBuffers();
934  }
935  else if (ResetValue == KSRESET_END)
936  {
937  // end of reset process
939  }
940  }
941  }
942  else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_WRITE_STREAM || IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_READ_STREAM)
943  {
944  /* increment total number of packets */
946 
947  DPRINT("New Packet Total %u State %x MinData %u\n", m_TotalPackets, m_State, m_IrpQueue->NumData());
948 
949  /* is the device not currently reset */
950  if (m_ResetState == KSRESET_END)
951  {
952  /* add the mapping */
953  Status = m_IrpQueue->AddMapping(Irp, &Data);
954 
955  /* check for success */
956  if (NT_SUCCESS(Status))
957  {
960  }
961  }
962  else
963  {
964  /* reset request is currently in progress */
966  DPRINT1("NotReady\n");
967  }
968  }
969  else
970  {
972  }
973 
974  if (Status != STATUS_PENDING)
975  {
976  Irp->IoStatus.Status = Status;
978  }
979 
980  return Status;
981 }
982 
983 NTSTATUS
984 NTAPI
987  IN PIRP Irp)
988 {
990 }
991 
992 NTSTATUS
993 NTAPI
996  IN PIRP Irp)
997 {
999 }
1000 
1001 NTSTATUS
1002 NTAPI
1005  IN PIRP Irp)
1006 {
1008 }
1009 
1010 NTSTATUS
1011 NTAPI
1014  IN PIRP Irp)
1015 {
1016  DPRINT("CPortPinWaveCyclic::Close entered\n");
1017 
1019 
1020  if (m_Format)
1021  {
1022  // free format
1024 
1025  // format is freed
1026  m_Format = NULL;
1027  }
1028 
1029  if (m_IrpQueue)
1030  {
1031  // cancel remaining irps
1032  m_IrpQueue->CancelBuffers();
1033 
1034  // release irp queue
1035  m_IrpQueue->Release();
1036 
1037  // queue is freed
1038  m_IrpQueue = NULL;
1039  }
1040 
1041  if (m_ServiceGroup)
1042  {
1043  // remove member from service group
1044  m_ServiceGroup->RemoveMember(PSERVICESINK(this));
1045 
1046  // do not release service group, it is released by the miniport object
1047  m_ServiceGroup = NULL;
1048  }
1049 
1050  if (m_Stream)
1051  {
1052  if (m_State != KSSTATE_STOP)
1053  {
1054  // stop stream
1055  NTSTATUS Status = m_Stream->SetState(KSSTATE_STOP);
1056  if (!NT_SUCCESS(Status))
1057  {
1058  DPRINT("Warning: failed to stop stream with %x\n", Status);
1059  PC_ASSERT(0);
1060  }
1061  }
1062  // set state to stop
1064 
1065  DPRINT("Closing stream at Irql %u\n", KeGetCurrentIrql());
1066 
1067  // release stream
1068  m_Stream->Release();
1069 
1070  // stream is now freed
1071  m_Stream = NULL;
1072  }
1073 
1074 
1075  if (m_Filter)
1076  {
1077  // disconnect pin from filter
1078  m_Filter->FreePin((PPORTPINWAVECYCLIC)this);
1079 
1080  // release filter reference
1081  m_Filter->Release();
1082 
1083  // pin is done with filter
1084  m_Filter = NULL;
1085  }
1086 
1087  if (m_Port)
1088  {
1089  // release reference to port driver
1090  m_Port->Release();
1091 
1092  // work is done for port
1093  m_Port = NULL;
1094  }
1095 
1096  Irp->IoStatus.Information = 0;
1097  Irp->IoStatus.Status = STATUS_SUCCESS;
1099 
1100  delete this;
1101 
1102  return STATUS_SUCCESS;
1103 }
1104 
1105 NTSTATUS
1106 NTAPI
1107 CPortPinWaveCyclic::QuerySecurity(
1109  IN PIRP Irp)
1110 {
1112 }
1113 
1114 NTSTATUS
1115 NTAPI
1116 CPortPinWaveCyclic::SetSecurity(
1118  IN PIRP Irp)
1119 {
1121 }
1122 
1123 BOOLEAN
1124 NTAPI
1125 CPortPinWaveCyclic::FastDeviceIoControl(
1127  IN BOOLEAN Wait,
1133  OUT PIO_STATUS_BLOCK StatusBlock,
1135 {
1137 }
1138 
1139 
1140 BOOLEAN
1141 NTAPI
1142 CPortPinWaveCyclic::FastRead(
1145  IN ULONG Length,
1146  IN BOOLEAN Wait,
1147  IN ULONG LockKey,
1148  IN PVOID Buffer,
1149  OUT PIO_STATUS_BLOCK StatusBlock,
1151 {
1153 }
1154 
1155 
1156 BOOLEAN
1157 NTAPI
1158 CPortPinWaveCyclic::FastWrite(
1161  IN ULONG Length,
1162  IN BOOLEAN Wait,
1163  IN ULONG LockKey,
1164  IN PVOID Buffer,
1165  OUT PIO_STATUS_BLOCK StatusBlock,
1167 {
1169 }
1170 
1171 
1172 NTSTATUS
1173 NTAPI
1177  IN KSPIN_CONNECT * ConnectDetails,
1178  IN KSPIN_DESCRIPTOR * KsPinDescriptor)
1179 {
1180  NTSTATUS Status;
1182  //PDEVICE_OBJECT DeviceObject;
1183  BOOLEAN Capture;
1184  PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor = NULL;
1185  //IDrmAudioStream * DrmAudio = NULL;
1186 
1187  m_KsPinDescriptor = KsPinDescriptor;
1188  m_ConnectDetails = ConnectDetails;
1190 
1191  //DeviceObject = GetDeviceObject(Port);
1192 
1193  DataFormat = (PKSDATAFORMAT)(ConnectDetails + 1);
1194 
1195  DPRINT("CPortPinWaveCyclic::Init entered Size %u\n", DataFormat->FormatSize);
1196 
1198  if (!NT_SUCCESS(Status))
1199  return Status;
1200 
1201  if (KsPinDescriptor->Communication == KSPIN_COMMUNICATION_SINK && KsPinDescriptor->DataFlow == KSPIN_DATAFLOW_IN)
1202  {
1203  Capture = FALSE;
1204  }
1205  else if (KsPinDescriptor->Communication == KSPIN_COMMUNICATION_SINK && KsPinDescriptor->DataFlow == KSPIN_DATAFLOW_OUT)
1206  {
1207  Capture = TRUE;
1208  }
1209  else
1210  {
1211  DPRINT("Unexpected Communication %u DataFlow %u\n", KsPinDescriptor->Communication, KsPinDescriptor->DataFlow);
1212  DbgBreakPoint();
1213  while(TRUE);
1214  }
1215 
1216 
1217  Status = m_Miniport->NewStream(&m_Stream,
1218  NULL,
1219  NonPagedPool,
1220  ConnectDetails->PinId,
1221  Capture,
1222  DataFormat,
1223  &m_DmaChannel,
1224  &m_ServiceGroup);
1225 #if 0
1226  Status = m_Stream->QueryInterface(IID_IDrmAudioStream, (PVOID*)&DrmAudio);
1227  if (NT_SUCCESS(Status))
1228  {
1230  DPRINT("Got IID_IDrmAudioStream interface %p\n", DrmAudio);
1231 
1233  DrmRights.Reserved = 0;
1235 
1236  Status = DrmAudio->SetContentId(1, &DrmRights);
1237  DPRINT("Status %x\n", Status);
1238  }
1239 #endif
1240 
1241  DPRINT1("CPortPinWaveCyclic::Init Status %x PinId %u Capture %u\n", Status, ConnectDetails->PinId, Capture);
1242 
1243  if (!NT_SUCCESS(Status))
1244  return Status;
1245 
1246  ISubdevice * Subdevice = NULL;
1247  // get subdevice interface
1248  Status = Port->QueryInterface(IID_ISubdevice, (PVOID*)&Subdevice);
1249 
1250  if (!NT_SUCCESS(Status))
1251  return Status;
1252 
1253  Status = Subdevice->GetDescriptor(&SubDeviceDescriptor);
1254  if (!NT_SUCCESS(Status))
1255  {
1256  // failed to get descriptor
1257  Subdevice->Release();
1258  return Status;
1259  }
1260 
1261  /* initialize event management */
1264 
1266  SubDeviceDescriptor->InterfaceCount,
1267  SubDeviceDescriptor->Interfaces,
1268  0, /* FIXME KSINTERFACE_STANDARD with KSINTERFACE_STANDARD_STREAMING / KSINTERFACE_STANDARD_LOOPED_STREAMING */
1269  NULL,
1270  sizeof(PinWaveCyclicPropertySet) / sizeof(KSPROPERTY_SET),
1272  0,
1273  0,
1274  0,
1275  NULL,
1276  sizeof(PinWaveCyclicEventSet) / sizeof(KSEVENT_SET),
1278  SubDeviceDescriptor->DeviceDescriptor);
1279 
1281  m_Descriptor->UnknownMiniport = SubDeviceDescriptor->UnknownMiniport;
1282  m_Descriptor->PortPin = (PVOID)this;
1285 
1286  // initialize reset state
1288 
1289  // release subdevice descriptor
1290  Subdevice->Release();
1291 
1292  // add ourselves to service group
1293  Status = m_ServiceGroup->AddMember(PSERVICESINK(this));
1294  if (!NT_SUCCESS(Status))
1295  {
1296  DPRINT("Failed to add pin to service group\n");
1297  return Status;
1298  }
1299 
1300  m_Stream->SetState(KSSTATE_STOP);
1303  m_CommonBufferSize = m_DmaChannel->AllocatedBufferSize();
1304  m_CommonBuffer = m_DmaChannel->SystemAddress();
1305  m_Capture = Capture;
1306  // delay of 10 millisec
1307  m_Delay = Int32x32To64(10, -10000);
1308 
1309  // sanity checks
1312 
1313  Status = m_Stream->SetNotificationFreq(10, &m_FrameSize);
1316 
1317  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());
1318 
1319 
1320  /* set up allocator framing */
1327 
1329 
1330  Status = m_IrpQueue->Init(ConnectDetails, KsPinDescriptor, m_FrameSize, 0, FALSE);
1331  if (!NT_SUCCESS(Status))
1332  {
1333  m_IrpQueue->Release();
1334  return Status;
1335  }
1336 
1338  if (!m_Format)
1340 
1342 
1343  Port->AddRef();
1344  Filter->AddRef();
1345 
1346  m_Port = Port;
1347  m_Filter = Filter;
1348 
1349  return STATUS_SUCCESS;
1350 }
1351 
1352 
1353 ULONG
1354 NTAPI
1355 CPortPinWaveCyclic::GetCompletedPosition()
1356 {
1357  UNIMPLEMENTED;
1358  return 0;
1359 }
1360 
1361 
1362 ULONG
1363 NTAPI
1364 CPortPinWaveCyclic::GetCycleCount()
1365 {
1366  UNIMPLEMENTED;
1367  return 0;
1368 }
1369 
1370 
1371 ULONG
1372 NTAPI
1373 CPortPinWaveCyclic::GetDeviceBufferSize()
1374 {
1375  return m_CommonBufferSize;
1376 }
1377 
1378 
1379 PVOID
1380 NTAPI
1381 CPortPinWaveCyclic::GetIrpStream()
1382 {
1383  return (PVOID)m_IrpQueue;
1384 }
1385 
1386 
1387 PMINIPORT
1388 NTAPI
1389 CPortPinWaveCyclic::GetMiniport()
1390 {
1391  return (PMINIPORT)m_Miniport;
1392 }
1393 
1394 
1395 NTSTATUS
1397  OUT IPortPinWaveCyclic ** OutPin)
1398 {
1400 
1402  if (!This)
1404 
1405  This->AddRef();
1406 
1407  // store result
1408  *OutPin = (IPortPinWaveCyclic*)This;
1409 
1410  return STATUS_SUCCESS;
1411 }
1412 
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:127
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:139
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:118
#define TRUE
Definition: types.h:120
KSPIN_INTERFACE Interface
Definition: ks.h:2601
#define IOCTL_KS_DISABLE_EVENT
Definition: ks.h:133
#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:142
#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:385
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:553
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:346
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:145
#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:1685
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:2101
IPortPinWaveCyclic * PPORTPINWAVECYCLIC
Definition: interfaces.hpp:797
ULONG RequirementsFlags
Definition: ks.h:1663
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:1670
_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:72
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:1688
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:1673
#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:1955
KSEVENT_SET PinWaveCyclicEventSet[]
ULONG AddRef()
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
IPortFilterWaveCyclic * m_Filter
#define InterlockedDecrement
Definition: armddk.h:52
#define IOCTL_KS_ENABLE_EVENT
Definition: ks.h:130
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
#define P(row, col)
Status
Definition: gdiplustypes.h:24
ULONG PoolType
Definition: ks.h:1668
#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:1214
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
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
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:1030
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:566
#define UNIMPLEMENTED
Definition: debug.h:114
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
PPCFILTER_DESCRIPTOR DeviceDescriptor
Definition: interfaces.hpp:217
struct KSIDENTIFIER * PKSPROPERTY
struct _KSEVENT_ENTRY * PKSEVENT_ENTRY
Definition: ks.h:2101
_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:2772
ULONG FileAlignment
Definition: ks.h:1672
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:2938
_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:1671
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:1226
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:70
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