[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-datatype-cvs
Subject:    [Datatype-cvs] mp4/payload mp4vpyld.cpp,1.24,1.25
From:       alokjain () helixcommunity ! org
Date:       2009-03-30 4:43:20
Message-ID: 200903300545.n2U5jSwh016481 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/datatype/mp4/payload
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv16316

Modified Files:
	mp4vpyld.cpp 
Log Message:
Implement plugin interface in mp4vpacketizer

Index: mp4vpyld.cpp
===================================================================
RCS file: /cvsroot/datatype/mp4/payload/mp4vpyld.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- mp4vpyld.cpp	25 Feb 2009 18:28:05 -0000	1.24
+++ mp4vpyld.cpp	30 Mar 2009 04:43:18 -0000	1.25
@@ -85,10 +85,16 @@
 #include "mp4vpyld.h"
 #include "mp4pyldutil.h"
 #include "avcconfig.h"
-
+#include "pckunpck.h"
+#include "hxver.h"
+#include "mp4payload.ver"
 
 const char* const MP4VPayloadFormat::m_ppszMPEG4VideoCodecID[] = {"MP4V", NULL};
 const char* const MP4VPayloadFormat::m_ppszAVCCodecID[]        = {"AVC1", "AVCQ", NULL};
+const char* const MP4VPayloadFormat::zm_pDescription    = "RealNetworks MPEG4 Video Packetizer Plugin";
+const char* const MP4VPayloadFormat::zm_pCopyright      = HXVER_COPYRIGHT;
+const char* const MP4VPayloadFormat::zm_pMoreInfoURL    = HXVER_MOREINFO;
+const char* const zm_pMimeType    = "video/MP4V-ES";
 
 MP4VPayloadFormat::MP4VPayloadFormat(CHXBufferMemoryAllocator* pAllocator)
     : m_lRefCount	(0)
@@ -111,6 +117,7 @@
     , m_ulCodecIDIndex(0)
     , m_ppszCodecID(NULL)
     , m_PayloadID	(PYID_UNKNOWN)
+    , m_pContext(NULL)
 {
     if (m_pAllocator)
     {
@@ -131,6 +138,7 @@
     }
     HX_RELEASE(m_pClassFactory);
     HX_RELEASE(m_pStreamHeader);
+    HX_RELEASE(m_pContext);
 }
 
 HX_RESULT MP4VPayloadFormat::Build(REF(IMP4VPayloadFormat*) pFmt)
@@ -163,6 +171,8 @@
     {
 	{ GET_IIDHANDLE(IID_IUnknown), this },
 	{ GET_IIDHANDLE(IID_IHXPayloadFormatObject), (IHXPayloadFormatObject*) this },
+	{ GET_IIDHANDLE(IID_IHXPluginProperties), (IHXPluginProperties*) this },
+	{ GET_IIDHANDLE(IID_IHXPlugin), (IHXPlugin*) this },
     };
     return ::QIFind(qiList, QILISTSIZE(qiList), riid, ppvObj);
 }
@@ -199,6 +209,138 @@
     return 0;
 }
 
+HX_RESULT STDAPICALLTYPE 
+MP4VPayloadFormat::HXCreateInstance(IUnknown** ppIUnknown)
+{
+    *ppIUnknown = (IUnknown*)(IHXPlugin*) new MP4VPayloadFormat();
+    if (*ppIUnknown)
+    {
+        (*ppIUnknown)->AddRef();
+        return HXR_OK;
+    }
+
+    return HXR_OUTOFMEMORY;
+}
+
+HX_RESULT STDAPICALLTYPE 
+MP4VPayloadFormat::CanUnload(void)
+{
+    return CanUnload2();
+}
+
+HX_RESULT STDAPICALLTYPE 
+MP4VPayloadFormat::CanUnload2(void)
+{
+    return ((CHXBaseCountingObject::ObjectsActive() > 0) ? HXR_FAIL : HXR_OK);
+}
+
+/************************************************************************
+ *  IHXPlugin methods
+ */
+/************************************************************************
+ *  Method:
+ *    IHXPlugin::InitPlugin
+ *  Purpose:
+ *    Initializes the plugin for use. This interface must always be
+ *    called before any other method is called. This is primarily needed
+ *    so that the plugin can have access to the context for creation of
+ *    IHXBuffers and IMalloc.
+ */
+STDMETHODIMP 
+MP4VPayloadFormat::InitPlugin(IUnknown* /*IN*/ pContext)
+{
+    HX_RESULT retVal = HXR_OK;
+
+    HX_ASSERT(pContext);
+
+    if(!pContext)
+    {
+        return HXR_INVALID_PARAMETER;
+    }
+
+    m_pContext = pContext;
+    m_pContext->AddRef();
+
+    HX_RELEASE(m_pClassFactory);
+    retVal = m_pContext->QueryInterface(IID_IHXCommonClassFactory,
+					 (void**) &m_pClassFactory);
+
+    return retVal;
+}
+
+/************************************************************************
+ *  Method:
+ *    IHXPlugin::GetPluginInfo
+ *  Purpose:
+ *    Returns the basic information about this plugin. Including:
+ *
+ *    bLoadMultiple	whether or not this plugin DLL can be loaded
+ *			multiple times. All File Formats must set
+ *			this value to TRUE.
+ *    pDescription	which is used in about UIs (can be NULL)
+ *    pCopyright	which is used in about UIs (can be NULL)
+ *    pMoreInfoURL	which is used in about UIs (can be NULL)
+ */
+STDMETHODIMP MP4VPayloadFormat::GetPluginInfo
+(
+    REF(HXBOOL)         bLoadMultiple,
+    REF(const char*)    pDescription,
+    REF(const char*)    pCopyright,
+    REF(const char*)    pMoreInfoURL,
+    REF(ULONG32)        ulVersionNumber
+)
+{
+    bLoadMultiple   = TRUE;   // Must be true for file formats.
+
+    pDescription    = zm_pDescription;
+    pCopyright      = zm_pCopyright;
+    pMoreInfoURL    = zm_pMoreInfoURL;
+    ulVersionNumber = TARVER_ULONG32_VERSION;
+
+    return HXR_OK;
+}
+
+/************************************************************************
+ *  Method:
+ *      IHXPluginProperties::GetProperties
+ */
+
+STDMETHODIMP
+MP4VPayloadFormat::GetProperties(REF(IHXValues*) pIHXValuesProperties)
+{
+    HX_RESULT res = HXR_FAIL;
+    HX_ASSERT(m_pClassFactory);
+    if(!m_pClassFactory)
+    {
+        return res;
+    }
+    m_pClassFactory->CreateInstance(IID_IHXValues, (void**)&pIHXValuesProperties);
+
+    if (pIHXValuesProperties)
+    {
+        //plugin class
+        res = SetCStringPropertyCCF(pIHXValuesProperties, PLUGIN_CLASS,
+                                    PLUGIN_PACKETIZER_TYPE, m_pContext);
+        if (HXR_OK != res)
+        {
+            return res;
+        }
+
+        //mime type
+        res = SetCStringPropertyCCF(pIHXValuesProperties, PLUGIN_PACKETIZER_MIME,
+                                    zm_pMimeType, m_pContext); 
+        if (HXR_OK != res)
+        {
+            return res;
+        }
+    }
+    else
+    {
+        return HXR_OUTOFMEMORY;
+    }
+    return HXR_OK;
+}
+
 
 STDMETHODIMP
 MP4VPayloadFormat::Init(IUnknown* pContext,


_______________________________________________
Datatype-cvs mailing list
Datatype-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic