Pleora Technologies Inc. eBUS SDK v5.1.10.4642 API



PvDSStream.h
1 // *****************************************************************************
2 //
3 // Copyright (c) 2012, Pleora Technologies Inc., All rights reserved.
4 //
5 // *****************************************************************************
6 
7 #pragma once
8 
9 #include <PvPipeline.h>
10 #include <PvDevice.h>
11 #include <PvStream.h>
12 #include <PvBufferConverter.h>
13 #include <list>
14 
15 
16 typedef std::list<PvBuffer *> PvBufferList;
17 
18 class PvDSSource;
19 class IVideoInfoHeader;
20 
21 
22 namespace PtUtilsLib
23 {
24  class Logger;
25 }
26 
27 
28 class PvDSStream :
29  public CSourceStream,
30  public IAMStreamConfig,
31  public IKsPropertySet
32 {
33 public:
34 
35  // IUnknown
36  STDMETHODIMP QueryInterface( REFIID riid, void **ppv );
37  STDMETHODIMP_(ULONG) AddRef() { return GetOwner()->AddRef(); }
38  STDMETHODIMP_(ULONG) Release() { return GetOwner()->Release(); }
39 
40  // IQualityControl
41  STDMETHODIMP Notify( IBaseFilter * pSender, Quality q );
42 
43  // IAMStreamConfig
44  HRESULT STDMETHODCALLTYPE SetFormat( AM_MEDIA_TYPE *pmt );
45  HRESULT STDMETHODCALLTYPE GetFormat( AM_MEDIA_TYPE **ppmt );
46  HRESULT STDMETHODCALLTYPE GetNumberOfCapabilities( int *piCount, int *piSize );
47  HRESULT STDMETHODCALLTYPE GetStreamCaps( int iIndex, AM_MEDIA_TYPE **pmt, BYTE *pSCC );
48 
49  // IKsPropertySet
50  HRESULT STDMETHODCALLTYPE Set( REFGUID guidPropSet, DWORD dwID, void *pInstanceData, DWORD cbInstanceData, void *pPropData, DWORD cbPropData );
51  HRESULT STDMETHODCALLTYPE Get( REFGUID guidPropSet, DWORD dwPropID, void *pInstanceData,DWORD cbInstanceData, void *pPropData, DWORD cbPropData, DWORD *pcbReturned );
52  HRESULT STDMETHODCALLTYPE QuerySupported( REFGUID guidPropSet, DWORD dwPropID, DWORD *pTypeSupport );
53 
54  // CSourceStream
55  PvDSStream( HRESULT *phr, PvDSSource *pParent, LPCWSTR pPinName );
56  ~PvDSStream();
57 
58  HRESULT FillBuffer( IMediaSample *pms );
59  HRESULT DecideBufferSize( IMemAllocator *pIMemAlloc, ALLOCATOR_PROPERTIES *pProperties );
60  HRESULT CheckMediaType( const CMediaType *pMediaType );
61  HRESULT GetMediaType( int iPosition, CMediaType *pMediaType );
62  HRESULT SetMediaType( const CMediaType *pmt );
63 
64  HRESULT OnThreadCreate( void );
65  HRESULT OnThreadDestroy(void);
66  HRESULT OnThreadStartPlay(void);
67 
68  HRESULT StartAcquisition();
69  HRESULT StopAcquisition();
70 
71  HRESULT Save( PvString &aContent, bool aBasic = false );
72  HRESULT Load( const PvString &aContent, bool aBasic = false );
73  HRESULT LoadDefault();
74 
75  void SyncFormat();
76  PvGenParameterArray *GetSelectedParameters();
77  void CopyImage( PvBuffer *aBuffer, BYTE *pData );
78  void DrawText( BYTE *pData, const std::wstring &aText );
79  void OutputDiagnostics( BYTE *pData );
80 
81  IVideoInfoHeader *AllocPVIFrom( const CMediaType *aMediaType );
82 
83  HRESULT GetRole( int &aValue ) const { aValue = mRole; return NOERROR; }
84  HRESULT SetRole( int aValue ) { mRole = aValue; return NOERROR; }
85  HRESULT GetUnicastPort( int &aValue ) const { aValue = mUnicastPort; return NOERROR; }
86  HRESULT SetUnicastPort( int aValue ) { mUnicastPort = aValue; return NOERROR; }
87  HRESULT GetMulticastIP( std::wstring &aValue ) const { aValue = mMulticastIP; return NOERROR; }
88  HRESULT SetMulticastIP( const std::wstring &aValue ) { mMulticastIP = aValue; return NOERROR; }
89  HRESULT GetMulticastPort( int &aValue ) const { aValue = mMulticastPort; return NOERROR; }
90  HRESULT SetMulticastPort( int aValue ) { mMulticastPort = aValue; return NOERROR; }
91  HRESULT DisconnectDevice();
92  HRESULT ConnectIfNeeded();
93 
94  HRESULT GetDiagnosticEnabled( bool &aValue ) const { aValue = mDiagnosticEnabled; return NOERROR; }
95  HRESULT SetDiagnosticEnabled( bool aValue );
96 
97  HRESULT GetDeviceID( std::wstring &aValue ) const { aValue = mDeviceID; return NOERROR; }
98  HRESULT SetDeviceID( const std::wstring &aValue );
99  HRESULT GetSourceCount( int &aValue );
100  HRESULT GetSourceName( int aIndex, std::wstring &aValue );
101  HRESULT GetSource( std::wstring &aValue ) const { aValue = mSource; return NOERROR; }
102  HRESULT SetSource( const std::wstring &aValue );
103  HRESULT GetChannel( int &aValue ) const { aValue = mChannel; return NOERROR; }
104  HRESULT SetChannel( int aValue ) { mChannel = aValue; return NOERROR; }
105 
106  HRESULT GetBufferCount( int &aValue ) const { aValue = mBufferCount; return NOERROR; }
107  HRESULT SetBufferCount( int aValue ) { mBufferCount = aValue; return NOERROR; }
108  HRESULT GetDefaultBufferSize( int &aValue ) const { aValue = mDefaultBufferSize; return NOERROR; }
109  HRESULT SetDefaultBufferSize( int aValue ) { mDefaultBufferSize = aValue; return NOERROR; }
110  HRESULT GetDropThreshold( int &aValue ) const { aValue = mDropThreshold; return NOERROR; }
111  HRESULT SetDropThreshold( int aValue ) { mDropThreshold = aValue; return NOERROR; }
112  HRESULT GetWidth( int &aValue ) const { aValue = mWidth; return NOERROR; }
113  HRESULT SetWidth( int aValue );
114  HRESULT GetHeight( int &aValue ) const { aValue = mHeight; return NOERROR; }
115  HRESULT SetHeight( int aValue );
116  HRESULT GetAverageFPS( int &aValue ) const { aValue = mAverageFPS; return NOERROR; }
117  HRESULT SetAverageFPS( int aValue );
118 
119  HRESULT GetParametersSelector( int &aValue ) const { aValue = mParameterSelector; return NOERROR; }
120  HRESULT SetParametersSelector( int aValue );
121  HRESULT GetParametersAvailable( bool &aValue ) const;
122  HRESULT GetParameterCount( int &aValue );
123  HRESULT GetParameterName( int aIndex, std::wstring &aValue );
124  HRESULT GetParameterCategory( const std::wstring &aName, std::wstring &aValue );
125  HRESULT GetParameterValue( const std::wstring &aName, std::wstring &aValue );
126  HRESULT SetParameterValue( const std::wstring &aName, const std::wstring &aValue, std::wstring &aMessage );
127  HRESULT GetParameterType( const std::wstring &aName, std::wstring &aType );
128  HRESULT GetParameterAccess( const std::wstring &aName, bool &aAvailable, bool &aReadable, bool &aWritable );
129  HRESULT ParameterExecute( const std::wstring &aName, std::wstring &aMessage );
130  HRESULT GetParameterPossibleValueCount( const std::wstring &aName, int &aCount );
131  HRESULT GetParameterPossibleValue( const std::wstring &aName, int aIndex, std::wstring &aValue );
132  HRESULT GetParameterVisibility( const std::wstring &aName, int &aVisibility );
133 
134  LONGLONG GetImageCount() const { return mImageCount; }
135  LONGLONG GetImageDroppedCount() const { return mImageDroppedCount; }
136  int GetLastImageSize() const { return mLastImageSize; }
137 
138  HRESULT MakeDefault();
139  HRESULT ResetDefault();
140  HRESULT GetDefaultSummary( std::wstring &aSummary ) { aSummary = mDefaultSummary; return NOERROR; }
141 
142 private:
143 
144  PvDSSource *m_pParent;
145 
146  PvDevice *mDevice;
147  PvStream *mStream;
148  PvPipeline *mPipeline;
149 
150  std::wstring mActiveDeviceID;
151  std::wstring mActiveSource;
152  int mActiveChannel;
153  int mActiveUnicastPort;
154  std::wstring mActiveMulticastIP;
155  int mActiveMulticastPort;
156 
157  int mWidth;
158  int mHeight;
159  int mLastImageWidth;
160  int mLastImageHeight;
161  int mLastImageSize;
162  int mAverageFPS;
163 
164  REFERENCE_TIME mReferenceTime;
165  REFERENCE_TIME mLastTime;
166  LONGLONG mImageCount;
167  LONGLONG mImageDroppedCount;
168 
169  HANDLE mMutex;
170  BOOL mStreaming;
171 
172  PvResult mLastConnect;
173  PvResult mLastOpen;
174  std::wstring mLastWarning;
175 
176  int mRole;
177  int mUnicastPort;
178  std::wstring mMulticastIP;
179  int mMulticastPort;
180  bool mDiagnosticEnabled;
181  std::wstring mDeviceID;
182  std::wstring mSource;
183  int mChannel;
184  int mBufferCount;
185  int mDefaultBufferSize;
186  int mDropThreshold;
187  std::wstring mDefaultSummary;
188 
189  int mParameterSelector;
190 
191  PvBufferConverter mConverter;
192 
193  PtUtilsLib::Logger *mLogger;
194  ULONG_PTR mGdiplusToken;
195 
196  IReferenceClock *mClock;
197 
198  bool mClearOutputFlag;
199 };
200 
201 
Receive data from a GigE Vision or USB3 Vision transmitter.
Definition: PvStream.h:38
Helper class for receiving data from a GigE Vision or USB3 Vision transmitter.
Definition: PvPipeline.h:22
Used to convert a PvBuffer to another pixel type.
Definition: PvBufferConverter.h:28
String class.
Definition: PvString.h:21
Result information.
Definition: PvResult.h:13
Definition: PvDeviceAdapter.h:16
Definition: PvDSStream.h:28
Represents a block of GigE Vision or USB3 Vision data in memory.
Definition: PvBuffer.h:37
GenICam feature array.
Definition: PvGenParameterArray.h:38
Definition: PvDSSource.h:12
Connect, configure and control a GigE Vision or USB3 Vision device.
Definition: PvDevice.h:31

Copyright (c) 2002-2018 Pleora Technologies Inc.
www.pleora.com