[hxdatatype] CR: making plugins unloadable

[hxdatatype] CR: making plugins unloadable

Jonathan H.H. Bloedow jbloedow at real.com
Thu Jul 31 12:09:01 PDT 2003


OK, Eric kindly reviewed a previous version of this, and that version 
worked fine, but I realized that because of the way the group video plugin 
renderer is written, it would probably be better to change this a bit.

Previously, my group video renderer CanUnload2 just used the mp4, rm, and 
h263 CanUnload (static member) functions. But because we might want to 
remove the obsolete CanUnload functions, I think I should have a completely 
separate CanUnload2 function in each of these renderers. So I have added 
those, plus a separate m_fpCanUnloadArray2 in the group video renderer.

Alas, now the mp4, h263 and rm video renderers have 2 CanUnload2 (& 
CanUnload) functions: 1 exported non-member function, and one static member 
function (which is used by the group video renderer).

It seems a little messy when you describe it, but here it is. Maybe I 
should just get rid of all the obsolete(?) CanUnload functions at the same 
time???

Thanks.

-- Jonathan


### GROUP VIDEO RENDERER ###

Index: Umakefil
===================================================================
RCS file: /cvs/datatype/group/video/Umakefil,v
retrieving revision 1.1
diff -b -u -5 -r1.1 Umakefil
--- Umakefil	13 May 2003 02:32:24 -0000	1.1
+++ Umakefil	31 Jul 2003 18:45:26 -0000
@@ -49,10 +49,11 @@
  project.ExportFunction("RMACreateInstance",
                         "IUnknown** ppObj",
                         "common/include",
                         "hxcom.h")
  project.ExportFunction("CanUnload", "void")
+project.ExportFunction("CanUnload2", "void")
  project.ExportFunction("SetDLLAccessPath", "const char* pszPath")

  DLLTarget("vidplin")

  DependTarget()
Index: pub/vidplin.h
===================================================================
RCS file: /cvs/datatype/group/video/pub/vidplin.h,v
retrieving revision 1.1
diff -b -u -5 -r1.1 vidplin.h
--- pub/vidplin.h	13 May 2003 02:32:24 -0000	1.1
+++ pub/vidplin.h	31 Jul 2003 18:45:26 -0000
@@ -37,10 +37,11 @@
      LONG32 m_lRefCount;
      UINT16  m_usNumOfPlugins;
      static HX_RESULT (STDAPICALLTYPE  *const m_fpEntryArray[])(IUnknown**);
      static HX_RESULT (STDAPICALLTYPE  *const m_fpExitArray[])();
      static HX_RESULT (STDAPICALLTYPE  *const m_fpUnloadArray[])();
+    static HX_RESULT (STDAPICALLTYPE  *const m_fpUnloadArray2[])();
  };

  /****************************************************************************
   *
   *  Function:
Index: vidplin.cpp
===================================================================
RCS file: /cvs/datatype/group/video/vidplin.cpp,v
retrieving revision 1.1
diff -b -u -5 -r1.1 vidplin.cpp
--- vidplin.cpp	13 May 2003 02:32:24 -0000	1.1
+++ vidplin.cpp	31 Jul 2003 18:45:26 -0000
@@ -78,10 +78,22 @@
  #ifdef HELIX_FEATURE_VIDEO_H263
      CH263VideoRenderer::CanUnload,
  #endif	// HELIX_FEATURE_VIDEO_H263
      0};

+HX_RESULT (STDAPICALLTYPE* const VideoPluginFactory::m_fpUnloadArray2[])()={
+#ifdef HELIX_FEATURE_VIDEO_REAL
+    CRVXVideoRenderer::CanUnload2,
+#endif	// HELIX_FEATURE_VIDEO_REAL
+#ifdef HELIX_FEATURE_VIDEO_MPEG4
+    CMP4VideoRenderer::CanUnload2,
+#endif	// HELIX_FEATURE_VIDEO_MPEG4
+#ifdef HELIX_FEATURE_VIDEO_H263
+    CH263VideoRenderer::CanUnload2,
+#endif	// HELIX_FEATURE_VIDEO_H263
+    0};
+

  /****************************************************************************
   *
   *  Function:
   *
@@ -149,18 +161,31 @@
   *  then the pluginhandler can unload the DLL
   *
   */
  STDAPI CanUnload(void)
  {
-    HX_RESULT (STDAPICALLTYPE * const *iterator)(void) = 
&(VideoPluginFactory::m_fpUnloadArray[0]);
-    while(*iterator)
+    for( int i=0; VideoPluginFactory::m_fpUnloadArray[i]; i++ )
+    {
+        if( (VideoPluginFactory::m_fpUnloadArray[i])() != HXR_OK )
+        {
+            return HXR_FAIL;
+        }
+    }
+
+    return HXR_OK;
+}
+
+STDAPI CanUnload2(void)
+{
+    for( int i=0; VideoPluginFactory::m_fpUnloadArray2[i]; i++ )
      {
-	if (HXR_OK != (*iterator++)())
+        if( (VideoPluginFactory::m_fpUnloadArray2[i])() != HXR_OK )
  	{
  	    return HXR_FAIL;
  	}
      }
+
      return HXR_OK;
  }

  /////////////////////////////////////////////////////////////////////////
  //  Method:

### MP4 VIDEO RENDERER ###

Index: dllumakefil
===================================================================
RCS file: /cvs/datatype/mp4/video/renderer/dllumakefil,v
retrieving revision 1.3
diff -b -u -5 -r1.3 dllumakefil
--- dllumakefil	22 Jun 2003 20:17:16 -0000	1.3
+++ dllumakefil	31 Jul 2003 18:44:24 -0000
@@ -30,10 +30,11 @@
  project.ExportFunction("RMACreateInstance",
                         "IUnknown** ppObj",
                         "common/include",
                         "hxcom.h")
  project.ExportFunction("CanUnload", "void")
+project.ExportFunction("CanUnload2", "void")
  project.ExportFunction("SetDLLAccessPath", "const char* pszPath")

  DLLTarget('mp4vrender')

  DependTarget()
Index: pub/mp4video.h
===================================================================
RCS file: /cvs/datatype/mp4/video/renderer/pub/mp4video.h,v
retrieving revision 1.3
diff -b -u -5 -r1.3 mp4video.h
--- pub/mp4video.h	13 May 2003 02:15:39 -0000	1.3
+++ pub/mp4video.h	31 Jul 2003 18:44:24 -0000
@@ -61,10 +61,11 @@
  			     HXBitmapInfoHeader &bitmapInfoHeader);

  public:
      static HX_RESULT STDAPICALLTYPE HXCreateInstance(IUnknown** ppIUnknown);
      static HX_RESULT STDAPICALLTYPE CanUnload(void);
+    static HX_RESULT STDAPICALLTYPE CanUnload2(void);

      /*
       *	Constructor/Destructor
       */
      CMP4VideoRenderer(void);
Index: mp4video.cpp
===================================================================
RCS file: /cvs/datatype/mp4/video/renderer/mp4video.cpp,v
retrieving revision 1.3
diff -b -u -5 -r1.3 mp4video.cpp
--- mp4video.cpp	13 May 2003 02:15:39 -0000	1.3
+++ mp4video.cpp	31 Jul 2003 18:44:24 -0000
@@ -109,10 +109,15 @@
  HX_RESULT STDAPICALLTYPE CMP4VideoRenderer::CanUnload(void)
  {
      return ((CHXBaseCountingObject::ObjectsActive() > 0) ? HXR_FAIL : 
HXR_OK);
  }

+HX_RESULT STDAPICALLTYPE CMP4VideoRenderer::CanUnload2(void)
+{
+    return ((CHXBaseCountingObject::ObjectsActive() > 0) ? HXR_FAIL : HXR_OK);
+}
+

  /* ***** BEGIN LICENSE BLOCK *****
   * Version: RCSL 1.0 and Exhibits.
   * REALNETWORKS CONFIDENTIAL--NOT FOR DISTRIBUTION IN SOURCE CODE FORM
   * Portions Copyright (c) 1995-2002 RealNetworks, Inc.
Index: plugin.cpp
===================================================================
RCS file: /cvs/datatype/mp4/video/renderer/plugin.cpp,v
retrieving revision 1.2
diff -b -u -5 -r1.2 plugin.cpp
--- plugin.cpp	13 May 2003 02:15:39 -0000	1.2
+++ plugin.cpp	31 Jul 2003 18:44:24 -0000
@@ -104,5 +104,10 @@

  STDAPI ENTRYPOINT(CanUnload)(void)
  {
      return CMP4VideoRenderer::CanUnload();
  }
+
+STDAPI ENTRYPOINT(CanUnload2)(void)
+{
+    return CMP4VideoRenderer::CanUnload2();
+}


### RM VIDEO RENDERER ###

Index: umakedll
===================================================================
RCS file: /cvs/datatype/rm/video/renderer/umakedll,v
retrieving revision 1.6
diff -b -u -5 -r1.6 umakedll
--- umakedll	22 Jun 2003 20:18:34 -0000	1.6
+++ umakedll	31 Jul 2003 18:44:40 -0000
@@ -75,10 +75,11 @@
  project.ExportFunction("RMACreateInstance",
                         "IUnknown** ppObj",
                         "common/include",
                         "hxcom.h")
  project.ExportFunction("CanUnload", "void")
+project.ExportFunction("CanUnload2", "void")
  project.ExportFunction("SetDLLAccessPath", "const char* pszPath")

  DLLTarget("rvxrender")

  DependTarget()
Index: rvxdll.cpp
===================================================================
RCS file: /cvs/datatype/rm/video/renderer/rvxdll.cpp,v
retrieving revision 1.3
diff -b -u -5 -r1.3 rvxdll.cpp
--- rvxdll.cpp	1 Jul 2003 02:23:34 -0000	1.3
+++ rvxdll.cpp	31 Jul 2003 18:44:40 -0000
@@ -77,5 +77,10 @@
  STDAPI ENTRYPOINT(CanUnload)(void)
  {
      return CRVXVideoRenderer::CanUnload();
  }

+STDAPI ENTRYPOINT(CanUnload2)(void)
+{
+    return CRVXVideoRenderer::CanUnload2();
+}
+
Index: pub/rvxvideo.h
===================================================================
RCS file: /cvs/datatype/rm/video/renderer/pub/rvxvideo.h,v
retrieving revision 1.1
diff -b -u -5 -r1.1 rvxvideo.h
--- pub/rvxvideo.h	13 May 2003 02:06:59 -0000	1.1
+++ pub/rvxvideo.h	31 Jul 2003 18:44:40 -0000
@@ -62,10 +62,11 @@
  			     HXBitmapInfoHeader &bitmapInfoHeader);

  public:
      static HX_RESULT STDAPICALLTYPE HXCreateInstance(IUnknown** ppIUnknown);
      static HX_RESULT STDAPICALLTYPE CanUnload(void);
+    static HX_RESULT STDAPICALLTYPE CanUnload2(void);

      /*
       *	Constructor/Destructor
       */
      CRVXVideoRenderer(void);
Index: rvxvideo.cpp
===================================================================
RCS file: /cvs/datatype/rm/video/renderer/rvxvideo.cpp,v
retrieving revision 1.7
diff -b -u -5 -r1.7 rvxvideo.cpp
--- rvxvideo.cpp	1 Jul 2003 02:23:34 -0000	1.7
+++ rvxvideo.cpp	31 Jul 2003 18:44:40 -0000
@@ -144,10 +144,15 @@
  HX_RESULT STDAPICALLTYPE CRVXVideoRenderer::CanUnload(void)
  {
      return ((CHXBaseCountingObject::ObjectsActive() > 0) ? HXR_FAIL : 
HXR_OK);
  }

+HX_RESULT STDAPICALLTYPE CRVXVideoRenderer::CanUnload2(void)
+{
+    return ((CHXBaseCountingObject::ObjectsActive() > 0) ? HXR_FAIL : HXR_OK);
+}
+

  /************************************************************************
   *  Method:
   *    IHXPlugin::GetPluginInfo
   *  Purpose:

### H263 VIDEO RENDERER ###

Index: umakedll
===================================================================
RCS file: /cvs/datatype/h263/renderer/umakedll,v
retrieving revision 1.1
diff -b -u -5 -r1.1 umakedll
--- umakedll	13 May 2003 01:57:04 -0000	1.1
+++ umakedll	31 Jul 2003 18:45:22 -0000
@@ -70,10 +70,11 @@
  project.ExportFunction("RMACreateInstance",
                         "IUnknown** ppObj",
                         "common/include",
                         "hxcom.h")
  project.ExportFunction("CanUnload", "void")
+project.ExportFunction("CanUnload2", "void")
  project.ExportFunction("SetDLLAccessPath",
                         "const char* pszPath")

  DLLTarget('h263render')

Index: pub/h263video.h
===================================================================
RCS file: /cvs/datatype/h263/renderer/pub/h263video.h,v
retrieving revision 1.1
diff -b -u -5 -r1.1 h263video.h
--- pub/h263video.h	13 May 2003 01:57:04 -0000	1.1
+++ pub/h263video.h	31 Jul 2003 18:45:22 -0000
@@ -62,10 +62,11 @@
  			     HXBitmapInfoHeader &bitmapInfoHeader);

  public:
      static HX_RESULT STDAPICALLTYPE HXCreateInstance(IUnknown** ppIUnknown);
      static HX_RESULT STDAPICALLTYPE CanUnload(void);
+    static HX_RESULT STDAPICALLTYPE CanUnload2(void);

      /*
       *	Constructor/Destructor
       */
      CH263VideoRenderer(void);
Index: h263video.cpp
===================================================================
RCS file: /cvs/datatype/h263/renderer/h263video.cpp,v
retrieving revision 1.5
diff -b -u -5 -r1.5 h263video.cpp
--- h263video.cpp	26 Jun 2003 02:32:29 -0000	1.5
+++ h263video.cpp	31 Jul 2003 18:45:22 -0000
@@ -132,10 +132,15 @@
  HX_RESULT STDAPICALLTYPE CH263VideoRenderer::CanUnload(void)
  {
      return ((CHXBaseCountingObject::ObjectsActive() > 0) ? HXR_FAIL : 
HXR_OK);
  }

+HX_RESULT STDAPICALLTYPE CH263VideoRenderer::CanUnload2(void)
+{
+    return ((CHXBaseCountingObject::ObjectsActive() > 0) ? HXR_FAIL : HXR_OK);
+}
+

  /************************************************************************
   *  Method:
   *    IHXPlugin::GetPluginInfo
   *  Purpose:
Index: plugin.cpp
===================================================================
RCS file: /cvs/datatype/h263/renderer/plugin.cpp,v
retrieving revision 1.3
diff -b -u -5 -r1.3 plugin.cpp
--- plugin.cpp	26 Jun 2003 02:32:29 -0000	1.3
+++ plugin.cpp	31 Jul 2003 18:45:22 -0000
@@ -102,5 +102,10 @@

  STDAPI ENTRYPOINT(CanUnload)(void)
  {
      return CH263VideoRenderer::CanUnload();
  }
+
+STDAPI ENTRYPOINT(CanUnload2)(void)
+{
+    return CH263VideoRenderer::CanUnload2();
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe at datatype.helixcommunity.org
For additional commands, e-mail: dev-help at datatype.helixcommunity.org




More information about the Datatype-dev mailing list
 

Site Map   |   Terms of Use   |   Privacy Policy   |   Contact Us

Copyright © 1995-2007 RealNetworks, Inc. All rights reserved. RealNetworks and Helix are trademarks of RealNetworks.
All other trademarks or registered trademarks are the property of their respective holders.