Ignore:
Timestamp:
Jul 14, 2011 8:46:19 AM (13 years ago)
Author:
ming
Message:

Re #1278: NSApplication and NSAutoreleasePool management for Mac OS X

Application now needs to call pj_run_app() from its main() function and pass a pointer to the application's main function. For some examples, please refer to aviplay, pjmedia_test, and pjsua.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/2.0-dev/pjsip-apps/src/pjsua/main.c

    r3510 r3643  
    1818 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
    1919 */ 
    20 #include <pjmedia_videodev.h> 
    2120#include <pjsua-lib/pjsua.h> 
    2221 
    23 #if defined(PJ_DARWINOS) && PJ_DARWINOS!=0 
    24 #   include <CoreFoundation/CFRunLoop.h> 
    25 #endif 
    2622 
    2723#define THIS_FILE       "main.c" 
     
    3228 */ 
    3329extern pj_bool_t app_restart; 
    34 pj_bool_t is_quit = PJ_FALSE; 
    3530pj_status_t app_init(int argc, char *argv[]); 
    3631pj_status_t app_main(void); 
     
    8176#endif 
    8277 
    83 #if defined(PJ_DARWINOS) && PJ_DARWINOS!=0 
    84 static int main_func(void *data); 
    85 int argc; 
    86 char **argv; 
    87  
    88 int main(int argcm, char *argvm[]) 
    89 {  
    90     pthread_t thread; 
    91  
    92     argc = argcm; 
    93     argv = (char **)argvm; 
    94     if (pthread_create(&thread, NULL, &main_func, NULL) == 0) { 
    95         while (!is_quit) { 
    96             CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false); 
    97         } 
    98     } 
    99  
    100     return 0; 
    101 } 
    102 static int main_func(void *data) 
    103 #else 
    104 int main(int argc, char *argv[]) 
    105 #endif 
     78static int main_func(int argc, char *argv[]) 
    10679{ 
    10780    do { 
     
    12093    } while (app_restart); 
    12194 
    122     is_quit = PJ_TRUE; 
    12395    return 0; 
    12496} 
    12597 
     98int main(int argc, char *argv[]) 
     99{ 
     100    return pj_run_app(&main_func, argc, argv, 0); 
     101} 
Note: See TracChangeset for help on using the changeset viewer.