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

📄 hantrodecoder.cpp

📁 freescale i.mx31 BSP CE5.0全部源码
💻 CPP
字号:
/*------------------------------------------------------------------------------
--                                                                            --
--       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 
--
------------------------------------------------------------------------------*/

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

#include <streams.h>
#include <DMOreg.h>
#include <initguid.h>
#include "HantroDecoderGuids.h"
#include "HantroDecoderDMO.h"

/*------------------------------------------------------------------------------
    2. Module defines
------------------------------------------------------------------------------*/

CFactoryTemplate g_Templates[1] = 
{   { L"Hantro Decoder DMO",               // Name
      &CLSID_HantroDecoderDMO,			   // CLSID
      CHantroDecoderDMO::CreateInstance,   // Method to create an instance of MyComponent
      NULL,                                // Initialization function
      NULL                                 // Set-up information (for filters)
    }
};
int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);

/*------------------------------------------------------------------------------
    3. DllRegisterServer function
------------------------------------------------------------------------------*/

STDAPI DllRegisterServer(void)
{
	LONG inputCount = 4;//sizeof(inputGuids)/sizeof(inputGuids[0]);
	LONG outputCount = 3;//sizeof(outputGuids)/sizeof(outputGuids[0]);
	DMO_PARTIAL_MEDIATYPE mtIn[4];
	DMO_PARTIAL_MEDIATYPE mtOut[3];
	
	// Set the input types
	for( int i=0; i < inputCount; i++ )
	{
		mtIn[i].type = MEDIATYPE_Video;
		switch( i )
		{
		case 0:
			mtIn[i].subtype = INPUTTYPE_MP4V;
			break;
		case 1:
			mtIn[i].subtype = INPUTTYPE_mp4v;
			break;
		case 2:
			mtIn[i].subtype = INPUTTYPE_H263;
			break;
		case 3:
			mtIn[i].subtype = INPUTTYPE_h263;
			break;
		}
	}

	// Set the output types
	for( i = 0; i < 3; i++ )
	{
		mtOut[i].type = MEDIATYPE_Video;
		switch(i)
		{
		case 0:
			mtOut[i].subtype = OUTPUTTYPE_IYUV;
			break;
		case 1:
			mtOut[i].subtype = OUTPUTTYPE_iyuv;
			break;
		case 2:
			mtOut[i].subtype = MEDIASUBTYPE_RGB565;
			break;
		}
	}

	// RGS file also registers with a merit of 0 so DirectShow won't try to use us
	HRESULT hr = DMORegister(L"Hantro Decoder DMO",		// Symbolic name
							 CLSID_HantroDecoderDMO,	// CLSID
							 DMOCATEGORY_VIDEO_DECODER, // Video decoder
							 0,							// Use is not keyed by register
							 inputCount,				// register (inputCount) inputs
							 mtIn,						// input types
							 outputCount,				// register (outputCount) outputs
							 mtOut);					// output types

	if( FAILED(hr) )
		return hr;

    // registers object

	return AMovieDllRegisterServer( );
}

/*------------------------------------------------------------------------------
    4. DllUnregisterServer function
------------------------------------------------------------------------------*/

STDAPI DllUnregisterServer(void)
{
    HRESULT hr = DMOUnregister(CLSID_HantroDecoderDMO, DMOCATEGORY_VIDEO_DECODER);
	return AMovieDllUnregisterServer( );
}

/*------------------------------------------------------------------------------
    5. DllEntryPoint
------------------------------------------------------------------------------*/

extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);

/*------------------------------------------------------------------------------
    6. DllMain function
------------------------------------------------------------------------------*/

BOOL APIENTRY DllMain(HANDLE hModule, 
                      DWORD  dwReason, 
                      LPVOID lpReserved)
{
	return DllEntryPoint((HINSTANCE)(hModule), dwReason, lpReserved);
}

⌨️ 快捷键说明

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