[Helix-client-dev] CR/CN: Solaris-Sparc-GCC patches for GMPMetaEditor branch

Petar Basic <[email protected]> Mon, 11 Jan 2010 18:58:37 +0100
Newsgroups gmane.comp.multimedia.helix.devel
Message-ID <[email protected]>
Modified by: pbasic at real.com
Date: 2010/01/11
Project: GMP MetaEditor (meta3gp.exe)

Synopsis:
Solaris-Sparc-GCC patches for GMPMetaEditor branch

Overview:
This CR includes patches needed to successfully build/run meta3gp
project with GCC on Solaris-Sparc.

Checked into GMPMetaEditor branch immediately since I need to verify
the build on the farm ASAP.  Some points below can be discussed and
improved on later, however, at this time they seem irrelevant in the
context of GMPMetaEditor.

Details:
1.) "audio/fixptutil/pub/math64.h" was failing to compile due to
missing implementation of 64-bit operations for Solaris-Sparc-GCC
combo.

In the CVS log, one can find traces of Sparc specific blocks of code
which according to CVS comments had some bugs and were replaced by
platform independent (plain C) implementations for Solaris-SunStudio
combo.  Relevant ifdef statement has now been modified to also compile
platform independent implementations under Solaris-Sparc-GCC combo.

All tests performed by "audio/fixptutil/test/fixpttest.c" succeed,
although the execution proves slow.  Testing with MetaEditor reveals
that these operations are not used during meta-data
extraction/injection, so at this time optimization for
Solaris-Sparc-GCC does not seem important.

2.) statvfs on Solaris fails if passed an empty path argument, which
causes calling method CHXFileSpecUtils::IsDiskLocal to print out an
error to the console.  This is not acceptable for MetaEditor,
especially since everything works correctly.  The culprit is actually
in MemoryMapDataFile::Bind method in
"common/fileio/platform/unix/mmapdatf.cpp".  The code has been updated
to process empty paths as a special case before resorting to
CHXFileSpecUtils::IsDiskLocal.  Also, what seems as a duplicate code
block due to a bad check-in has been removed.

3.) RMAShutdown entry point which is now required by plugin handler
has been added to metaeditor.dll.

4.) Defaulting meta3gp executable to DTDriver synchronous mode since
asynchronous mode is not implemented on Solaris.

5.) Fixed various build busters.

6.) Reordered library dependencies in a few projects to allow the
Solaris linker to link all symbols correctly.

Testing:
Verified operation on GMP MetaEditor on Solaris 5.10 Sparc via
standard MetaEditor test scripts.

Files Modified:
audio/fixptutil/pub/math64.h
client/medpltfm/hxmedpltfmdll
client/medpltfm/pub/chxmedpltfmkicker.h
client/medpltfm/pub/chxmedpltfmsched.h
common/fileio/platform/unix/mmapdatf.cpp
datatype/mp4/filewriter/m4avsh.cpp
datatype/mp4/filewriter/mp4atoms.h
datatype/mp4/filewriter/mp4sm.cpp
datatype/mp4/filewriter/ra10sh.cpp
datatype/tools/dtdriver/apps/meta3gp/HXXmlInputParser.h
datatype/tools/dtdriver/apps/meta3gp/Umakefil_meta3gp
datatype/tools/dtdriver/apps/meta3gp/Umakefil_tests
datatype/tools/dtdriver/apps/meta3gp/main.cpp
datatype/tools/dtdriver/dtdrplin/dtdr_genr_lib
datatype/tools/dtdriver/dtdrplin/dtdr_platform_dll
datatype/tools/metaeditor/Umakefil
datatype/tools/metaeditor/hxdll.cpp

Platforms and Profiles Affected:
All

Image Size and Heap Use impact:
None

Platforms and Profiles Build Verified:
system id: win32-i386-vc7, sunos-5.8-sparc-gcc-server
profile: helix-client-all-defines

Platforms and Profiles Functionality Verified:
x86 Windows XP SP2
Sparc SunOS 5.10

Branch:
GMPMetaEditor

Copyright assignment:
I am a RealNetworks employee or contractor.

_______________________________________________
Helix-client-dev mailing list
[email protected]
http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev
audio_fixptutil.diff (text/x-patch, 1.7 KB)
Index: pub/math64.h
===================================================================
RCS file: /cvsroot/audio/fixptutil/pub/math64.h,v
retrieving revision 1.34
diff -d -H -w -U30 -r1.34 math64.h
--- pub/math64.h	6 Apr 2009 03:53:41 -0000	1.34
+++ pub/math64.h	10 Jan 2010 22:34:10 -0000
@@ -634,61 +634,61 @@
     int zlow, z;
     
     __asm {
         smull 	zlow, x, y, x
         mov 	zlow, zlow, lsr n
         rsb	n,n,#32
         orr 	z, zlow, x, lsl n
    	}
 
     return z;
 }
 
 #define HAVE_FASTABS
 static __inline int FASTABS(int x) 
 {
 	int s;
 
 	__asm {
 		 eor	s, x, x, asr #31
 		 sub	x, s, x, asr #31 
 	}
 
 	return x;
 }
 
 
 ///////////////////////////////////////////////////////////////////////////////////////
 // platform independent implementations
 ///////////////////////////////////////////////////////////////////////////////////////
 
-#elif (defined(_MAC_UNIX) && defined(__i386__)) || (defined(_HPUX) || (defined(_SOLARIS) && !defined(__GNUC__)))
+#elif (defined(_MAC_UNIX) && defined(__i386__)) || defined(_HPUX) || defined(_SOLARIS)
 
 #ifndef ASSERT
 #define ASSERT(x)
 #endif
 
 #ifndef TICK
 #define TICK()
 #endif
 
 #ifndef TOCK
 #define TOCK(nsamples) 1
 #endif
 
 #define HAVE_PLATFORM_MACROS
 static __inline int MulDiv64(int a, int b, int c)
 {
     long long t = (long long)a * (long long)b ;
     return (int)(t / c) ;
 }
 
 /* Compute (a * b) >> 32, using 64-bit intermediate result */
 static __inline int MulShift32(int x, int y)
 {
     long long t = (long long)x * (long long)y ;
     return (int)(t >> 32);
 }
 
 /* Compute (a * b) >> 31, using 64-bit intermediate result */
 static __inline int MulShift31(int x, int y)
 {
client_medpltfm.diff (text/x-patch, 7.8 KB)
Index: hxmedpltfmdll
===================================================================
RCS file: /cvsroot/client/medpltfm/hxmedpltfmdll,v
retrieving revision 1.15
diff -d -H -w -U30 -r1.15 hxmedpltfmdll
--- hxmedpltfmdll	4 Dec 2008 07:27:10 -0000	1.15
+++ hxmedpltfmdll	10 Jan 2010 13:35:54 -0000
@@ -50,73 +50,76 @@
 # 
 
 UmakefileVersion(2,2)
 
 project.AddModuleIncludes("common/include",
                           "common/container/pub",
                           "common/util/pub",
                           "common/system/pub",
                           "common/dbgtool/pub",
                           "common/runtime/pub",
                           "common/fileio/pub",
                           "common/lang/xml/pub",
                           "common/netio/pub",
                           "common/log/logutil/pub",
                           "protocol/http/pub",
                           "audio/include",
                           "video/include",
                           "client/include",
                           "client/common/container/pub/extended")
 
 project.AddIncludes("../include",
                     "../common/container/pub",
                     "../common/util/pub",
                     "../common/netio/pub",
                     "../common/system/pub",
                     "../videosvc/pub",
                     "../netwksvc/pub",
                     "../resource/pub")
 
 project.AddModuleLibraries("common/dbgtool[debuglib]",
-                           "common/util[utillib]",
-                           "common/container[contlib]",
-                           "common/system[syslib]",
-                           "common/runtime[runtlib]",
-                           "common/fileio[fileiolib]",
                            "common/netio[netiolib]",
                            "common/log/logutil[logutillib]",
                            "common/lang/xml[xmllib]",                           
-                           "client/common/system[sysclntlib]",
                            "client/common/container[contclntlib]",
-                           "client/common/util[utlclntlib]",
                            "client/common/netio[netioclntlib]",
-                           "client/videosvc[vidsvclib]")
+                           "client/videosvc[vidsvclib]",
+                           "client/common/util[utlclntlib]",
+                           "client/common/system[sysclntlib]",
+                           "common/fileio[fileiolib]",
+                           "common/system[syslib]",
+                           "common/container[contlib]",
+                           "common/runtime[runtlib]",
+                           "common/util[utillib]",
+                           "common/fileio[fileiolib]",
+                           "client/common/util[utlclntlib]",
+                           "common/system[syslib]")
 
 project.AddSources("chxmedpltfm.cpp",
                    "chxmedpltfmkicker.cpp",
                    "chxmedpltfmsched.cpp",
                    "hxpackageunloader.cpp",
                    "hxdll.cpp",
                    "dlliids.cpp")
 				   
 if project.IsDefined('HELIX_FEATURE_SECURE_SOCKET'):
     project.AddModuleLibraries('common\crypto\lite[crypto]')
 	
 if project.IsDefined("HELIX_CONFIG_USE_EXTENDED"):
     project.AddSources("mediaplatformextension.cpp")
     project.ExportFunction("HXCreateMediaPlatformEx",
                        "IHXMediaPlatform** ppMediaPlatform",
                        "client/medpltfm/pub",
                        "chxmedpltfm.h")
     project.ExportFunction("HXMediaPlatformCloseEx",
                        "void",
                        "client/medpltfm/pub",
                        "chxmedpltfm.h")	
 	
 if project.IsDefined("HELIX_FEATURE_EXTENDED_MEDIAPLATFORM"):
     project.AddSources("hxgenericcontext.cpp")
     project.AddSources("chxmedpltfmex.cpp")
 
 project.ExportFunction("HXMediaPlatformOpen",
                        "void",
                        "client/medpltfm/pub",
                        "chxmedpltfm.h")
Index: pub/chxmedpltfmkicker.h
===================================================================
RCS file: /cvsroot/client/medpltfm/pub/chxmedpltfmkicker.h,v
retrieving revision 1.4
diff -d -H -w -U30 -r1.4 chxmedpltfmkicker.h
--- pub/chxmedpltfmkicker.h	6 Jul 2007 21:58:21 -0000	1.4
+++ pub/chxmedpltfmkicker.h	10 Jan 2010 13:35:54 -0000
@@ -52,49 +52,49 @@
 
 #include "unkimp.h"
 #include "ihxcontextuser.h"
 #include "ihxmedpltfm.h"
 #include "hxengin.h"
 #include "chxmaplongtoobj.h"
 #include "hxsched.h"
 
 class CHXMediaPlatformScheduler;
 
 class CHXMediaPlatformKicker : public CUnknownIMP
 			     , public IHXContextUser
 			     , public IHXMediaPlatformKicker
 {
 protected:
     IUnknown*		m_pContext;
     IHXMutex*		m_pMutex;
     HXBOOL		m_bClosed;
     CHXMapLongToObj*	m_pSchedulerMap;
     CHXMapLongToObj	m_SchedTimerMap;
     
     HX_RESULT		AddScheduler(CHXMediaPlatformScheduler* pScheduler);
     HX_RESULT		RemoveScheduer(CHXMediaPlatformScheduler* pScheduler);
 
     friend class CHXMediaPlatformScheduler;
 
 public:
     CHXMediaPlatformKicker(void);
     ~CHXMediaPlatformKicker(void);
 
-    DECLARE_UNKNOWN_NOCREATE(CHXMediaPlatformKicker);
+    DECLARE_UNKNOWN_NOCREATE(CHXMediaPlatformKicker)
     DECLARE_COM_CREATE_FUNCS(CHXMediaPlatformKicker)
 
     // IHXContextUser
     STDMETHOD(RegisterContext)	(THIS_ 
 				 IUnknown* pContext);
 
     /*
      *  IHXMediaPlatformKicker methods
      *  see common/include/ihxmedpltfm.h for detail description
      */
     STDMETHOD(Kick)		(THIS_
 				 UINT32  ulThreadID,
 				 UINT32* pulSuggestedSleep);
 
     HX_RESULT	Close(void);
 };
 
 #endif /* _CHXKICKER_H_ */
Index: pub/chxmedpltfmsched.h
===================================================================
RCS file: /cvsroot/client/medpltfm/pub/chxmedpltfmsched.h,v
retrieving revision 1.7
diff -d -H -w -U30 -r1.7 chxmedpltfmsched.h
--- pub/chxmedpltfmsched.h	6 Jul 2007 21:58:21 -0000	1.7
+++ pub/chxmedpltfmsched.h	10 Jan 2010 13:35:54 -0000
@@ -46,61 +46,61 @@
  * Contributor(s):
  * 
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef _CHXMEDPLTFMSCHED_H_
 #define _CHXMEDPLTFMSCHED_H_
 
 #include "unkimp.h"
 #include "hxengin.h"
 #include "hxsched.h"
 
 class CHXMediaPlatformKicker;
 
 class CHXMediaPlatformScheduler : public CUnknownIMP
 				, public IHXScheduler
 				, public IHXScheduler2
 {
 protected:
     UINT32			m_ulThreadID;
     HXScheduler*		m_pScheduler;
     CHXMediaPlatformKicker*	m_pKicker;
 
     HX_RESULT	_InternalQIMutex(REFIID riid, void** ppvObj);
 
     friend class CHXMediaPlatformKicker;
 
 public:
     CHXMediaPlatformScheduler(void);
     ~CHXMediaPlatformScheduler(void);
 
-    DECLARE_UNKNOWN_NOCREATE(CHXMediaPlatformScheduler);
+    DECLARE_UNKNOWN_NOCREATE(CHXMediaPlatformScheduler)
     DECLARE_COM_CREATE_FUNCS(CHXMediaPlatformScheduler)
 
     /*
      * IHXScheduler methods
      */
     STDMETHOD_(CallbackHandle,RelativeEnter)	    (THIS_
 						    IHXCallback* pCallback,
 						    UINT32 ms);
 
     STDMETHOD_(CallbackHandle,AbsoluteEnter)	    (THIS_
 						    IHXCallback* pCallback,
 						    HXTimeval tVal);
 
     STDMETHOD(Remove)				    (THIS_
 			    			    CallbackHandle Handle);
 
     STDMETHOD_(HXTimeval,GetCurrentSchedulerTime)   (THIS);
 
     /*
      *	IHXScheduler2 methods
      */
     STDMETHOD(StartScheduler)			    (THIS);
     STDMETHOD(StopScheduler)			    (THIS);
     STDMETHOD(OnTimeSync)			    (THIS_
 						    HXBOOL bAtInterrupt);
     STDMETHOD(SetInterrupt)			    (THIS_
 						    HXBOOL bInterruptenable);
     STDMETHOD_(HXBOOL, IsAtInterruptTime)	    (THIS);
     STDMETHOD(SetMutex)				    (THIS_
 						    IHXMutex* pMutex);
common_fileio_platform_unix.diff (text/x-patch, 3.6 KB)
Index: mmapdatf.cpp
===================================================================
RCS file: /cvsroot/common/fileio/platform/unix/mmapdatf.cpp,v
retrieving revision 1.19
diff -d -H -w -U30 -r1.19 mmapdatf.cpp
--- mmapdatf.cpp	22 Jul 2008 07:15:36 -0000	1.19
+++ mmapdatf.cpp	11 Jan 2010 14:23:33 -0000
@@ -172,84 +172,85 @@
 	   UnlockFile();
        }
        close(m_nFD);
        m_nFD = -1;
     }
     HX_RELEASE(m_pFilename);
     HX_RELEASE(m_pMMM);
     HX_RELEASE(m_pContext);
 
     DPRINTF(0x5d000000, ("MemoryMapDataFile::~MemoryMapDataFile()\n"));
 }
 
 /*
  *  IHXDataFile methods
  */
 
 /* Bind DataFile Object with FileName */
 STDMETHODIMP_(void)
 MemoryMapDataFile::Bind(const char* pFilename)
 {
 #if defined(_MAC_UNIX) || defined(_UNIX)
     // on OS X, memory mapping a file from an audio CD
     // causes a kernel panic. This has been reported
     // to Apple as radr://3730990 but we still need
     // to avoid this situation.
     
     CHXFileSpecifier fileSpec(pFilename);
     CHXDirSpecifier dirSpec = fileSpec.GetParentDirectory();
     
     bool bMemMappingOK = true;
-#if defined(_MAC_UNIX)    
-    if (CHXFileSpecUtils::IsDiskAudioCD(dirSpec))
+
+#if defined(_SOLARIS)
+    // Solaris:
+    // Some CHXFileSpecUtils functions which use statvfs will display an error due to statvfs system call failing with ENOENT
+    // on an empty path and will not return useful information in this case anyway. So, if the path is empty, assume that statvfs
+    // will fail and simply invalidate current memory mapping without displaying a bunch of useless system error reports in the console window.
+    if(dirSpec.GetPathName().IsEmpty())
     {
         bMemMappingOK = false;
     }
 #endif   
-    // if a windows share (smb) is shut down remotely then if
-    // we're memory-mapping we crash. This happened with the
-    // windows implementation of MemoryMapDataFile ages ago,
-    // and I'm pulling over their solution which is to ensure
-    // that memory mapping does not happen unless the disk is
-    // local AND non-ejectable.
-    if (!CHXFileSpecUtils::IsDiskLocal(dirSpec) || CHXFileSpecUtils::IsDiskEjectable(dirSpec))
+
+#if defined(_MAC_UNIX)    
+    if (bMemMappingOK && CHXFileSpecUtils::IsDiskAudioCD(dirSpec))
     {
         bMemMappingOK = false;
     }
-    
+#endif   
     // if a windows share (smb) is shut down remotely then if
     // we're memory-mapping we crash. This happened with the
     // windows implementation of MemoryMapDataFile ages ago,
     // and I'm pulling over their solution which is to ensure
     // that memory mapping does not happen unless the disk is
     // local AND non-ejectable.
-    if (!CHXFileSpecUtils::IsDiskLocal(dirSpec) || CHXFileSpecUtils::IsDiskEjectable(dirSpec))
+    if (bMemMappingOK && !CHXFileSpecUtils::IsDiskLocal(dirSpec) || CHXFileSpecUtils::IsDiskEjectable(dirSpec))
     {
         bMemMappingOK = false;
     }
     
     if (!bMemMappingOK)
     {
         if (MmapHandle && m_pMMM)
         {
             m_pMMM->CloseMap(MmapHandle);
             MmapHandle = 0;
         }
         HX_RELEASE(m_pMMM);
 	m_pMMM = new MemoryMapManager(m_pContext, TRUE, m_ulChunkSize);
     }
     
 #endif
 
     m_pFilename->Set((BYTE *)pFilename, strlen(pFilename)+1);
 
     DPRINTF(0x5d000000, ("MemoryMapDataFile::Bind(%s)\n", 
 	    (const char *)m_pFilename->GetBuffer()));
 }
 
 
 /* Creates a datafile using the specified mode
  * uOpenMode --- File Open mode - HX_FILEFLAG_READ/HX_FILEFLAG_WRITE/HX_FILEFLAG_BINARY
  */
 STDMETHODIMP
 MemoryMapDataFile::Create(UINT16 uOpenMode)
 {
datatype_mp4_filewriter.diff (text/x-patch, 13 KB)
Index: m4avsh.cpp
===================================================================
RCS file: /cvsroot/datatype/mp4/filewriter/m4avsh.cpp,v
retrieving revision 1.5
diff -d -H -w -U30 -r1.5 m4avsh.cpp
--- m4avsh.cpp	20 Oct 2009 15:32:06 -0000	1.5
+++ m4avsh.cpp	10 Jan 2010 13:36:23 -0000
@@ -185,70 +185,70 @@
 
     if( SUCCEEDED( retVal ) )
     {
         retVal = GetASCFromESD( pOpaqueData, ucDecoderInfo, ulDSILength, nObjectType );
     }
 
     HX_RELEASE( pOpaqueData );
         
 
     if( SUCCEEDED( retVal ) )
     {
         IHXBuffer* pBuffer = NULL;
     
         retVal = HXR_OUTOFMEMORY;
         m_pCommonClassFactory->CreateInstance( IID_IHXBuffer, (void**) &pBuffer );
 
         if( pBuffer )
         {
             UCHAR* pBuf;
             retVal = pBuffer->SetSize( ulDSILength + 2 );
             if( SUCCEEDED( retVal ) )
             {
                 pBuf = pBuffer->GetBuffer();
 
                 // ObjectTypeIndication
                 pBuf[0] = nObjectType;
             
                 if (m_eStreamType == VIDEO)
                 {
                     // StreamType
-                    pBuf[1] = CMP4Atom_esds::DecoderConfigStreamTypes::ST_VisualStream;
+                    pBuf[1] = CMP4Atom_esds::ST_VisualStream;
 
                     // Indicate this is a video track with mp4v sample format
                     pHeader->SetPropertyULONG32( "TrackType", MP4_BUILD_ATOMID('v','i','d','e') );
                     pHeader->SetPropertyULONG32( "SampleFormat", MP4_BUILD_ATOMID('m','p','4','v') );
                 }
                 else
                 {
                     // StreamType
-                    pBuf[1] = CMP4Atom_esds::DecoderConfigStreamTypes::ST_AudioStream;
+                    pBuf[1] = CMP4Atom_esds::ST_AudioStream;
 
                     // Indicate this is a sound track with mp4a sample format
                     pHeader->SetPropertyULONG32( "TrackType", MP4_BUILD_ATOMID('s','o','u','n') );
                     pHeader->SetPropertyULONG32( "SampleFormat", MP4_BUILD_ATOMID('m','p','4','a') );
                 }
             
             
                 // Copy in the decoder specific info
                 memcpy( pBuf + 2, ucDecoderInfo, ulDSILength );
                 
                 pHeader->SetPropertyBuffer("DecoderInfo", pBuffer );
 
                 HX_RELEASE( pBuffer );
 
                 m_pStreamMixer->SetStreamHeader( pHeader );
 
                 retVal = HXR_OK;
             }
         }
     }
 
     HX_VECTOR_DELETE( ucDecoderInfo );
     
     return retVal;
 }
 
 HX_RESULT CM4AVStreamHandler::GetASCFromESD( IHXBuffer* pASC, UINT8*& pDSI, UINT32& ulDSILength, UINT8& nObjectType )
 {
     HX_RESULT retVal;
 
Index: mp4atoms.h
===================================================================
RCS file: /cvsroot/datatype/mp4/filewriter/mp4atoms.h,v
retrieving revision 1.17
diff -d -H -w -U30 -r1.17 mp4atoms.h
--- mp4atoms.h	6 Jan 2010 16:15:18 -0000	1.17
+++ mp4atoms.h	10 Jan 2010 13:36:23 -0000
@@ -329,61 +329,61 @@
                 {
                     m_pNext = pNext;
                 }
             }
         // Traverse
         ChildList* Next()
             {
                 return m_pNext;
             }
         // Fetch contents
         CMP4Atom* GetAtom()
             {
                 return m_pAtom;
             }
 #if 0
         // Clean up
         void Destroy()
             {
                 m_pAtom->Release();
                 if( m_pNext )
                 {
                     m_pNext->Destroy();
                 }
             }
 #endif
     private:
         CMP4Atom* m_pAtom;
         ChildList* m_pNext;
     };
 
-    LONG              m_lRefCount;
+    LONG32              m_lRefCount;
 
     ChildList*        m_pChildren;
 
     UINT32            m_ulWriteSize;
     UINT32            m_ulWriteOffset;
     HXBOOL              m_bHasWritten;
 };
     
 class CMP4ContainerAtom : public CMP4Atom
 {
 public:
     CMP4ContainerAtom(UINT32 uiAtomID) : CMP4Atom(uiAtomID)
         {}
     STDMETHOD_(UINT32, GetCurrentSize )     (THIS_ HXBOOL bIncludeChildren = FALSE)
         {
             return 8 + (bIncludeChildren ? GetSizeOfChildren() : 0);
         }
     STDMETHOD( WriteToBuffer )      (THIS_ UCHAR*& pBuffer,
                                      HXBOOL bIncludeChildren=FALSE)
         {
             HX_RESULT retVal = HXR_OK;
             if( pBuffer )
             {
                 WriteToBufferAndInc( pBuffer, GetCurrentSize(TRUE) );
                 WriteToBufferAndInc( pBuffer, m_ulAtomID );
 
                 if( bIncludeChildren )
                 {
                     retVal = ChildrenWriteToBuffer( pBuffer );
                 }
Index: mp4sm.cpp
===================================================================
RCS file: /cvsroot/datatype/mp4/filewriter/mp4sm.cpp,v
retrieving revision 1.24
diff -d -H -w -U30 -r1.24 mp4sm.cpp
--- mp4sm.cpp	6 Jan 2010 17:40:09 -0000	1.24
+++ mp4sm.cpp	10 Jan 2010 13:36:23 -0000
@@ -1390,66 +1390,67 @@
         UINT32 ulStreamNum = (UINT32) pPacket->GetStreamNumber();
         // Sanity check
         if (m_pStreamInfo && ulStreamNum < m_ulStreamCount)
         {
             // Get the ASM rule number
             UINT32 ulASMRuleNum = (UINT32) pPacket->GetASMRuleNumber();
             // Sanity check
             if (m_pStreamInfo->m_pASMRuleInfo && ulASMRuleNum < m_pStreamInfo->m_ulNumASMRules)
             {
                 // Is this a "thinning" rule? In RV streams, the rm session format generates
                 // a thiining rule which applies to keyframes. Therefore, the ASM Mux will duplicate
                 // keyframe packets - the first will belong to the keyframe rule, and the second to
                 // the thinning rule. We want to ignore the thinning rule packets.
                 if (m_pStreamInfo->m_pASMRuleInfo[ulASMRuleNum].m_bPNMThinning)
                 {
                     // This is a thinning rule packet, so we should ignore it.
                     bRet = TRUE;
                 }
             }
         }
     }
 
     return bRet;
 }
 
 HX_RESULT CMP4StreamMixer::BuildMP4Atoms()
 {
     HX_RESULT retVal = HXR_OUTOFMEMORY;
 
     //calculate duration
-    for (UINT32 i = 0; i < m_ulStreamCount; i++)
+    UINT32 iStream = 0;
+    for (iStream = 0; iStream < m_ulStreamCount; iStream++)
     {
-        if (m_pStreamInfo[i].m_pStreamHeader)
+        if (m_pStreamInfo[iStream].m_pStreamHeader)
         {
             UINT32 ulDuration = 0;
-            m_pStreamInfo[i].m_pStreamHeader->GetPropertyULONG32("Duration", ulDuration);
+            m_pStreamInfo[iStream].m_pStreamHeader->GetPropertyULONG32("Duration", ulDuration);
             if (m_ulReportedDuration < ulDuration)
             {
                 m_ulReportedDuration = ulDuration;
             }
         }
     }
 
     // This addresses a problem where line in encoding sets the duration to -1
     if( m_ulReportedDuration == 0xFFFFFFFF )
     {
         m_ulReportedDuration = 0;
     }
     
     if( !m_ulReportedDuration )
     {
 	if (m_e3gpMode == M3GPP_PROGDL || m_e3gpMode == M3GPP_STREAMDL)
 	{
 	    m_bForceMoovFirst = TRUE;
 	}
 	else if (!m_bForceMoovFirst)
 	{
 	    m_bMoovAtEnd = TRUE;
 	}
     }
 
     if (m_bForceMoovFirst)
     {
 	// Notify the archiver that we need an extra temporary file for the mdat section
 	m_pArchiver->SetNeedMdatFile();
     }
@@ -1666,63 +1667,63 @@
             for (UINT32 i = 0; i < m_ulStreamCount && SUCCEEDED(retVal); i++)
             {
                 if (m_pStreamInfo[i].m_pStreamHeader)
                 {
                     UINT32 ulTrackType = MP4_BUILD_ATOMID('n','u','l','l');
                     m_pStreamInfo[i].m_pStreamHeader->GetPropertyULONG32("TrackType", ulTrackType);
 
                     //only handle video and audio tracks
                     if (   ulTrackType ==  MP4_BUILD_ATOMID('s','o','u','n')
                         || ulTrackType ==  MP4_BUILD_ATOMID('v','i','d','e'))
                     {
                         retVal = HXR_OUTOFMEMORY;
                         CMP4Atom_trak* pTrak = new CMP4Atom_trak();
                         if( pTrak )
                         {
                             retVal = HXR_OK;
 
                             // Call out to build the trak tree
                             BuildTrack( (UINT16)i, pTrak );
 
                             pMoov->AddChild( pTrak );
 
                             if (ulTrackType == MP4_BUILD_ATOMID('v','i','d','e'))
                             {
                                 bHasVideo = TRUE;
                             }
                         }
                     }
                 }
             }
-	    for (UINT32 i = 0; i < m_ulStreamCount && SUCCEEDED(retVal); ++i)
+	    for (iStream = 0; iStream < m_ulStreamCount && SUCCEEDED(retVal); ++iStream)
 	    {
-		HintInfo *hi = m_pStreamInfo[i].m_pHintInfo;
+		HintInfo *hi = m_pStreamInfo[iStream].m_pHintInfo;
 		
 		if (hi != NULL && hi->trak != NULL)
 		    pMoov->AddChild(hi->trak);
 	    }
         }
 
         // Do we need to generate a udta box that is a child
         // of the moov box?
         if (SUCCEEDED(retVal) && NeedToAddUdtaChildToMoovBox())
         {
             // Set the return value
             retVal = HXR_OUTOFMEMORY;
             // Create the udta box
             CMP4Atom_udta* pUdta = new CMP4Atom_udta();
             if (pUdta)
             {
                 // Clear the return value
                 retVal = HXR_OK;
                 // Check the meta-data format we are supposed to generate
                 if (m_bRequestedOutputMetaFlavorITUNES || (m_eMetaFlavor == META_ITUNES))
                 {
                     // Build iTunes meta-data
                     BuildiTunesMetaData(pUdta);
                 }
                 if (m_bRequestedOutputMetaFlavor3GPP || (m_eMetaFlavor == META_3GPP)
                     || m_bFileHeaderCarriesUITSData)
                 {
                     // Build 3GP meta-data
                     Build3GPPMetaData(pUdta, pMoov);
                 }
Index: ra10sh.cpp
===================================================================
RCS file: /cvsroot/datatype/mp4/filewriter/ra10sh.cpp,v
retrieving revision 1.8
diff -d -H -w -U30 -r1.8 ra10sh.cpp
--- ra10sh.cpp	9 Mar 2009 18:36:51 -0000	1.8
+++ ra10sh.cpp	10 Jan 2010 13:36:23 -0000
@@ -359,63 +359,63 @@
                 if( SamplingFrequencies[i] == ulSampleRate )
                 {
                     ucSamplingFrequencyIndex = i;
                     retVal = HXR_OK;
                     break;
                 }
             }
         
             // 14496-3 sp1
             // Upper 5 bits: AudioObjectType. for our purposes we use 0x02 (AAC LC)
             // Next  4 bits: SamplingFrequencyIndex
             // Next  4 bits: ChannelConfiguration (number of channels - note that 7.1 is actually 7 here)
             // 14496-3 sp4
             // Next  1 bits: FrameLengthFlag
             // Next  1 bits: DependsOnCoreCoder
             // Next  1 bits: ExtensionFlag
 
             usDSI = (0x02 << 11) | (ucSamplingFrequencyIndex << 7) | (ucChannelConfiguration << 3) | 0;
 
             ucDecoderInfo[2] = (UCHAR) (usDSI >>    8);
             ucDecoderInfo[3] = (UCHAR) (usDSI &  0xff);
 
             retVal = HXR_OK;
         }
     }
 
     // Generate the OTI and stream type, copy the buffer to the streamheader
     if( SUCCEEDED( retVal ) )
     {
         // ObjectTypeIndication
-        ucDecoderInfo[0] = CMP4Atom_esds::ObjectTypeIndicationValues::OTI_Audio_14496_3;
+        ucDecoderInfo[0] = CMP4Atom_esds::OTI_Audio_14496_3;
         // StreamType
-        ucDecoderInfo[1] = CMP4Atom_esds::DecoderConfigStreamTypes::ST_AudioStream;
+        ucDecoderInfo[1] = CMP4Atom_esds::ST_AudioStream;
     
         retVal = HXR_OUTOFMEMORY;
         
         IHXBuffer* pBuffer = NULL;
         m_pCommonClassFactory->CreateInstance( IID_IHXBuffer, (void**) &pBuffer );
 
         if( pBuffer )
         {
             pBuffer->Set( ucDecoderInfo, uiDSILength );
             pHeader->SetPropertyBuffer( "DecoderInfo", pBuffer );
 
             HX_RELEASE( pBuffer );
             
             retVal = HXR_OK;
         }
     }
 
     // Final step, initialize our depacketizer
     if( SUCCEEDED( retVal ) )
     {
         retVal = HXR_OUTOFMEMORY;
         m_pDepacketizer = new CVBRSimpleDepacketizer();
                 
         if( m_pDepacketizer )
         {
             m_pDepacketizer->Init( m_pContext, fmsPerBlock, m_unStreamNumber, 0, FALSE );
             
             // Indicate this is a sound track with mp4a sample format
             pHeader->SetPropertyULONG32( "TrackType", MP4_BUILD_ATOMID('s','o','u','n') );
             pHeader->SetPropertyULONG32( "SampleFormat", MP4_BUILD_ATOMID('m','p','4','a') );
datatype_tools_dtdriver_apps_meta3gp.diff (text/x-patch, 31.2 KB)
Index: HXXmlInputParser.h
===================================================================
RCS file: /cvsroot/datatype/tools/dtdriver/apps/meta3gp/HXXmlInputParser.h,v
retrieving revision 1.1
diff -d -H -w -U30 -r1.1 HXXmlInputParser.h
--- HXXmlInputParser.h	1 Dec 2009 09:50:17 -0000	1.1
+++ HXXmlInputParser.h	11 Jan 2010 17:47:39 -0000
@@ -22,86 +22,86 @@
  *  
  * 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 ***** */ 
 
 
 /****************************************************************************
  *  Includes
  */
 
 #ifndef _HXXMLINPUTPARSER_H_
 #define _HXXMLINPUTPARSER_H_
 
 #include "hxcom.h"
 #include "hxstring.h"
 #include "hxxml.h"
 #include "carray.h"
 
 
 struct XmlPair
 {
-    XmlPair(CHXString& path, CHXString& value)
+    XmlPair(const CHXString& path, const CHXString& value)
         : xmlPath(path)
         , xmlValue(value)
     {
     }
     CHXString xmlPath;
     CHXString xmlValue;
 };
 
 class CParsedXmlPairs
 {
 public:
     ~CParsedXmlPairs()
     {
         for(int i = 0; i < xmlPairs.GetSize(); i++)
         {
             delete (XmlPair*)xmlPairs.GetAt(i);
         }
     }
 
     void Add(XmlPair* pair)
     {
         xmlPairs.Add(pair);
     }
 
-    XmlPair* GetAt(CHXString& xmlPath)
+    XmlPair* GetAt(const CHXString& xmlPath)
     {
         for(int i = 0; i < xmlPairs.GetSize(); i++)
         {
             XmlPair *pair = (XmlPair*)xmlPairs.GetAt(i);
             if (pair->xmlPath == xmlPath)
             {
                 return pair;
             }
         }
 
         return NULL;
     }
 
     void Dump()
     {
         for(int i = 0; i < xmlPairs.GetSize(); i++)
         {
             XmlPair *pair = (XmlPair*)xmlPairs.GetAt(i);
             printf(" Xml xpath %s contains value: %s\n", (const char*)pair->xmlPath, (const char*)pair->xmlValue);
         }
     }
 
     CHXPtrArray* GetAllPairs()
     {
         return &xmlPairs;
     }
 
 private:
     CHXPtrArray xmlPairs;
 };
Index: Umakefil_meta3gp
===================================================================
RCS file: /cvsroot/datatype/tools/dtdriver/apps/meta3gp/Umakefil_meta3gp,v
retrieving revision 1.4
diff -d -H -w -U30 -r1.4 Umakefil_meta3gp
--- Umakefil_meta3gp	1 Dec 2009 09:50:17 -0000	1.4
+++ Umakefil_meta3gp	11 Jan 2010 17:47:39 -0000
@@ -1,41 +1,41 @@
 
 UmakefileVersion(2,0)
 
 project.AddModuleIncludes("common/include",
                           "common/log/logobserverfile/pub",
                           "datatype/include",
                           "datatype/common/util/pub",
                           "datatype/common/filewriter/pub",
                           "datatype/tools/dtdriver/engine/pub",
                           "datatype/tools/minicntx/pub",
                           "datatype/tools/metaeditor/pub",
                           "producersdk/include")
 
 project.AddModuleLibraries( "client/common/container[contclntlib]",
 			    "client/common/system[sysclntlib]",
 			    "client/common/util[utlclntlib]",
-                            "common/runtime[runtlib]",
 			    "common/dbgtool[debuglib]", 
-			    "common/util[utillib]", 
-			    "common/container[contlib]",
 			    "common/system[syslib]",
 			    "common/fileio[fileiolib]",
 			    "common/log/logutil[logutillib]",
-                "datatype/common/util[dtutillib]")
+                "datatype/common/util[dtutillib]",
+                "common/container[contlib]",
+			    "common/util[utillib]",
+                "common/runtime[runtlib]")
 
 if project.IsDefined('HELIX_FEATURE_METAEDIT_AUDIO_HASH'):
 	project.AddIncludes("../../../../../server_rn/snmp/master/crypt")
 
 project.AddDefines( 'HELIX_FEATURE_ALLOW_DEPRECATED_SMARTPOINTERS' )
 
 project.AddSources( "main.cpp",
                     "dlliids.cpp",
                     "HXXmlInputParser.cpp")
 					
 if project.IsDefined('HELIX_FEATURE_METAEDIT_AUDIO_HASH'):
 	project.AddSources( "../../../../../server_rn/snmp/master/crypt/sha256.c",
                     "../../../../../server_rn/snmp/master/crypt/crypt.c" )
 
 ProgramTarget('meta3gp')
 
 DependTarget()
Index: Umakefil_tests
===================================================================
RCS file: /cvsroot/datatype/tools/dtdriver/apps/meta3gp/Umakefil_tests,v
retrieving revision 1.2
diff -d -H -w -U30 -r1.2 Umakefil_tests
--- Umakefil_tests	6 Nov 2007 11:39:02 -0000	1.2
+++ Umakefil_tests	11 Jan 2010 17:47:39 -0000
@@ -1,23 +1,24 @@
 
 UmakefileVersion(2,0)
 
 project.AddModuleIncludes("common/include",
                           "datatype/include",
                           "datatype/common/filewriter/pub")
 
 project.AddModuleLibraries( "client/common/container[contclntlib]",
 			    "client/common/system[sysclntlib]",
 			    "client/common/util[utlclntlib]",
-                            "common/runtime[runtlib]",
-			    "common/dbgtool[debuglib]", 
 			    "common/util[utillib]", 
 			    "common/container[contlib]",
 			    "common/system[syslib]",
 			    "common/fileio[fileiolib]",
-			    "common/log/logutil[logutillib]")
+			    "common/log/logutil[logutillib]",
+                "common/runtime[runtlib]",
+                "common/dbgtool[debuglib]",
+                "common/runtime[runtlib]")
 
 project.AddSources( "tests.cpp" )
 
 ProgramTarget('test_utfconv')
 
 DependTarget()
Index: main.cpp
===================================================================
RCS file: /cvsroot/datatype/tools/dtdriver/apps/meta3gp/main.cpp,v
retrieving revision 1.7
diff -d -H -w -U30 -r1.7 main.cpp
--- main.cpp	6 Jan 2010 17:43:02 -0000	1.7
+++ main.cpp	11 Jan 2010 17:47:43 -0000
@@ -34,79 +34,85 @@
  * ***** END LICENSE BLOCK ***** */ 
 
 
 /****************************************************************************
  *  Includes
  */
 #include <stdlib.h>
 #include <stdarg.h>
 
 #include "hlxclib/time.h"
 #include "hlxclib/stdio.h"
 #include "hlxclib/wchar.h"
 #include "hxtypes.h"
 #include "hlxosstr.h"
 #include "ffdriver.h"
 #include "cstrmsrt.h"
 #include "hxmemprb.h"
 #include "hxtick.h"
 #include "chxpckts.h"
 #include "pckunpck.h"
 #include "dllpath.h"
 #include "filespecutils.h"
 #include "metainfokeys.h"
 #include "uniconv.h"
 #include "proptools.h"
 #include "dllacces.h"
 #include "ihxmetaeditor.h"
 #include "HXXmlInputParser.h"
 #include "metautil.h"
 
+#include "meta3gp.ver"
+
 #ifdef HELIX_FEATURE_METAEDIT_AUDIO_HASH
 #include "mycrypt.h"
 #endif
 
+
 /****************************************************************************
  *  Meta-data command line editor.
  *  Build-time configuration options.
  */
 
 // uncomment to force usage of legacy strings on Windows
 // (only relevant for command-line argument transfer)
 //#define FORCE_LEGACY_CHAR 1
 
+// environment variable name
+#define PLUGIN_PATH_ENV_VAR_NAME "META3GP_PLUGIN_PATH"
+
 
 /****************************************************************************
  *  Component operational modes
  */
 HXBOOL g_bUseDefaultMetaEditorProcessor = FALSE;
-HXBOOL g_bUseDTDriverSynchronousMode = FALSE;
+HXBOOL g_bUseDTDriverSynchronousMode = TRUE;
 
 
 /****************************************************************************
  *  System character type macros
  */
 #ifdef USE_WIDE_CHAR
 #undef USE_WIDE_CHAR
 #endif
 
 #if defined(_WINDOWS) && !defined(FORCE_LEGACY_CHAR)
 #define USE_WIDE_CHAR 1
 #endif
 
 
 #ifdef _T
 #undef _T
 #endif
 #ifdef TCHAR
 #undef TCHAR
 #endif
 #ifdef TMAIN
 #undef TMAIN
 #endif
 
 
 #ifdef USE_WIDE_CHAR
 
 #define _T(Val) L##Val
 #define TCHAR wchar_t
 #define TMAIN wmain
@@ -127,65 +133,67 @@
 #define TUTF8EncodedStringCCPVar(VarName, Val) EncodedString VarName((const char*)::UTF8FromCCP(Val), HX_TEXT_ENCODING_TYPE_UTF8)
 #define TUTF8EncodedStringCCPCtor(Val) EncodedString((const char*)::UTF8FromCCP(Val), HX_TEXT_ENCODING_TYPE_UTF8)
 
 #endif //USE_WIDE_CHAR
 
 
 /****************************************************************************
  *  Build-time messages
  */
 #ifdef _WINDOWS
 
 #ifdef USE_WIDE_CHAR
 #   pragma message("Using wide-string command-line arguments")
 #else
 #   pragma message("Using legacy-string command-line arguments")
 #endif
 
 #endif //_WINDOWS
 
 
 /****************************************************************************
  *  DLLAccessPath Variable
  */
 ENABLE_DLLACCESS_PATHS(g_Meta3GPAccessPath);
 
 
 /****************************************************************************
  *  Defines
  */
 #define PROGRAM_NAME_STRING         "RealNetworks meta-data editor"
-#define PROGRAM_COPYRIGHT_STRING    "Copyright (c) RealNetworks 2009"
-#define PROGRAM_VERSION_STRING      "1.0.3"
+#define PROGRAM_COPYRIGHT_STRING    "Copyright (c) RealNetworks 2010"
 
 // input/output control
-#define OPTION_STRING_SYNCMODE       "dev-syncmode"
+#ifdef _WINDOWS
+#define OPTION_STRING_ASYNCMODE      "dev-asyncmode"
+#endif //_WINDOWS
+
 #define OPTION_STRING_DEFMETAPROC    "dev-defmetaproc"
 #define OPTION_STRING_INPUTFILE      "if"
 #define OPTION_STRING_OUTPUTFILE     "of"
 #define OPTION_STRING_XMLINPUTFILE   "xmlin"
 #define OPTION_STRING_XMLOUTPUTFILE  "xmlout"
 #define OPTION_STRING_CLEARMETADATA  "metaclear"
 #define OPTION_STRING_METASTYLE      "metastyle"
 #define OPTION_STRING_UTF16OUTPUT    "utf16"
 #define OPTION_STRING_ID3V240OUTPUT  "id3v240"
 #define OPTION_STRING_ID3V230OUTPUT  "id3v230"
 #define OPTION_STRING_ID3V2NOOUTPUT  "id3v2no"
 #define OPTION_STRING_OVERWRITEFILE  "overwrite"
 #define OPTION_STRING_PRINTMETADATA  "print"
 #define OPTION_STRING_HELP           "help"
 #define OPTION_STRING_GENERATEHASH   "audiohash"
 
 // common metadata
 #define OPTION_STRING_TITLE            "title"
 #define OPTION_STRING_ARTIST           "artist"
 #define OPTION_STRING_ALBUM            "album"
 #define OPTION_STRING_GENRE            "genre"
 #define OPTION_STRING_COMPOSER         "composer"
 #define OPTION_STRING_COMMENT          "comment"
 #define OPTION_STRING_TRACKNUMBER      "track"
 #define OPTION_STRING_YEAR             "year"
 
 #define OPTION_STRING_PICTURE_ADD      "addpic"
 #define OPTION_STRING_PICTURE_REMOVE   "rempic"
 #define OPTION_STRING_PICTURE_CLEAR    "clrpic"
 #define OPTION_STRING_PICTURE_EXTRACT  "savepic"
@@ -408,61 +416,61 @@
         return NULL;
     }
 
     void InitializeXmlPairs(CParsedXmlPairs *xmlPairs)
     {
         for(int i = 0; i < descs.GetSize(); i++)
         {
             OptionDesc* desc = (OptionDesc*)descs.GetAt(i);
             CHXString xpath(desc->GetXPath());
             if (!xpath.IsEmpty())
             {
                 xmlPairs->Add(new XmlPair(xpath, CHXString("")));
             }
         }
     }
 
 private:
     CHXPtrArray descs;
 };
 
 void DisplayUsage(const TCHAR* argv0, OptionRegistry& optionReg)
 {
     const char* pszDbg = "";
 #if defined(DEBUG) || defined(_DEBUG)
     pszDbg = ".debug";
 #endif
 
     CHXString exeName = CHXFileSpecUtils::GetCurrentApplication().GetName();
 
     printf("\n--- %s ---\n    %s\n    Version %s%s\n\n",
-            PROGRAM_NAME_STRING, PROGRAM_COPYRIGHT_STRING, PROGRAM_VERSION_STRING, pszDbg);
+            PROGRAM_NAME_STRING, PROGRAM_COPYRIGHT_STRING, TARVER_STRING_VERSION, pszDbg);
     printf("usage: %s [ -option [value]... ]...\n", (const char*)exeName);
     printf("with options:\n");
 
     optionReg.PrintColumns(2);
 }
 
 
 /****************************************************************************
 *  Asynchronous mode helpers
 */
 void SignalAsyncDriveEnd()
 {
 #ifdef _WINDOWS
     ::PostMessage(0, (WM_USER + 202), 0, 0);
 #else
     printf("ERROR: SignalAsyncDriveEnd not implemented.\n");
 #endif
 }
 
 void WaitAsyncDriveEnd()
 {
 #ifdef _WINDOWS
     MSG msg;
     while(GetMessage(&msg, 0, 0, 0))
     {
         if(msg.message == (WM_USER + 202))
         {
             break;
         }
         DispatchMessage(&msg);
@@ -628,61 +636,61 @@
         {
             delete (ID3Tools::APICFrame*)a[i];
         }
         a.RemoveAll();
     }
 
     // meta-data input params
     HXBOOL ClearMetaData;
     HXBOOL ClearKeywords;
     HXBOOL ClearPictures;
     HXBOOL GenerateHash;
     UINT32 InjectedMetaFlavors;
     MetaInfo InjectedMetaInfo;
     CHXPtrArray AddedKeywords; //EncodedString pointers
     CHXPtrArray RemovedKeywords; //EncodedString pointers
     CHXPtrArray AddedPictures; //ID3Tools::APICFrame pointers
     CHXPtrArray RemovedPictures; //Integers
 
     // meta-data output storage
     MetaInfo ExtractedMetaInfo;
     MetaInfo OutboundMetaInfo;
 
 #ifdef HELIX_FEATURE_METAEDIT_AUDIO_HASH
     unsigned char SHAHash[32];
     hash_state HashState;
 #endif
 };
 
 struct InputOption
 {
-    InputOption(CHXString& optionName, CHXString& optionValue, CHXString& xmlOptionValue)
+    InputOption(const CHXString& optionName, const CHXString& optionValue, const CHXString& xmlOptionValue)
         : OptionName(optionName)
         , OptionValue(optionValue)
         , XmlOptionValue(xmlOptionValue)
     {
     }
 
     ~InputOption()
     {
     }
 
     CHXString OptionName;
     CHXString OptionValue;
     CHXString XmlOptionValue;
 };
 
 /****************************************************************************
 *  Param extractors
 */
 enum eCommandLineProcessorPhase
 {
     CLPP_IndependentOptions = 0,
     CLPP_DependentOptions,
     CLPP_Done
 };
 
 class ArgVars
 {
 public:
     ArgVars(int argc_, TCHAR* argv_[], OptionRegistry& optionReg_)
         : argc(argc_)
@@ -1053,61 +1061,61 @@
     if(MetaInfo::IsItemSupportedByAnyFlavor(MetaInfo::ArrayMetaItem_Pictures, metaFlavorFlags))
     {
         ID3Tools::APICFrame* pFrame = new ID3Tools::APICFrame;
         if(!pFrame)
         {
             return HXR_OUTOFMEMORY;
         }
 
         // process image file
         HX_RESULT retVal = HXR_FAILED;
 
         CHXString sFileName = option->OptionValue;
         if(!sFileName.IsEmpty())
         {
             // load image, accept only known MIME types
             retVal = pFrame->LoadPictureDataFromImageFile((const char*)sFileName, TRUE);
 
             // check if frame is acceptable
             if(SUCCEEDED(retVal))
             {
                 if(!MetaInfo::IsAPICFrameValidForFlavors(*pFrame, metaFlavorFlags))
                 {
                     retVal = HXR_FAILED;
                 }
             }
         }
 
         if(FAILED(retVal))
         {
             printf("Invalid image file for option %s: %s\n",
-                    option->OptionName, (const char*)sFileName);
+                    (const char*)option->OptionName, (const char*)sFileName);
         }
 
         // export frame
         if(SUCCEEDED(retVal) && pFrame)
         {
             if(!aAddedAPICFrames.AddIfUnique(pFrame))
             {
                 retVal = HXR_FAILED;
             }
         }
 
         if(FAILED(retVal))
         {
             // cleanup
             HX_DELETE(pFrame);
         }
 
         return retVal;
     }
 
     ReportUnsupportedMetaStyleOptionA(option->OptionName);
     return HXR_PARSE_ERROR;
 }
 
 // Caller is responsible for result deallocation
 HX_RESULT CopyCCPStringOption(ArgVars& argVars, CHXString& sOut, HXBOOL bOptional = FALSE)
 {
     const TCHAR* pVal = argVars.CurrentArg(1, bOptional);
 
     sOut = TCHXStringCtor(pVal);
@@ -1334,61 +1342,61 @@
         for(int i = 0; i < options.GetSize(); i++)
         {
             delete (InputOption*)options.GetAt(i);
         }
     }
 
     void Add(InputOption* inputOpt)
     {
         options.Add(inputOpt);
     }
 
     void ResetPosition(int pos = 0)
     {
         position = pos;
     }
 
     HXBOOL ReachedEndPosition()
     {
         return (position >= options.GetSize());
     }
 
     void MovePosition(int step = 1)
     {
         position += step;
         if(position < 0)
         {
             position = 0;
         }
     }
 
-    InputOption* GetOption(CHXString& optionName) const
+    InputOption* GetOption(const CHXString& optionName) const
     {
         for(int i = 0; i < options.GetSize(); i++)
         {
             InputOption* option = (InputOption*)options.GetAt(i);
 
             if (option->OptionName == optionName)
             {
                 return option;
             }
         }
 
         return 0;
     }
 
     // Returns pointer to option
     InputOption* CurrentOption() const
     {
         if(position < options.GetSize())
         {
             return (InputOption*)options.GetAt(position);
         }
 
         return 0;
     }
 
 private:
     CHXPtrArray options;
     int position;
 };
 
@@ -1429,61 +1437,61 @@
             CHXString optionArgument("");
             if (od->GetNumberOfOptions() == -1)
             {
                 // zero or one parameter
                 retVal = CopyCCPStringOption(argVars, optionArgument, TRUE);
             }
             else if (od->GetNumberOfOptions() == 1)
             {
                 // one parameter
                 retVal = CopyCCPStringOption(argVars, optionArgument);
             }
             inputOptions.Add(new InputOption(strOption, optionArgument, CHXString("")));
         }
 
     }
 
     return retVal;
 }
 
 HX_RESULT ParseXMLInputOptions(IHXCommonClassFactory* pCommonClassFactory, CHXXmlInputParser* pInputParser, 
                                InputOption* option, CParsedXmlPairs* parsedXmlResults)
 {
     if(option->OptionValue.IsEmpty())
     {
         return HXR_FAIL;
     }
 
     FILE* fp = fopen(option->OptionValue, "r");
     if(fp == NULL)
     {
-        printf("Unable to open file: %s\n", option->OptionValue);
+        printf("Unable to open file: %s\n", (const char*)option->OptionValue);
         return HXR_FAIL;
     }
 
     HX_RESULT retVal = HXR_OK;
     retVal = pInputParser->Start(parsedXmlResults);
 
     ULONG32 uParserBufferSize = 64 * 1024;
 
     if(SUCCEEDED(retVal))
     {
         // create temporary buffer for manifest chunks
         IHXBuffer* pBuffer = NULL;
         retVal = CreateBufferCCF(pBuffer, pCommonClassFactory);
         if(SUCCEEDED(retVal))
         {
             pBuffer->SetSize(uParserBufferSize);
 
             // read manifest, chunk by chunk
             while(true)
             {
                 size_t nItemsRead = fread(pBuffer->GetBuffer(), 1, uParserBufferSize, fp);
                 if(nItemsRead != 0)
                 {
                     if(uParserBufferSize != nItemsRead)
                     {
                         pBuffer->SetSize(nItemsRead);
                     }
 
                     // parse chunk
                     HXBOOL bIsFinal = uParserBufferSize != nItemsRead;
@@ -1517,110 +1525,112 @@
 
     return retVal;
 }
 
 /****************************************************************************
 *  Main entry point
 */
 int TMAIN(int argc, TCHAR* argv[])
 {
     // separate shell command from output
     printf("\n");
 
     // initialize variables
     CHXFileSpecifier exeFileSpec;
     UINT32 startTime = 0;
     
     DLLAccess* pDLLAccess = 0;
     FPHXMEDIAPLATFORMOPEN fpHXMediaPlatformOpen = 0;
     FPHXCREATEMEDIAPLATFORM fpHXCreateMediaPlatform = 0;
     FPHXMEDIAPLATFORMCLOSE fpHXMediaPlatformClose = 0;
 
     IHXMediaPlatform* pMediaPlatform = 0;
     IHXCommonClassFactory* pCommonClassFactory = 0;
     IHXMetaDataEditor* pEditor = 0;
     CResponse* pResponse = 0;
     CProcessor* pProcessor = 0;
     IHXValues* pOptions = 0;
 
     char pDllPath[_MAX_PATH] = {0};
     char pDllFile[_MAX_PATH] = {0};
-    const char* pszHelixLibs = 0;
+    const char* pszHelixPluginPath = 0;
 
     CHXString strInputFileName;
     CHXString strOutputFileName;
     CHXString strPictureFileNamePrefix;
     CHXString strUITSDataOutputFileName;
     CHXString strMetaStyleName;
 
     HXBOOL bDisplayHelp = FALSE;
     HXBOOL bOverwriteFile = FALSE;
     HXBOOL bPrintMetaData = FALSE;
     HXBOOL bExtractPicturesToFiles = FALSE;
     HXBOOL bUTF16Output = FALSE;
     UINT32 ulMetaDataID3VersionOutput = METADATAID3VERSION_240;
 
     MetaProcessorVars metaProcessorVars;
     OptionRegistry optionReg;
+    eCommandLineProcessorPhase clpp = CLPP_IndependentOptions;
 
     // input options parsed from the command line and xml file
     InputOptions inputOptions;
+
     // xml parser to parse xml input file
     CHXXmlInputParser* pInputParser = 0;
 
     // initialize Helix DNA client media-platform
     HX_RESULT retVal = HXR_OK;
 
     // load Helix media-platform library
     pDLLAccess = new DLLAccess();
     if(!pDLLAccess)
     {
         retVal = HXR_OUTOFMEMORY;
         goto cleanup;
     }
 
     // extract plugin directory
 #ifdef _WINDOWS
     exeFileSpec = CHXFileSpecUtils::GetCurrentApplication();
     strncpy(pDllPath, (const char*)exeFileSpec.GetParentDirectory().GetPathName(), _MAX_PATH);
     snprintf(pDllFile, _MAX_PATH, "%s\\%s", pDllPath, "hxmedpltfm.dll");
 
 #else
-    pszHelixLibs = getenv("HELIX_LIBS");
-    if(pszHelixLibs)
+    pszHelixPluginPath = getenv(PLUGIN_PATH_ENV_VAR_NAME);
+    if(pszHelixPluginPath && (strlen(pszHelixPluginPath) > 0))
     {
-        strncpy(pDllPath, pszHelixLibs, _MAX_PATH);
+        strncpy(pDllPath, pszHelixPluginPath, _MAX_PATH);
         snprintf(pDllFile, _MAX_PATH, "%s/%s", pDllPath, "hxmedpltfm.so");
     }
     else
     {
-        printf("Missing HELIX_LIBS environment variable\n");
+        printf("Missing environment variable %s.\n", PLUGIN_PATH_ENV_VAR_NAME);
         goto cleanup;
     }
 #endif
 
     pDllPath[_MAX_PATH - 1] = '\0';
     pDllFile[_MAX_PATH - 1] = '\0';
     
     if(pDLLAccess->open(pDllFile) != DLLAccess::DLL_OK)
     {
         printf("Failed to access Helix DNA client media-platform library file: %s\n", pDllFile);
 
         const char* szError = pDLLAccess->getErrorString();
         if(szError)
         {
             printf("Error description: %s\n", szError);
         }
 
         goto cleanup;
     }
 
     // initialize Helix media-platform
     fpHXMediaPlatformOpen = (FPHXMEDIAPLATFORMOPEN) pDLLAccess->getSymbol("HXMediaPlatformOpen");
     fpHXCreateMediaPlatform = (FPHXCREATEMEDIAPLATFORM) pDLLAccess->getSymbol("HXCreateMediaPlatform");
     fpHXMediaPlatformClose = (FPHXMEDIAPLATFORMCLOSE) pDLLAccess->getSymbol("HXMediaPlatformClose");
 
     if(!fpHXMediaPlatformOpen || !fpHXCreateMediaPlatform || !fpHXMediaPlatformClose)
     {
         retVal = HXR_FAILED;
     }
 
@@ -1746,130 +1756,138 @@
     optionReg.Add(new OptionDesc(OPTION_STRING_ENCODEDBY, "<string>", "update iTunes encoded by", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_GROUPING, "<string>", "update iTunes grouping", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_ALBUMARTIST, "<string>", "update iTunes album artist", 1, "/albums/album/artist/name"));
     optionReg.Add(new OptionDesc(OPTION_STRING_LYRICS, "<string>", "update iTunes lyrics", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_SUBTITLE, "<string>", "update iTunes track subtitle", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_BPM, "<integer>", "update iTunes beats per minute", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_PARTOFCOMP, "<0 | 1>", "update iTunes part of compilation", 1, "/albums/album/compilation"));
     optionReg.Add(new OptionDesc(OPTION_STRING_EXPLICIT, "<0 | 1>", "update iTunes content rating", 1, "/albums/album/explicit"));
     optionReg.Add(new OptionDesc(OPTION_STRING_TRACKSTOTAL, "<integer>", "update iTunes track count", 1, "/albums/album/trackCount"));
     optionReg.Add(new OptionDesc(OPTION_STRING_DISKNUMBER, "<integer>", "update iTunes disc number", 1, "/albums/album/track/discNumber"));
     optionReg.Add(new OptionDesc(OPTION_STRING_DISKSTOTAL, "<integer>", "update iTunes disc count", 1, "/albums/album/discCount"));
     optionReg.Add(new OptionDesc());
     optionReg.Add(new OptionDesc(OPTION_STRING_RATING_ENTITY, "<4 character code>", "update 3GPP rating entity", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_RATING_CRITERIA, "<4 character code>", "update 3GPP rating criteria", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_RATING_INFO, "<string>", "update 3GPP rating info", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_CLASSIFICATION_ENTITY, "<4 character code>", "update 3GPP classification entity", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_CLASSIFICATION_TABLE, "<integer 0..65535>", "update 3GPP classification table", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_CLASSIFICATION_INFO, "<string>", "update 3GPP classification info", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_KEYWORD_ADD, "<string>", "add 3GPP keyword", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_KEYWORD_REMOVE, "<string>", "remove 3GPP keyword", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_KEYWORD_CLEAR, 0, "clear all extracted 3GPP keywords", 0));
     optionReg.Add(new OptionDesc(OPTION_STRING_LOCATION_NAME, "<string>", "update 3GPP location name", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_LOCATION_ASTRONOMICAL_BODY, "<string>", "update 3GPP location astronomical body", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_LOCATION_ADDITIONAL_NOTES, "<string>", "update 3GPP location notes", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_LOCATION_ROLE, "<integer 0..255>", "update 3GPP location role", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_LOCATION_LONGITUDE, "<decimal number>", "update 3GPP location longitude", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_LOCATION_LATITUDE, "<decimal number>", "update 3GPP location latitude", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_LOCATION_ALTITUDE, "<decimal number>", "update 3GPP location altitude", 1));
     optionReg.Add(new OptionDesc(OPTION_STRING_LANGUAGE_CODE, "<3 character code>", "ISO639.2/T language code of 3GPP metadata text", 1));
     optionReg.Add(new OptionDesc());
-    optionReg.Add(new OptionDesc(OPTION_STRING_SYNCMODE, 0, "dtdriver sync mode (developer option)", 0));
+    
+#ifdef _WINDOWS
+    optionReg.Add(new OptionDesc(OPTION_STRING_ASYNCMODE, 0, "dtdriver async mode (developer option)", 0));
+#endif //_WINDOWS
+
     optionReg.Add(new OptionDesc(OPTION_STRING_DEFMETAPROC, 0, "default meta processor (developer option)", 0));
     optionReg.Add(new OptionDesc(OPTION_STRING_HELP, 0, "display help text", 0));
     
     {
         // parse command line parameters
         ArgVars argVars(argc, argv, optionReg);
         retVal = ParseCCPInputOptions(argVars, optionReg, inputOptions);
 
         if (SUCCEEDED(retVal))
         {
             InputOption* optionXmlIn = inputOptions.GetOption(CHXString(OPTION_STRING_XMLINPUTFILE));
             if (optionXmlIn && !optionXmlIn->OptionValue.IsEmpty())
             {
                 // parse xml input file
                 CParsedXmlPairs parsedXmlResults;
                 optionReg.InitializeXmlPairs(&parsedXmlResults);
 
                 retVal = ParseXMLInputOptions(pCommonClassFactory, pInputParser, optionXmlIn, &parsedXmlResults);
 
                 if (SUCCEEDED(retVal))
                 {
                     // merge parsed results into inputOptions
                     CHXPtrArray *xmlPairs = parsedXmlResults.GetAllPairs();
                     for(int i = 0; i < xmlPairs->GetSize(); i++)
                     {
                         XmlPair *pair = (XmlPair*)xmlPairs->GetAt(i);
                         OptionDesc* optDesc = optionReg.GetOptionDescWithPath(pair->xmlPath);
 
                         if (optDesc!=NULL && !pair->xmlValue.IsEmpty()) // we'll add them only if there exist not null element in results of parsing xml
                         {
                             CHXString strName = optDesc->GetOptionString();
                             InputOption* inOpt = inputOptions.GetOption(strName);
                             if (inOpt==NULL)
                             {
                                 inputOptions.Add(new InputOption(strName, CHXString(""), pair->xmlValue));
                             }
                             else
                             {
                                 printf("Xml parameter is overriding input parameter: %s.\n",(const char *)strName );
                                 inOpt->XmlOptionValue = pair->xmlValue;
                             }
                         }
                     }
                 }
             }
         }
     }
 
 
     // The first phase seeks for independent arguments, the second phase seeks for dependent arguments.
-    eCommandLineProcessorPhase clpp = CLPP_IndependentOptions;
+    clpp = CLPP_IndependentOptions;
 
     while(SUCCEEDED(retVal) && (clpp != CLPP_Done))
     {
         for(inputOptions.ResetPosition(0); SUCCEEDED(retVal) && !inputOptions.ReachedEndPosition(); 
                 inputOptions.MovePosition(1))
         {
             InputOption* option = inputOptions.CurrentOption();
             CHXString strOption = option->OptionName;
             CHXString strOptionValue = option->XmlOptionValue.IsEmpty()? option->OptionValue : option->XmlOptionValue;
 
             if(strOption == OPTION_STRING_HELP)
             {
                 bDisplayHelp = TRUE;
             }
-            else if(strOption == OPTION_STRING_SYNCMODE)
+
+#ifdef _WINDOWS
+            else if(strOption == OPTION_STRING_ASYNCMODE)
             {
-                g_bUseDTDriverSynchronousMode = TRUE;
+                g_bUseDTDriverSynchronousMode = FALSE;
             }
+#endif //_WINDOWS
+
             else if(strOption == OPTION_STRING_DEFMETAPROC)
             {
                 g_bUseDefaultMetaEditorProcessor = TRUE;
             }
             else if(strOption == OPTION_STRING_INPUTFILE)
             {
                 strInputFileName = strOptionValue;
             }
             else if(strOption == OPTION_STRING_OUTPUTFILE)
             {
                 strOutputFileName = strOptionValue;
             }
             else if(strOption == OPTION_STRING_OVERWRITEFILE)
             {
                 bOverwriteFile = TRUE;
             }
             else if(strOption == OPTION_STRING_CLEARMETADATA)
             {
                 metaProcessorVars.ClearMetaData = TRUE;
             }
             else if(strOption == OPTION_STRING_PRINTMETADATA)
             {
                 bPrintMetaData = TRUE;
             }
             else if(strOption == OPTION_STRING_GENERATEHASH)
             {
                 metaProcessorVars.GenerateHash = TRUE;
             }
             else if(strOption == OPTION_STRING_XMLINPUTFILE)
             {
datatype_tools_dtdriver_dtdrplin.diff (text/x-patch, 4.7 KB)
Index: dtdr_genr_lib
===================================================================
RCS file: /cvsroot/datatype/tools/dtdriver/dtdrplin/dtdr_genr_lib,v
retrieving revision 1.2
diff -d -H -w -U30 -r1.2 dtdr_genr_lib
--- dtdr_genr_lib	5 Nov 2007 22:11:33 -0000	1.2
+++ dtdr_genr_lib	10 Jan 2010 13:37:14 -0000
@@ -20,35 +20,37 @@
 # 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 ***** 
 # 
 
 project.AddModuleIncludes("common/include",
                           "common/log/logobserverfile/pub",
                           "datatype/tools/dtdriver/engine",
                           "datatype/tools/dtdriver/loader/pub",
                           "common/system/pub",
                           "common/container/pub",
                           "common/dbgtool/pub",
                           "common/util/pub",
                           "datatype/tools/dtdriver/engine/pub",
                           "client/common/system/pub",
                           "datatype/tools/minicntx/pub")
 
+project.AddModuleIncludes("datatype/tools/dtdriver/dtdrplin")
+
 project.AddSources('datatypedr.cpp', 'cbmgr.cpp')
 
 # the dtdriver engine relies on Producer headers that require
 # deprecated smartpointer implementation
 project.AddDefines( 'HELIX_FEATURE_ALLOW_DEPRECATED_SMARTPOINTERS' )
\ No newline at end of file
Index: dtdr_platform_dll
===================================================================
RCS file: /cvsroot/datatype/tools/dtdriver/dtdrplin/dtdr_platform_dll,v
retrieving revision 1.5
diff -d -H -w -U30 -r1.5 dtdr_platform_dll
--- dtdr_platform_dll	27 Aug 2008 15:00:33 -0000	1.5
+++ dtdr_platform_dll	10 Jan 2010 13:37:14 -0000
@@ -35,32 +35,58 @@
 # 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 *****
 # 
 
 UmakefileVersion(2,2)
 
 project.AddSources('hxmeddtdrpln.cpp')
 
 execfile("dtdr_genr_dll", globals())
 
 project.AddModuleLibraries("datatype/tools/dtdriver/dtdrplin[dtdr_platform_lib]",
 			   "datatype/tools/minicntx[minisubcntx]",
 			   "common/log/logutil[logutillib]",
                            "video/vidutil[vidutillib]",
 			   "datatype/common/filewriter[wrtrlib]")
 
+project.AddModuleLibraries("datatype/tools/dtdriver/loader[SourceHandlerLoader]",
+                "datatype/tools/dtdriver/engine[dtdrengine]")
+
+if project.IsDefined("HELIX_FEATURE_DTDR_ENCODER"):
+	project.AddModuleLibraries("client/encodesvc/common/util[produtillib]")
+
+project.AddModuleLibraries("datatype/tools/dtdriver/common[dtdrcomlib]",
+                "datatype/tools/dtdriver/decoder/common[dtdrdeclib]",
+                "datatype/tools/dtdriver/decoder/video[dtdrviddec]",
+                "datatype/tools/dtdriver/decoder/audio[dtdrauddec]",
+                "video/vidutil[vidutillib]",
+                "client/audiosvc[audsvclib]",
+                "audio/resampler[audresamplib]",
+                "audio/crossfade[audxfadelib]",
+                "audio/limiter[audlimiter]",
+                "datatype/tools/dtdriver/decoder/common[dtdrdeclib]",
+                "datatype/tools/minicntx[minisubcntx]",
+                "datatype/common/filewriter[wrtrlib]",
+                "datatype/common/util[dtutillib]",
+                "common/log/logutil[logutillib]",
+                "common/container[contlib]",
+                "common/util[utillib]",
+                "common/system[syslib]",
+                "common/dbgtool[debuglib]",
+                "common/runtime[runtlib]")
+
 DLLTarget('hxdtdriver')
 DependTarget()
datatype_tools_metaeditor.diff (text/x-patch, 4.2 KB)
Index: Umakefil
===================================================================
RCS file: /cvsroot/datatype/tools/metaeditor/Umakefil,v
retrieving revision 1.2
diff -d -H -w -U30 -r1.2 Umakefil
--- Umakefil	23 Oct 2009 09:41:23 -0000	1.2
+++ Umakefil	10 Jan 2010 13:36:49 -0000
@@ -41,49 +41,50 @@
 # 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 *****
 # 
 
 UmakefileVersion(2,2)
 
 project.AddModuleIncludes("common/include",
                           "datatype/tools/dtdriver/engine/pub",
                           "datatype/tools/minicntx/pub",
                           "common/system/pub",
                           "common/container/pub",
                           "common/dbgtool/pub",
                           "common/util/pub",
                           "common/fileio/pub",
                           "datatype/include",
                           "datatype/common/util/pub",
                           "client/common/system/pub",
                           "client/core",
                           "client/core/pub")
 
 project.AddModuleLibraries( "client/common/container[contclntlib]",
 			    "client/common/system[sysclntlib]",
 			    "client/common/util[utlclntlib]",
-                            "common/runtime[runtlib]",
+                "datatype/common/util[dtutillib]",
 			    "common/dbgtool[debuglib]", 
+			    "common/log/logutil[logutillib]",
+			    "common/fileio[fileiolib]",
 			    "common/util[utillib]", 
 			    "common/container[contlib]",
 			    "common/system[syslib]",
-			    "common/fileio[fileiolib]",
-			    "common/log/logutil[logutillib]",
-                "datatype/common/util[dtutillib]")
+                "common/runtime[runtlib]")
 
 project.AddSources('srchandler.cpp',
                    'editor.cpp',
                    'hxdll.cpp',
                    'dlliids.cpp')
 
 project.ExportFunction("RMACreateInstance", "IUnknown** ppObj", "common/include", "hxcom.h")
 project.ExportFunction("CanUnload2", "void")
+project.ExportFunction("RMAShutdown", "void")
 
 DLLTarget('metaeditor')
 DependTarget()
Index: hxdll.cpp
===================================================================
RCS file: /cvsroot/datatype/tools/metaeditor/hxdll.cpp,v
retrieving revision 1.1
diff -d -H -w -U30 -r1.1 hxdll.cpp
--- hxdll.cpp	5 Nov 2007 22:29:46 -0000	1.1
+++ hxdll.cpp	10 Jan 2010 13:36:49 -0000
@@ -56,60 +56,66 @@
 
 #include "srchandler.h"
 #include "editor.h"
 #include "hxdll.h"
 
 
 const char* const CComponentPlugin::zm_pDescription = "Helix Meta-data Editor Component Plugin";
 const char* const CComponentPlugin::zm_pCopyright   = "Copyright(c) RealNetworks, Inc. 1995-2007.";
 const char* const CComponentPlugin::zm_pMoreInfoURL = "http://www.real.com";
 
 
 STDAPI ENTRYPOINTCALLTYPE ENTRYPOINT(HXCREATEINSTANCE)
 (
     IUnknown** ppIUnknown
 )
 {
     *ppIUnknown = (IUnknown*)(IHXPlugin*)new CComponentPlugin();
     if (*ppIUnknown)
     {
         (*ppIUnknown)->AddRef();
         return HXR_OK;
     }
     return HXR_OUTOFMEMORY;
 }
 
 STDAPI ENTRYPOINTCALLTYPE ENTRYPOINT(CanUnload2)(void)
 {
     return (CHXBaseCountingObject::ObjectsActive() ? HXR_FAIL : HXR_OK);
 }
 
+// Plugin handler requires HXSHUTDOWN entry-point.
+STDAPI ENTRYPOINTCALLTYPE ENTRYPOINT(HXSHUTDOWN)(void)
+{
+    return HXR_OK;
+}
+
 CComponentPlugin::CComponentPlugin()
     : m_lRefCount(0)
     , m_pCCF(0)
 {
 }
 
 CComponentPlugin::~CComponentPlugin()
 {
     HX_RELEASE(m_pCCF);
 }
 
 STDMETHODIMP
 CComponentPlugin::QueryInterface(REFIID riid, void** ppvObj)
 {
     if(IsEqualIID(riid, IID_IUnknown))
     {
         AddRef();
         *ppvObj = (IUnknown*)(IHXPlugin*)this;
         return HXR_OK;
     }
     else if(IsEqualIID(riid, IID_IHXPlugin))
     {
         AddRef();
         *ppvObj = (IHXPlugin*)this;
         return HXR_OK;
     }
     else if(IsEqualIID(riid, IID_IHXComponentPlugin))
     {
         AddRef();
         *ppvObj = (IHXComponentPlugin*)this;