[hxprotocol] CR: making sdp plugin unloadable
Jonathan H.H. Bloedow jbloedow at real.comProtocolies:
This adds a CanUnload2 function. Unfortunately this whole solution seems to
add 180 bytes even though we get to remove some code (because we are using
CHXBaseCountingObject instead). Any objections?
-- Jonathan
Index: sdpplin
===================================================================
RCS file: /cvs/protocol/sdp/sdpplin,v
retrieving revision 1.6
diff -b -u -5 -r1.6 sdpplin
--- sdpplin 11 Apr 2003 20:28:16 -0000 1.6
+++ sdpplin 29 Jul 2003 21:02:23 -0000
@@ -57,9 +57,10 @@
project.ExportFunction("RMACreateInstance",
"IUnknown** ppObj",
"common/include",
"hxcom.h")
project.ExportFunction("CanUnload", "void")
+project.ExportFunction("CanUnload2", "void")
DLLTarget('sdpplin')
DependTarget()
Index: sdpplin.h
===================================================================
RCS file: /cvs/protocol/sdp/sdpplin.h,v
retrieving revision 1.2
diff -b -u -5 -r1.2 sdpplin.h
--- sdpplin.h 3 Apr 2003 17:37:06 -0000 1.2
+++ sdpplin.h 29 Jul 2003 21:02:23 -0000
@@ -35,17 +35,19 @@
#ifndef _SDPPLIN_H_
#define _SDPPLIN_H_
+#include "baseobj.h"
#include "mdescparse.h"
#include "mdescgen.h"
class CSDPStreamDescription : public IHXPlugin,
public IHXStreamDescription,
public IHXStreamDescriptionSettings,
- public IHXRTPPayloadInfo
+ public IHXRTPPayloadInfo,
+ public CHXBaseCountingObject
{
private:
LONG32 m_lRefCount;
MediaDescParser* m_pDescParser;
MediaDescGenerator* m_pDescGenerator;
Index: sdpplin.cpp
===================================================================
RCS file: /cvs/protocol/sdp/sdpplin.cpp,v
retrieving revision 1.9
diff -b -u -5 -r1.9 sdpplin.cpp
--- sdpplin.cpp 25 Jun 2003 21:06:03 -0000 1.9
+++ sdpplin.cpp 29 Jul 2003 21:04:17 -0000
@@ -86,29 +86,10 @@
#define SDP_RELEASE 7L
#define SDP_BUILD 4248L
#define SDP_MEDIA_DESC_GENERATOR_VERSION
HX_ENCODE_PROD_VERSION(SDP_MAJOR,SDP_MINOR,SDP_RELEASE,SDP_BUILD)
#endif
-
-#if defined(HELIX_CONFIG_NOSTATICS)
-#include "globals/hxglobalint.h"
-#define DLLRefType const INT32
-#else
-#define DLLRefType INT32
-#endif
-
-static DLLRefType g_nRefCount_sdpp = 0 ;
-
-INT32& RefCountSDPP()
-{
-#if defined(HELIX_CONFIG_NOSTATICS)
- return HXGlobalInt32::Get((GlobalID)&g_nRefCount_sdpp);
-#else
- return g_nRefCount_sdpp;
-#endif
-}
-
/****************************************************************************
*
* Function:
*
* HXCreateInstance()
@@ -151,11 +132,16 @@
* then the pluginhandler can unload the DLL
*
*/
STDAPI ENTRYPOINT(CanUnload)(void)
{
- return (RefCountSDPP() ? HXR_FAIL : HXR_OK);
+ return (CHXBaseCountingObject::ObjectsActive() > 0 ? HXR_FAIL : HXR_OK );
+}
+
+STDAPI ENTRYPOINT(CanUnload2)(void)
+{
+ return CanUnload();
}
const char* const CSDPStreamDescription::zm_pDescription =
"RealNetworks SDP Stream Description Plugin";
const char* const CSDPStreamDescription::zm_pCopyright =
HXVER_COPYRIGHT;
const char* const CSDPStreamDescription::zm_pMoreInfoURL = HXVER_MOREINFO;
@@ -331,23 +317,19 @@
, m_pDescParser(0)
, m_pDescGenerator(0)
, m_pContext(0)
, m_pCCF(0)
{
- RefCountSDPP()++;
-
m_pDescParser = new SDPMediaDescParser(TARVER_ULONG32_VERSION);
#if defined(HELIX_FEATURE_SERVER)
m_pDescGenerator = new
SDPMediaDescGenerator(SDP_MEDIA_DESC_GENERATOR_VERSION);
#endif /* defined(HELIX_FEATURE_SERVER) */
}
CSDPStreamDescription::~CSDPStreamDescription()
{
- RefCountSDPP()--;
-
delete m_pDescParser;
HX_DELETE(m_pDescGenerator);
HX_RELEASE(m_pCCF);
HX_RELEASE(m_pContext);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe at protocol.helixcommunity.org
For additional commands, e-mail: dev-help at protocol.helixcommunity.org