Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
3.6 KiB

  1. // Copyright (c) 1997 - 1998 Microsoft Corporation. All Rights Reserved.
  2. #ifndef __MEDIA_STREAM_SAMPLE_H_
  3. #define __MEDIA_STREAM_SAMPLE_H_
  4. class ATL_NO_VTABLE CAMMediaTypeSample :
  5. public CSample,
  6. public IAMMediaTypeSample
  7. {
  8. public:
  9. CAMMediaTypeSample();
  10. virtual ~CAMMediaTypeSample();
  11. DECLARE_POLY_AGGREGATABLE(CAMMediaTypeSample);
  12. //
  13. // IStreamSample
  14. //
  15. STDMETHODIMP GetMediaStream(
  16. /* [in] */ IMediaStream **ppMediaStream)
  17. {
  18. return CSample::GetMediaStream(ppMediaStream);
  19. }
  20. STDMETHODIMP GetSampleTimes(
  21. /* [optional][out] */ STREAM_TIME *pStartTime,
  22. /* [optional][out] */ STREAM_TIME *pEndTime,
  23. /* [optional][out] */ STREAM_TIME *pCurrentTime)
  24. {
  25. return CSample::GetSampleTimes(
  26. pStartTime,
  27. pEndTime,
  28. pCurrentTime
  29. );
  30. }
  31. STDMETHODIMP SetSampleTimes(
  32. /* [optional][in] */ const STREAM_TIME *pStartTime,
  33. /* [optional][in] */ const STREAM_TIME *pEndTime)
  34. {
  35. return CSample::SetSampleTimes(pStartTime, pEndTime);
  36. }
  37. STDMETHODIMP Update(
  38. /* [in] */ DWORD dwFlags,
  39. /* [optional][in] */ HANDLE hEvent,
  40. /* [optional][in] */ PAPCFUNC pfnAPC,
  41. /* [optional][in] */ DWORD_PTR dwAPCData)
  42. {
  43. return CSample::Update(dwFlags, hEvent, pfnAPC, dwAPCData);
  44. }
  45. STDMETHODIMP CompletionStatus(
  46. /* [in] */ DWORD dwFlags,
  47. /* [optional][in] */ DWORD dwMilliseconds)
  48. {
  49. return CSample::CompletionStatus(dwFlags, dwMilliseconds);
  50. }
  51. //
  52. // Extensions to media sample interface.
  53. //
  54. STDMETHODIMP SetPointer(BYTE * pBuffer, LONG lSize);
  55. //
  56. // Basic methods all forwarded to the media sample.
  57. //
  58. STDMETHODIMP GetPointer(BYTE ** ppBuffer);
  59. STDMETHODIMP_(LONG) GetSize(void);
  60. STDMETHODIMP GetTime(REFERENCE_TIME * pTimeStart, REFERENCE_TIME * pTimeEnd);
  61. STDMETHODIMP SetTime(REFERENCE_TIME * pTimeStart, REFERENCE_TIME * pTimeEnd);
  62. STDMETHODIMP IsSyncPoint(void);
  63. STDMETHODIMP SetSyncPoint(BOOL bIsSyncPoint);
  64. STDMETHODIMP IsPreroll(void);
  65. STDMETHODIMP SetPreroll(BOOL bIsPreroll);
  66. STDMETHODIMP_(LONG) GetActualDataLength(void);
  67. STDMETHODIMP SetActualDataLength(LONG lActual);
  68. STDMETHODIMP GetMediaType(AM_MEDIA_TYPE **ppMediaType);
  69. STDMETHODIMP SetMediaType(AM_MEDIA_TYPE *pMediaType);
  70. STDMETHODIMP IsDiscontinuity(void);
  71. STDMETHODIMP SetDiscontinuity(BOOL bDiscontinuity);
  72. STDMETHODIMP GetMediaTime(LONGLONG * pTimeStart, LONGLONG * pTimeEnd);
  73. STDMETHODIMP SetMediaTime(LONGLONG * pTimeStart, LONGLONG * pTimeEnd);
  74. //
  75. // Methods for this stream samples that will be called by CMediaSample.
  76. //
  77. HRESULT MSCallback_GetPointer(BYTE ** ppBuffer);
  78. LONG MSCallback_GetSize(void);
  79. LONG MSCallback_GetActualDataLength(void);
  80. HRESULT MSCallback_SetActualDataLength(LONG lActual);
  81. bool MSCallback_AllowSetMediaTypeOnMediaSample(void);
  82. //
  83. // Internal functions
  84. //
  85. HRESULT Initialize(CAMMediaTypeStream *pStream, long lSize, BYTE *pData);
  86. HRESULT CopyFrom(IMediaSample *pSrcMediaSample);
  87. BEGIN_COM_MAP(CAMMediaTypeSample)
  88. COM_INTERFACE_ENTRY(IAMMediaTypeSample)
  89. COM_INTERFACE_ENTRY_CHAIN(CSample)
  90. END_COM_MAP()
  91. public:
  92. BYTE * m_pDataPointer;
  93. LONG m_lSize;
  94. LONG m_lActualDataLength;
  95. bool m_bIAllocatedThisBuffer;
  96. };
  97. #endif