Ryan Malloy bbdcb243dc Normalize line endings to LF across entire repository
Apply .gitattributes normalization to convert all CRLF line
endings inherited from Windows-origin source files to Unix LF.
175 files, zero content changes.
2026-02-20 10:55:50 -07:00

162 lines
5.3 KiB
C++

/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1CapturePin.h
Author :
Date :
Purpose : This file contains header for the video capture pin on the capture
filter.
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
/* Include the Library and Other header file */
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Declare Enumerations here */
/* End of Enumeration declaration */
/* Global & Static variables Declaration */
//This Structure can be used in future for the
//better stream management
typedef struct _STREAM_POINTER_CONTEXT
{
ULONG ulFrameIndex;
} STREAM_POINTER_CONTEXT, *PSTREAM_POINTER_CONTEXT;
//The video capture pin class.
class CCapturePin : public ICaptureSink
{
private:
//The AVStream pin we're associated with.
PKSPIN m_Pin;
//Pointer to the internal device object for our capture device.
//We access the Device through this object.
CSkyWalker1Device *m_Device;
//The state we've put the hardware into. This allows us to keep track
//of whether to do things like unpausing or restarting.
HARDWARE_STATE m_HardwareState;
//The clock we've been assigned. As with other capture filters, we do
//not expose a clock. If one has been assigned, we will use it to
//time stamp packets (plus a reasonable delta to work the capture stream
//in a preview graph).
PIKSREFERENCECLOCK m_Clock;
//The transport information for this capture pin. The settings for device will be
//programmed for this transport info.
PBDA_TRANSPORT_INFO m_TransportInfo;
//This Variable is used to keep the count of the Streams sent for the
//Data read
ULONG m_CurrentFrameIndex;
//An indication of whether or not this pin has acquired the necessary
//hardware resources to operate. When the pin reaches KSSTATE_ACQUIRE,
//we attempt to acquire the hardware. This flag will be set based on
//our success / failure.
BOOLEAN m_AcquiredResources;
//Clean up any references we hold on frames in the queue. This is called
//when we abruptly stop the fake hardware.
NTSTATUS CleanupReferences ();
//This is the state transition handler for the capture pin. It attempts
//to acquire resources for the capture pin (or releasing them if
//necessary) and starts and stops the hardware as required.
NTSTATUS SetState ( IN KSSTATE ToState,IN KSSTATE FromState);
//This is the processing dispatch for the capture pin. It handles
//sending the Streams to the Device.
NTSTATUS Process();
//This routine is not required as the Transport Information is already
//provided into the CCapturePin but still using it to make the
//settings flexible
PBDA_TRANSPORT_INFO CaptureBdaTransportInfo ();
//This is the free callback from the bagged item (CCapturePin). If we
//do not provide a callback when we bag the CCapturePin, ExFreePool
//would be called. This is not desirable for C++ constructed objects.
//We merely delete the object here.
static void Cleanup (IN CCapturePin *Pin)
{
delete Pin;
}
public:
//The capture pin's constructor. Initialize any non-0, non-NULL fields
//(since new will have zero'ed the memory anyway) and set up our
//device level pointers for access during capture routines.
CCapturePin (IN PKSPIN Pin);
//The capture pin's destructor.
~CCapturePin ();
CSkyWalker1Device* GetDevice()
{
return m_Device;
}
//This is the capture sink notification mechanism for mapping completion.
//When the device DPC detects that a given number of mappings have been
//completed by the fake hardware, it signals the capture sink of this
//through this method.
virtual void ReleaseStream(IN ULONG ulStreamIndex);
//This is the creation dispatch for the capture pin. It creates
//the CCapturePin object and associates it with the AVStream object
//bagging it in the process.
static NTSTATUS PinCreate( IN OUT PKSPIN pKSPin,
IN PIRP pIoRequestPacket
);
//This is the set device state dispatch for the pin. The routine bridges
//to SetState() in the context of the CCapturePin.
static NTSTATUS DispatchSetState (
IN PKSPIN Pin,
IN KSSTATE ToState,
IN KSSTATE FromState
)
{
return
(reinterpret_cast<CCapturePin *>(Pin->Context))->
SetState(ToState, FromState);
}
//This is the processing dispatch for the capture pin. The routine
//bridges to Process() in the context of the CCapturePin.
static NTSTATUS DispatchProcess (IN PKSPIN Pin)
{
return
(reinterpret_cast<CCapturePin *>(Pin->Context))->Process();
}
};
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Function Prototypes */
/* End of Function prototype definitions */