⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ihtrvideointerfaces.h

📁 Freescale ARM11系列CPU MX31的WINCE 5.0下的BSP
💻 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 file defines the interfaces expected by the Hantro
--                MPEG-4/H.263 decoder DirectShow filter from modules below.
--
--------------------------------------------------------------------------------

------------------------------------------------------------------------------*/

#ifndef IHTRVIDEOINTERFACES_H
#define IHTRVIDEOINTERFACES_H

/*------------------------------------------------------------------------------
    1. Include headers
------------------------------------------------------------------------------*/

#include <streams.h> // For datatypes
#include "MP4SwDecApi.h" // For MPEG-4/H.263 decoder API
#include "yuvtorgbinit.h" // For cct definition

/*------------------------------------------------------------------------------
    2. Module defines
------------------------------------------------------------------------------*/
/** \brief HtrDecRv
 *  TBD!
 */
typedef struct
{
    enum {
        HTRDEC_STATUS_OK = 0,
        HTRDEC_STATUS_ERR = 1,
        HTRDEC_STATUS_EOS = 2
        } status;
    enum {
        HTRDEC_VOP_NOTREADY = 0,
        HTRDEC_VOP_READY = 1
        } vopRdy;
    enum {
        HTRDEC_BUF_EMPTY = 0,
        HTRDEC_BUF_NOTEMPTY = 1
        } bufEmpty;
} HtrDecRv;

typedef struct
{
    GUID guid_type;
    RECT rect_bufferDimensions;
    RECT rect_pictureDimensions;
    u32 u32_bitRate;
    i32 i32_frameRate;
} HtrStreamProperties;

class CHtrBuffer; // Forward declaration

/*------------------------------------------------------------------------------
    3. Classes
------------------------------------------------------------------------------*/

/** \brief IHtrVideoDecoder
 *  TBD!
 */
class IHtrVideoDecoder
{
public:
    virtual HRESULT Init() = 0;
    virtual HtrDecRv Decode(CHtrBuffer* pIn, CHtrBuffer* pOut) = 0;
    virtual HRESULT ShutDown() = 0;
};

/** \brief IHtrPostProcessing
 *  TBD!
 */
class IHtrPostProcessing
{
public:
    virtual HRESULT Init(GUID* outputType) = 0;
    virtual HRESULT PostProcess(CHtrBuffer* pIn, CHtrBuffer* pOut) = 0;
    virtual HRESULT ShutDown() = 0;
};

/** \brief CHtrBuffer
 *  TBD!
 *
 *  Only valid area of the buffer should be used. Following
 *  ASCII graphics illustrates buffer dimensions vs. valid data
 *  dimensions:
 *
 *  +-------------------------------+
 *  |                               |
 *  |  Buffer                       |
 *  |  area      +-------------+    |
 *  |            |/////////////|    |
 *  |            |////Valid////|    |
 *  |            |////area/////|    |
 *  |            |/////////////|    |
 *  |            +-------------+    |
 *  |                               |
 *  +-------------------------------+
 *
 *  Valid area is the only part of the buffer which contains meaningful
 *  data. Actual offsets within buffers can be usually counted when one
 *  knows the dimensions of the buffer, valid area and the type of the
 *  color space used. For example, with planar YUV formats the data is
 *  divided into three completely separate parts of the buffer.
 */
class CHtrBuffer
{
private:
    BYTE* m_pBuffer; /**< Pointer to the buffer */
    BOOL m_ownBuffer; /**< Flag to indicate whether we own the buffer */
    LONG m_bufferLength; /**< Length of the buffer in bytes */
    GUID m_mt; /** Structure defining the media type for the buffer */
    RECT m_bufferDimensions; /**< Dimensions for the whole buffer */
    RECT m_validDimensions; /**< Dimensions for the valid data contained in the buffer */
    REFERENCE_TIME m_rtBegin; /**< Begin time of the buffer */
    REFERENCE_TIME m_rtEnd; /**< End time of the buffer */
    BOOL m_keyFrame; /**< Defines whether it is keyframe */

public:
    /** Constructor where the buffer is to be allocated by the
     *  buffer object itself.
     */
    CHtrBuffer(GUID mt, 
               REFERENCE_TIME rtBegin,
               REFERENCE_TIME rtEnd,
               BOOL isKeyFrame,
               RECT bufferDimensions,
               RECT validDimensions,
               HRESULT* phr);

    /** Constructor where the buffer is to be allocated by the
     *  buffer object itself and the parameters are copied from the
     *  template buffer given by the application.
     */
    CHtrBuffer(GUID mt,
               CHtrBuffer* pTemplate,
               HRESULT* phr);

    /** Constructor where the buffer exists already and object will create
     *  simply itself as a wrapper around the buffer
     */
    CHtrBuffer(GUID mt,
               BYTE* pBuffer,
               UINT32 bufferLength,
               REFERENCE_TIME rtBegin,
               REFERENCE_TIME rtEnd,
               BOOL isKeyFrame,
               RECT bufferDimensions,
               RECT validDimensions,
               HRESULT* phr);

    CHtrBuffer(GUID mt,
               BYTE* pExternalBuf,
               REFERENCE_TIME rtBegin,
               REFERENCE_TIME rtEnd,
               BOOL isKeyFrame,
               RECT bufferDimensions,
               RECT validDimensions,
               HRESULT* phr);

    ~CHtrBuffer();

    static UINT32 BitsPerPixel(GUID mt);

    BYTE* GetBuffer(void);

    UINT32 GetBufferLength(void);

    GUID GetMediaType();

    RECT GetValidDataDimensions(void);

    RECT GetBufferDimensions(void);

    HRESULT GetTiming(REFERENCE_TIME* pBegin, REFERENCE_TIME* pEnd);

    BYTE* GiveBufferAway(void);

    void HijackBuffer(CHtrBuffer* pVictim);

    BOOL IsKeyFrame();

    void MarkAsKeyFrame(BOOL isKeyFrame);
};

// TODO: Commentation
class CHtrQueue
{
private:
    UINT32 m_count;
    UINT32 m_maxSize;
    HtrStreamProperties m_streamProps;
    CCritSec m_lock;
    CQueue<CHtrBuffer*>* m_pQueue;
    char m_name[512];

public:
    CHtrQueue(UINT32 size, const char* pName, HRESULT* phr);

    ~CHtrQueue();

    HRESULT Flush();

    BOOL IsFull();

    HRESULT Pop(CHtrBuffer** ppBuffer);

    HRESULT Push(CHtrBuffer* pBuffer);

    HtrStreamProperties* GetStreamProperties(void);

    HRESULT SetStreamProperties(HtrStreamProperties* pStreamProps);
};

#endif /* IHTRVIDEOINTERFACES_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -