Ignore:
Timestamp:
Apr 8, 2014 9:43:01 AM (11 years ago)
Author:
ming
Message:

Re #1757: Add example to display video in ipjsua (require ffmpeg libraries)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m

    r4590 r4813  
    22//  ipjsuaAppDelegate.m 
    33//  ipjsua 
    4 // 
    5 //  Created by Liong Sauw Ming on 13/3/13. 
    6 //  Copyright (c) 2013 Teluu. All rights reserved. 
    7 // 
    8  
     4/* 
     5 * Copyright (C) 2013-2014 Teluu Inc. (http://www.teluu.com) 
     6 * 
     7 * This program is free software; you can redistribute it and/or modify 
     8 * it under the terms of the GNU General Public License as published by 
     9 * the Free Software Foundation; either version 2 of the License, or 
     10 * (at your option) any later version. 
     11 * 
     12 * This program is distributed in the hope that it will be useful, 
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     15 * GNU General Public License for more details. 
     16 * 
     17 * You should have received a copy of the GNU General Public License 
     18 * along with this program; if not, write to the Free Software 
     19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
     20 */ 
    921#import "ipjsuaAppDelegate.h" 
    1022#import <pjlib.h> 
     
    3446{ 
    3547    NSString *str = [NSString stringWithFormat:@"%s", msg]; 
    36     [app performSelectorOnMainThread:@selector(displayMsg:) withObject:str 
    37                        waitUntilDone:NO]; 
     48    dispatch_async(dispatch_get_main_queue(), 
     49                   ^{app.viewController.textLabel.text = str;}); 
    3850} 
    3951 
     
    7284{ 
    7385    PJ_UNUSED_ARG(cfg); 
    74 } 
    75  
    76 - (void)displayMsg:(NSString *)str 
    77 { 
    78     app.viewController.textLabel.text = str; 
    7986} 
    8087 
     
    216223} 
    217224 
     225void displayWindow(pjsua_vid_win_id wid) 
     226{ 
     227#if PJSUA_HAS_VIDEO 
     228    pjsua_vid_win_info wi; 
     229     
     230    if (wid != PJSUA_INVALID_ID && 
     231        pjsua_vid_win_get_info(wid, &wi) == PJ_SUCCESS) 
     232    { 
     233        UIView *view = (__bridge UIView *)wi.hwnd.info.ios.window; 
     234        if (view) { 
     235            dispatch_async(dispatch_get_main_queue(), ^{ 
     236                UIView *parent = app.viewController.view; 
     237                /* Add the video window as subview */ 
     238                [parent addSubview:view]; 
     239                /* Center it */ 
     240                view.center = CGPointMake(parent.bounds.size.width/2.0, 
     241                                          parent.bounds.size.height/2.0); 
     242            }); 
     243        } 
     244    } 
     245#endif 
     246} 
     247 
    218248@end 
Note: See TracChangeset for help on using the changeset viewer.