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

📄 hxcleng.cpp

📁 著名的 helix realplayer 基于手机 symbian 系统的 播放器全套源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
/* ***** 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"
#if defined( _WIN32 ) || defined( _WINDOWS )
#include "hlxclib/windows.h"

#if !defined(WIN32_PLATFORM_PSPC)
#include <ddeml.h>
#endif /* !defined(WIN32_PLATFORM_PSPC) */
#endif /* defined( _WIN32 ) || defined( _WINDOWS ) */
#include "hxcom.h"
#include "hxresult.h"
//#include "pnlice.h"
#include "timeval.h"
#include "pq.h"
#include "hxcomm.h"
#include "hxengin.h"
#include "hxslist.h"
#if defined(HELIX_FEATURE_NETINTERFACES)
#include "hxnetif.h"
#endif /* HELIX_FEATURE_NETINTERFACES */
#include "ihxpckts.h"
#include "hxfiles.h"
#include "hxcore.h"
#include "hxprefs.h"
#include "auderrs.h"
#include "hxausvc.h"
#include "hxhyper.h"
#include "hxmon.h"
#include "hxclreg.h"
#include "hxcommn.h"
#include "hxsmbw.h"
#include "hxgroup.h"
#include "hxxrsmg.h"
#include "hxxml.h"
#include "hxpac.h"

#include "threngin.h"

#if defined(_UNIX) || (defined(_MACINTOSH) && defined(_CARBON) && defined(THREADS_SUPPORTED))
//XXXgfw Just temp. See below in EventOccurred....
#include "conn.h"
#include "thrdconn.h"
#if defined(_UNIX)
#include "UnixThreads.h"  //For new unix message loop....
#elif defined(_MACINTOSH) && defined(_CARBON) && defined(THREADS_SUPPORTED)
#include "carbthrd.h"
#endif
#include "hxmsgs.h"  //for the messages.
#endif

#include "hxaudses.h"
#include "hxaudply.h"
#include "hxwinver.h"
#include "hxplay.h"
#include "hxclsnk.h"
#include "chxpckts.h"
#include "hxsched.h"
#include "hxoptsc.h"
#include "hxpref.h"
#include "hxwin.h"
#include "hxcorgui.h"
#if defined(HELIX_FEATURE_PLAYBACK_NET)
#include "hxnetapi.h"
#endif /* HELIX_FEATURE_PLAYBACK_NET */
#include "hxhypnv.h"
#include "thrhypnv.h"
#include "hxerror.h"
//#include "corgui.h"
#include "chxuuid.h"
#include "hxplugn.h"
#include "hxshtdn.h"
#include "chunkres.h"
#include "hxthread.h"
#include "hxresmg.h"
#include "portaddr.h"
#include "clntcore.ver"
#include "rtsputil.h"

#ifdef _WIN32
#include "hxconv.h"
#include "platform/win/hxdllldr.h"
#include "filespecutils.h"
#endif
#include "hxpsink.h"
#include "hxcorcom.h"
#include "hxcleng.h"
#include "statinfo.h"
#include "createbwman.h"
#include "dbcs.h"

#include "hxmarsh.h"
//#include "hxmime.h"
#include "plsnkctl.h"
#include "hxmangle.h"
#if defined(_STATICALLY_LINKED) || !defined(HELIX_FEATURE_PLUGINHANDLER2)
#if defined(HELIX_CONFIG_CONSOLIDATED_CORE)
#include "basehand.h"
#else /* HELIX_CONFIG_CONSOLIDATED_CORE */
#include "hxpluginmanager.h"
#endif /* HELIX_CONFIG_CONSOLIDATED_CORE */
#else
#include "plghand2.h"
#endif /* _STATICALLY_LINKED */
#include "dllpath.h"
#include "readpath.h"
#include "hxdir.h"
#include "hxstrutl.h"
#include "validatr.h"

#if !defined(_WINCE) 
#include "hxlang.h"
#endif

#include "crdcache.h"
#include "hxresmgr.h"
#include "hxxmlprs.h"
#include "ihxcookies.h"
#include "cookhlpr.h"
#include "cookies.h"
#if defined(HELIX_FEATURE_SMARTERNETWORK)
#include "preftran.h"
#endif /* HELIX_FEATURE_SMARTERNETWORK */
#include "medblock.h"
#include "viewsrc.h"
#include "hxovmgr.h"

#ifdef _TEST_REPLACED_AUDIO_DEVICE
#include "hxaudev.h"
#endif /*_TEST_REPLACED_AUDIO_DEVICE*/

//#include "../dcondev/dcon.h"

#if defined (_WIN16)
#include <stdlib.h>
#include <windows.h>
#include <shellapi.h>
#endif

#if (defined (_WINDOWS) || defined (_WIN32) ) && !defined(_WINCE) && defined (HELIX_FEATURE_VIDEO)
#include "platform/win/sdidde.h"
#include <vfw.h>
#include "ddraw.h"
//#include "rncolor.h"
#endif /*defined (_WINDOWS) || defined (_WIN32)*/

#include "hxver.h"

#ifdef _OPENWAVE
#include "timeline.h"
#endif

#ifdef _UNIX
#include "unix_net.h"
#include "timeline.h"
#include "hxslctcb.h"
#endif
#ifdef _MACINTOSH
#include "hx_moreprocesses.h"
#include "hxmm.h"
#endif

#ifdef __TCS__
#include "platform/tm1/tm1_net.h"
#include "sitemgr.h"
#include "timeline.h"
#endif

#ifdef _MAC_UNIX
#include "sitemgr.h"
#include "hxwintyp.h"
#include "filespecutils.h"
#endif

#ifdef _MACINTOSH
#include "timeline.h"
#include "sitemgr.h"
#include "hxwintyp.h"

#ifdef _CARBON
#include "genthrd.h"
#include "filespecutils.h"
#endif

#endif

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

#if defined (_WINDOWS) || defined (_WIN32)

#ifndef _DEBUG
#define _MEDIUM_BLOCK 1
#endif


#if 0
#ifdef _DEBUG
#include "allochok.h"
HXAllocHook g_MemoryHook;
#endif
#endif

#endif

#define DEFAULT_MIN_BANDWIDTH   57600       // 56.6 Kbps
#define DEFAULT_MAX_BANDWIDTH   10485800    // 10Mbps

#ifdef _TEST_REPLACED_AUDIO_DEVICE
CHXAudioDevice* z_ReplacedAudioDevice = NULL;
#endif /*_TEST_REPLACED_AUDIO_DEVICE*/

#if defined(HELIX_FEATURE_SYSTEMREQUIRED)
STDMETHODIMP 
HXSystemRequired::QueryInterface(REFIID riid, void** ppvObj)
{
    QInterfaceList qiList[] =
        {
            { GET_IIDHANDLE(IID_IHXSystemRequired), (IHXSystemRequired*)this },
            { GET_IIDHANDLE(IID_IUnknown), (IUnknown*)(IHXSystemRequired*)this },
        };
    
    return ::QIFind(qiList, QILISTSIZE(qiList), riid, ppvObj);
}

STDMETHODIMP_(ULONG32) 
HXSystemRequired::AddRef()
{
    return InterlockedIncrement(&m_lRefCount);
}

STDMETHODIMP_(ULONG32) 
HXSystemRequired::Release()
{
    if (InterlockedDecrement(&m_lRefCount) > 0)
    {
    return m_lRefCount;
    }

    if(m_lRefCount == 0)
    {
    delete this;
    }

    return 0;
}

STDMETHODIMP 
HXSystemRequired::HasFeatures(IHXUpgradeCollection* pFeatures)
{
    return HXR_FAIL;
}
#endif /* HELIX_FEATURE_SYSTEMREQUIRED */

HXClientEngine::HXClientEngine() :
    m_lRefCount (0)
    ,m_ulPlayerIndex (0)
    ,m_unRegistryID (0)
    ,m_pRegistry(NULL)
    ,m_pCommonClassFactory (0)
    ,m_pCommonClassFactoryOverride (0)
    ,m_pScheduler (0)
    ,m_pOptimizedScheduler(0)
    ,m_pOrigPreferences(0)
    ,m_pPreferences (0)
    ,m_LastError (0)
    ,m_pAudioSession(NULL)
    ,m_bIsSchedulerStarted(FALSE)
    ,m_pOrigNetworkServices(NULL)
    ,m_pNetworkServices(NULL)
#ifdef _UNIX
    ,m_pAsyncIOSelection(NULL)
#if defined(_SOLARIS) // XXXNH: threaded networking currently buggy on solaris
    ,m_bNetworkThreading(FALSE)
#else
    ,m_bNetworkThreading(TRUE)
#endif
#endif
    ,m_pOrigHyperNavigate(NULL)
    ,m_pHyperNavigate(NULL)
    ,m_pPlugin2Handler(NULL)
    ,m_pPlayerSinkControl(NULL)
    ,m_pResMgr(NULL)
    ,m_pExternalResourceManager(NULL)
    ,m_pCredentialsCache(NULL)
    ,m_bInitialized(FALSE)
    ,m_pCoreComm(NULL)
#if defined(THREADS_SUPPORTED)
    ,m_bUseCoreThread(TRUE)
#else
    ,m_bUseCoreThread(FALSE)
#endif
    ,m_bUseCoreThreadExternallySet(FALSE)    
    ,m_pXMLParser(NULL)
    ,m_pValidator(NULL)
    ,m_pCookies(NULL)
    ,m_pCookiesHelper(NULL)
    ,m_pSingleLoadPlugins(NULL)
    ,m_pAllocator(NULL)
    ,m_pViewSource(NULL)
    ,m_pSystemRequired(NULL)
    ,m_pProxyManager(NULL)
    ,m_pPreferredTransportManager(NULL)
    ,m_pOverlayManager(NULL)
    ,m_pMultiPlayPauseSupport(NULL)
    ,m_pASM(NULL)
    ,m_lROBActive(0)
    ,m_pProxyAutoConfig(NULL)
    ,m_pNetInterfaces(NULL)
    ,m_AUName(NULL)
#if defined(_MACINTOSH) && defined(_CARBON) && defined(THREADS_SUPPORTED)
    ,m_bUseMacBlitMutex(FALSE)
    ,m_pMacBlitMutex(NULL)
#endif
{
#ifdef _MEDIUM_BLOCK
    m_pAllocator        = new CMediumBlockAllocator();
    CHXBuffer::SetAllocator(m_pAllocator);
#endif
    m_pCommonClassFactory   = new HXCommonClassFactory((IUnknown*) (IHXClientEngine*)this);
    m_pScheduler        = new HXScheduler((IUnknown*) (IHXClientEngine*)this);

#ifdef HELIX_FEATURE_OPTIMIZED_SCHEDULER
    m_pOptimizedScheduler   = new HXOptimizedScheduler((IUnknown*) (IHXClientEngine*)this);
#endif /* HELIX_FEATURE_OPTIMIZED_SCHEDULER */

#if defined(HELIX_FEATURE_PREFERENCES)
#if defined(HELIX_FEATURE_NO_INTERNAL_PREFS)
    m_pOrigPreferences = NULL;
#elif defined(HELIX_FEATURE_LITEPREFS)
    m_pOrigPreferences      = CHXLitePrefs::CreateObject();
#else
    m_pOrigPreferences      = new HXPreferences;
#endif
#endif /* HELIX_FEATURE_PREFERENCES */
#if defined(HELIX_FEATURE_REGISTRY)
    m_pRegistry         = new HXClientRegistry;
#endif /* HELIX_FEATURE_REGISTRY */
#if defined(HELIX_FEATURE_PLAYBACK_NET)
    m_pOrigNetworkServices  = new HXNetworkServices((IUnknown*) (IHXClientEngine*)this);
#endif /* HELIX_FEATURE_PLAYBACK_NET */

#if defined(HELIX_FEATURE_HYPER_NAVIGATE)
#ifndef _WINCE
    m_pOrigHyperNavigate    = new HXThreadHyperNavigate;
#endif
#endif /* defined(HELIX_FEATURE_HYPER_NAVIGATE) */
#if defined(HELIX_FEATURE_ASM)
    m_pASM = CreateBandwidthManager();
#endif /* HELIX_FEATURE_ASM */
    m_pPlayerSinkControl    = new CHXPlayerSinkControl();
#if defined(HELIX_FEATURE_AUTHENTICATION)
    m_pCredentialsCache     = new CHXCredentialsCache();
#endif /* HELIX_FEATURE_AUTHENTICATION */
#if defined(HELIX_FEATURE_XMLPARSER)
    m_pXMLParser        = new HXXMLParser;
#endif /* HELIX_FEATURE_XMLPARSER */
#if defined(HELIX_FEATURE_CORECOMM)
    m_pCoreComm         = HXCoreComm::Create(this);
#endif /* HELIX_FEATURE_CORECOMM */
#if defined(HELIX_FEATURE_SYSTEMREQUIRED)
    m_pSystemRequired       = (IHXSystemRequired*) new HXSystemRequired;
#endif /* HELIX_FEATURE_SYSTEMREQUIRED */
#if defined(HELIX_FEATURE_PROXYMGR)
    m_pProxyManager     = new HXProxyManager();
#endif /* HELIX_FEATURE_PROXYMGR */
#if defined(HELIX_FEATURE_SMARTERNETWORK)
    m_pPreferredTransportManager = new HXPreferredTransportManager((IUnknown*)(IHXClientEngine*)this);
#endif /* HELIX_FEATURE_SMARTERNETWORK */
#if defined(HELIX_FEATURE_OVERLAYMGR)
    m_pOverlayManager       = new HXOverlayManager((IUnknown*)(IHXClientEngine*)this);
#endif /* HELIX_FEATURE_OVERLAYMGR */

#ifdef _MEDIUM_BLOCK
    m_pAllocator->SetScheduler((IUnknown*)m_pScheduler);
#endif

#if defined(_UNIX) || defined(__TCS__)
    m_pSiteEventHandler = NULL;
#endif

#ifdef THREADS_SUPPORTED
    HXMutex::MakeMutex(m_pCoreMutex);
#else

#ifdef _CARBON
#error "Carbon should have threads supported turned on"
    // if running in OS X
    m_pCoreMutex = new HXGenMacMutex;
#else
    HXMutex::MakeStubMutex(m_pCoreMutex);
#endif

#endif

    if (!m_pCommonClassFactory
    || !m_pScheduler
#if defined(HELIX_FEATURE_PREFERENCES) && !defined(HELIX_FEATURE_NO_INTERNAL_PREFS)
    || !m_pOrigPreferences  
#endif /* HELIX_FEATURE_PREFERENCES */
#if defined(HELIX_FEATURE_REGISTRY)
    || !m_pRegistry 
#endif /* HELIX_FEATURE_REGISTRY */
#if defined(HELIX_FEATURE_PLAYBACK_NET)
    || !m_pOrigNetworkServices
#endif /* HELIX_FEATURE_PLAYBACK_NET */
#if defined(HELIX_FEATURE_HYPER_NAVIGATE)
#ifndef _WINCE
    || !m_pOrigHyperNavigate
#endif
#endif /* defined(HELIX_FEATURE_HYPER_NAVIGATE) */
#if defined(HELIX_FEATURE_ASM)
        || !m_pASM      
#endif /* HELIX_FEATURE_ASM */
    || !m_pPlayerSinkControl
#if defined(HELIX_FEATURE_AUTHENTICATION)
    || !m_pCredentialsCache 
#endif /* HELIX_FEATURE_AUTHENTICATION */
#if defined(HELIX_FEATURE_SYSTEMREQUIRED)
    || !m_pSystemRequired       
#endif /* HELIX_FEATURE_SYSTEMREQUIRED */
#if defined(HELIX_FEATURE_PROXYMGR)

⌨️ 快捷键说明

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