[prev in list] [next in list] [prev in thread] [next in thread]
List: helix-datatype-dev
Subject: [datatype-dev] CR: Implement plugin interface in mp4vpacketizer and
From: "Alok Jain" <alokj () real ! com>
Date: 2009-03-27 9:54:59
Message-ID: 00f601c9aec0$6d0f1a70$1e01a8c0 () AlokSystem
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Synopsis:
mp4vpacketizer class inherits mp4vpyld. I have implemented plugin interface in \
mp4vpyld so that to be loadable by the producer framework via mp4vpacketizer.
Added mp4vpacketizer to the Packetizer plugin factory. PacketizerPluginFactory will \
be linked with this mp4vpacketizer library to help in loading via the plugin finder.
**for mpeg4video codec is not yet in cvs. So I would not be able to test this code \
now. But I feel mp4videopacketizer(transform plugin) code is generic enough to handle \
this.
Perhaps there might be only bit modification.
Overview:
Added mp4vpacketizer to the plugin factory class to enable creation of mp4vpacketizer \
into a .dll/.so and allow it to dynamically
loaded by the plugin handler.
I have only doubt about Version file. Version file(latmpack.ver) already exist \
inside datatype/mp4/payload/, so I think we do not need to create any other .ver \
file.
I meant to ask that should I simply use existing latmpack.ver or rename latmpack.ver \
to some generic like mp4pack.ver.
Files Modified:
datatype/mp4/payload/mp4vpyld.cpp
datatype/mp4/payload/pub/mp4vpyld.h
datatype/group/payload/packetizer/PacketizerPluginFactory.cpp
datatype/group/payload/packetizer/Umakefil
Files Added:
None
Image Size and Heap Use impact (Client -Only):
None.
Platforms and Profiles Affected:
None.
Distribution Libraries Affected:
None.
Distribution library impact and planned action:
None.
Branch:
HEAD
Thanks,
Alok Jain
[Attachment #5 (text/html)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:m =
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16809" name=GENERATOR>
<STYLE>@font-face {
font-family: Cambria Math;
}
@font-face {
font-family: Calibri;
}
@font-face {
font-family: Consolas;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; }
P.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"
}
LI.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"
}
DIV.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"
}
A:link {
COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
P.MsoPlainText {
FONT-SIZE: 10.5pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: Consolas; mso-style-priority: \
99; mso-style-link: "Plain Text Char" }
LI.MsoPlainText {
FONT-SIZE: 10.5pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: Consolas; mso-style-priority: \
99; mso-style-link: "Plain Text Char" }
DIV.MsoPlainText {
FONT-SIZE: 10.5pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: Consolas; mso-style-priority: \
99; mso-style-link: "Plain Text Char" }
SPAN.PlainTextChar {
FONT-FAMILY: Consolas; mso-style-priority: 99; mso-style-link: "Plain Text"; \
mso-style-name: "Plain Text Char" }
SPAN.EmailStyle19 {
COLOR: windowtext; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal
}
SPAN.EmailStyle20 {
COLOR: #1f497d; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-reply
}
.MsoChpDefault {
FONT-SIZE: 10pt; mso-style-type: export-only
}
DIV.Section1 {
page: Section1
}
</STYLE>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-US vLink=purple link=blue bgColor=#ffffff>
<DIV class=Section1>
<P class=MsoNormal><B><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
'Arial','sans-serif'">Synopsis:<o:p></o:p></SPAN></B></P> <P \
class=MsoNormal>mp4vpacketizer class inherits mp4vpyld. I have implemented plugin \
interface in mp4vpyld so that to be <BR>loadable by the producer framework via \
mp4vpacketizer.<BR>Added mp4vpacketizer to the Packetizer plugin factory. \
PacketizerPluginFactory will be linked with this mp4vpacketizer library to \
help in <BR>loading via the plugin finder.<o:p></o:p></P> <P \
class=MsoNormal> **for mpeg4video codec is not yet in cvs. So I would not be \
able to test this code now. But I feel mp4videopacketizer(transform plugin) code is \
generic enough to handle this. <o:p></o:p></P> <P class=MsoNormal> \
Perhaps there might be only bit modification.<o:p></o:p></P>
<P class=MsoNormal> <o:p></o:p></P>
<P class=MsoNormal><B>Overview:<o:p></o:p></B></P>
<P class=MsoNormal>Added mp4vpacketizer to the plugin factory class to enable
creation of mp4vpacketizer into a .dll/.so and allow it to
dynamically<o:p></o:p></P>
<P class=MsoNormal>loaded by the plugin handler.<o:p></o:p></P>
<P class=MsoNormal>I have only doubt about Version file. Version
file(latmpack.ver) already exist inside datatype/mp4/payload/, so I think we do
not need to create any other .ver file. <o:p></o:p></P>
<P class=MsoNormal>I meant to ask that should I simply use existing latmpack.ver
or rename latmpack.ver to some generic like mp4pack.ver.<o:p></o:p></P>
<P class=MsoNormal> <o:p></o:p></P>
<P class=MsoNormal><B>Files Modified:<o:p></o:p></B></P>
<P class=MsoNormal>datatype/mp4/payload/mp4vpyld.cpp<o:p></o:p></P>
<P class=MsoNormal>datatype/mp4/payload/pub/mp4vpyld.h<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P
class=MsoNormal>datatype/group/payload/packetizer/PacketizerPluginFactory.cpp<BR>datatype/group/payload/packetizer/Umakefil<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal><B>Files Added:<o:p></o:p></B></P>
<P class=MsoNormal>None<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>Image Size and Heap Use impact (Client -Only):<o:p></o:p></P>
<P class=MsoNormal>None.<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>Platforms and Profiles Affected:<o:p></o:p></P>
<P class=MsoNormal>None.<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>Distribution Libraries Affected:<o:p></o:p></P>
<P class=MsoNormal>None.<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>Distribution library impact and planned
action:<o:p></o:p></P>
<P class=MsoNormal>None.<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoPlainText>Branch:<o:p></o:p></P>
<P class=MsoPlainText>HEAD<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: \
'Arial','sans-serif'"><o:p> </o:p></SPAN></P> <P \
class=MsoNormal>Thanks,<o:p></o:p></P> <P class=MsoNormal>Alok Jain<o:p></o:p></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 11pt; FONT-FAMILY: \
'Calibri','sans-serif'"><o:p> </o:p></SPAN></P> <P class=MsoNormal><SPAN
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: \
'Calibri','sans-serif'"><o:p> </o:p></SPAN></P></DIV></BODY></HTML>
["factory.diff" (application/octet-stream)]
Index: PacketizerPluginFactory.cpp
===================================================================
RCS file: /cvsroot/datatype/group/payload/packetizer/PacketizerPluginFactory.cpp,v
retrieving revision 1.3
diff -u -r1.3 PacketizerPluginFactory.cpp
--- PacketizerPluginFactory.cpp 25 Mar 2009 08:24:28 -0000 1.3
+++ PacketizerPluginFactory.cpp 27 Mar 2009 05:31:18 -0000
@@ -109,6 +109,10 @@
#include "amrpacketizer.h"
#endif
+#if defined(HELIX_FEATURE_PACKETIZER_MPEG4_VIDEO)
+#include "mp4vpacketizer.h"
+#endif
+
#include "PacketizerPluginFactory.h"
#ifdef _DEBUG
@@ -127,6 +131,9 @@
#if defined(HELIX_FEATURE_PACKETIZER_AMR)
AMRPacketizer::HXCreateInstance,
#endif
+#if defined(HELIX_FEATURE_PACKETIZER_MPEG4_VIDEO)
+ CMP4VPacketizer::HXCreateInstance,
+#endif
NULL
};
@@ -140,6 +147,9 @@
#if defined(HELIX_FEATURE_PACKETIZER_AMR)
AMRPacketizer::CanUnload2,
#endif
+#if defined(HELIX_FEATURE_PACKETIZER_MPEG4_VIDEO)
+ CMP4VPacketizer::CanUnload2,
+#endif
NULL
};
Index: Umakefil
===================================================================
RCS file: /cvsroot/datatype/group/payload/packetizer/Umakefil,v
retrieving revision 1.4
diff -u -r1.4 Umakefil
--- Umakefil 25 Mar 2009 08:24:28 -0000 1.4
+++ Umakefil 27 Mar 2009 05:31:18 -0000
@@ -1,6 +1,6 @@
#
# ***** BEGIN LICENSE BLOCK *****
-# Source last modified: $Id: Umakefil,v 1.4 2009/03/25 08:24:28 alokjain Exp $
+# Source last modified: $Id: Umakefil,v 1.3 2009/03/20 21:38:25 ebala Exp $
#
# Copyright Notices:
#
@@ -65,6 +65,7 @@
project.AddDefines("HELIX_FEATURE_PACKETIZER_MP4A_LATM")
project.AddDefines("HELIX_FEATURE_PACKETIZER_H263")
project.AddDefines("HELIX_FEATURE_PACKETIZER_AMR")
+project.AddDefines("HELIX_FEATURE_PACKETIZER_MPEG4_VIDEO")
# Add module includes needed by all
project.AddModuleIncludes("common/include")
@@ -80,12 +81,14 @@
"protocol/rtsp[rtsplib]",
"datatype/common/util[dtutillib]",
"datatype/common/packetizer[packetizerutil]")
-
-if project.IsDefined("HELIX_FEATURE_PACKETIZER_MP4A_LATM"):
- project.AddModuleIncludes("datatype/mp4/payload/pub")
+
+if project.IsDefined("HELIX_FEATURE_PACKETIZER_MP4A_LATM") or \
+ project.IsDefined("HELIX_FEATURE_PACKETIZER_MPEG4_VIDEO"):
+ project.AddModuleIncludes("datatype/mp4/payload/pub")
project.AddModuleLibraries("datatype/mp4/payload[mp4pyldlib]",
"datatype/mp4/common[mp4comlib]")
+
if project.IsDefined("HELIX_FEATURE_PACKETIZER_H263"):
project.AddModuleIncludes("datatype/h263/payload/pub")
project.AddModuleLibraries("datatype/h263/payload[h263pyldlib]")
@@ -96,8 +99,11 @@
"common/util/pub")
project.AddModuleLibraries("datatype/amr/payload[amrpyldlib]",
"datatype/amr/common[amrcomlib]")
-
-
+
+if project.IsDefined("HELIX_FEATURE_PACKETIZER_MPEG4_VIDEO"):
+ project.AddModuleIncludes("datatype/rm/include")
+ project.AddModuleLibraries("datatype/rm/common[rmcommonlib]")
+
project.AddSources("PacketizerPluginFactory.cpp")
project.ExportFunction("RMACreateInstance",
["mp4_plugin.diff" (application/octet-stream)]
Index: mp4vpyld.cpp
===================================================================
RCS file: /cvsroot/datatype/mp4/payload/mp4vpyld.cpp,v
retrieving revision 1.23
diff -u -r1.23 mp4vpyld.cpp
--- mp4vpyld.cpp 15 Jan 2009 17:18:50 -0000 1.23
+++ mp4vpyld.cpp 27 Mar 2009 08:36:19 -0000
@@ -84,10 +84,16 @@
#include "mp4vpyld.h"
#include "mp4pyldutil.h"
#include "avcconfig.h"
-
+#include "pckunpck.h"
+#include "hxver.h"
+#include "latmpack.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)
@@ -110,6 +116,7 @@
, m_ulCodecIDIndex(0)
, m_ppszCodecID(NULL)
, m_PayloadID (PYID_UNKNOWN)
+ , m_pContext(NULL)
{
if (m_pAllocator)
{
@@ -130,6 +137,7 @@
}
HX_RELEASE(m_pClassFactory);
HX_RELEASE(m_pStreamHeader);
+ HX_RELEASE(m_pContext);
}
HX_RESULT MP4VPayloadFormat::Build(REF(IMP4VPayloadFormat*) pFmt)
@@ -162,6 +170,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);
}
@@ -198,6 +208,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,
Index: pub/mp4vpyld.h
===================================================================
RCS file: /cvsroot/datatype/mp4/payload/pub/mp4vpyld.h,v
retrieving revision 1.8
diff -u -r1.8 mp4vpyld.h
--- pub/mp4vpyld.h 15 Jan 2009 17:18:51 -0000 1.8
+++ pub/mp4vpyld.h 27 Mar 2009 08:36:19 -0000
@@ -42,16 +42,26 @@
#include "hxalloc.h"
#include "tsconvrt.h"
#include "mp4vpyif.h"
+#include "baseobj.h"
+#include "hxplugn.h"
+#include "hxplgns.h"
/****************************************************************************
* MP4VPayloadFormat
*/
-class MP4VPayloadFormat : public IMP4VPayloadFormat
+class MP4VPayloadFormat : public IMP4VPayloadFormat,
+ public IHXPlugin,
+ public IHXPluginProperties,
+ public CHXBaseCountingObject
+
{
public:
MP4VPayloadFormat(CHXBufferMemoryAllocator* pAllocator = NULL);
~MP4VPayloadFormat();
static HX_RESULT Build(REF(IMP4VPayloadFormat*) pFmt);
+ static HX_RESULT STDAPICALLTYPE HXCreateInstance(IUnknown** ppIUnknown);
+ static HX_RESULT STDAPICALLTYPE CanUnload(void);
+ static HX_RESULT STDAPICALLTYPE CanUnload2(void);
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_
@@ -59,6 +69,28 @@
void** ppvObj);
STDMETHOD_(ULONG32,AddRef) (THIS);
STDMETHOD_(ULONG32,Release) (THIS);
+
+ /*
+ * IHXPlugin methods
+ */
+
+ STDMETHOD(InitPlugin) (THIS_
+ IUnknown* /*IN*/ pContext);
+
+ STDMETHOD(GetPluginInfo) (THIS_
+ REF(HXBOOL) bLoadMultiple,
+ REF(const char*) pDescription,
+ REF(const char*) pCopyright,
+ REF(const char*) pMoreInfoURL,
+ REF(ULONG32) ulVersionNumber
+ );
+
+ /*
+ * IHXPluginProperties
+ */
+ STDMETHOD(GetProperties) (THIS_
+ REF(IHXValues*) pIHXValuesProperties
+ );
/*
* IHXPayloadFormatObject methods
@@ -174,9 +206,13 @@
PayloadID m_PayloadID;
CTSConverter m_TSConverter;
+ IUnknown* m_pContext;
static const char* const m_ppszMPEG4VideoCodecID[];
static const char* const m_ppszAVCCodecID[];
+ static const char* const zm_pDescription;
+ static const char* const zm_pCopyright;
+ static const char* const zm_pMoreInfoURL;
};
#endif // _MP4VPYLD_H_
_______________________________________________
Datatype-dev mailing list
Datatype-dev@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic