📄 pxff2.cpp
字号:
/* ***** BEGIN LICENSE BLOCK ***** * Source last modified: $Id: pxff2.cpp,v 1.1.26.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 ***** */// system// include#include "hxtypes.h"#include "hxwintyp.h"#include "hxcom.h"#include "hxtypes.h"#include "hxresult.h"#include "hxcomm.h"#include "ihxpckts.h"#include "hxfiles.h"#include "hxformt.h"#include "hxplugn.h"#include "hxprefs.h"#include "hxformt.h"#include "hxpends.h"#include "hxengin.h"#include "hxmon.h"#include "hxver.h"#include "defslice.h"#include "hxupgrd.h"#include "hxxres.h"#include "hxxrsmg.h"#include "hxerror.h"#include "ihxfgbuf.h"#include "hxxml.h"#include "hxvsrc.h"#include "hxcore.h"#include "hxcache.h"// pnmisc#include "verutil.h"#include "baseobj.h"#include "unkimp.h"#include "perplex.h"// pncont#include "hxstring.h"#include "hxslist.h"#include "hxmap.h"#include "hxbuffer.h"#include "carray.h"#include "chxfgbuf.h"// coreres#include "pixres.h"// pxcomlib#include "pxcolor.h"#include "pxrect.h"#include "pxeffect.h"#include "pxcmpmgr.h"#include "pxffmcod.h"#include "wirefmgr.h"#include "rpfile.h"#include "rpparser.h"#include "pxerror.h"#include "pxffcmgr.h"// pxff#include "rpfilobj.h" // Have to include for !()$*(#$($) old parser#include "filehdlr.h"#include "pxschedu.h"#include "shadvsrc.h"#include "pxff2.h"#include "rpffdll.ver"// pndebug#include "errdbg.h"#include "hxheap.h"#ifdef _DEBUG#undef HX_THIS_FILE static char HX_THIS_FILE[] = __FILE__;#endif#ifdef _AIX#include "dllpath.h"ENABLE_MULTILOAD_DLLACCESS_PATHS(Pxff);#endifconst IID CRealPixFileFormat::m_IID = IID_IHXFileFormatObject;const char * CRealPixFileFormat::m_pszDescription = "Helix RealPix Format Plugin";const char * CRealPixFileFormat::m_pszCopyright = HXVER_COPYRIGHT;const char * CRealPixFileFormat::m_pszMoreInfoURL = HXVER_MOREINFO;const char * CRealPixFileFormat::m_ppszFileMimeTypes[] = {"application/vnd.rn-realpix", "image/vnd.rn-realpix", NULL};const char * CRealPixFileFormat::m_ppszFileExtensions[] = {"rp", NULL};const char * CRealPixFileFormat::m_ppszFileOpenNames[] = {"RealPix (*.rp)", NULL};const char * CRealPixFileFormat::m_ppszStreamMimeTypes[] = {"application/vnd.rn-realpixstream2", NULL};const UINT32 CRealPixFileFormat::m_ulStreamVersion = HX_ENCODE_PROD_VERSION(0, 0, 0, 0);CRealPixFileFormat::CRealPixFileFormat(){ m_lRefCount = 0; m_pContext = NULL; m_pCommonClassFactory = NULL; m_pRequest = NULL; m_pFileFormatResponse = NULL; m_pRPFileObject = NULL; m_pPoolPathAdjustment = NULL; m_pCodecManager = NULL; m_pWireFormatManager = NULL; m_pRPFileHandler = NULL; m_pImageFileHandler = NULL; m_pFileHandlerArray = NULL; m_pPacketScheduler = NULL; m_pRealPixFile = NULL; m_pCodec = NULL; m_ulSessionHandle = 0; m_bImageParseActive = FALSE; m_ulState = kStateConstructed; m_bRealPixLicensed = TRUE; m_ulStrictnessLevel = REALPIX_STRICTNESS_LOW; m_bShutdownRPFile = FALSE; m_pAcceptMetaInfoStr = NULL;}CRealPixFileFormat::~CRealPixFileFormat(){ Deallocate();}void CRealPixFileFormat::Deallocate(){ ReleaseAllFileHandlers(); HX_RELEASE(m_pContext); HX_RELEASE(m_pCommonClassFactory); HX_RELEASE(m_pRequest); HX_RELEASE(m_pFileFormatResponse); HX_RELEASE(m_pRPFileObject); HX_RELEASE(m_pPoolPathAdjustment); HX_RELEASE(m_pCodecManager); HX_RELEASE(m_pWireFormatManager); HX_RELEASE(m_pRPFileHandler); HX_RELEASE(m_pImageFileHandler); HX_DELETE(m_pFileHandlerArray); HX_RELEASE(m_pPacketScheduler); HX_RELEASE(m_pRealPixFile); HX_RELEASE(m_pCodec); HX_RELEASE(m_pAcceptMetaInfoStr);}STDMETHODIMP CRealPixFileFormat::QueryInterface(REFIID riid, void** ppvObj){ HX_RESULT retVal = HXR_OK; if (IsEqualIID(riid, IID_IUnknown)) { AddRef(); *ppvObj = (IUnknown*) (IHXPlugin*) this; } else if (IsEqualIID(riid, IID_IHXPlugin)) { AddRef(); *ppvObj = (IHXPlugin*) this; } else if (IsEqualIID(riid, IID_IHXFileFormatObject)) { AddRef(); *ppvObj = (IHXFileFormatObject*) this; } else if (IsEqualIID(riid, IID_IHXInterruptSafe)) { AddRef(); *ppvObj = (IHXInterruptSafe*) this; } else if (IsEqualIID(riid, IID_IHXFileViewSource)) { CRPViewSource* pVsrc = new CRPViewSource(m_pContext, (IUnknown*)(IHXPlugin*)this); if (pVsrc) { retVal = pVsrc->QueryInterface(riid, ppvObj); } else { retVal = HXR_OUTOFMEMORY; } } else if (IsEqualIID(riid, IID_IHXThreadSafeMethods)) { AddRef(); *ppvObj = (IHXThreadSafeMethods*)this; } else { *ppvObj = NULL; retVal = HXR_NOINTERFACE; } return retVal;}STDMETHODIMP_(UINT32) CRealPixFileFormat::AddRef(){ return InterlockedIncrement(&m_lRefCount);}STDMETHODIMP_(UINT32) CRealPixFileFormat::Release(){ if (InterlockedDecrement(&m_lRefCount) > 0) return m_lRefCount; delete this; return 0;}STDMETHODIMP CRealPixFileFormat::GetPluginInfo(REF(BOOL) bMultipleLoad, REF(const char*) pDescription, REF(const char*) pCopyright, REF(const char*) pMoreInfoURL, REF(ULONG32) ulVersionNumber){ bMultipleLoad = TRUE; pDescription = m_pszDescription; pCopyright = m_pszCopyright; pMoreInfoURL = m_pszMoreInfoURL; ulVersionNumber = TARVER_ULONG32_VERSION; return HXR_OK;}STDMETHODIMP CRealPixFileFormat::InitPlugin(IUnknown* pContext){ HX_RESULT retVal = HXR_FAIL; if (m_ulState == kStateConstructed) { if (pContext) { // Clear out everything Deallocate(); // Save a copy of the context m_pContext = pContext; m_pContext->AddRef(); // Get an IHXCommonClassFactory interface retVal = m_pContext->QueryInterface(IID_IHXCommonClassFactory, (void**) &m_pCommonClassFactory); if (SUCCEEDED(retVal)) { // Change the state m_ulState = kStatePluginInitialized; } } } return retVal;}STDMETHODIMP CRealPixFileFormat::GetFileFormatInfo(REF(const char**) pFileMimeTypes, REF(const char**) pFileExtensions, REF(const char**) pFileOpenNames){ pFileMimeTypes = m_ppszFileMimeTypes; pFileExtensions = m_ppszFileExtensions; pFileOpenNames = m_ppszFileOpenNames; return HXR_OK;}STDMETHODIMP CRealPixFileFormat::InitFileFormat(IHXRequest* pRequest, IHXFormatResponse* pFormatResponse, IHXFileObject* pFileObject){#ifdef XXXMEH_DEBUG_LOG DEBUG_OUTF("c:\\pxff.log", (s, "CRealPixFileFormat::InitFileFormat(0x%08X,0x%08X,0x%08X,0x%08X)\n", this, pRequest, pFormatResponse, pFileObject));#endif HX_RESULT retVal = HXR_FAIL; if (m_ulState == kStatePluginInitialized) { if (pRequest && pFormatResponse && pFileObject) { // Save a copy of the request m_pRequest = pRequest; m_pRequest->AddRef(); // Save a copy of the file format response m_pFileFormatResponse = pFormatResponse; m_pFileFormatResponse->AddRef(); // Save a copy of the file object m_pRPFileObject = pFileObject; m_pRPFileObject->AddRef();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -