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

📄 playhpnv.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 "hlxclib/stdio.h"
#if defined(_AIX)
#include <string.h>
#define strnicmp strncasecmp
#endif // _AIX
#include "hxtypes.h"
#include "hxresult.h"
#include "hxcom.h"
#include "hxprefs.h"
#include "hxhyper.h"
#include "hxplugn.h"
#include "hxfiles.h"
#include "hxtick.h"
#include "plghand2.h"

#include "hxcore.h"
#include "playhpnv.h"

#include "dbcs.h"
#include "hxstring.h"
#include "hxrquest.h"
#include "nptime.h"
#include "chxpckts.h"
#include "hxstrutl.h"
#include "hxgroup.h"
#include "hxmon.h"
#include "dbcs.h"
#include "corshare.h"

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


/****************************************************************************
 *
 *  Interface:
 *
 *	HXHyperNavigate
 *
 *  Purpose:
 *
 *	TBD
 *
 *  IID_IHXHyperNavigate:
 *
 *	{00000900-61DF-11d0-9CEE-080017035B43}
 *
 */


PlayerHyperNavigate::PlayerHyperNavigate() :
      m_bInitialized(FALSE)
    , m_lRefCount(0)
    , m_pContext(NULL)
    , m_pPlayer(0)
    , m_pGroupManager(0)
    , m_pHyperNavigate(0)
    , m_pHyperNavigateWithContext(NULL)
    , m_pPendingRequest(NULL)
    , m_pScheduler(NULL)
    , m_CallbackHandle(0)
    , m_pFileObject(0)
{
}

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

/////////////////////////////////////////////////////////////////////////
//	Method:
//		IUnknown::QueryInterface
//	Purpose:
//		Implement this to export the interfaces supported by your
//		object.
//
STDMETHODIMP PlayerHyperNavigate::QueryInterface(REFIID riid, void** ppvObj)
{
    QInterfaceList qiList[] =
        {
            { GET_IIDHANDLE(IID_IHXHyperNavigate), (IHXHyperNavigate*)this },
            { GET_IIDHANDLE(IID_IHXHyperNavigate2), (IHXHyperNavigate2*)this },
            { GET_IIDHANDLE(IID_IHXHyperNavigateHint), (IHXHyperNavigateHint*)this },
            { GET_IIDHANDLE(IID_IHXHTTPRedirectResponse), (IHXHTTPRedirectResponse*)this },
            { GET_IIDHANDLE(IID_IHXFileSystemManagerResponse), (IHXFileSystemManagerResponse*)this },
            { GET_IIDHANDLE(IID_IHXCallback), (IHXCallback*)this },
            { GET_IIDHANDLE(IID_IUnknown), (IUnknown*)(IHXHyperNavigate*)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) PlayerHyperNavigate::AddRef()
{
    return InterlockedIncrement(&m_lRefCount);
}

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

    delete this;

    return 0;
}


void     
PlayerHyperNavigate::Close(void)
{
    HX_RELEASE(m_pFileObject);
    HX_RELEASE(m_pContext);
    HX_RELEASE(m_pPlayer);
    HX_RELEASE(m_pGroupManager);
    HX_RELEASE(m_pHyperNavigate);
    HX_RELEASE(m_pHyperNavigateWithContext);
    HX_RELEASE(m_pPendingRequest);
    if (m_CallbackHandle && m_pScheduler)
    {
	m_pScheduler->Remove(m_CallbackHandle);
	m_CallbackHandle = 0;
    }
    HX_RELEASE(m_pScheduler);

}

STDMETHODIMP PlayerHyperNavigate::Init(IUnknown* pContext, IHXHyperNavigate* pHyperNavigate, 
				       IHXHyperNavigateWithContext* pHyperNavigateWithContext)
{
    if (!pContext)
    {
	return HXR_UNEXPECTED;
    }

    m_pContext = pContext;
    m_pContext->AddRef();

    IHXPlayer* pPlayer = 0;

    if (pContext && pContext->QueryInterface(IID_IHXPlayer, (void**)&pPlayer) == HXR_OK)
    {
        m_pPlayer = pPlayer;
    }

    IHXGroupManager* pGroupManager = 0;

    if (m_pPlayer && m_pPlayer->QueryInterface(IID_IHXGroupManager, (void**)&pGroupManager) == HXR_OK)
    {
	m_pGroupManager = pGroupManager;
    }

    if (m_pPlayer)
    {
	m_pPlayer->QueryInterface(IID_IHXScheduler, (void**)&m_pScheduler);
    }

    m_pHyperNavigate		= pHyperNavigate;
    m_pHyperNavigateWithContext = pHyperNavigateWithContext;

    if (m_pHyperNavigate)
	m_pHyperNavigate->AddRef();

    if (m_pHyperNavigateWithContext)
	m_pHyperNavigateWithContext->AddRef();

    m_bInitialized = TRUE;

    return HXR_OK;
}

/*
 *	IHXHyperNavigate methods
 */

#define URL_COMMAND_SEEK "seek("
#define URL_COMMAND_PLAY "play("
#define URL_COMMAND_PAUSE "pause("
#define URL_COMMAND_STOP "stop("
#define URL_COMMAND_PREVIOUSCLIP "previousclip("
#define URL_COMMAND_NEXTCLIP "nextclip("
#define URL_COMMAND_ADSCOOKIES "adscookies("

/************************************************************************
 *	Method:
 *	    IHXHyperNavigate::GoToURL
 *	Purpose:
 *	    Parses and delegates player commands or performs a simple Go To
 *          URL operation in the user's browser.
 */

STDMETHODIMP PlayerHyperNavigate::GoToURL(const char* pURL, const char* pTarget)
{
    return ExecuteWithContext(pURL, pTarget, NULL, NULL, NULL, NULL);
}


/************************************************************************
 *	Method:
 *	    IHXHyperNavigate2::Execute
 *	Purpose:
 *	    
 *	Parameters:
 *      pURL:	    URL (absolute or relative)
 *	    pTargetInstance:	
 *	    pTargetApplication: 
 *	    pTargetRegion:
 *	    pParams:
 */
STDMETHODIMP 
PlayerHyperNavigate::Execute(const char* pURL,
			     const char* pTargetInstance,
			     const char* pTargetApplication,
			     const char* pTargetRegion,
			     IHXValues* pParams)
{
    return ExecuteWithContext(pURL, pTargetInstance, pTargetApplication,
			      pTargetRegion, pParams, NULL);
}


HX_RESULT
PlayerHyperNavigate::ExecuteWithContext(const char* pURL,
					const char* pTargetInstance,
					const char* pTargetApplication,
					const char* pTargetRegion,
					IHXValues* pParams,
					IUnknown*	pContext)
{
    if (!m_bInitialized)
    {
	return HXR_NOT_INITIALIZED;
    }

    if (pURL == NULL)
    {
	return HXR_FAIL;
    }

    HX_RESULT hxrResult = HXR_NOTIMPL;

    // first, deleegate to the alternate hypernavigation interface

    if (m_pHyperNavigateWithContext)
    {
	hxrResult = m_pHyperNavigateWithContext->ExecuteWithContext(pURL, pTargetInstance, 
		    pTargetApplication, pTargetRegion, pParams, pContext);
    }
    else if (m_pHyperNavigate)
    {
	hxrResult = m_pHyperNavigate->GoToURL(pURL, pTargetInstance);
    }

    // if alternate hypernavigation says it doesn't implement
    if (hxrResult != HXR_NOTIMPL)
	return(hxrResult);

    return HandleCommands(pURL, pTargetInstance, pParams);
}

⌨️ 快捷键说明

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