vbasernd.cpp
来自「symbian 下的helix player源代码」· C++ 代码 · 共 563 行 · 第 1/2 页
CPP
563 行
/* ***** BEGIN LICENSE BLOCK *****
* Source last modified: $Id: vbasernd.cpp,v 1.5.24.2 2004/07/09 12:53:26 pankajgupta Exp $
*
* Portions Copyright (c) 1995-2004 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 (the "RPSL") available at
* http://www.helixcommunity.org/content/rpsl unless you have licensed
* the file under the current version of the RealNetworks Community
* Source License (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.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License Version 2 or later (the
* "GPL") in which case the provisions of the GPL are applicable
* instead of those above. If you wish to allow use of your version of
* this file only under the terms of the GPL, and not to allow others
* to use your version of this file under the terms of either the RPSL
* or RCSL, indicate your decision by deleting the provisions above
* and replace them with the notice and other provisions required by
* the GPL. If you do not delete the provisions above, a recipient may
* use your version of this file under the terms of any one of the
* RPSL, the RCSL or the GPL.
*
* 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
#include "hxtypes.h"
#include "hxwintyp.h"
#include "hxcom.h"
#include "hxassert.h"
#ifdef _WINDOWS
#include <windows.h>
#include "resource.h"
#elif defined(_UNIX) && defined(USE_XWINDOWS)
#include <X11/cursorfont.h>
#include <X11/Intrinsic.h>
#elif defined(_MACINTOSH) || defined(_MAC_UNIX)
#include <ctype.h>
#include "platform/mac/cresload.h"
extern FSSpec g_DLLFSpec;
//CResourceLoader* CResourceLoader::zm_theResourceLoader = NULL;
#endif
#include "hxcomm.h"
#include "ihxpckts.h"
#include "hxhyper.h"
#include "hxupgrd.h"
#include "hxprefs.h"
#include "hxplugn.h"
#include "hxengin.h"
#include "hxrendr.h"
#include "hxwin.h"
#include "hxmon.h"
#include "hxcore.h"
#include "hxasm.h"
#include "hxvsurf.h"
#include "hxevent.h"
#include "hxerror.h"
// pncont
#include "hxbuffer.h"
// pnmisc
#include "unkimp.h"
#include "baseobj.h"
// baserend
#include "baserend.h"
#include "vbasernd.h"
#ifdef _WINDOWS
extern HINSTANCE g_hInstance;
#endif
CRNVisualBaseRenderer::CRNVisualBaseRenderer()
: CRNBaseRenderer()
{
m_cWindowSize.cx = 0;
m_cWindowSize.cy = 0;
m_pMISUS = NULL;
m_pSite = NULL;
m_pStatusMessage = NULL;
m_sOldMouseX = -1;
m_sOldMouseY = -1;
m_bStatusMsgWillNeedErasing = FALSE;
m_bSetHyperlinkCursor = FALSE;
#if defined(_WINDOWS)
m_hPreHyperlinkCursor = NULL;
m_hHyperlinkCursor = NULL;
#elif defined(_MACINTOSH)
const short HAND_CURSOR = 1313;
m_eCurrentCursor = CURSOR_ARROW;
m_pResourceLoader = CResourceLoader::CreateInstance(g_DLLFSpec);
m_hHyperlinkCursor = (CursHandle)m_pResourceLoader->LoadResource('CURS', HAND_CURSOR);
#elif defined(_UNIX) && defined(USE_XWINDOWS)
m_pDisplay = 0;
m_Window = 0;
m_hHyperlinkCursor = 0;
m_hCurrentCursor = 0;
#endif
}
CRNVisualBaseRenderer::~CRNVisualBaseRenderer()
{
HX_RELEASE(m_pMISUS);
HX_RELEASE(m_pSite);
HX_RELEASE(m_pStatusMessage);
#if defined(_MACINTOSH)
if (m_hHyperlinkCursor)
{
m_pResourceLoader->UnloadResource((Handle)m_hHyperlinkCursor);
m_hHyperlinkCursor = NULL;
HX_RELEASE(m_pResourceLoader);
}
#endif
#if defined(_UNIX) && defined(USE_XWINDOWS)
if (m_pDisplay && m_hHyperlinkCursor)
{
XLockDisplay(m_pDisplay);
XFreeCursor(m_pDisplay, m_hHyperlinkCursor);
XUnlockDisplay(m_pDisplay);
m_hHyperlinkCursor = 0;
}
#endif
}
STDMETHODIMP CRNVisualBaseRenderer::QueryInterface(REFIID riid, void** ppvObj)
{
HX_RESULT retVal = HXR_OK;
if (ppvObj)
{
// Set default
*ppvObj = NULL;
// Check for IID type
if (IsEqualIID(riid, IID_IHXSiteUser))
{
AddRef();
*ppvObj = (IHXSiteUser*) this;
}
else if (IsEqualIID(riid, IID_IHXSiteUserSupplier))
{
if (m_pMISUS)
{
return m_pMISUS->QueryInterface(IID_IHXSiteUserSupplier, ppvObj);
}
else
{
retVal = HXR_UNEXPECTED;
}
}
else
{
// If we don't support it, then QI our
// base class for this interface
retVal = CRNBaseRenderer::QueryInterface(riid, ppvObj);
}
}
else
{
retVal = HXR_FAIL;
}
return retVal;
}
STDMETHODIMP_(UINT32) CRNVisualBaseRenderer::AddRef()
{
return CRNBaseRenderer::AddRef();
}
STDMETHODIMP_(UINT32) CRNVisualBaseRenderer::Release()
{
return CRNBaseRenderer::Release();
}
STDMETHODIMP CRNVisualBaseRenderer::InitPlugin(IUnknown *pContext)
{
HX_RESULT retVal = CRNBaseRenderer::InitPlugin(pContext);
if (SUCCEEDED(retVal))
{
// Now we need to get IHXStatusMessage - OK if TLC doesn't support it
HX_RELEASE(m_pStatusMessage);
pContext->QueryInterface(IID_IHXStatusMessage, (void**) &m_pStatusMessage);
}
return retVal;
}
STDMETHODIMP CRNVisualBaseRenderer::StartStream(IHXStream* pStream, IHXPlayer* pPlayer)
{
HX_RESULT retVal = HXR_OK;
// Call the super-class's StartStream()
retVal = CRNBaseRenderer::StartStream(pStream, pPlayer);
#if defined (HELIX_FEATURE_MISU)
if (SUCCEEDED(retVal))
{
// Create a IHXMultiInstanceSiteUserSupplier interface
HX_RELEASE(m_pMISUS);
retVal = m_pCommonClassFactory->CreateInstance(CLSID_IHXMultiInstanceSiteUserSupplier,
(void**) &m_pMISUS);
if (SUCCEEDED(retVal))
{
// Register ourselves as a site user
retVal = m_pMISUS->SetSingleSiteUser((IUnknown*) (IHXSiteUser*) this);
}
}
#endif
// Clean up the state if there was an error
if (FAILED(retVal))
{
HX_RELEASE(m_pStream);
HX_RELEASE(m_pPlayer);
HX_RELEASE(m_pBackChannel);
HX_RELEASE(m_pASMStream);
HX_RELEASE(m_pMISUS);
}
return retVal;
}
STDMETHODIMP CRNVisualBaseRenderer::AttachSite(IHXSite *pSite)
{
HX_RESULT retVal = HXR_OK;
if (pSite)
{
// Check to see if we alredy have a site interface
if (!m_pSite)
{
// Save a copy of the IHXSite interface
m_pSite = pSite;
m_pSite->AddRef();
// Get the window size from the sub-class
retVal = GetWindowSize(m_cWindowSize);
if (SUCCEEDED(retVal))
{
// Inform the site of our size
retVal = m_pSite->SetSize(m_cWindowSize);
}
//Give sub class a change to set up site.
_AttachSite();
}
else
{
retVal = HXR_UNEXPECTED;
}
}
else
{
retVal = HXR_FAIL;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?