📄 smlpkt.cpp
字号:
/* ***** 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/stdlib.h"
#include "hlxclib/stdio.h"
#include "hlxclib/ctype.h"
#include "hxtypes.h"
#include "hxresult.h"
#include "hxassert.h"
#include "hxcom.h"
#include "debug.h"
#include "hxstrutl.h"
#include "hxstring.h"
#include "hxmap.h"
#include "hxslist.h"
#include "chxpckts.h"
#include "cbbqueue.h"
#include "hxstack.h"
#include "smlpkt.h"
#ifdef _WINCE
#include <charfs.h>
#endif
#include "hxheap.h"
#ifdef _DEBUG
#undef HX_THIS_FILE
static char HX_THIS_FILE[] = __FILE__;
#endif
static const int MAX_ARGS = 32;
static const int MAX_STRING_LEN = 10000;
CSmilAddGroupPacket::CSmilAddGroupPacket():
CSmilPacket(SMILAddGroup),
m_nGroup(0),
m_nTotalTracks(0),
m_nInitTracks(0),
m_ulDuration((UINT32)-1)
{
}
void
CSmilAddGroupPacket::assign(const char* pName, const char** pValues,
INT32 nValues)
{
if(strcmp(pName, "ver") == 0 && nValues >= 1)
{
m_version = pValues[0];
}
else if(strcmp(pName, "id") == 0 && nValues >= 1)
{
m_id = pValues[0];
}
else if(strcmp(pName, "group") == 0 && nValues >= 1)
{
m_nGroup = (int)atol(pValues[0]);
}
else if(strcmp(pName, "total-tracks") == 0 && nValues >= 1)
{
m_nTotalTracks = (int)atol(pValues[0]);
}
else if(strcmp(pName, "init-tracks") == 0 && nValues >= 1)
{
m_nInitTracks = (int)atol(pValues[0]);
}
else if(strcmp(pName, "title") == 0 && nValues >= 1)
{
m_title = pValues[0];
}
else if(strcmp(pName, "dur") == 0 && nValues >= 1)
{
m_ulDuration = atol(pValues[0]);
}
}
CSmilPlayGroupPacket::CSmilPlayGroupPacket():
CSmilPacket(SMILPlayGroup),
m_nGroup(0),
m_ulDelay(0),
m_ulDuration(0)
{
}
void
CSmilPlayGroupPacket::assign(const char* pName, const char** pValues,
INT32 nValues)
{
if(strcmp(pName, "ver") == 0 && nValues >= 1)
{
m_version = pValues[0];
}
else if(strcmp(pName, "id") == 0 && nValues >= 1)
{
m_id = pValues[0];
}
else if(strcmp(pName, "group") == 0 && nValues >= 1)
{
m_nGroup = (int)atol(pValues[0]);
}
else if(strcmp(pName, "delay") == 0 && nValues >= 1)
{
m_ulDelay = atol(pValues[0]);
}
else if(strcmp(pName, "dur") == 0 && nValues >= 1)
{
m_ulDuration = atol(pValues[0]);
}
}
CSmilMetaValuesPacket::CSmilMetaValuesPacket():
CSmilPacket(SMILMetaValues)
{
m_pValues = new CHXHeader;
m_pValues->AddRef();
}
CSmilMetaValuesPacket::~CSmilMetaValuesPacket()
{
HX_RELEASE(m_pValues);
}
void
CSmilMetaValuesPacket::assign(const char* pName, const char** pValues,
INT32 nValues)
{
if(nValues >= 1)
{
CHXBuffer* pBuffer = new CHXBuffer;
pBuffer->AddRef();
pBuffer->Set((BYTE*)pValues[0], strlen(pValues[0])+1);
m_pValues->SetPropertyCString(pName, pBuffer);
pBuffer->Release();
}
}
CSmilAddChannelPacket::CSmilAddChannelPacket():
CSmilPacket(SMILAddChannel),
m_ulLeft(0),
m_ulTop(0),
m_ulHeight(0),
m_ulWidth(0),
m_ulZIndex(0),
m_ulBgColor(0)
{
}
void
CSmilAddChannelPacket::assign(const char* pName, const char** pValues,
INT32 nValues)
{
if(strcmp(pName, "ver") == 0 && nValues >= 1)
{
m_version = pValues[0];
}
else if(strcmp(pName, "id") == 0 && nValues >= 1)
{
m_id = pValues[0];
}
else if(strcmp(pName, "left") == 0 && nValues >= 1)
{
m_ulLeft = atol(pValues[0]);
}
else if(strcmp(pName, "top") == 0 && nValues >= 1)
{
m_ulTop = atol(pValues[0]);
}
else if(strcmp(pName, "height") == 0 && nValues >= 1)
{
m_ulHeight = atol(pValues[0]);
}
else if(strcmp(pName, "width") == 0 && nValues >= 1)
{
m_ulWidth = atol(pValues[0]);
}
else if(strcmp(pName, "z-index") == 0 && nValues >= 1)
{
m_ulZIndex = atol(pValues[0]);
}
else if(strcmp(pName, "bgcolor") == 0 && nValues >= 1)
{
m_ulBgColor = atol(pValues[0]);
}
}
CSmilEndLayoutPacket::CSmilEndLayoutPacket():
CSmilPacket(SMILEndLayout)
{
}
CSmilEndLayoutPacket::~CSmilEndLayoutPacket()
{
}
void
CSmilEndLayoutPacket::assign(const char* pName, const char** pValues,
INT32 nValues)
{
}
CSmilDocumentPacket::CSmilDocumentPacket():
CSmilPacket(SMILDocument),
m_ulPacketNumber(0),
m_ulTotalPackets(0)
{
}
CSmilDocumentPacket::~CSmilDocumentPacket()
{
}
void
CSmilDocumentPacket::assign(const char* pName, const char** pValues,
INT32 nValues)
{
if(strcmp(pName, "ver") == 0 && nValues >= 1)
{
m_version = pValues[0];
}
else if(strcmp(pName, "id") == 0 && nValues >= 1)
{
m_id = pValues[0];
}
else if(strcmp(pName, "doc") == 0 && nValues >= 1)
{
m_document = pValues[0];
}
else if(strcmp(pName, "npkt") == 0 && nValues >= 1)
{
m_ulPacketNumber = atol(pValues[0]);
}
else if(strcmp(pName, "ttlpkt") == 0 && nValues >= 1)
{
m_ulTotalPackets = atol(pValues[0]);
}
}
CSmilAddSourcePacket::CSmilAddSourcePacket():
CSmilPacket(SMILAddSource),
m_ulDelay((UINT32)-1),
m_ulDuration((UINT32)-1),
m_ulClipStart((UINT32)-1),
m_ulClipEnd((UINT32)-1)
{
}
void
CSmilAddSourcePacket::assign(const char* pName, const char** pValues,
INT32 nValues)
{
if(strcmp(pName, "ver") == 0 && nValues >= 1)
{
m_version = pValues[0];
}
else if(strcmp(pName, "id") == 0 && nValues >= 1)
{
m_id = pValues[0];
}
else if(strcmp(pName, "src") == 0 && nValues >= 1)
{
m_src = pValues[0];
}
else if(strcmp(pName, "channel") == 0 && nValues >= 1)
{
m_channel = pValues[0];
}
else if(strcmp(pName, "group") == 0 && nValues >= 1)
{
m_nGroup = atol(pValues[0]);
}
else if(strcmp(pName, "delay") == 0 && nValues >= 1)
{
m_ulDelay = atol(pValues[0]);
}
else if(strcmp(pName, "dur") == 0 && nValues >= 1)
{
m_ulDuration = atol(pValues[0]);
}
else if(strcmp(pName, "start") == 0 && nValues >= 1)
{
m_ulClipStart = atol(pValues[0]);
}
else if(strcmp(pName, "end") == 0 && nValues >= 1)
{
m_ulClipEnd = atol(pValues[0]);
}
else if(strcmp(pName, "fill") == 0 && nValues >= 1)
{
m_fill = pValues[0];
}
}
CSmilSourceAddedPacket::CSmilSourceAddedPacket():
CSmilPacket(SMILSourceAdded),
m_duration(0)
{
}
void
CSmilSourceAddedPacket::assign(const char* pName, const char** pValues,
INT32 nValues)
{
if(strcmp(pName, "dur") == 0 && nValues >= 1)
{
m_duration = atol(pValues[0]);
}
}
CSmilPacketParser::CSmilPacketParser():
m_pRootNode(0)
{
}
CSmilPacketParser::~CSmilPacketParser()
{
deleteNode(m_pRootNode);
}
CSmilPacketParser::SMILPacketParseResult
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -