📄 htrvideodecoder.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 2006 HANTRO PRODUCTS OY --
-- ALL RIGHTS RESERVED --
-- --
-- The entire notice above must be reproduced on all copies. --
-- --
--------------------------------------------------------------------------------
--
-- Description : This is the main header file defining classes for Hantro
-- multiformat video decoder DirectShow integration.
--
--------------------------------------------------------------------------------
------------------------------------------------------------------------------*/
#ifndef HTRVIDEODECODER_H
#define HTRVIDEODECODER_H
/*------------------------------------------------------------------------------
1. Include headers
------------------------------------------------------------------------------*/
#include <streams.h> // For DirectShow base classes
#include "IHtrVideoInterfaces.h" // For processing block interfaces
#include "HtrVideoDecoderGuids.h"
/*------------------------------------------------------------------------------
2. Module defines
------------------------------------------------------------------------------*/
/** Globally defined name string for the filter.
*/
#define g_wszHtrVideoDecoder TEXT("Hantro Multiformat Video Decoder Filter")
class CHtrThreadParams;
class CHtrVideoDecoder;
/**
* Video output type.
*/
const AMOVIESETUP_MEDIATYPE videoOpPinTypes =
{
&MEDIATYPE_Video, /**< Major type */
&MEDIASUBTYPE_NULL /**< Minor type */
};
/**
* Audio output type.
*/
const AMOVIESETUP_MEDIATYPE videoIpPinTypes =
{
&MEDIATYPE_Video, /**< Major type */
&MEDIASUBTYPE_NULL /**< Minor type */
};
/**
* Video output pin registration information.
*/
const AMOVIESETUP_PIN videoOutputPin =
{
L"Video output", /**< Obsolete, not used. */
FALSE, /**< Is this pin rendered? */
TRUE, /**< Is it an output pin? */
FALSE, /**< Can the filter create zero instances? */
FALSE, /**< Does the filter create multiple instances? */
&CLSID_NULL, /**< Obsolete. */
NULL, /**< Obsolete. */
1, /**< Number of media types. */
&videoOpPinTypes /**< Pointer to media types. */
};
/**
* Audio output pin registration information.
*/
const AMOVIESETUP_PIN videoInputPin =
{
L"Video input", /**< Obsolete, not used. */
FALSE, /**< Is this pin rendered? */
FALSE, /**< Is it an output pin? */
FALSE, /**< Can the filter create zero instances? */
FALSE, /**< Does the filter create multiple instances? */
&CLSID_NULL, /**< Obsolete. */
NULL, /**< Obsolete. */
1, /**< Number of media types. */
&videoIpPinTypes /**< Pointer to media types. */
};
/**
* Registration information for HantroMpeg4DecoderFilter pins.
*/
const AMOVIESETUP_PIN HtrMpeg4DecoderPins[2] =
{
videoInputPin, /**< Video input pin */
videoOutputPin /**< Video output pin */
};
const AMOVIESETUP_FILTER HtrVideoDecoder =
{
&CLSID_HtrVideoDecoder, /**< Filter CLSID */
g_wszHtrVideoDecoder, /**< String name */
MERIT_NORMAL, /**< Filter merit */
2, /**< Number of pins */
&HtrMpeg4DecoderPins[0] /**< Pin details */
};
/*------------------------------------------------------------------------------
3. Classes
------------------------------------------------------------------------------*/
/** \brief CHtrVideoDecoder
*
* - Must pass through seek requests.
* - Each transform phase (decoding, color conversion) must be threaded.
* - DirectShow filter implementation must be separated from individual codec API
* + IHtrVideoDecoder
* + IHtrPostProcessing
* - Is there suitable STL class for FIFO queues, which is thread-safe?
* - Scaling, rotation? (Should we take care of this or the renderer?)
*
* Exposed COM interfaces:
* - INonDelegatingUnknown
* - IAMovieSetup
* - IMediaFilter
* - IBaseFilter
*/
class CHtrVideoDecoder : public CVideoTransformFilter
{
private:
/** Constructor method. Constructor is private because you have to use
* CreateInstance to create an instance of the class.
* @param pUnk [in] Pointer to the owning object which is creating the pin.
* @param phr [out] Pointer to variable for return value.
*/
CHtrVideoDecoder(IUnknown *pUnk, HRESULT *phr);
/** ChangeInputMediaType changes the input pin's media type
* to the specified type.
* @param pMt Pointer to the new media type
* @return Hresult value indicating the success of call.
*/
HRESULT ChangeInputMediaType(const AM_MEDIA_TYPE* pMt);
/** ChangeOutputMediaType changes the input pin's media type
* to the specified type.
* @param pMt Pointer to the new media type
* @return Hresult value indicating the success of call.
*/
HRESULT ChangeOutputMediaType(const AM_MEDIA_TYPE* pMt);
IHtrVideoDecoder* m_pVideoDecoder; /**< Video decoder instance */
IHtrPostProcessing* m_pPostProcessor; /**< Post processor instance */
COutputQueue* m_pOutputQueue; /**< Output pin queue */
AM_MEDIA_TYPE m_mtIn; /**< Media type for input */
VIDEOINFOHEADER m_vihIn; /**< Video info header for input */
AM_MEDIA_TYPE m_mtOut; /**< Media type for output */
VIDEOINFOHEADER m_vihOut; /**< Video info header for output */
public:
/** Destructor method.
*/
~CHtrVideoDecoder(void);
/** Static method for creating an instance of CHtr3gpSource filter.
* @param pUnk [in] Pointer to the owning object which is creating the pin.
* @param phr [out] Pointer to variable for return value.
*/
static CUnknown * WINAPI CreateInstance(IUnknown *pUnk, HRESULT *phr);
HRESULT CheckInputType(const CMediaType *mtIn);
// TODO: document very spesifically which fields are set by the decoder and which
// fields are simply relayed through the filter from the input.
HRESULT GetMediaType(int iPos, CMediaType *mt);
HRESULT CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut);
HRESULT DecideBufferSize(IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest);
HRESULT Transform(IMediaSample *pIn, IMediaSample *pOut);
HRESULT CompleteConnect(PIN_DIRECTION dir, IPin *pReceivePin);
HRESULT BreakConnect(PIN_DIRECTION dir);
HRESULT StartStreaming(void);
HRESULT StopStreaming(void);
LPAMOVIESETUP_FILTER GetSetupData(void);
};
#endif /* HTRVIDEODECODER_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -