📄 smlparse.cpp
字号:
/* ***** BEGIN LICENSE BLOCK ***** * Source last modified: $Id: smlparse.cpp,v 1.10.2.7 2004/07/13 23:02:47 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>#if defined(_UNIX) && (!(defined(_BEOS))) && (!(defined(_MAC_UNIX)))/*for Display and Screen structs and X functions:*/#include "hlxclib/string.h"#include <X11/X.h>#include <X11/Xlib.h>#include <X11/Xutil.h>#include <X11/Xos.h>#include <sys/types.h>#endif#if defined (_SYMBIAN)# ifdef _SYMBIAN7# include <hal_data.h> # endif# include <hal.h># include <coemain.h># include <e32svr.h># include <e32math.h>#endif// include#include "hxtypes.h"#include "hxwintyp.h"#include "hxcom.h"#include "hxcomm.h"#include "hxprefs.h"#include "hxxml.h"#include "hxmon.h"#include "smiltype.h"#include "hxupgrd.h"// pncont#include "chxpckts.h"#include "hxstring.h"#include "hxslist.h"#include "rtsputil.h"#include "hxstack.h"// pnmisc#include "nptime.h"#include "smpte.h"#include "hxstrutl.h"#include "hxurl.h"#include "hxparse.h"#include "hxwinver.h"#include "dbcs.h" /* for HXGetNextChar() */// rnxmllib#include "xmlreslt.h"#include "hxxmlprs.h"// rmasmil#include "smlelem.h"#include "smltime.h"#include "smlerror.h"#include "smlprstime.h"#include "animattr.h"#include "binrymap.h"#include "smlparse.h"#include "parstabl.h"#include "smlutil.h"// pndebug#include "hxheap.h"#ifdef _DEBUG#undef HX_THIS_FILEstatic const char HX_THIS_FILE[] = __FILE__;#endif#define TARGET_OF_LINK_DESTINATION_SOUND_LEVEL_STR "targetOfLinkDestnSndLevel"#define TARGET_OF_LINK_SOURCE_SOUND_LEVEL_STR "targetOfLinkSourceSndLevel"#if defined(_DEBUG)// /#define XXXEHODGE_DEBUG_EXCL_TRACK_REMOVAL#if defined(XXXEHODGE_DEBUG_EXCL_TRACK_REMOVAL)static BOOL bFirstExclTrackChangeDebugOut = TRUE;#endif#endif#if defined(_DEBUG)// /#define XXXEHODGE_DEBUG_RESETTIMELINEELEMENTDUR_AND_DELAY#if defined(XXXEHODGE_DEBUG_RESETTIMELINEELEMENTDUR_AND_DELAY)static BOOL bFirstResetTimelineElementDuration = TRUE;#endif /*XXXEHODGE_DEBUG_RESETTIMELINEELEMENTDUR_AND_DELAY*/#endif /*_DEBUG*/// /This enables RealPlayer 8 (and prior) behavior when there is no explicit// outer time container (seq, par, [or excl in a SMIL 2.0 doc]):#define ALLOW_PLAYLIST_STYLE_SEQ 1#define DONT_ALLOW_PLAYLIST_STYLE_SEQ_IF_EXPLICIT_OUTER_TIMECONTAINER 1#define CHECKPENDING_TIME_VS_CURTIME_FUDGE_FACTOR 150 /* in milliseconds .*/// /XXXEH- in order to get Interop Timing #25.6 working, we had to trick the// core into staying alive by adding this track in slightly before the one// that paused it has finished:#define FUDGE_FACTOR_WHEN_DEFERRING_PAST_END_OF_GROUP 100 /*milliseconds*/#define FUDGE_FACTOR_FOR_DEFERRING_PRIOR_TO_END_OF_GROUP 500 /*milliseconds*/static const UINT32 MAX_DRIVER_PACKET_SIZE = 1024;static const UINT32 INITIAL_STREAM1_TIMESTAMP = 1;static const UINT32 INITIAL_STREAM0_TIMESTAMP = 0;static const UINT32 MAX_ERROR_LEN = 1024;static const char* const RN_PREFIX = "rn";static const char* const RN_TAG_RENDERER_LIST = "rn:renderer-list";static const char* const RN_TAG_RENDERER = "rn:renderer";static const char* const SYSTEM_COMPONENT_NAMESPACE = "http://features.real.com/systemComponent";static const char* const SYSTEM_COMPONENT = "systemComponent";// /These are all the SMIL Module namespaces recognized by the// SMIL 2.0 Language:// (From http://www.w3.org/AudioVideo/Group/Modules/// smil-modules.html#smilModulesNSSMIL20ModuleIdentifiers)const char* const CSmilParser::zm_pSupportedSMIL2ModuleNamespaces[ NUM_SUPPORTED_SMIL_2_0_MODULE_NAMESPACES+1] ={ // /XXXEH- TODO: OPTIMIZATION: these all share the same base URL, so // we should just store the last part here and combine with the base // when comparing to a used namespace: "http://www.w3.org/2000/SMIL20/CR/NestedTimeContainers", "http://www.w3.org/2000/SMIL20/CR/DeprecatedFeatures", "http://www.w3.org/2000/SMIL20/CR/HostLanguage",#if defined(HANDLE_CATCHALL_NS_FOR_ALL_SMIL_2_0_MODULES) "http://www.w3.org/2000/SMIL20/CR/",#else "",#endif "http://www.w3.org/2000/SMIL20/CR/Language", "http://www.w3.org/2000/SMIL20/CR/IntegrationSet", // /The rest are SMIL 2.0 Module namespaces: "http://www.w3.org/2000/SMIL20/CR/AccessKeyTiming", "http://www.w3.org/2000/SMIL20/CR/AudioLayout", "http://www.w3.org/2000/SMIL20/CR/BasicAnimation", "http://www.w3.org/2000/SMIL20/CR/BasicContentControl", "http://www.w3.org/2000/SMIL20/CR/BasicInlineTiming", "http://www.w3.org/2000/SMIL20/CR/BasicLayout", "http://www.w3.org/2000/SMIL20/CR/BasicLinking", "http://www.w3.org/2000/SMIL20/CR/BasicMedia", "http://www.w3.org/2000/SMIL20/CR/BasicTimeContainers", "http://www.w3.org/2000/SMIL20/CR/BasicTransistions", "http://www.w3.org/2000/SMIL20/CR/BrushMedia", "http://www.w3.org/2000/SMIL20/CR/CoordinatedTransitions", "http://www.w3.org/2000/SMIL20/CR/CustomTestAttributes", "http://www.w3.org/2000/SMIL20/CR/EventTiming", "http://www.w3.org/2000/SMIL20/CR/ExclTimeContainers", "http://www.w3.org/2000/SMIL20/CR/FillDefault", "http://www.w3.org/2000/SMIL20/CR/HierarchicalLayout",#if defined(HANDLE_SMIL_2_0_INLINETRANSITIONS_MODULE) "http://www.w3.org/2000/SMIL20/CR/InlineTransitions",#else "",#endif "http://www.w3.org/2000/SMIL20/CR/LinkingAttributes", "http://www.w3.org/2000/SMIL20/CR/MediaAccessibility", "http://www.w3.org/2000/SMIL20/CR/MediaClipMarkers", "http://www.w3.org/2000/SMIL20/CR/MediaClipping", "http://www.w3.org/2000/SMIL20/CR/MediaDescription", "http://www.w3.org/2000/SMIL20/CR/MediaMarkerTiming", "http://www.w3.org/2000/SMIL20/CR/MediaParam", "http://www.w3.org/2000/SMIL20/CR/Metainformation", "http://www.w3.org/2000/SMIL20/CR/MinMaxTiming", "http://www.w3.org/2000/SMIL20/CR/MultiArcTiming", "http://www.w3.org/2000/SMIL20/CR/MultiWindowLayout", "http://www.w3.org/2000/SMIL20/CR/ObjectLinking", "http://www.w3.org/2000/SMIL20/CR/PrefetchControl", "http://www.w3.org/2000/SMIL20/CR/PrevTiming", "http://www.w3.org/2000/SMIL20/CR/RepeatTiming", "http://www.w3.org/2000/SMIL20/CR/RepeatValueTiming", "http://www.w3.org/2000/SMIL20/CR/RestartDefault", "http://www.w3.org/2000/SMIL20/CR/RestartTiming", "http://www.w3.org/2000/SMIL20/CR/SkipContentControl",#if defined(HANDLE_SMIL_2_0_SPLINEANIMATION_MODULE) "http://www.w3.org/2000/SMIL20/CR/SplineAnimation",#else "",#endif "http://www.w3.org/2000/SMIL20/CR/Structure", "http://www.w3.org/2000/SMIL20/CR/SyncbaseTiming", "http://www.w3.org/2000/SMIL20/CR/SyncBehavior", "http://www.w3.org/2000/SMIL20/CR/SyncBehaviorDefault",#if defined(HANDLE_SMIL_2_0_SYNCMASTER_MODULE) "http://www.w3.org/2000/SMIL20/CR/SyncMaster",#else "",#endif "http://www.w3.org/2000/SMIL20/CR/TimeContainerAttributes",#if defined(HANDLE_SMIL_2_0_TIME_MANIPULATIONS_MODULE) "http://www.w3.org/2000/SMIL20/CR/TimeManipulations",#else "",#endif "http://www.w3.org/2000/SMIL20/CR/TransitionModifiers", "http://www.w3.org/2000/SMIL20/CR/WallclockTiming", "http://www.3gpp.org/SMIL20/PSS4/", "http://www.3gpp.org/SMIL20/PSS5/", NULL};static const struct smilTagTable{ SMILNodeTag m_tag; const char* m_name;} SmilTagTable[] ={ {SMILSmil, "smil"}, {SMILMeta, "meta"}, {SMILMetadata, "metadata"}, {SMILHead, "head"}, {SMILBody, "body"}, {SMILBasicLayout, "layout"}, {SMILRootLayout, "root-layout"}, {SMILRegion, "region"}, {SMILRegPoint, "regPoint"}, {SMILViewport, "topLayout"}, {SMILTransition, "transition"}, {SMILSwitch, "switch"}, {SMILText, "text"}, {SMILImg, "img"}, {SMILRef, "ref"}, {SMILAudio, "audio"}, {SMILVideo, "video"}, {SMILAnimation, "animation"}, {SMILTextstream, "textstream"}, {SMILBrush, "brush"}, {SMILPrefetch, "prefetch"}, {SMILAnchor, "anchor"}, {SMILArea, "area"}, {SMILAAnchor, "a"}, {SMILPar, "par"}, {SMILSeq, "seq"}, {SMILExcl, "excl"}, {SMILPriorityClass, "priorityClass"}, {SMILCustomAttributes, "customAttributes"}, {SMILCustomTest, "customTest"}, {SMILRNRendererList, RN_TAG_RENDERER_LIST}, {SMILRendererPreFetch, RN_TAG_RENDERER}, {SMILAnimate, "animate"}, {SMILSet, "set"}, {SMILAnimateMotion, "animateMotion"}, {SMILAnimateColor, "animateColor"}, {SMILUnknown, "unknown"}};SMILNamespace::SMILNamespace(SMILNamespace* pNS){ if (pNS) { m_name = new_string(pNS->m_name); m_pValue = pNS->m_pValue; if (m_pValue) { m_pValue->AddRef(); } }}SMILNamespace::SMILNamespace(const char* name, IHXBuffer* pVal){ m_name = new_string(name); m_pValue = pVal; if (m_pValue) { m_pValue->AddRef(); }}SMILNamespace::~SMILNamespace(){ HX_VECTOR_DELETE(m_name); HX_RELEASE(m_pValue);}CSmilParser::CSmilParser(IUnknown* pContext): m_pContext(pContext), m_pClassFactory(NULL), m_pISystemRequired(NULL), m_pNodeList(0), m_pNodeListStack(0), m_pPacketQueue(0), m_pIDMap(0), m_pAddGroupMap(0), m_pSourceUpdateList(0), m_pRequireTagsMap(0), m_pCustomTestMap(NULL), m_bNoNamespaces(FALSE), m_bRNNamespace(FALSE), // XXXJHUG -- shouldn't we always ignor? m_bIgnoreUnrecognizedElements(TRUE), m_bSMILRootLayoutAlreadyFound(FALSE), m_pActiveNamespaceMap(NULL), m_pNSConflictList(NULL), m_bTimestampsResolved(FALSE), m_pCurNode(0), m_pNodeDependencies(0), m_pCurrentDependentNode(0), m_pAnchorStack(0), m_pCurrentAnchor(0), m_lLastCheckPendingTime(-1), m_ulBandwidthPreference(0), m_ulScreenHeightPreference(0), m_ulScreenWidthPreference(0), m_ulScreenDepthPreference(0), m_pLanguagePreferenceList(0), m_bCaptionsPreference(FALSE), m_pOverdubOrCaptionPreference(0), m_bSystemAudioDescPreference(FALSE), m_bUseSystemCPU(TRUE), // /If regkey not present, treat as "TRUE" m_bUseSystemOS(TRUE), // /If regkey not present, treat as "TRUE" m_pBasePath(0), m_pTagAttributeMap(0), m_bContainsSource(FALSE), m_bContainsInitiallyScheduledTrack(FALSE), m_ulDurIfNoInitialTracksScheduled(DEFAULT_DUR_IF_NO_SOURCES_SCHEDULED), m_pEncoding(0), m_pTrackHintList(0), m_pParser(NULL), m_pResponse(NULL), m_ulErrorLineNumber(0), m_ulErrorColumnNumber(0), m_pErrorText(NULL) , m_bStoreErrors(FALSE) , m_pErrors(NULL) , m_pBeginTimeSyncList(NULL) , m_pEndTimeSyncList(NULL) , m_pBeginEventList(NULL) , m_pEndEventList(NULL) , m_pBeginMediaMarkerList(NULL) , m_pEndMediaMarkerList(NULL) , m_pClipBeginMarkerList(NULL) , m_pClipEndMarkerList(NULL) , m_pPendingBeginTimeList(NULL) , m_pPendingEndTimeList(NULL) , m_pOnLoadURLList(NULL) , m_pOnLoadURLListCopyForPostSeek(NULL) , m_bHandlePostSeekOnLoadURLs(FALSE)#if defined(HELIX_FEATURE_SMIL2_TRANSITIONS) , m_pTransitionMap(NULL)#endif /* #if defined(HELIX_FEATURE_SMIL2_TRANSITIONS) */ , m_bFirstPacket(TRUE) , m_pDefaultNamespace(NULL) , m_ulPlatformVer(HX_PLATFORM_UNKNOWN) , m_ulPersistentComponentID(0) , m_ulPersistentComponentDelay(0) , m_ulPersistentComponentDuration(0) , m_bAllowPlaylistBehavior(FALSE) , m_elementWithinTag(WithinUnknown) , m_pElementMap(NULL) , m_pAttributeMap(NULL)#if defined(HELIX_FEATURE_SMIL2_VALIDATION) , m_pExtElementMap(NULL) , m_pExtAttributeMap(NULL) , m_pNamespaceMap(NULL) , m_pLegalAttrMap(NULL) , m_pContentModelMap(NULL) , m_pAttrType(NULL) , m_ppEnumAttrMap(NULL) , m_ppReqAttrList(NULL)#endif /* #if defined(HELIX_FEATURE_SMIL2_VALIDATION) */ , m_pValNSList(NULL) , m_pXMMFElementList(NULL) , m_lParseError(HXR_OK) , m_pAnimateElementList(NULL) , m_pBeginTimeMap(NULL) , m_pEndTimeMap(NULL) , m_pExternalEventList(NULL) , m_pExternalEventListPos(NULL) , m_bAllTracksNeedReflushHint(FALSE) , m_pElementsWithHandlerList(NULL) , m_pVarName(NULL) , m_ulNextVar(1024) , m_pTimelineElementManager(NULL){ if(m_pContext) { m_pContext->AddRef(); m_pContext->QueryInterface(IID_IHXCommonClassFactory, (void**)&m_pClassFactory); } initRequireTags(); initTagAttributes(); getPreferences(); initParsingMaps(); m_versionInfo.dwPlatformId = HX_PLATFORM_UNKNOWN; m_versionInfo.dwMachineType = HX_MACHINE_UNKNOWN; // /Get the OS and CPU version information: m_ulPlatformVer = HXGetWinVer(&m_versionInfo); // Allocate the variable name buffer m_pVarName = new char [256]; // Allocate the timeline element manager m_pTimelineElementManager = new CSmilTimelineElementManager;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -