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

📄 hxcommn.cpp

📁 著名的 helix realplayer 基于手机 symbian 系统的 播放器全套源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/* ***** BEGIN LICENSE BLOCK ***** 
 * Version: RCSL 1.0/RPSL 1.0 
 *  
 * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
 *      
 * The contents of this file, and the files included with this file, are 
 * subject to the current version of the RealNetworks Public Source License 
 * Version 1.0 (the "RPSL") available at 
 * http://www.helixcommunity.org/content/rpsl unless you have licensed 
 * the file under the RealNetworks Community Source License Version 1.0 
 * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
 * in which case the RCSL will apply. You may also obtain the license terms 
 * directly from RealNetworks.  You may not use this file except in 
 * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
 * applicable to this file, the RCSL.  Please see the applicable RPSL or 
 * RCSL for the rights, obligations and limitations governing use of the 
 * contents of the file.  
 *  
 * This file is part of the Helix DNA Technology. RealNetworks is the 
 * developer of the Original Code and owns the copyrights in the portions 
 * it created. 
 *  
 * This file, and the files included with this file, is distributed and made 
 * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
 * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
 * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
 * 
 * Technology Compatibility Kit Test Suite(s) Location: 
 *    http://www.helixcommunity.org/content/tck 
 * 
 * Contributor(s): 
 *  
 * ***** END LICENSE BLOCK ***** */ 

#include "hxtypes.h"
#include "hxcom.h"
#include "hxresult.h"
#include "hxstrutl.h"
#include "hxstring.h"

#include "hxcomm.h"
#include "ihxpckts.h"
#include "hxfiles.h"
#include "hxcore.h"
#include "hxmon.h"
#include "hxplugn.h"
#include "hxvalue.h"
#include "hxcache.h"
#include "hxtbuf.h"
#include "cachobj.h"

#include "smartptr.h"
#include "miscsp.h"
#include "unkimp.h"
//#include "rncont.h"
#include "hxlist.h"
//#include "rnmap.h"

#include "chxfgbuf.h"
#include "chxpckts.h"
#include "watchlst.h"
#include "hxclreg.h"
#include "hxrquest.h"
#include "hxvalues.h"

#if defined(_WINDOWS) && !defined(_WINCE)
#ifdef _WIN32
#include <vfw.h>
#else
#include <windows.h>
#include <drawdib.h>
#endif	/* _WIN32 */
#endif	/* _WINDOWS */

// Needed for CHXSiteWindowed
#include "hxwintyp.h"
#include "chxxtype.h"
#include "hxwin.h"
#include "hxengin.h"
#include "hxsite2.h"
#include "hxslist.h"
//#include "hxcodec.h"
#include "hxvsurf.h"
#include "hxvctrl.h"
#include "dllacces.h"
#include "dllaccesserver.h"
#include "dllpath.h"

#if defined(HELIX_FEATURE_FILESYSTEMMGR)
#include "hxfsmgr.h"
#endif


#include "hxmisus.h"

//#include "rmafsmgr.h"
#include "hxcommn.h"

//#include "plgnhand.h"
#include "plghand2.h"
#include "hxplugn.h"
#include "hxgrpen2.h"
#include "chxuuid.h"
//#include "rmargn.h"
//#include "hxausvc.h"
#include "hxmutex.h"
#include "chxminiccf.h"

#include "hxheap.h"
#ifdef _DEBUG
#undef HX_THIS_FILE		
static const char HX_THIS_FILE[] = __FILE__;
#endif

HXCommonClassFactory::HXCommonClassFactory(IUnknown* pContext) :
     m_lRefCount (0)
    ,m_pContext(pContext)
    ,m_pMiniCCF(new CHXMiniCCF())
{
    if (m_pContext)
    {
	m_pContext->AddRef();
    }

    if (m_pMiniCCF)
    {
	m_pMiniCCF->AddRef();
    }
}

HXCommonClassFactory::~HXCommonClassFactory()
{ 
    Close();
}

void
HXCommonClassFactory::Close()
{ 
    HX_RELEASE(m_pContext);
    HX_RELEASE(m_pMiniCCF);
}

/*
 * IUnknown methods
 */

/////////////////////////////////////////////////////////////////////////
//	Method:
//		IUnknown::QueryInterface
//	Purpose:
//		Implement this to export the interfaces supported by your 
//		object.
//
STDMETHODIMP HXCommonClassFactory::QueryInterface(REFIID riid, void** ppvObj)
{
    QInterfaceList qiList[] =
        {
            { GET_IIDHANDLE(IID_IHXCommonClassFactory), (IHXCommonClassFactory*)this },
            { GET_IIDHANDLE(IID_IUnknown), (IUnknown*)(IHXCommonClassFactory*)this },
        };
    
    return ::QIFind(qiList, QILISTSIZE(qiList), riid, ppvObj);
}

/////////////////////////////////////////////////////////////////////////
//	Method:
//		IUnknown::AddRef
//	Purpose:
//		Everyone usually implements this the same... feel free to use
//		this implementation.
//
STDMETHODIMP_(ULONG32) HXCommonClassFactory::AddRef()
{
    return InterlockedIncrement(&m_lRefCount);
}

/////////////////////////////////////////////////////////////////////////
//	Method:
//		IUnknown::Release
//	Purpose:
//		Everyone usually implements this the same... feel free to use
//		this implementation.
//
STDMETHODIMP_(ULONG32) HXCommonClassFactory::Release()
{
    if (InterlockedDecrement(&m_lRefCount) > 0)
    {
	return m_lRefCount;
    }

    delete this;
    return 0;
}


/************************************************************************
 *	Method:
 *		IHXController::CreateInstance
 *	Purpose:
 *		Creates instances of common objects supported by the system,
 *		like IHXBuffer, IHXPacket, IHXValues, etc.
 *
 *		This method is similar to Window's CoCreateInstance() in its 
 *		purpose, except that it only creates objects of a well known
 *		types.
 *
 *		NOTE: Aggregation is never used. Therefore and outer unknown is
 *		not passed to this function, and you do not need to code for this
 *		situation.
 */
STDMETHODIMP HXCommonClassFactory::CreateInstance
(
    REFCLSID	/*IN*/		rclsid,
    void**	/*OUT*/		ppUnknown
)
{
    if (m_pMiniCCF)
    {
	HX_RESULT res = m_pMiniCCF->CreateInstance(rclsid, ppUnknown);

	if (HXR_NOINTERFACE != res)
	{
	    return res;
	}
    }

    if (IsEqualCLSID(rclsid, CLSID_IHXPacket))
    {
	*ppUnknown = (IUnknown*)(IHXPacket*)(new CHXPacket());
        if( !*ppUnknown )
        {
            return HXR_OUTOFMEMORY;
        }
	((IUnknown*)*ppUnknown)->AddRef();
	return HXR_OK;
    }
    else if (IsEqualCLSID(rclsid, CLSID_IHXRTPPacket))
    {
	*ppUnknown = (IUnknown*)(IHXRTPPacket*)(new CHXRTPPacket());
        if( !*ppUnknown )
        {
            return HXR_OUTOFMEMORY;
        }
	((IUnknown*)*ppUnknown)->AddRef();
	return HXR_OK;
    }
    else if(IsEqualCLSID(rclsid, CLSID_IHXRequest))
    {
	*ppUnknown = (IUnknown*)(IHXRequest*)(new CHXRequest());
        if( !*ppUnknown )
        {
            return HXR_OUTOFMEMORY;
        }
	((IUnknown*)*ppUnknown)->AddRef();
	return HXR_OK;
    }
#if defined(HELIX_FEATURE_FIFOCACHE)
    else if(IsEqualCLSID(rclsid, CLSID_IHXFIFOCache))
    {
	*ppUnknown = (IUnknown*)(IHXFIFOCache*)(new HXFIFOCache());
        if( !*ppUnknown )
        {
            return HXR_OUTOFMEMORY;
        }
	((IUnknown*)*ppUnknown)->AddRef();
	return HXR_OK;
    }
#endif /* HELIX_FEATURE_FIFOCACHE */
#if defined(HELIX_FEATURE_REGION)
#ifdef _WIN32
    else if(IsEqualCLSID(rclsid, CLSID_IHXRegion))
    {
	HXRegion *pRegion = new HXRegion();
        if( !pRegion )
        {
            return HXR_OUTOFMEMORY;
        }
	return pRegion->QueryInterface(IID_IUnknown, (void**) ppUnknown);
    }
#endif
#endif /* HELIX_FEATURE_REGION */
#if defined(HELIX_FEATURE_FRAGMENTBUFFER)
    else if (IsEqualCLSID(rclsid, CLSID_IHXFragmentedBuffer))
    {
	return CHXFragmentedBuffer::CreateInstance((IUnknown**)ppUnknown);
    }
#endif /* HELIX_FEATURE_FRAGMENTBUFFER */
    else if(IsEqualCLSID(rclsid, CLSID_IHXKeyValueList))
    {
	*ppUnknown = (IUnknown*)(IHXKeyValueList*)(new CKeyValueList());
        if( !*ppUnknown )
        {
            return HXR_OUTOFMEMORY;
        }
	((IUnknown*)*ppUnknown)->AddRef();

⌨️ 快捷键说明

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