Changes between Version 3 and Version 7 of Ticket #1278


Ignore:
Timestamp:
Jul 21, 2011 12:09:01 AM (13 years ago)
Author:
bennylp
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1278

    • Property Status changed from new to closed
    • Property Component changed from pjmedia-videodev to common
    • Property Resolution changed from to fixed
    • Property Summary changed from NSApplication and NSAutoreleasePool management for Mac OS X to System specific initialization during application startup
  • Ticket #1278 – Description

    v3 v7  
    1 On Mac OS X, application needs to initialize an autorelease memory pool, event loop management, and multi-threading environment if it needs to use Cocoa framework (currently used by qt_dev and sdl_dev). 
     1Some video devices implementation (in pjmedia-videodev) assumes that the application has been initialized in certain way in order for it to work. For example, the SDL and !QuickTime video device implementation on Mac OS X requires NSApplication and NSAutoreleasePool to be present in the application. 
     2 
     3That normally is not a problem if the application is GUI application created with IDE such as XCode, since the IDE will create those for us. But for application created manually, such as console apps that are common in our samples, these objects have to be created manually. 
     4 
     5This ticket implements a generic way to initialize system specific settings to the application. This new API in {{{pj/os.h}}} is proposed: 
     6 
     7{{{ 
     8/* Type for main function. */ 
     9typedef int (*pj_main_func_ptr)(int argc, char *argv[]); 
     10 
     11/** 
     12 * Run the application. This function has to be called in the main thread 
     13 * and after doing the necessary initialization according to the flags 
     14 * provided, it will call main_func() function. 
     15 * 
     16 * @param main_func Application's main function. 
     17 * @param argc      Number of arguments from the main() function, which 
     18 *                  will be passed to main_func() function. 
     19 * @param argv      The arguments from the main() function, which will 
     20 *                  be passed to main_func() function. 
     21 * @param flags     Flags for application execution, currently must be 0. 
     22 * 
     23 * @return          main_func()'s return value. 
     24 */ 
     25int pj_run_app(pj_main_func_ptr main_func, int argc, char *argv[], 
     26               unsigned flags); 
     27}}} 
     28 
     29Console apps need to call the above {{{pj_run_app()}}} API, passing it's ''main'' routine as the argument. 
     30