📄 rpfilobj.cpp
字号:
/* ***** BEGIN LICENSE BLOCK ***** * Source last modified: $Id: rpfilobj.cpp,v 1.2.24.1 2004/07/09 01:52:03 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 <stdio.h>#include <stdlib.h>#include <ctype.h>#include "hxcom.h"#include "hxtypes.h"#include "hxwintyp.h"#include "hxresult.h"#include "hxcomm.h"#include "ihxpckts.h"#include "hxfiles.h"#include "hxformt.h"#include "hxplugn.h"#include "hxprefs.h"#include "hxrendr.h"#include "hxformt.h"#include "hxpends.h"#include "hxengin.h"#include "hxmon.h"#include "hxstring.h"#include "hxvsrc.h"// pncont#include "hxbuffer.h"// From coreres#include "pixres.h"// pnmisc#include "baseobj.h"#include "unkimp.h"#include "hxparse.h"// pxcomlib#include "pxcolor.h"#include "pxrect.h"#include "pxeffect.h"#include "rpfile.h"#include "rpfilobj.h"#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)char CIMFFileObject::m_pszIMFStartTag[] = "<imfl>";char CIMFFileObject::m_pszIMFEndTag[] = "</imfl>";char CIMFFileObject::m_pszTagStart[] = "<";char CIMFFileObject::m_pszTagEnd[] = "/>";char CIMFFileObject::m_pszHeadTag[] = "head";char CIMFFileObject::m_pszHeadTitleAttribute[] = "title";char CIMFFileObject::m_pszHeadAuthorAttribute[] = "author";char CIMFFileObject::m_pszHeadCopyrightAttribute[] = "copyright";char CIMFFileObject::m_pszHeadStartAttribute[] = "start";char CIMFFileObject::m_pszHeadDurationAttribute[] = "duration";char CIMFFileObject::m_pszHeadPrerollAttribute[] = "preroll";char CIMFFileObject::m_pszHeadBitrateAttribute[] = "bitrate";char CIMFFileObject::m_pszHeadWidthAttribute[] = "width";char CIMFFileObject::m_pszHeadHeightAttribute[] = "height";char CIMFFileObject::m_pszHeadAspectAttribute[] = "aspect";char CIMFFileObject::m_pszHeadURLAttribute[] = "url";char CIMFFileObject::m_pszHeadMaxFps[] = "maxfps";char CIMFFileObject::m_pszHeadTimeFormatAttribute[] = "timeformat";char CIMFFileObject::m_pszHeadVersionAttribute[] = "version";char CIMFFileObject::m_pszHeadBackgroundColorAttr[] = "background-color";char CIMFFileObject::m_pszHeadOpacityAttr[] = "backgroundOpacity";char CIMFFileObject::m_pszWhitespace[] = " \t\n\r";char CIMFFileObject::m_pszImageTag[] = "image";char CIMFFileObject::m_pszImageHandleAttribute[] = "handle";char CIMFFileObject::m_pszImageNameAttribute[] = "name";char CIMFFileObject::m_pszFillTag[] = "fill";char CIMFFileObject::m_pszFadeinTag[] = "fadein";char CIMFFileObject::m_pszFadeoutTag[] = "fadeout";char CIMFFileObject::m_pszCrossfadeTag[] = "crossfade";char CIMFFileObject::m_pszWipeTag[] = "wipe";char CIMFFileObject::m_pszViewchangeTag[] = "viewchange";char CIMFFileObject::m_pszExternalEffectTag[] = "effect";char CIMFFileObject::m_pszAnimateTag[] = "animate";CIMFFileObject::CIMFFileObject(){ m_cURL = ""; m_cTitle = ""; m_cAuthor = ""; m_cCopyright = ""; m_ulStartTime = 0; m_ulDuration = 0; m_ulPreroll = 0; m_ulBitrate = 0; m_ulDisplayWidth = 0; m_ulDisplayHeight = 0; m_ulTimeFormat = kTimeFormatDHMS; m_ulContentVersion = BASE_VERSION; m_ulBackgroundColor = 0; // default to black m_ulOpacity = 255; m_bAspectFlag = TRUE; m_ulMaxFps = 0;}CIMFFileObject::~CIMFFileObject(){ GListIterator itr; //CTJ gcc hated the prior scope for (itr = m_cImageList.Begin(); itr != m_cImageList.End(); itr++) { CIMFImage *pImage = (CIMFImage *) *itr; HX_DELETE(pImage); } for (itr = m_cEffectList.Begin(); itr != m_cEffectList.End(); itr++) { CIMFEffect *pEffect = (CIMFEffect *) *itr; HX_DELETE(pEffect); }};int CIMFFileObject::GetImageIndexFromHandle(ULONG32 ulHandle){ int idx=0; for (GListIterator itr = m_cImageList.Begin(); itr != m_cImageList.End(); itr++) { CIMFImage *pImage = (CIMFImage *) *itr; if (pImage->GetHandle() == ulHandle) { return idx; } idx++; } return 0L;}const char * CIMFFileObject::GetNameFromHandle(ULONG32 ulHandle){ for (GListIterator itr = m_cImageList.Begin(); itr != m_cImageList.End(); itr++) { CIMFImage *pImage = (CIMFImage *) *itr; if (pImage->GetHandle() == ulHandle) { return pImage->GetName().c_str(); } } return (const char *) 0;}CIMFImage * CIMFFileObject::GetImageFromHandle(ULONG32 ulHandle){ for (GListIterator itr = m_cImageList.Begin(); itr != m_cImageList.End(); itr++) { CIMFImage *pImage = (CIMFImage *) *itr; if (pImage->GetHandle() == ulHandle) { return pImage; } } return 0L;}void CIMFFileObject::RenderAttribute(const char *pszAttrStr, GString &rValue, GString &rText){ rText += pszAttrStr; rText += "=\""; rText += rValue; rText += "\" ";}void CIMFFileObject::RenderAttribute(const char *pszAttrStr, ULONG32 ulValue, GString &rText){ char cTmp[32]; rText += pszAttrStr; rText += "="; sprintf(cTmp, "%ld", ulValue); /* Flawfinder: ignore */ rText += cTmp; rText += " ";}void CIMFFileObject::RenderAttribute(const char *pszAttrStr, BOOL bValue, GString &rText){ rText += pszAttrStr; rText += "="; if (bValue == TRUE) { rText += "true"; } else { rText += "false"; } rText += " ";}void CIMFFileObject::InsertImageIntoList(CIMFImage *pImage){ // If null pointer, don't do anything if (!pImage) { return; } // Insert in order of ascending start time GListIterator itr; for (itr = m_cImageList.Begin(); itr != m_cImageList.End(); itr++) { CIMFImage *pCurImage = (CIMFImage *) *itr; if (pCurImage->GetHandle() > pImage->GetHandle()) { break; } } m_cImageList.Insert(itr, (void *) pImage);}void CIMFFileObject::InsertEffectIntoList(CIMFEffect *pEffect){ // If null pointer, don't do anything if (!pEffect) { return; } GListIterator itr; //CTJ gcc hated the prior scope // Insert in order of ascending start time for (itr = m_cEffectList.Begin(); itr != m_cEffectList.End(); itr++) { CIMFEffect *pCurEffect = (CIMFEffect *) *itr; if (pCurEffect->GetStart() > pEffect->GetStart()) { break; } } m_cEffectList.Insert(itr, (void *) pEffect);}void CIMFFileObject::RenderText(GString &rText){ // Output <imfl> rText = m_pszIMFStartTag; rText += "\r\n "; // Output <head> tag and attributes rText += m_pszTagStart; rText += m_pszHeadTag; rText += " "; if (m_cTitle.length() > 0) { RenderAttribute(m_pszHeadTitleAttribute, m_cTitle, rText); rText += "\r\n "; } if (m_cAuthor.length() > 0) { RenderAttribute(m_pszHeadAuthorAttribute, m_cAuthor, rText); rText += "\r\n "; } if (m_cCopyright.length() > 0) { RenderAttribute(m_pszHeadCopyrightAttribute, m_cCopyright, rText); rText += "\r\n "; } if (m_ulStartTime > 0) { RenderAttribute(m_pszHeadStartAttribute, m_ulStartTime, rText); rText += "\r\n "; } RenderAttribute(m_pszHeadDurationAttribute, m_ulDuration, rText); rText += "\r\n "; if (m_ulPreroll > 0) { RenderAttribute(m_pszHeadPrerollAttribute, m_ulPreroll, rText); rText += "\r\n "; } if (m_ulMaxFps > 0) { RenderAttribute(m_pszHeadMaxFps, m_ulMaxFps, rText); rText += "\r\n "; } RenderAttribute(m_pszHeadBitrateAttribute, m_ulBitrate, rText); rText += "\r\n "; RenderAttribute(m_pszHeadWidthAttribute, m_ulDisplayWidth, rText); rText += "\r\n "; RenderAttribute(m_pszHeadHeightAttribute, m_ulDisplayHeight, rText); rText += "\r\n "; if (m_bAspectFlag == FALSE) { RenderAttribute(m_pszHeadAspectAttribute, m_bAspectFlag, rText); rText += "\r\n "; } if (m_cURL.length() > 0) { RenderAttribute(m_pszHeadURLAttribute, m_cURL, rText); rText += "\r\n "; } rText += m_pszTagEnd; rText += "\r\n "; GListIterator itr;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -