chxavplayerapp.cpp
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:3k
源码类别:

Symbian

开发平台:

C/C++

  1. /************************************************************************
  2.  * chxavplayerapp.cpp
  3.  * ------------------
  4.  *
  5.  * Synopsis:
  6.  * Contains the implementation of the base application for the Symbian
  7.  * OS port of Helix.
  8.  *
  9.  *
  10.  * Target:
  11.  * Symbian OS
  12.  *
  13.  *
  14.  * (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
  15.  *
  16.  ************************************************************************/
  17. #include "ihxpckts.h"
  18. #include "hxstring.h"
  19. #include "hxurl.h"
  20. #include "hxglobalmgr_imp.h"
  21. #include "hxglobalmgr_inst.h"
  22. #include "platform/symbian/symbian_dll_map.h"
  23. #include "platform/symbian/symbian_dll_map_inst.h"
  24. #include "chxavplayerui.h"
  25. #include "chxavplayerapp.h"
  26. #include "player_uids.h"
  27. #include "hxsym_debug.h"
  28. #include "chxavplayerdoc.h"
  29. // required by all EPOC32 DLLs
  30. GLDEF_C TInt E32Dll(TDllReason reason)
  31. {
  32.     if (reason == EDllProcessDetach)
  33.     {
  34. CloseSTDLIB();
  35.     }
  36.     return KErrNone;
  37. }
  38. EXPORT_C CApaApplication* NewApplication()
  39. {
  40.     return new CHXAvPlayerApp();
  41. }
  42. // for HXSymbianDLLMapInstance
  43. void destroyDLLMap(void* pObj)
  44. {
  45.     SymbianDLLMapImp* pDLLMap = reinterpret_cast<SymbianDLLMapImp*>(pObj);
  46.     delete pDLLMap;
  47. }
  48. /*
  49.  * InitL
  50.  * ---------------
  51.  *
  52.  */
  53. void CHXAvPlayerApp::InitL()
  54. {
  55.     // for accessing global dll data; manages global pointers (including cleanup) accessed via HXGlobalPtr
  56.     HXGlobalManager* pGM = new (ELeave) HXGlobalManagerImp();
  57.     HXGlobalManInstance::SetInstance(pGM);
  58.     // Install ISymbianDLLMap object. 
  59.     // This object is used by DLLAccess to reference count each DLL. This
  60.     // map keeps track of when a library will actually be unloaded by the OS
  61.     // and arranges for the DLLs globals to get cleaned up before the DLL is
  62.     // unloaded.
  63.     HXSymbianDLLMapInstance::SetInstance(new (ELeave) SymbianDLLMapImp, &destroyDLLMap);
  64.     //__UHEAP_MARK;
  65.     //
  66.     // Setup default dprintf behavior. Later, once
  67.     // preferences are loaded, mask and sink are set
  68.     // from config.
  69.     //
  70.     dbg::SetupDebug("console", SYMP_INFO);
  71.     DPRINTF(SYMP_INFO, ("CHXAvPlayeApp(): ctorn"));
  72. }
  73. /*
  74.  * CreateDocumentL
  75.  * ---------------
  76.  * Create the doc. Called once per app instance.
  77.  *
  78.  */
  79. CApaDocument* CHXAvPlayerApp::CreateDocumentL()
  80. {
  81.     InitL();
  82.     return CHXAvPlayerDoc::NewL(*this);
  83. }
  84. /*
  85.  * AppDLLUid
  86.  * ---------
  87.  *
  88.  */
  89. TUid CHXAvPlayerApp::AppDllUid() const
  90. {
  91.     return CHXAvMisc::KAppUID;
  92. }
  93. /*
  94.  * ~CHXAvPlayerApp
  95.  * ---------------
  96.  * Dtor
  97.  *
  98.  */
  99. CHXAvPlayerApp::~CHXAvPlayerApp()
  100. {
  101.     DPRINTF(SYMP_INFO, ("CHXAvPlayerApp(): dtorn"));
  102.     //__UHEAP_MARKEND;
  103.     HXGlobalManagerImp* pGM = static_cast<HXGlobalManagerImp*>( HXGlobalManInstance::GetInstance() );
  104.     pGM->Shutdown();
  105.     HX_DELETE(pGM);
  106.     HXGlobalManInstance::SetInstance(0);
  107. }