C++ build

August 26th, 2010

Building the MXM source code (C++) on win32

Software requirements

In order to build the MXM C++ code on win32 system, you need the following software installed on your machine (we suggest to install any dependencies on your<WORKSPACE_FOLDER>):

  • Visual C++ 2008 compiler
    • If you cannot pay the license, you can download the “Visual C++ 2008 Express” edition. It is free and it has everything you may need to start working
  • XERCES (http://xerces.apache.org/xerces-c/)
    • Download and unzip the latest binary files  (3.1.0 for vc9.0) in the <WORKSPACE_FOLDER>/xerces-c
  • LOG4Cxx 0.10.0 (http://logging.apache.org/log4cxx/)
    • Download and unzip the last source files (http://www.apache.org/dyn/closer.cgi/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.zip) in the <WORKSPACE_FOLDER>/apache-log4cxx-0.10.0 and its dependencies (apr-1.2.12-win32-src.zip, apr-util-1.2.12-win32-src.zip) in <WORKSPACE_FOLDER>/apr and <WORKSPACE_FOLDER>/apr-util
    • Build on your own as specified in http://logging.apache.org/log4cxx/building/vstudio.html
    • If you got any troubles with configure-aprutil.bat, use the following commands:
      1. sed -e “s/#define APU_HAVE_APR_ICONV\b.*/#define APU_HAVE_APR_ICONV 0/” ../apr-util/include/apu.hw
      2. sed -e “s/#define APR_HAS_LDAP\b.*/#define APR_HAS_LDAP 0/” ../apr-util/include/apr_ldap.hw
    • If you got any troubles with apr, please use the tutorial here: https://issues.apache.org/bugzilla/show_bug.cgi?id=40398
    • If you got any troubles with apr-util, simply remove any call to apr-iconv in xlate.c
  • XSD CODESYNTHESIS 3.2.0 (http://www.codesynthesis.com/)
    • Download and unzip the last source files (http://www.codesynthesis.com/products/xsd/download.xhtml) in the <WORKSPACE_FOLDER>/xsd-3.2.0-i686-windows

Building the MXM source code

  • Create the <WORKSPACE_FOLDER>/install and <WORKSPACE_FOLDER>/install/debug folders. They’ll contains any compiled .dll / .lib / .exe files
  • Open the WORKSPACE_FOLDER>/mxm-cpp/win32/MXM.sln with Visual Studio
  • Rebuild the module you need (NOTE that mxm_dataobject is OPTIONAL and can take several minutes to compile due its high number of classes)

Building the MXM source code (C++) on linux/ubuntu

Software requirements

In order to build the MXM C++ code on linux/ubuntu, you need to have on your system the following libraries

Building the MXM source code

  • go to workspace folder (cd $MXM_WORKSPACE) and following this order:
    • mxm-cpp/linux/mxm_dataobject
    • mxm-cpp/linux/mxm_core
    • mxm-cpp/linux/mxm_engines
    • mxm-cpp/linux/mxm_apps
  • Compile and install every component this way:
    • cd < component >
    • bash bootstrap
    • make
    • sudo make install
    • exit
  • After successfull compile, to update dynamic library system info, execute
    1. sudo ldconfig

Building the MXM source code (C++) on Macs

We use JHBuild in order to fetch and cross compile all dependencies. JHBuild
enviromnent lives inside a user directory and does not need root privileges.

cd $HOME
svn co .. smartrm

ls smartrm/

Subfolders :

  • jhbuild/ contains jhbuild configuration files
    • *.modules are xml descriptions of packages sources and deps
    • smartrm.jhbuildrc is a python script that sets up build options at
      jhbuild startup. If you change dirname of the project you may have to slightly modify this script.
  • head/ is where packages are being downloaded and built
  • install/ is the –prefix where all packages are being installed
  • smartrm/ the directory where smartrm sources will be checked out

Set up environment variables in order to use jhbuild

cd smartrm
source environment

Build jhbuild packages

Install mxm dependencies using jhbuild tool as follows

packages="iconv git gettext glib gstreamer sqlite3 apr apr-util log4cxx \
  icu xerces xsd libtool pkg-config libidl axis2"

for package in git $packages; do smartrm-jhbuild build $package; done

**BROKEN PACKAGES:

AFAIK 2 jhbuild dependencies fail to build.

1) ICU package.tar.gz tries to unpack itself in a subfolder that does not match
its own package name. To fix this press 4 at jhbuild error prompt to
get a shell then :

cd ..
mv icu icu-[correct package name]
exit

and then press (1) to restart the building phase

If it’s still not working try to apply the darwinports patch to the configure
file.

2) asix2 official binary does not work on a mac, several fixes has been applied
to the code so an alternative tarball will be provided later on.

Build MXM

Enter the jhbuild environment

cd mxm_workspace
smartrm-jhbuild shell

mxm-cpp :

svn co http://wg11.sc29.org/mxmsvn/repos/C/trunk mxm-cpp
cd mxm-cpp/linux
for proj in mxm_dataobject mxm_dataobject_protocols mxm_core mxm_engines mxm_apps; do
  cd $proj
  bash bootstrap
  make clean; make; make install
  cd ..
done
cd ../..

done!

Generic Metadata Engine (win32 platform)

Software requirements

  • download MPEG-7 library version 2.5 ( for Visual Studio .NET 2008) from http://mpeg7.joanneum.at (see the MPEG-7 Library submenu and its Download link) and unzip in <WORKSPACE_FOLDER>\Mp7Jrs2.5

Building the engine

  • To compile use the VC9 solution available on mxm-cpp\win32\MXM.sln (it includes the mxm-cpp\src\mxm_engines\GenericMetadataEngine\GenericMetadataEngine.vcproj)

Testing the code

  • Adjust the MXMConfigurationRelease_generic_metadata.xml file
    xml tag <LibraryPath>to/where/you/copied/it/GenericMetadataEngine.dll</LibraryPath>
    xml tag <EngineParameters><entry key=”Dependency”>to/where/you/copied/it/mp7jrs2.5_w32_vc90d.dll</entry></EngineParameters>
  • At commandline prompt type in metadata_mxm_test.exe ..\..\..\resources\log4cxx.info ..\..\..\resources\MXMConfigurationRelease_generic_metadata.xml to start the test application. it will create an mxm fragment on the same directory you launched the application
  • documentation on svn repo: mxm-cpp\docs\genericmetadataengine\

Player Orchestrator Engine (win32 platform)

Software requirements

  • download from http://qt.nokia.com/downloads/ (LGPL) the

    • Qt libraries 4.6.3 for Windows (VS 2008, 194 MB)
    • Visual Studio Add-in (44 MB)

Building the engine

  • To compile use the VC9 solution available on mxm-cpp\win32\MXM.sln:
    • mxm_playerorchestrator
    • mxm_eud

Testing the code

  • Adjust the MXMConfiguration-debug-eud.xml file with your preferend engine’s list
  • At commandline prompt type in mxm_eud.exe ..\..\..\resources\log4cxx.info ..\..\..\resources\MXMConfiguration-debug-eud.xml
  • documentation on svn repo: mxm-cpp\docs\genericmetadataengine\

Generate on your own the mxm_dataobject and mxm_dataobject_protocols classes (win32)

The mxm_dataobject module contains classes generated automatically from the schemas defined in a number of MPEG-7, 21 standards and others.

To create the data objects using XSD CODESYNTHESIS, follow these steps:

  1. download the following schemas to xsd/bin folder (from svn repo: http://wg11.sc29.org/mxmsvn/repos/resources/schemas/xsd):
    • dia
      • dia.xsd
    • did
      • didl.xsd
      • didl-msx.xsd
      • didmodel.xsd
    • dii
      • dii.xsd
    • er
      • erl.xsd
    • ipmp
      • ipmpdidl.xsd
      • ipmpinfo.xsd
      • ipmpinfo-msx.xsd
      • ipmpmsg.xsd
      • mpeg4ipmp.xsd
    • mpeg7
      • mpeg7smp.xsd
    • rel
      • rel-m1x.xsd
      • rel-m2x.xsd
      • rel-m3x.xsd
      • rel-mx.xsd
      • rel-r.xsd
      • rel-sx.xsd
    • w3c
      • dsig.xsd
      • xenc.xsd
      • xml.xsd
    • mxm-protocols
      • mxmalp.xsd
      • mxmbp.xsd
      • mxmicp.xsd
      • mxmidp.xsd
      • mxmslp.xsd
      • mxmvdp.xsd
    • still not supported
      • bbl.xsd
      • mpeg7.xsd
      • mxmacp.xsd
      • mxmaitp.xsd
      • mxmaucp.xsd
      • mxmd.xsd
      • mxmdp.xsd
      • mxmerp.xsd
      • mxmrlp.xsd
      • mxmscp.xsd (trouble on xsd)
      • ued.xsd
  1. move to xsd/bin folder
  2. generate the base xml class executing following command: xsd cxx-tree --generate-xml-schema --generate-serialization --generate-polymorphic xmlschema.xsd (xmlschema.xsd this is a dummy name)
  3. generate the mxm configuration file xml class executing following command: xsd cxx-tree --generate-wildcard --extern-xml-schema xmlschema.hxx --generate-serialization --generate-polymorphic --namespace-map urn:org:iso:mpeg:mxm:configuration:schema=mxm_core::configuration mxmConfiguration.xsd
  4. generate the mxm_dataobject classes executing following command: xsd cxx-tree --generate-wildcard --extern-xml-schema xmlschema.hxx --generate-serialization --generate-polymorphic --file-per-type --namespace-map urn:mpeg:mpeg-m:schema:storelicenseprotocol:2010=mxm_dataobject::mxm_slp --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/bbl.xsd=bbl.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/mxmalp.xsd=mxmalp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2010/04/mxmbp.xsd=mxmbp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/dia.xsd=dia.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/erl.xsd=erl.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/didl-msx.xsd=didl-msx.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/didl.xsd=didl.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/didmodel.xsd=didmodel.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/dii.xsd=dii.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpdidl.xsd=ipmpdidl.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpinfo-msx.xsd=ipmpinfo-msx.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpinfo.xsd=ipmpinfo.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2010/08/mxmidp.xsd=mxmidp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/ipmpmsg.xsd=ipmpmsg.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/mpeg4ipmp.xsd=mpeg4ipmp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/mpeg7smp.xsd=mpeg7smp.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-m1x.xsd=rel-m1x.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-m2x.xsd=rel-m2x.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-m3x.xsd=rel-m3x.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-mx.xsd=rel-mx.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-r.xsd=rel-r.xsd --location-map http://mxm.wg11.sc29.org/wp-content/uploads/2009/12/rel-sx.xsd=rel-sx.xsd --location-map http://www.w3.org/2001/xml.xsd=xml.xsd --location-map http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd=dsig.xsd --location-map http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/xenc-schema.xsd=xenc.xsd --namespace-map urn:mpeg:maf:schema:mediastreaming:DIDLextensions=mxm_dataobject::didl_msx --namespace-map urn:mpeg:mpeg21:2006:07-DIDL-NS=mxm_dataobject::didl --namespace-map urn:mpeg:mpeg21:2002:02-DIDMODEL-NS=mxm_dataobject::didmodel --namespace-map urn:mpeg:mpeg21:2002:01-DII-NS=mxm_dataobject::dii --namespace-map urn:mpeg:mpeg21:2004:01-IPMPDIDL-NS=mxm_dataobject::ipmpdidl --namespace-map urn:mpeg:mpeg21:2003:01-DIA-NS=mxm_dataobject::dia --namespace-map urn:mpeg:mpeg21:2005:01-ERL-NS=mxm_dataobject::erl --namespace-map urn:mpeg:maf:Schema:mediastreaming:IPMPINFOextensions:2007=mxm_dataobject::ipmpinfo_msx --namespace-map urn:mpeg:mpeg21:2004:01-IPMPINFO-NS=mxm_dataobject::ipmpinfo --namespace-map urn:mpeg:mpegB:schema:IPMP-XML-MESSAGES:2007=mxm_dataobject::ipmpmsg --namespace-map urn:mpeg:mpeg4:IPMPSchema:2002=mxm_dataobject::mpeg4ipmp --namespace-map urn:mpeg:mpeg7:smp:schema:2001=mxm_dataobject::mpeg7smp --namespace-map urn:mpeg:mpeg21:2005:01-REL-M1X-NS=mxm_dataobject::rel_m1x --namespace-map urn:mpeg:mpeg21:2006:01-REL-M2X-NS=mxm_dataobject::rel_m2x --namespace-map urn:mpeg:mpeg21:2006:01-REL-M3X-NS=mxm_dataobject::rel_m3x --namespace-map urn:mpeg:mpeg21:2003:01-REL-MX-NS=mxm_dataobject::rel_mx --namespace-map urn:mpeg:mpeg21:2003:01-REL-R-NS=mxm_dataobject::rel_r --namespace-map urn:mpeg:mpeg21:2003:01-REL-SX-NS=mxm_dataobject::rel_sx --namespace-map http://www.w3.org/XML/1998/namespace=mxm_dataobject::xml --namespace-map http://www.w3.org/2000/09/xmldsig#=mxm_dataobject::dsig --namespace-map http://www.w3.org/2001/04/xmlenc#=mxm_dataobject::xenc --namespace-map urn:mpeg:mpeg-m:schema:accesslicenseprotocol:2010=mxm_dataobject::mxm_alp --namespace-map urn:mpeg:mpeg-m:schema:baseprotocol:2010=mxm_dataobject::mxm_bprotocols --namespace-map urn:mpeg:mpeg-m:schema:identifycontentprotocol:2010=mxm_dataobject::mxm_icp --namespace-map urn:mpeg:mpeg-m:schema:identifydeviceprotocol:2010=mxm_dataobject::mxm_idp --namespace-map urn:mpeg:mpeg-m:schema:verifydeviceprotocol:2010=mxm_dataobject::mxm_vdp didl.xsd
  5. generate the mxm_dataobject_protocols xml class executing the above command with : mxmvdp.xsd (include mxmidp and mxmbp), mxmicp.xsd, mxmslp.xsd, mxmalp.xsd. Remove anytime the generated classes and beware about mxmslp that use the class ItemType as in didl schema and you need to modify the first #define

Still on my TODO list (C++)

  • MXM engine parameters
  • MXM command line
  • MXM core as singleton
  • MXM configuration file updated live
  • MXM loader / adapter (like java side)
  • MXM DATAOBJECT - to speed-up compilation. You would normally include xml-schema.hxx into the precompiled header and then include the precompiled header into each generated source file using the –cxx-prologue option.

Add a new MXM engine type

  • add the new entry on the MXMConfigurationFile , i.e. for  VerifyDeviceProtocolEngine
    • <!– **************************************************************** –>
      <!–                    VerifyDeviceProtocolEngine                        –>
      <!– **************************************************************** –>
      <element name=”VerifyDeviceProtocolEngine” type=”mxm:VerifyDeviceProtocolEngineType” substitutionGroup=”mxm:MXMEngine”/>
      <complexType name=”VerifyDeviceProtocolEngineType”>
      <complexContent>
      <extension base=”mxm:MXMEngineType”>
      <sequence>
      <!– VerifyDeviceProtocolEngine-specific configuration parameters TBD –>
      </sequence>
      </extension>
      </complexContent>
      </complexType>
  • generate the new level 0 c++ class as specified above
  • add in MXMEngine.h header, for enum called MXMEngine_t the entry for your new mxm engine type
  • add in MXMEngine.cpp class, for MXMEngine_ts structure in the getEngineTypeName routine, your new mxm engine type
-->