rpparser.cpp
来自「symbian 下的helix player源代码」· C++ 代码 · 共 1,582 行 · 第 1/5 页
CPP
1,582 行
/* ***** BEGIN LICENSE BLOCK *****
* Source last modified: $Id: rpparser.cpp,v 1.3.24.1 2004/07/09 01:54:51 hubbe 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 "hxresult.h"
#include "hxcomm.h"
#include "ihxpckts.h"
#include "hxxml.h"
#include "hxxres.h"
#include "hxxrsmg.h"
#include "hxerror.h"
// hxmisc
#include "baseobj.h"
#include "unkimp.h"
#include "hxxmlprs.h"
#include "hxparse.h"
// hxcont
#include "hxbuffer.h"
#include "hxslist.h"
#include "hxmap.h"
// coreres
#include "pixres.h"
// pxcomlib
#include "pxrect.h"
#include "pxcolor.h"
#include "pxeffect.h"
#include "gstring.h"
#include "parseurl.h"
#include "rpfile.h"
#include "pxerror.h"
#include "rpparser.h"
// hxdebug
#include "hxheap.h"
#ifdef _DEBUG
#undef HX_THIS_FILE
static char HX_THIS_FILE[] = __FILE__;
#endif
#define BASE_VERSION HX_ENCODE_PROD_VERSION(0, 0, 0, 0)
#define U2_VERSION HX_ENCODE_PROD_VERSION(1, 1, 0, 0)
#define REDSTONE_VERSION HX_ENCODE_PROD_VERSION(1, 1, 0, 0) // XXXMEH - for now, we keep it the same
#define OPACITY_VERSION HX_ENCODE_PROD_VERSION(1, 4, 0, 0)
const UINT32 PXRealPixParser::m_ulHighestSupportedContentVersion = OPACITY_VERSION;
const PXRealPixParser::PXStringTable PXRealPixParser::m_pTagTable[] =
{
{ kTagRoot, "imfl" },
{ kTagHead, "head" },
{ kTagImage, "image" },
{ kTagFill, "fill" },
{ kTagFadein, "fadein" },
{ kTagCrossfade, "crossfade" },
{ kTagFadeout, "fadeout" },
{ kTagWipe, "wipe" },
{ kTagAnimate, "animate" },
{ kTagViewchange, "viewchange" },
{ kTagEffect, "effect" },
{ kNumTags, NULL }
};
const PXRealPixParser::PXStringTable PXRealPixParser::m_pAttrTable[] =
{
{ kAttrWidth, "width" },
{ kAttrHeight, "height" },
{ kAttrBitrate, "bitrate" },
{ kAttrTimeformat, "timeformat" },
{ kAttrVersion, "version" },
{ kAttrTitle, "title" },
{ kAttrAuthor, "author" },
{ kAttrCopyright, "copyright" },
{ kAttrBackgroundcolor, "background-color" },
{ kAttrBackgroundOpacity, "backgroundOpacity"},
{ kAttrStart, "start" },
{ kAttrPreroll, "preroll" },
{ kAttrAspect, "aspect" },
{ kAttrUrl, "url" },
{ kAttrMaxfps, "maxfps" },
{ kAttrDuration, "duration" },
{ kAttrHandle, "handle" },
{ kAttrName, "name" },
{ kAttrTarget, "target" },
{ kAttrSrcx, "srcx" },
{ kAttrSrcy, "srcy" },
{ kAttrSrcw, "srcw" },
{ kAttrSrch, "srch" },
{ kAttrDstx, "dstx" },
{ kAttrDsty, "dsty" },
{ kAttrDstw, "dstw" },
{ kAttrDsth, "dsth" },
{ kAttrColor, "color" },
{ kAttrDirection, "direction" },
{ kAttrType, "type" },
{ kAttrPackage, "package" },
{ kAttrData, "data" },
{ kAttrFile, "file" },
{ kAttrStartsrcx, "startsrcx" },
{ kAttrStartsrcy, "startsrcy" },
{ kAttrStartsrcw, "startsrcw" },
{ kAttrStartsrch, "startsrch" },
{ kAttrStartdstx, "startdstx" },
{ kAttrStartdsty, "startdsty" },
{ kAttrStartdstw, "startdstw" },
{ kAttrStartdsth, "startdsth" },
{ kAttrCenter, "center" },
{ kAttrSize, "size" },
{ kAttrMime, "mime" },
{ kNumAttr, NULL }
};
// This list will be used to initialize a data structure for
// legal attribute lookup. The pattern is:
//
// tag-id1, id1-attr1, id1-attr2, ..., kNumAttr
// tag-id2, id2-attr1, id2-attr2, ..., kNumAttr
// ...
// kNumTags
//
//
// kNumAttr is a marker for the end of the list of attribute ids.
//
const BYTE PXRealPixParser::m_pAttrList[] =
{
kTagRoot, kNumAttr,
kTagHead, kAttrWidth, kAttrHeight, kAttrBitrate, kAttrTimeformat,
kAttrVersion, kAttrTitle, kAttrAuthor, kAttrCopyright,
kAttrBackgroundcolor, kAttrStart, kAttrPreroll, kAttrAspect,
kAttrUrl, kAttrMaxfps, kAttrDuration, kAttrCenter, kNumAttr,
kTagImage, kAttrHandle, kAttrName, kAttrSize, kAttrMime, kNumAttr,
kTagFill, kAttrStart, kAttrDstx, kAttrDsty, kAttrDstw, kAttrDsth,
kAttrUrl, kAttrMaxfps, kAttrColor, kNumAttr,
kTagFadein, kAttrStart, kAttrDuration, kAttrTarget, kAttrSrcx,
kAttrSrcy, kAttrSrcw, kAttrSrch, kAttrDstx, kAttrDsty,
kAttrDstw, kAttrDsth, kAttrUrl, kAttrMaxfps,
kAttrAspect, kAttrCenter, kAttrBackgroundcolor, kNumAttr,
kTagCrossfade, kAttrStart, kAttrDuration, kAttrTarget, kAttrSrcx,
kAttrSrcy, kAttrSrcw, kAttrSrch, kAttrDstx, kAttrDsty,
kAttrDstw, kAttrDsth, kAttrUrl, kAttrMaxfps,
kAttrAspect, kAttrCenter, kAttrBackgroundcolor, kNumAttr,
kTagFadeout, kAttrStart, kAttrDuration, kAttrDstx, kAttrDsty,
kAttrDstw, kAttrDsth, kAttrUrl, kAttrMaxfps,
kAttrColor, kNumAttr,
kTagWipe, kAttrStart, kAttrDuration, kAttrTarget, kAttrSrcx,
kAttrSrcy, kAttrSrcw, kAttrSrch, kAttrDstx, kAttrDsty,
kAttrDstw, kAttrDsth, kAttrUrl, kAttrMaxfps, kAttrAspect,
kAttrDirection, kAttrType, kAttrCenter, kAttrBackgroundcolor,
kNumAttr,
kTagAnimate, kAttrStart, kAttrDuration, kAttrTarget, kAttrSrcx,
kAttrSrcy, kAttrSrcw, kAttrSrch, kAttrDstx, kAttrDsty,
kAttrDstw, kAttrDsth, kAttrUrl, kAttrMaxfps,
kAttrAspect, kAttrCenter, kAttrBackgroundcolor, kNumAttr,
kTagViewchange, kAttrStart, kAttrDuration, kAttrSrcx, kAttrSrcy, kAttrSrcw,
kAttrSrch, kAttrDstx, kAttrDsty, kAttrDstw, kAttrDsth,
kAttrUrl, kAttrMaxfps, kAttrStartsrcx, kAttrStartsrcy,
kAttrStartsrcw, kAttrStartsrch, kAttrStartdstx, kAttrStartdsty,
kAttrStartdstw, kAttrStartdsth, kAttrTarget, kAttrAspect, kNumAttr,
kTagEffect, kAttrStart, kAttrDuration, kAttrTarget, kAttrSrcx,
kAttrSrcy, kAttrSrcw, kAttrSrch, kAttrDstx, kAttrDsty,
kAttrDstw, kAttrDsth, kAttrUrl, kAttrMaxfps, kAttrAspect,
kAttrPackage, kAttrName, kAttrData,
kAttrFile, kNumAttr,
kNumTags
};
// This list will be used to initialize a data structure for
// required attribute lookup. The pattern is:
//
// tag-id1, id1-attr1, id1-attr2, ..., kNumAttr
// tag-id2, id2-attr1, id2-attr2, ..., kNumAttr
// ...
// kNumTags
//
//
// kNumAttr is a marker for the end of the list of attribute ids.
//
const BYTE PXRealPixParser::m_pRequiredAttrList[] =
{
kTagRoot, kNumAttr,
kTagHead, kAttrWidth, kAttrHeight, kAttrBitrate, kNumAttr,
kTagImage, kAttrHandle, kAttrName, kNumAttr,
kTagFill, kAttrStart, kAttrColor, kNumAttr,
kTagFadein, kAttrStart, kAttrDuration, kAttrTarget, kNumAttr,
kTagCrossfade, kAttrStart, kAttrDuration, kAttrTarget, kNumAttr,
kTagFadeout, kAttrStart, kAttrDuration, kNumAttr,
kTagWipe, kAttrStart, kAttrDuration, kAttrTarget, kNumAttr,
kTagAnimate, kAttrStart, kAttrDuration, kAttrTarget, kNumAttr,
kTagViewchange, kAttrStart, kAttrDuration, kNumAttr,
kTagEffect, kAttrStart, kAttrDuration, kAttrTarget, kAttrPackage, kAttrName, kNumAttr,
kNumTags
};
BEGIN_INTERFACE_LIST(PXRealPixParser)
INTERFACE_LIST_ENTRY(IID_IHXXMLParserResponse, IHXXMLParserResponse)
END_INTERFACE_LIST
PXRealPixParser::PXRealPixParser()
{
m_pContext = NULL;
m_pCommonClassFactory = NULL;
m_pParser = NULL;
m_pRealPixFile = NULL;
m_pErrorText = NULL;
m_pLegalAttrLUT = NULL;
m_pTagToIDMap = NULL;
m_pAttrToIDMap = NULL;
m_bRealPixError = FALSE;
m_pByteListCursor = NULL;
m_ulState = kStateConstructed;
m_pLastEffect = NULL;
m_bVersionSpecified = FALSE;
m_ulStrictnessLevel = REALPIX_STRICTNESS_LOW;
}
PXRealPixParser::~PXRealPixParser()
{
HX_RELEASE(m_pContext);
HX_RELEASE(m_pCommonClassFactory);
HX_RELEASE(m_pParser);
HX_RELEASE(m_pRealPixFile);
HX_RELEASE(m_pErrorText);
HX_RELEASE(m_pLegalAttrLUT);
HX_DELETE(m_pTagToIDMap);
HX_DELETE(m_pAttrToIDMap);
HX_RELEASE(m_pLastEffect);
}
STDMETHODIMP PXRealPixParser::Init(IUnknown* pContext,
PXRealPixFile* pRealPixFile,
UINT32 ulStrictnessLevel)
{
HX_RESULT retVal = HXR_OK;
if (pContext && pRealPixFile)
{
// Init members
HX_RELEASE(m_pContext);
m_pContext = pContext;
m_pContext->AddRef();
HX_RELEASE(m_pRealPixFile);
m_pRealPixFile = pRealPixFile;
m_pRealPixFile->AddRef();
if (ulStrictnessLevel == REALPIX_STRICTNESS_LOW ||
ulStrictnessLevel == REALPIX_STRICTNESS_MEDIUM ||
ulStrictnessLevel == REALPIX_STRICTNESS_HIGH)
{
m_ulStrictnessLevel = ulStrictnessLevel;
}
else
{
m_ulStrictnessLevel = REALPIX_STRICTNESS_LOW;
}
// Get an IHXXMLParser interface
HX_RELEASE(m_pCommonClassFactory);
retVal = m_pContext->QueryInterface(IID_IHXCommonClassFactory,
(void**) &m_pCommonClassFactory);
if (SUCCEEDED(retVal))
{
BOOL bAllowBadComments = (m_ulStrictnessLevel >= REALPIX_STRICTNESS_MEDIUM ? FALSE : TRUE);
HXXMLParser* pParser = NULL;
pParser = new HXXMLParser(bAllowBadComments);
if (pParser)
{
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?