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

📄 smldoc.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 5 页
字号:
/* ***** BEGIN LICENSE BLOCK ***** * Source last modified: $Id: smldoc.cpp,v 1.10.4.8 2004/07/13 22:46:02 ehodge 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 ***** */// system#include <time.h>#include <math.h>#include <ctype.h>  /* for isspace() */#if defined(_UNIX)  &&  (!(defined(_BEOS)))  &&  defined(USE_XWINDOWS)#include <X11/Xlib.h>#include <X11/Xutil.h>#endif// include#include "hxtypes.h"#include "hxwintyp.h"#include "hxcom.h"#include "smiltype.h"#include "hxcomm.h"#include "ihxpckts.h"#include "hxprefs.h"#include "hxplugn.h"#include "hxcore.h"#include "hxwin.h"#include "hxsite2.h"#include "hxrendr.h"#include "hxgroup.h"#include "hxevent.h"#include "hxvsurf.h"#include "hxhyper.h"#include "hxxml.h"#include "hxvport.h"#include "hxfiles.h"#include "hxausvc.h"#include "hxclsnk.h"#if !defined(XXXEH_NEED_TO_ADD_51_PRCNT_OPAQUE_SITE_ON_TOP_TO_DISABLE)#include "hxvctrl.h"#endif#include "hxmmrkr.h"#include "hxinter.h"#include "hxupgrd.h"#include "hxsm2sm.h"#include "hxerror.h"// pncont#include "hxslist.h"#include "chxpckts.h"#include "hxstring.h"#include "hxmap.h"#include "hxordval.h"#include "hxstack.h"#include "rtsputil.h"// pnmisc#include "hxurl.h"#include "hxstrutl.h"#include "hxwinver.h"#include "hxtick.h"#include "dllpath.h"// rnxmllib#include "hxxmlprs.h"// coreres#include "smilres.h"// pxcomlib#include "buffutil.h"// rmasmil#include "smlelem.h"#include "smlparse.h"#include "smlprstime.h"#include "smlerror.h"#include "smlutil.h"// smlrendr#include "smlrendr.h"#include "smlrtype.h"#include "animattr.h"#include "animsand.h"#include "evnthook.h"#include "siteuser.h"#include "sitewatc.h"#include "layout.h"#include "passivsw.h"#include "layevent.h"#include "smcallbk.h"#include "xdata.h"#include "smldoc.h"#if defined(_WINDOWS)#include "hxalloc.h"#define IDC_HANDCURSOR 102#elif defined (_MACINTOSH)#include "hxmm.h"#include "cresload.h"extern FSSpec g_DLLFSpec;#endif#if defined(_UNIX)  &&  (!(defined(_BEOS)))  &&  defined(USE_XWINDOWS)#include <X11/Xlib.h>#include <X11/Xutil.h>#include <X11/cursorfont.h>/* USE_SHM doesn't work yet */#ifdef USE_SHM#undef USE_SHM#endif /* USE_SHM */#endif// pndebug#include "errdbg.h"#include "debugout.h"#include "smlrmlog.h"#include "hxheap.h"#ifdef _DEBUG#undef HX_THIS_FILEstatic const char HX_THIS_FILE[] = __FILE__;#endif#ifdef _WINDOWSextern HINSTANCE g_hInstance;#endif// /This got removed, accidentally, by huge optimization HEAD check-in on// 11/7/2001, causing show="new" and target="[someLPP]" (launching of LPP)// to stop working.  Putting this back in fixes PR 69905:#define XXXEH_USE_OPENWINDOW_METHOD#define HANDLE_DISCRETE_MEDIA_IN_TrackDurationSet 1// /XXXEH- talk to core devs; we need them to be able to// deal with an added track that all of a sudden has its// duration changed to zero; this seems to work fine for// tracks that have a zero delay, but subsequent ones// hang the system when their durations are set to zero:#define XXXEH_WAITING_FOR_PLAYER_CORE_FIX_FOR_RESETTING_DUR_TO_ZERO#if defined(XXXEH_WAITING_FOR_PLAYER_CORE_FIX_FOR_RESETTING_DUR_TO_ZERO)#define ZERO_DUR    1 /* 1 millisecond to trick core. */#else#define ZERO_DUR    0#endif// /For case where destinationLevel < 10 on a new player and we need to set// the shared-by-all-players volume to accomodate this, we need to limit it// for now so source player's volume doesn't cut out:#define XXXEH_MIN_DEST_AUDIOPLAYER_VOL    10// /Clamp track soundLevel at some arbitrary, high value; MEH chose 1000% (10x)// for max-allowed animation of soundLevel; use 1000 until someone complains// and then ask them what would be better:#define MAX_ALLOWED_SOUNDLEVEL  1000.0// /#define XXXEH_DEBUG_HANDLESOURCE_AND_TRACKDURATIONSET// /#define XXXEH_DEBUGOUT_TRACKSTOPPAUSERESUME// /#define XXXEH_DEBUGOUT_RESOLVEGROUPDUR/* * CSmilDocumentRenderer methods */CSmilDocumentRenderer::CSmilDocumentRenderer(    CSmilRenderer* pParent, IUnknown* pContext):    m_pParent(pParent),    m_pSmilParser(0),    m_ulParseResult(HXR_OK),    m_lRefCount(0),    m_pRegionMap(0),    m_pRootLayout(NULL),    m_pViewportList(NULL),    m_pRegPointMap(NULL),#if defined(HELIX_FEATURE_SMIL2_TRANSITIONS)    m_pTransitionMap(0),#endif /* #if defined(HELIX_FEATURE_SMIL2_TRANSITIONS) */    m_pSiteInfoByRendererMap(0),    m_pSiteWatcherMap(0),    m_pGroupInfoMap(0),    m_pGroupMap(0),    m_pDeferredSourceMap(0),    m_pDeferrededRemoveTrackMap(NULL),    m_bInTrackDurationSetCall(FALSE),    m_bEventSinkWasSetup(FALSE),    m_pPausedAndDisabledIDMap(NULL),    m_pPausedAndDisabledBrightnessMap(NULL),    m_pPrefetchTrackElementMap(0),    m_pSiteInfoList(0),    m_uCurrentGroupIndex(-1),    m_pPlayToAssocList(0),    m_pZOrderList(0),    m_pSiteMgr(0),    m_pScheduler(0),    m_pEventList(0),    m_pFragment(0),    m_ulCurrentTime(0),    m_ulEventListPosition(0),    m_bFirstTimeSync(FALSE),    m_bSettingFragment(FALSE),    m_bFragFoundAndResolved(FALSE),    m_ulFragmentTimeOffset(0),    m_bInHyperlink(FALSE),    m_pStatusMessage(0),    m_bStatusMessageSet(FALSE),    m_bMetadataPassedOffAlready(FALSE),    m_pPersistentLayoutStream(NULL),    m_bIsRootLayoutSetup(FALSE),    m_ulNoLayoutRendererCount(0),    m_pErrorMessages(NULL),    m_bDestPlaystateIsPause(FALSE),#ifdef _WINDOWS    m_hPreHyperlinkCursor(0),    m_hHyperlinkCursor(0),    m_bNeedToSetHyperlinkCursor(FALSE),#endif#ifdef _MACINTOSH    m_hHyperlinkCursor(0),    m_bResetCursor(FALSE),#endif#if defined(_UNIX)  &&  (!(defined(_BEOS)))  &&  defined(USE_XWINDOWS)    m_hHyperlinkCursor(0),    m_hCurrentCursor(0),    m_pDisplay(0),    m_Window(0),    m_pPixmapDisplay(NULL),    m_pVisualInfo(NULL),#endif    m_bSiteLayoutComplete(FALSE),    m_nFragmentTracks(0),    m_dResizeXScale(1.0),    m_dResizeYScale(1.0),    m_pActiveTransitions(NULL),    m_pActiveAnimations(NULL),    m_pRegionMapIterator(NULL),    m_pAnimationMap(NULL),    m_pDelayedRendererCloseList(NULL),    m_bSMILPresentationHasEnded(FALSE),    m_pSMILDefaultNamespaceStr(NULL),    m_pViewPortManager(NULL)#ifdef XXXMEH_DO_VIEWPORT_TLC    ,m_pViewPortSiteMap(NULL)    ,m_bSMILViewportClose(FALSE)#endif    , m_pPlayerResumeStack(NULL)#if defined(BE_SITE_SUPPLIER_20010205)    , m_pIndependentPlayer(NULL)    , m_pChildSiteInfoMap(NULL)#endif /* BE_SITE_SUPPLIER_20010205 */    , m_ulGroupIndex(0)    , m_ulTrackIndex(0)    , m_uGroupIndexWithin(0)    , m_bSitesDetached(FALSE)    , m_ulPersistentComponentID(0)    , m_uPersistentGroupID(0)    , m_uPersistentTrackID(0)    , m_pPersistentProperties(NULL)    , m_pPersistentParentRenderer(NULL)    , m_pExternalMediaMarkerList(NULL)    , m_bLayoutElementPresent(FALSE)    , m_bEmptyLayout(FALSE)    , m_bDoNotZoom(FALSE)    , m_AnimationIterator(NULL)    , m_pAnimSiteRedrawMap(NULL)    , m_pAnimRegionRecomputeMap(NULL)    , m_bAnimateRootLayout(FALSE)    , m_pAnimTopLayoutMap(NULL)    , m_usAnimBaseGroupIndex(0)    , m_ulAnimDuration(0)    , m_ulCurGroupDuration(0)    , m_pSoundLevelMutex(NULL)    , m_bCloseCalled(FALSE)    , m_bRootLayoutSiteDetached(FALSE)    , m_pHandlePendingSchedulingCallback(NULL)    , m_pHyperlinkCallback(NULL)    , m_pMediaID2RendererMap(NULL)    , m_pMediaID2RendererSiteMap(NULL)    , m_pMediaID2RendererSiteWatcherMap(NULL)    , m_pEventSinkList(NULL)    , m_ulPktnum(0)    , m_usOldXPos(0)    , m_usOldYPos(0){    m_pContext = pContext;    HX_ASSERT(m_pContext);    if(m_pContext)    {	m_pContext->AddRef();		HX_VERIFY(HXR_OK == m_pContext->		  QueryInterface(IID_IHXSiteManager,(void**)&m_pSiteMgr));		HX_VERIFY(HXR_OK == m_pContext->		  QueryInterface(IID_IHXScheduler, (void**)&m_pScheduler));		if (HXR_OK != m_pContext->QueryInterface(IID_IHXStatusMessage,						 (void**)&m_pStatusMessage))	{	    // not an error, just a feature waiting to happen...	    m_pStatusMessage = NULL;	}#if defined(HELIX_FEATURE_SMIL2_MULTIWINDOWLAYOUT)        // QI for IHXViewPortManager        m_pContext->QueryInterface(IID_IHXViewPortManager,                                   (void**) &m_pViewPortManager);        if (m_pViewPortManager)        {            // Add ourselves as a view port sink            IHXViewPortSink* pSink = NULL;            QueryInterface(IID_IHXViewPortSink, (void**) &pSink);            if (pSink)            {                m_pViewPortManager->AddViewPortSink(pSink);            }            HX_RELEASE(pSink);        }#endif /* #if defined(HELIX_FEATURE_SMIL2_MULTIWINDOWLAYOUT) */        // Add ourselves as a media marker sink        // TRUE adds us, FALSE removes us        addRemoveMediaMarkerSink(TRUE);        // Add ourselves as an error sink        addRemoveErrorSink(TRUE);        // QI for IHXErrorMessages - ok if not implemented        m_pContext->QueryInterface(IID_IHXErrorMessages,                                   (void**) &m_pErrorMessages);    }#ifdef _WINDOWS    m_hHyperlinkCursor = LoadCursor(g_hInstance,        MAKEINTRESOURCE(IDC_HANDCURSOR));#endif#ifdef _MACINTOSH    const short HAND_CURSOR  = 1313;    m_pResourceLoader = CResourceLoader::CreateInstance(g_DLLFSpec);    m_hHyperlinkCursor = (CursHandle)m_pResourceLoader->LoadResource('CURS', HAND_CURSOR);#endif    #ifdef _DEBUG    BOOL bShowDependencies = FALSE;    ::getBooleanPreference(m_pContext,                           "showdependencies",                           bShowDependencies);    if(bShowDependencies)    {	// mark file boundary#ifdef _WINDOWS        const char* pszDepFile = "\\smildep.txt";#else        const char* pszDepFile = "smildep.txt";#endif	FILE* fp = fopen(pszDepFile, "a");	if(fp)	{    	    fprintf(fp, "===========================\n");	    fclose(fp);	}    }#endif}CSmilDocumentRenderer::~CSmilDocumentRenderer(){    HX_RELEASE(m_pSiteMgr);    HX_DELETE(m_pRootLayout);

⌨️ 快捷键说明

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