mediastreamer2_tester_ios.m 2.04 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
/*
 mediastreamer2 library - modular sound and video processing and streaming
 Copyright (C) 2006-2014 Belledonne Communications, Grenoble

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

#if TARGET_OS_IPHONE

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#include <AudioToolbox/AudioToolbox.h>
#include <CoreFoundation/CFRunLoop.h>
#include "mediastreamer2_tester.h"


int g_argc;
char** g_argv;
void stop_handler(int sig) {
    return;
}

static void* _apple_main(void* data) {
36 37 38 39 40 41 42
    NSString *bundlePath = [[[NSBundle mainBundle] bundlePath] retain];
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentPath = [[paths objectAtIndex:0] retain];
    NSLog(@"Bundle path: %@", bundlePath);
    NSLog(@"Document path: %@", documentPath);

    mediastreamer2_tester_set_file_root( [bundlePath UTF8String] );
jehan's avatar
jehan committed
43
    bc_tester_read_dir_prefix = [documentPath UTF8String] ;
44
    apple_main(g_argc,g_argv);
45 46 47

    [bundlePath release];
    [documentPath release];
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
    return NULL;
}
int main(int argc, char * argv[]) {
    pthread_t main_thread;
    g_argc=argc;
    g_argv=argv;
    pthread_create(&main_thread,NULL,_apple_main,NULL);
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    int value = UIApplicationMain(0, nil, nil, nil);
    [pool release];
    return value;
    pthread_join(main_thread,NULL);
    return 0;
}


jehan's avatar
jehan committed
64
#endif // target IPHONE