ReactOS 0.4.15-dev-8131-g4988de4
CMediaSample Class Reference
Inheritance diagram for CMediaSample:
Collaboration diagram for CMediaSample:

Public Member Functions

STDMETHODIMP QueryInterface (REFIID InterfaceId, PVOID *Interface)
 
 STDMETHODIMP_ (ULONG) AddRef()
 
 STDMETHODIMP_ (ULONG) Release()
 
HRESULT STDMETHODCALLTYPE GetPointer (BYTE **ppBuffer)
 
long STDMETHODCALLTYPE GetSize (void)
 
HRESULT STDMETHODCALLTYPE GetTime (REFERENCE_TIME *pTimeStart, REFERENCE_TIME *pTimeEnd)
 
HRESULT STDMETHODCALLTYPE SetTime (REFERENCE_TIME *pTimeStart, REFERENCE_TIME *pTimeEnd)
 
HRESULT STDMETHODCALLTYPE IsSyncPoint ()
 
HRESULT STDMETHODCALLTYPE SetSyncPoint (BOOL bIsSyncPoint)
 
HRESULT STDMETHODCALLTYPE IsPreroll ()
 
HRESULT STDMETHODCALLTYPE SetPreroll (BOOL bIsPreroll)
 
long STDMETHODCALLTYPE GetActualDataLength ()
 
HRESULT STDMETHODCALLTYPE SetActualDataLength (long Length)
 
HRESULT STDMETHODCALLTYPE GetMediaType (AM_MEDIA_TYPE **ppMediaType)
 
HRESULT STDMETHODCALLTYPE SetMediaType (AM_MEDIA_TYPE *pMediaType)
 
HRESULT STDMETHODCALLTYPE IsDiscontinuity ()
 
HRESULT STDMETHODCALLTYPE SetDiscontinuity (BOOL bDiscontinuity)
 
HRESULT STDMETHODCALLTYPE GetMediaTime (LONGLONG *pTimeStart, LONGLONG *pTimeEnd)
 
HRESULT STDMETHODCALLTYPE SetMediaTime (LONGLONG *pTimeStart, LONGLONG *pTimeEnd)
 
 CMediaSample (IMemAllocator *Allocator, BYTE *Buffer, LONG BufferSize)
 
virtual ~CMediaSample ()
 
- Public Member Functions inherited from IMediaSample
HRESULT GetPointer ([out] BYTE **ppBuffer)
 
long GetSize (void)
 
HRESULT GetTime ([out] REFERENCE_TIME *pTimeStart, [out] REFERENCE_TIME *pTimeEnd)
 
HRESULT SetTime ([in] REFERENCE_TIME *pTimeStart, [in] REFERENCE_TIME *pTimeEnd)
 
HRESULT IsSyncPoint (void)
 
HRESULT SetSyncPoint (BOOL bIsSyncPoint)
 
HRESULT IsPreroll (void)
 
HRESULT SetPreroll (BOOL bIsPreroll)
 
LONG GetActualDataLength (void)
 
HRESULT SetActualDataLength (LONG length)
 
HRESULT GetMediaType (AM_MEDIA_TYPE **ppMediaType)
 
HRESULT SetMediaType (AM_MEDIA_TYPE *pMediaType)
 
HRESULT IsDiscontinuity (void)
 
HRESULT SetDiscontinuity (BOOL bDiscontinuity)
 
HRESULT GetMediaTime ([out] LONGLONG *pTimeStart, [out] LONGLONG *pTimeEnd)
 
HRESULT SetMediaTime ([in] LONGLONG *pTimeStart, [in] LONGLONG *pTimeEnd)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Public Attributes

LONG m_Ref
 
BOOL m_bMediaTimeValid
 

Protected Attributes

ULONG m_Flags
 
ULONG m_TypeFlags
 
BYTEm_Buffer
 
LONG m_ActualLength
 
LONG m_BufferSize
 
IMemAllocatorm_Allocator
 
CMediaSamplem_Next
 
REFERENCE_TIME m_StartTime
 
REFERENCE_TIME m_StopTime
 
LONGLONG m_MediaStart
 
LONGLONG m_MediaStop
 
AM_MEDIA_TYPEm_MediaType
 
ULONG m_StreamId
 

Additional Inherited Members

- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 

Detailed Description

Definition at line 11 of file mediasample.cpp.

Constructor & Destructor Documentation

◆ CMediaSample()

CMediaSample::CMediaSample ( IMemAllocator Allocator,
BYTE Buffer,
LONG  BufferSize 
)

Definition at line 80 of file mediasample.cpp.

83 :
84 m_Flags(0),
85 m_TypeFlags(0),
89 m_Allocator(Allocator),
90 m_Next(0),
91 m_StartTime(0),
92 m_StopTime(0),
93 m_MediaStart(0),
94 m_MediaStop(0),
95 m_MediaType(0),
96 m_StreamId(0),
97 m_Ref(0),
99{
100}
Definition: bufpool.h:45
REFERENCE_TIME m_StartTime
Definition: mediasample.cpp:65
ULONG m_TypeFlags
Definition: mediasample.cpp:59
CMediaSample * m_Next
Definition: mediasample.cpp:64
LONGLONG m_MediaStart
Definition: mediasample.cpp:67
BYTE * m_Buffer
Definition: mediasample.cpp:60
IMemAllocator * m_Allocator
Definition: mediasample.cpp:63
REFERENCE_TIME m_StopTime
Definition: mediasample.cpp:66
ULONG m_StreamId
Definition: mediasample.cpp:70
LONG m_ActualLength
Definition: mediasample.cpp:61
BOOL m_bMediaTimeValid
Definition: mediasample.cpp:75
AM_MEDIA_TYPE * m_MediaType
Definition: mediasample.cpp:69
LONGLONG m_MediaStop
Definition: mediasample.cpp:68
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254

◆ ~CMediaSample()

virtual CMediaSample::~CMediaSample ( )
inlinevirtual

Definition at line 55 of file mediasample.cpp.

55{}

Member Function Documentation

◆ GetActualDataLength()

long STDMETHODCALLTYPE CMediaSample::GetActualDataLength ( void  )

Implements IMediaSample.

Definition at line 247 of file mediasample.cpp.

248{
249 return m_ActualLength;
250}

◆ GetMediaTime()

HRESULT STDMETHODCALLTYPE CMediaSample::GetMediaTime ( LONGLONG pTimeStart,
LONGLONG pTimeEnd 
)

Implements IMediaSample.

Definition at line 307 of file mediasample.cpp.

308{
309 if (!pTimeStart || !pTimeEnd)
310 return E_POINTER;
311
314
315 m_MediaStart = *pTimeStart;
316 m_MediaStop = *pTimeEnd;
317
318 return NOERROR;
319}
#define VFW_E_MEDIA_TIME_NOT_SET
Definition: vfwmsgs.h:105
#define NOERROR
Definition: winerror.h:2354
#define E_POINTER
Definition: winerror.h:2365

◆ GetMediaType()

HRESULT STDMETHODCALLTYPE CMediaSample::GetMediaType ( AM_MEDIA_TYPE **  ppMediaType)

Definition at line 265 of file mediasample.cpp.

266{
267 if (!m_MediaType)
268 {
269 *ppMediaType = NULL;
270 return S_FALSE;
271 }
272
273 assert(0);
274 return E_NOTIMPL;
275}
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112
#define assert(x)
Definition: debug.h:53
#define S_FALSE
Definition: winerror.h:2357

◆ GetPointer()

HRESULT STDMETHODCALLTYPE CMediaSample::GetPointer ( BYTE **  ppBuffer)

Implements IMediaSample.

Definition at line 133 of file mediasample.cpp.

135{
136 if (!ppBuffer)
137 return E_POINTER;
138
139 *ppBuffer = m_Buffer;
140 return S_OK;
141}
#define S_OK
Definition: intsafe.h:52

◆ GetSize()

long STDMETHODCALLTYPE CMediaSample::GetSize ( void  )

Implements IMediaSample.

Definition at line 145 of file mediasample.cpp.

146{
147 return m_BufferSize;
148}

◆ GetTime()

HRESULT STDMETHODCALLTYPE CMediaSample::GetTime ( REFERENCE_TIME pTimeStart,
REFERENCE_TIME pTimeEnd 
)

Implements IMediaSample.

Definition at line 152 of file mediasample.cpp.

155{
156 HRESULT hr;
157
158 if (!pTimeStart || !pTimeEnd)
159 return E_POINTER;
160
162 {
163 // no time is set
165 }
166
167 *pTimeStart = m_StartTime;
168
170 {
171 *pTimeEnd = m_StopTime;
172 hr = NOERROR;
173 }
174 else
175 {
176 *pTimeEnd = m_StartTime + 1;
178 }
179 return hr;
180}
@ AM_SAMPLE_TIMEVALID
Definition: axcore.idl:441
@ AM_SAMPLE_STOPVALID
Definition: axcore.idl:444
HRESULT hr
Definition: shlfolder.c:183
#define VFW_E_SAMPLE_TIME_NOT_SET
Definition: vfwmsgs.h:104
#define VFW_S_NO_STOP_TIME
Definition: vfwmsgs.h:34

◆ IsDiscontinuity()

HRESULT STDMETHODCALLTYPE CMediaSample::IsDiscontinuity ( void  )

Implements IMediaSample.

Definition at line 288 of file mediasample.cpp.

289{
291}
@ AM_SAMPLE_DATADISCONTINUITY
Definition: axcore.idl:439

◆ IsPreroll()

HRESULT STDMETHODCALLTYPE CMediaSample::IsPreroll ( void  )

Implements IMediaSample.

Definition at line 228 of file mediasample.cpp.

229{
230 return (m_Flags & AM_SAMPLE_PREROLL) ? S_OK : S_FALSE;
231}
@ AM_SAMPLE_PREROLL
Definition: axcore.idl:438

◆ IsSyncPoint()

HRESULT STDMETHODCALLTYPE CMediaSample::IsSyncPoint ( void  )

Implements IMediaSample.

Definition at line 210 of file mediasample.cpp.

211{
213}
@ AM_SAMPLE_SPLICEPOINT
Definition: axcore.idl:437

◆ QueryInterface()

HRESULT STDMETHODCALLTYPE CMediaSample::QueryInterface ( REFIID  InterfaceId,
PVOID Interface 
)

Definition at line 105 of file mediasample.cpp.

108{
109 if (IsEqualGUID(refiid, IID_IUnknown) ||
110 IsEqualGUID(refiid, IID_IMediaSample))
111 {
112 *Output = PVOID(this);
113 reinterpret_cast<IMediaSample*>(*Output)->AddRef();
114 return NOERROR;
115 }
116 if (IsEqualGUID(refiid, IID_IMediaSample2))
117 {
118#if 0
119 *Output = (IMediaSample2*)(this);
120 reinterpret_cast<IMediaSample2*>(*Output)->AddRef();
121 return NOERROR;
122#endif
123 }
124
125 return E_NOINTERFACE;
126}
const GUID IID_IUnknown
ULONG AddRef()
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
@ Output
Definition: arc.h:85
void * PVOID
Definition: typedefs.h:50
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ SetActualDataLength()

HRESULT STDMETHODCALLTYPE CMediaSample::SetActualDataLength ( long  Length)

Implements IMediaSample.

Definition at line 254 of file mediasample.cpp.

255{
256 if (Length > m_BufferSize)
258
260 return NOERROR;
261}
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define VFW_E_BUFFER_OVERFLOW
Definition: vfwmsgs.h:52

◆ SetDiscontinuity()

HRESULT STDMETHODCALLTYPE CMediaSample::SetDiscontinuity ( BOOL  bDiscontinuity)

Implements IMediaSample.

Definition at line 295 of file mediasample.cpp.

296{
297 if (bDiscontinuity)
299 else
300 m_Flags &= ~AM_SAMPLE_DATADISCONTINUITY;
301
302 return NOERROR;
303}

◆ SetMediaTime()

HRESULT STDMETHODCALLTYPE CMediaSample::SetMediaTime ( LONGLONG pTimeStart,
LONGLONG pTimeEnd 
)

Implements IMediaSample.

Definition at line 323 of file mediasample.cpp.

324{
325 if (!pTimeStart || !pTimeEnd)
326 {
327 m_bMediaTimeValid = false;
328 return NOERROR;
329 }
330
331 m_MediaStart = *pTimeStart;
332 m_MediaStop = *pTimeEnd;
333
334 return NOERROR;
335}

◆ SetMediaType()

HRESULT STDMETHODCALLTYPE CMediaSample::SetMediaType ( AM_MEDIA_TYPE pMediaType)

Definition at line 279 of file mediasample.cpp.

280{
281 OutputDebugStringW(L"CMediaSample::SetMediaType NotImplemented\n");
282 return E_NOTIMPL;
283}
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
#define L(x)
Definition: ntvdm.h:50

◆ SetPreroll()

HRESULT STDMETHODCALLTYPE CMediaSample::SetPreroll ( BOOL  bIsPreroll)

Implements IMediaSample.

Definition at line 235 of file mediasample.cpp.

236{
237 if (bIsPreroll)
239 else
240 m_Flags &= ~AM_SAMPLE_PREROLL;
241
242 return NOERROR;
243}

◆ SetSyncPoint()

HRESULT STDMETHODCALLTYPE CMediaSample::SetSyncPoint ( BOOL  bIsSyncPoint)

Implements IMediaSample.

Definition at line 216 of file mediasample.cpp.

217{
218 if (bIsSyncPoint)
220 else
221 m_Flags &= ~AM_SAMPLE_SPLICEPOINT;
222
223 return NOERROR;
224}

◆ SetTime()

HRESULT STDMETHODCALLTYPE CMediaSample::SetTime ( REFERENCE_TIME pTimeStart,
REFERENCE_TIME pTimeEnd 
)

Implements IMediaSample.

Definition at line 184 of file mediasample.cpp.

185{
186 if (!pTimeStart)
187 {
189 return NOERROR;
190 }
191
192 if (!pTimeEnd)
193 {
196 m_StartTime = *pTimeStart;
197 return NOERROR;
198 }
199
200
202 m_StartTime = *pTimeStart;
203 m_StopTime = *pTimeEnd;
204
205 return NOERROR;
206}

◆ STDMETHODIMP_() [1/2]

CMediaSample::STDMETHODIMP_ ( ULONG  )
inline

Definition at line 16 of file mediasample.cpp.

17 {
19 return m_Ref;
20 }
#define InterlockedIncrement
Definition: armddk.h:53

◆ STDMETHODIMP_() [2/2]

CMediaSample::STDMETHODIMP_ ( ULONG  )
inline

Definition at line 21 of file mediasample.cpp.

22 {
24 if (!m_Ref)
25 {
26 if (m_Allocator)
27 {
29 return 0;
30 }
31 delete this;
32 return 0;
33 }
34 return m_Ref;
35 }
#define InterlockedDecrement
Definition: armddk.h:52
HRESULT ReleaseBuffer([in] IMediaSample *pBuffer)

Member Data Documentation

◆ m_ActualLength

LONG CMediaSample::m_ActualLength
protected

Definition at line 61 of file mediasample.cpp.

Referenced by GetActualDataLength(), and SetActualDataLength().

◆ m_Allocator

IMemAllocator* CMediaSample::m_Allocator
protected

Definition at line 63 of file mediasample.cpp.

Referenced by STDMETHODIMP_().

◆ m_bMediaTimeValid

BOOL CMediaSample::m_bMediaTimeValid

Definition at line 75 of file mediasample.cpp.

Referenced by GetMediaTime(), and SetMediaTime().

◆ m_Buffer

BYTE* CMediaSample::m_Buffer
protected

Definition at line 60 of file mediasample.cpp.

Referenced by GetPointer().

◆ m_BufferSize

LONG CMediaSample::m_BufferSize
protected

Definition at line 62 of file mediasample.cpp.

Referenced by GetSize(), and SetActualDataLength().

◆ m_Flags

ULONG CMediaSample::m_Flags
protected

◆ m_MediaStart

LONGLONG CMediaSample::m_MediaStart
protected

Definition at line 67 of file mediasample.cpp.

Referenced by GetMediaTime(), and SetMediaTime().

◆ m_MediaStop

LONGLONG CMediaSample::m_MediaStop
protected

Definition at line 68 of file mediasample.cpp.

Referenced by GetMediaTime(), and SetMediaTime().

◆ m_MediaType

AM_MEDIA_TYPE* CMediaSample::m_MediaType
protected

Definition at line 69 of file mediasample.cpp.

Referenced by GetMediaType().

◆ m_Next

CMediaSample* CMediaSample::m_Next
protected

Definition at line 64 of file mediasample.cpp.

◆ m_Ref

LONG CMediaSample::m_Ref

Definition at line 73 of file mediasample.cpp.

Referenced by STDMETHODIMP_().

◆ m_StartTime

REFERENCE_TIME CMediaSample::m_StartTime
protected

Definition at line 65 of file mediasample.cpp.

Referenced by GetTime(), and SetTime().

◆ m_StopTime

REFERENCE_TIME CMediaSample::m_StopTime
protected

Definition at line 66 of file mediasample.cpp.

Referenced by GetTime(), and SetTime().

◆ m_StreamId

ULONG CMediaSample::m_StreamId
protected

Definition at line 70 of file mediasample.cpp.

◆ m_TypeFlags

ULONG CMediaSample::m_TypeFlags
protected

Definition at line 59 of file mediasample.cpp.


The documentation for this class was generated from the following file: