ReactOS  0.4.14-dev-317-g96040ec
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 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 }
ULONG m_StreamId
Definition: mediasample.cpp:70
IMemAllocator * m_Allocator
Definition: mediasample.cpp:63
LONG m_ActualLength
Definition: mediasample.cpp:61
ULONG m_TypeFlags
Definition: mediasample.cpp:59
Definition: bufpool.h:45
LONGLONG m_MediaStop
Definition: mediasample.cpp:68
BYTE * m_Buffer
Definition: mediasample.cpp:60
#define BufferSize
Definition: classpnp.h:419
LONGLONG m_MediaStart
Definition: mediasample.cpp:67
AM_MEDIA_TYPE * m_MediaType
Definition: mediasample.cpp:69
REFERENCE_TIME m_StopTime
Definition: mediasample.cpp:66
BOOL m_bMediaTimeValid
Definition: mediasample.cpp:75
CMediaSample * m_Next
Definition: mediasample.cpp:64
REFERENCE_TIME m_StartTime
Definition: mediasample.cpp:65

◆ ~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 }
LONG m_ActualLength
Definition: mediasample.cpp:61

◆ 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 
312  if (!m_bMediaTimeValid)
314 
315  m_MediaStart = *pTimeStart;
316  m_MediaStop = *pTimeEnd;
317 
318  return NOERROR;
319 }
#define NOERROR
Definition: winerror.h:2354
LONGLONG m_MediaStop
Definition: mediasample.cpp:68
LONGLONG m_MediaStart
Definition: mediasample.cpp:67
#define VFW_E_MEDIA_TIME_NOT_SET
Definition: vfwmsgs.h:105
BOOL m_bMediaTimeValid
Definition: mediasample.cpp:75
#define E_POINTER
Definition: winerror.h:2365

◆ GetMediaType()

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

Implements IMediaSample.

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 assert(x)
Definition: debug.h:53
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
AM_MEDIA_TYPE * m_MediaType
Definition: mediasample.cpp:69
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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 }
BYTE * m_Buffer
Definition: mediasample.cpp:60
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365

◆ 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 }
HRESULT hr
Definition: shlfolder.c:183
#define NOERROR
Definition: winerror.h:2354
#define VFW_E_SAMPLE_TIME_NOT_SET
Definition: vfwmsgs.h:104
LONG HRESULT
Definition: typedefs.h:77
REFERENCE_TIME m_StopTime
Definition: mediasample.cpp:66
#define VFW_S_NO_STOP_TIME
Definition: vfwmsgs.h:34
#define E_POINTER
Definition: winerror.h:2365
REFERENCE_TIME m_StartTime
Definition: mediasample.cpp:65

◆ IsDiscontinuity()

HRESULT STDMETHODCALLTYPE CMediaSample::IsDiscontinuity ( void  )

Implements IMediaSample.

Definition at line 288 of file mediasample.cpp.

289 {
291 }
#define S_FALSE
Definition: winerror.h:2357
#define S_OK
Definition: intsafe.h:59

◆ 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 }
#define S_FALSE
Definition: winerror.h:2357
#define S_OK
Definition: intsafe.h:59

◆ IsSyncPoint()

HRESULT STDMETHODCALLTYPE CMediaSample::IsSyncPoint ( void  )

Implements IMediaSample.

Definition at line 210 of file mediasample.cpp.

211 {
212  return (m_Flags & AM_SAMPLE_SPLICEPOINT) ? S_OK : S_FALSE;
213 }
#define S_FALSE
Definition: winerror.h:2357
#define S_OK
Definition: intsafe.h:59

◆ 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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
#define NOERROR
Definition: winerror.h:2354
void * PVOID
Definition: retypes.h:9
const GUID IID_IUnknown
Definition: arc.h:85
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ SetActualDataLength()

HRESULT STDMETHODCALLTYPE CMediaSample::SetActualDataLength ( long  Length)

Implements IMediaSample.

Definition at line 254 of file mediasample.cpp.

255 {
256  if (Length > m_BufferSize)
257  return VFW_E_BUFFER_OVERFLOW;
258 
260  return NOERROR;
261 }
#define NOERROR
Definition: winerror.h:2354
LONG m_ActualLength
Definition: mediasample.cpp:61
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#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
301 
302  return NOERROR;
303 }
#define NOERROR
Definition: winerror.h:2354

◆ 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 }
#define NOERROR
Definition: winerror.h:2354
LONGLONG m_MediaStop
Definition: mediasample.cpp:68
LONGLONG m_MediaStart
Definition: mediasample.cpp:67
BOOL m_bMediaTimeValid
Definition: mediasample.cpp:75

◆ SetMediaType()

HRESULT STDMETHODCALLTYPE CMediaSample::SetMediaType ( AM_MEDIA_TYPE pMediaType)

Implements IMediaSample.

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
static const WCHAR L[]
Definition: oid.c:1250
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ SetPreroll()

HRESULT STDMETHODCALLTYPE CMediaSample::SetPreroll ( BOOL  bIsPreroll)

Implements IMediaSample.

Definition at line 235 of file mediasample.cpp.

236 {
237  if (bIsPreroll)
239  else
241 
242  return NOERROR;
243 }
#define NOERROR
Definition: winerror.h:2354

◆ SetSyncPoint()

HRESULT STDMETHODCALLTYPE CMediaSample::SetSyncPoint ( BOOL  bIsSyncPoint)

Implements IMediaSample.

Definition at line 216 of file mediasample.cpp.

217 {
218  if (bIsSyncPoint)
220  else
222 
223  return NOERROR;
224 }
#define NOERROR
Definition: winerror.h:2354

◆ 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 }
#define NOERROR
Definition: winerror.h:2354
REFERENCE_TIME m_StopTime
Definition: mediasample.cpp:66
REFERENCE_TIME m_StartTime
Definition: mediasample.cpp:65

◆ 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  }
IMemAllocator * m_Allocator
Definition: mediasample.cpp:63
#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: