⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pxgifrnd.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 5 页
字号:
/* ***** BEGIN LICENSE BLOCK ***** * Source last modified: $Id: pxgifrnd.cpp,v 1.10.6.2 2004/07/09 12:55:11 pankajgupta 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 "hxassert.h"#include <stdio.h>#ifdef _WINDOWS#include <windows.h>#include "platform/win/resource.h"#endif#if defined(_UNIX) && defined(USE_XWINDOWS)#include <X11/cursorfont.h>#include <X11/Intrinsic.h>#endif#ifdef _MACINTOSH#include <ctype.h>#include "platform/mac/cresload.h"extern FSSpec g_DLLFSpec;//CResourceLoader* CResourceLoader::zm_theResourceLoader = NULL;#endif//Mini sites don't support ARGB blt'ing.//Should break this out into a ALPHA_SUPPORTED feature.#if !defined(HELIX_FEATURE_MINI_SITE)#  define ARGB_CID HX_ARGB#else#  define ARGB_CID HX_RGB#endif#include "hxcomm.h"#include "ihxpckts.h"#include "hxfiles.h"#include "hxcore.h"#include "hxrendr.h"#include "hxhyper.h"#include "hxplugn.h"#include "hxwin.h"#include "hxasm.h"#include "hxevent.h"#include "hxvsurf.h"#include "hxver.h"#include "hxupgrd.h"#include "hxengin.h"#include "hxmon.h"#include "hxerror.h"#include "hxclsnk.h"#include "hxprefs.h"#include "addupcol.h"#include "hxstrutl.h"#include "netbyte.h"#include "unkimp.h"#include "baseobj.h"#include "hxparse.h"#include "hxtick.h"#include "hxbuffer.h"#include "hxstring.h"#include "gstring.h"#include "glist.h"#include "pxutil.h"#include "pxrect.h"#include "pxcolor.h"#include "pxeffect.h"#include "parseurl.h"#include "pxcallbk.h"#include "pximage.h"#include "makebomb.h"#include "pxtransp.h"#include "cladvsnk.h"#include "baseobj.h"#include "unkimp.h"#include "lzw.h"#include "gifimage.h"#include "gifcodec.h"#include "gifrmlog.h"#include "pxgifrnd.h"#include "gifrdll.ver"#include "debugout.h"#include "hxheap.h"#ifdef _DEBUG#undef HX_THIS_FILE     static const char HX_THIS_FILE[] = __FILE__;#endif#include "errdbg.h"#ifdef _AIX#include "dllpath.h"ENABLE_MULTILOAD_DLLACCESS_PATHS(Pxgifrnd);#endifconst char * const CGIFRenderer::m_pszName                          = "GIF";const char * const CGIFRenderer::m_pszDescription                   = "Helix GIF Renderer Plugin";const char * const CGIFRenderer::m_pszCopyright                     = HXVER_COPYRIGHT;const char * const CGIFRenderer::m_pszMoreInfoURL                   = HXVER_MOREINFO;const char * const CGIFRenderer::m_ppszStreamMimeType[]             = {"application/vnd.rn-gifstream",                                                                  "application/vnd.rn-gifstream2",                                                                 "application/vnd.rn-gifstream3",                                                                 NULL};const UINT32 CGIFRenderer::m_ulHighestSupportedContentVersion = HX_ENCODE_PROD_VERSION(0, 0, 0, 0);const UINT32 CGIFRenderer::m_ulHighestSupportedStreamVersion  = HX_ENCODE_PROD_VERSION(0, 1, 0, 0);#ifdef _WINDOWSextern HINSTANCE g_hInstance;#endifCGIFRenderer::CGIFRenderer(){    MLOG_LEAK("CON CGIFRenderer this=0x%08x\n", this);    m_lRefCount            = 0;    m_pContext             = NULL;    m_pStream              = NULL;    m_cSize.cx             = 0;    m_cSize.cy             = 0;    m_pMISUS               = NULL;    m_pMISUSSite           = NULL;    m_pCommonClassFactory  = NULL;    m_pHyperNavigate       = NULL;    m_pStatusMessage       = NULL;    m_pGIFCodec            = NULL;    m_ulPadWidth           = 0;    m_bDecompressFinished  = FALSE;    m_ulCurImg             = 0;    m_ulCurImgRenderTime   = 0;    m_pOutputBuffer        = NULL;    m_ucTarget             = kTargetBrowser;    m_cURL                 = "";    m_ulBackgroundColor    = 0x00FFFFFF;    m_pScheduler           = NULL;    m_ulDataWidth          = 0;    m_ulLoopsDone          = 0;    m_ulBitsPerPixel       = 32;    m_ulBytesPerPixel      = 4;    m_bRGBOrdering         = TestBigEndian();    m_bFirstTimeSync       = TRUE;    m_bFirstDraw           = TRUE;    m_lLastImg             = -1;    m_bSiteAttached        = FALSE;    m_ulCurDelayTime       = 0;    m_pErrorMessages       = NULL;#if defined(_WINDOWS)    m_bRowsInverted        = TRUE;#elif defined(_MACINTOSH)    m_bRowsInverted        = FALSE;#elif defined(_UNIX)    m_bRowsInverted        = FALSE;#endif    m_bStatusMsgWillNeedErasing = FALSE;    m_bSetHyperlinkCursor    = FALSE;    m_sOldMouseX             = -1;    m_sOldMouseY             = -1;#if defined(_WINDOWS)    m_hPreHyperlinkCursor    = NULL;    m_hHyperlinkCursor       = NULL;#elif defined(_MACINTOSH)    const short HAND_CURSOR  = 1313;    m_pResourceLoader = CResourceLoader::CreateInstance(g_DLLFSpec);    m_hHyperlinkCursor = (CursHandle)m_pResourceLoader->LoadResource('CURS', HAND_CURSOR);    m_eCurrentCursor         = CURSOR_ARROW;#elif defined(_UNIX) && defined(USE_XWINDOWS)    m_pDisplay             = 0;    m_Window               = 0;    m_hHyperlinkCursor     = -1;    m_hCurrentCursor       = -1;#endif    m_pStreamHeaderBuffer  = NULL;    m_ulStreamHeaderOffset = 0;    m_bIgnorePackets       = FALSE;    m_pCallback            = NULL;    m_bImageBombed         = FALSE;    m_ulRendererFlags      = 0;    m_ulWidth              = 0;    m_ulHeight             = 0;    m_pValues              = NULL;    m_ulBackgroundOpacity         = 255;    m_ulMediaOpacity              = 255;    m_ulMediaChromaKey            = 0;    m_bMediaChromaKeySpecified    = FALSE;    m_ulMediaChromaKeyTolerance   = 0;    m_ulMediaChromaKeyOpacity     = 0;    m_bUsesAlphaChannel           = FALSE;    m_bPreserveMediaRepeat        = TRUE;    m_bPaused                     = FALSE;    m_lTimeOffset                 = 0;    m_tSchedulerTimeBase.tv_sec   = 0;    m_tSchedulerTimeBase.tv_usec  = 0;    m_ulTimeAtSchedulerTimeBase   = 0;    m_ulCurFrameIndex             = 0xFFFFFFFF;    m_pClientAdviseSink           = NULL;    m_ulEndTime                   = 0;    m_bNoNativeSize               = FALSE;    m_bCanBltSubRects             = FALSE;}CGIFRenderer::~CGIFRenderer(){    MLOG_LEAK("DES CGIFRenderer this=0x%08x\n", this);    if (m_pCallback)    {        if (m_pCallback->IsCallbackPending())        {            m_pCallback->RemovePendingCallback();        }    }    if (m_pClientAdviseSink)    {        m_pClientAdviseSink->Close();    }    HX_RELEASE(m_pStatusMessage);    HX_RELEASE(m_pOutputBuffer);    HX_RELEASE(m_pContext);    HX_RELEASE(m_pCommonClassFactory);    HX_RELEASE(m_pHyperNavigate);    HX_DELETE(m_pGIFCodec);    HX_RELEASE(m_pScheduler);    HX_RELEASE(m_pErrorMessages);    #if defined(_MACINTOSH)    if (m_hHyperlinkCursor)    {        m_pResourceLoader->UnloadResource((Handle)m_hHyperlinkCursor);        m_hHyperlinkCursor = NULL;                HX_RELEASE(m_pResourceLoader);    }#endif#if defined(_UNIX) && defined(USE_XWINDOWS)    if ((m_hHyperlinkCursor != -1) && m_pDisplay)    {    XLockDisplay(m_pDisplay);    XFreeCursor(m_pDisplay, m_hHyperlinkCursor);    XUnlockDisplay(m_pDisplay);    m_hHyperlinkCursor = -1;    }#endif    HX_RELEASE(m_pStreamHeaderBuffer);    HX_RELEASE(m_pCallback);    HX_RELEASE(m_pValues);    HX_RELEASE(m_pClientAdviseSink);}STDMETHODIMP CGIFRenderer::QueryInterface(REFIID riid, void** ppvObj){    HX_RESULT retVal = HXR_OK;    if (ppvObj)    {        // Set default        *ppvObj = NULL;        // Check for IID type        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_IHXRenderer))        {            AddRef();            *ppvObj = (IHXRenderer*) this;        }        else if (IsEqualIID(riid, IID_IHXSiteUser))        {            AddRef();            *ppvObj = (IHXSiteUser*) this;        }        else if (IsEqualIID(riid, IID_IHXSiteUserSupplier))        {            if (m_pMISUS)            {                return m_pMISUS->QueryInterface(IID_IHXSiteUserSupplier, ppvObj);            }            else            {                retVal = HXR_UNEXPECTED;            }        }        else if (IsEqualIID(riid, IID_IHXStatistics))        {            AddRef();            *ppvObj = (IHXStatistics*) this;        }        else if (IsEqualIID(riid, IID_IHXValues))        {            AddRef();            *ppvObj = (IHXValues*) this;        }        else if (IsEqualIID(riid, IID_IHXUpdateProperties))        {            AddRef();            *ppvObj = (IHXUpdateProperties*) this;        }        else        {            retVal = HXR_NOINTERFACE;        }    }    else    {        retVal = HXR_FAIL;    }    return retVal;}STDMETHODIMP_(UINT32) CGIFRenderer::AddRef(){    return InterlockedIncrement(&m_lRefCount);}STDMETHODIMP_(UINT32) CGIFRenderer::Release(){    if (InterlockedDecrement(&m_lRefCount) > 0)    {        return m_lRefCount;    }    delete this;    return 0;}STDMETHODIMP CGIFRenderer::GetPluginInfo(REF(BOOL)         rbLoadMultiple,                                         REF(const char *) rpszDescription,                                         REF(const char *) rpszCopyright,                                         REF(const char *) rpszMoreInfoURL,                                         REF(UINT32)       rulVersionNumber){    rbLoadMultiple   = TRUE;    rpszDescription  = (const char*) m_pszDescription;    rpszCopyright    = (const char*) m_pszCopyright;    rpszMoreInfoURL  = (const char*) m_pszMoreInfoURL;    rulVersionNumber = TARVER_ULONG32_VERSION;    return HXR_OK;}STDMETHODIMP CGIFRenderer::InitPlugin(IUnknown* pContext){    HX_RESULT retVal = HXR_FAIL;    if (pContext)    {        // Save a copy of the calling context

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -