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

📄 htrencwrapper.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 2005 HANTRO PRODUCTS OY                    --
--                            ALL RIGHTS RESERVED                             --
--                                                                            --
--          The entire notice above must be reproduced on all copies.         --
--                                                                            --
--------------------------------------------------------------------------------
--
--  Abstract : Wrapper for Hantro Encoder for use in DirectShow integration
--
------------------------------------------------------------------------------*/

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

    Table of context

    1. Include headers
    2. CHantroEncoderWrapper class declaration

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

#ifndef HTRENCWRAPPER_INCLUDED
#define HTRENCWRAPPER_INCLUDED

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

#include <windows.h>
#include <streams.h>
#include "mp4encapi.h"

/*------------------------------------------------------------------------------
    2. CHantroEncoderWrapper class declaration
------------------------------------------------------------------------------*/

class CHantroEncoderWrapper
{
public:
    enum VideoType { VIDEOTYPE_UNKNOWN = 0, VIDEOTYPE_MPEG4, VIDEOTYPE_H263 };
    
    struct Settings
    {
        Settings()
        : videoType(VIDEOTYPE_UNKNOWN), frameWidth(0), frameHeight(0), bitrate(0)
        , frameRate(0), intraRefreshRate(0)
        {}

        VideoType videoType;
        LONG frameWidth;
        LONG frameHeight;
        LONG bitrate;
        LONG frameRate;
        LONG intraRefreshRate;
    };

public:
    CHantroEncoderWrapper();
    ~CHantroEncoderWrapper();

    static HRESULT GetMinOutputStreamSize( Settings* pSettings, LONG* pOutputStreamSize );
    static HRESULT ValidateSettings( Settings* pSettings );

    HRESULT Init( Settings* pSettings );
    HRESULT StartStream( BYTE* pOutputStream, LONG* pOutputStreamSize );
    HRESULT EndStream( BYTE* pOutputStream, LONG* pOutputStreamSize );
    HRESULT Encode( DWORD busInputImage, REFERENCE_TIME* pStartTimestamp, REFERENCE_TIME* pEndTimestamp,
                    BYTE* pOutputStream, DWORD busOutputStream, LONG* pOutputStreamSize, BOOL* pKeyframe );

private:
    static HRESULT GetProfileAndLevel( Settings* pSettings, MP4EncProfileAndLevel* pProfileAndLevel, LONG* pOutputStreamSize );
    static LONG CalculateQP( Settings* pSettings );

private:
    MP4EncInst      m_encInst;
    u32             m_frameRateNum;
    u32             m_frameRateDenom;
    u32             m_uOffset;
    u32             m_vOffset;
    u32             m_intraRate;
    u32             m_vopNumber;
    REFERENCE_TIME  m_timestamp;
};

#endif // HANTROENCODERWRAPPER_INCLUDED

⌨️ 快捷键说明

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