📄 hantrodecoderdmo.h
字号:
/*------------------------------------------------------------------------------
-- --
-- This software is confidential and proprietary and may be used --
-- only as expressly authorized by a licensing agreement from --
-- --
-- Hantro Products Oy. --
-- --
-- In the event of publication, the following notice is applicable: --
-- --
-- (C) COPYRIGHT 2005 HANTRO PRODUCTS OY --
-- ALL RIGHTS RESERVED --
-- --
-- The entire notice above must be reproduced on all copies. --
-- --
--------------------------------------------------------------------------------
--
-- Description : Hantro MPEG-4/H.263 Video Decoder DirectX Media Object
--
------------------------------------------------------------------------------*/
#ifndef __HANTRODECODERDMO_H_
#define __HANTRODECODERDMO_H_
/*------------------------------------------------------------------------------
1. Include headers
------------------------------------------------------------------------------*/
#include <streams.h>
#define FIX_LOCK_NAME // Fix the name confliction Lock <-> DMOLock
#include <dmo.h>
#ifndef _DEBUG // To fix ASSERTE in DMOIMPL release build
#define _ASSERTE
#include <dmoimpl.h>
#undef _ASSERTE
#else
#include <dmoimpl.h>
#endif /* _DEBUG */
#include <objbase.h>
#include "tchar.h"
#include "HantroDecoderWrapper.h" // For decoder wrapper
#include "HantroDecoderGuids.h"
/*------------------------------------------------------------------------------
2. Module defines
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
3. CHantroDecoderDMO class
------------------------------------------------------------------------------*/
class CHantroDecoderDMO :
public IMediaObjectImpl<CHantroDecoderDMO, 1, 1>, // 1 input, 1 output
public CUnknown
{
public:
CHantroDecoderDMO(LPUNKNOWN pUnk)
: CUnknown(_T("HantroDecoderDMO"), pUnk)
{
m_pDecoder = NULL;
m_pInputBuffer = NULL;
}
static CUnknown * WINAPI CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr);
DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv)
{
if (riid == IID_IMediaObject)
{
return GetInterface((IMediaObject*)this, ppv);
}
// default
return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
void Lock() { m_crit.Lock(); }
void Unlock() { m_crit.Unlock(); }
// IMediaObjectImpl callbacks
HRESULT InternalGetInputStreamInfo(DWORD dwInputStreamIndex, DWORD *pdwFlags);
HRESULT InternalGetOutputStreamInfo(DWORD dwOutputStreamIndex, DWORD *pdwFlags);
HRESULT InternalCheckInputType(DWORD dwInputStreamIndex, const DMO_MEDIA_TYPE *pmt);
HRESULT InternalCheckOutputType(DWORD dwOutputStreamIndex, const DMO_MEDIA_TYPE *pmt);
HRESULT InternalGetInputType(DWORD dwInputStreamIndex, DWORD dwTypeIndex,
DMO_MEDIA_TYPE *pmt);
HRESULT InternalGetOutputType(DWORD dwOutputStreamIndex, DWORD dwTypeIndex,
DMO_MEDIA_TYPE *pmt);
HRESULT InternalGetInputSizeInfo(DWORD dwInputStreamIndex, DWORD *pcbSize,
DWORD *pcbMaxLookahead, DWORD *pcbAlignment);
HRESULT InternalGetOutputSizeInfo(DWORD dwOutputStreamIndex, DWORD *pcbSize,
DWORD *pcbAlignment);
HRESULT InternalGetInputMaxLatency(DWORD dwInputStreamIndex, REFERENCE_TIME *prtMaxLatency);
HRESULT InternalSetInputMaxLatency(DWORD dwInputStreamIndex, REFERENCE_TIME rtMaxLatency);
HRESULT InternalFlush();
HRESULT InternalDiscontinuity(DWORD dwInputStreamIndex);
HRESULT InternalAllocateStreamingResources();
HRESULT InternalFreeStreamingResources();
HRESULT InternalProcessInput(DWORD dwInputStreamIndex, IMediaBuffer *pBuffer,
DWORD dwFlags, REFERENCE_TIME rtTimestamp,
REFERENCE_TIME rtTimelength);
HRESULT InternalProcessOutput(DWORD dwFlags, DWORD cOutputBufferCount,
DMO_OUTPUT_DATA_BUFFER *pOutputBuffers,
DWORD *pdwStatus);
HRESULT InternalAcceptingInput(DWORD dwInputStreamIndex);
private:
CHantroDecoderWrapper* m_pDecoder; // Pointer to the actual decoder instance
IMediaBuffer* m_pInputBuffer;
CCritSec m_crit;
REFERENCE_TIME m_rtTimestamp;
REFERENCE_TIME m_rtTimelength;
};
#endif //__HANTRODECODERDMO_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -