summaryrefslogtreecommitdiff
path: root/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2014-04-08 09:43:01 +0000
committerLiong Sauw Ming <ming@teluu.com>2014-04-08 09:43:01 +0000
commit606c6843f5b533740858d65c8568485f0eb3ed93 (patch)
treee74e5d0289d13873de56461c9fbd58b34d82837c /pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m
parentf8f81f703f4715440cbfb28c2232345df5564b80 (diff)
Re #1757: Add example to display video in ipjsua (require ffmpeg libraries)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4813 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m')
-rw-r--r--pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m54
1 files changed, 42 insertions, 12 deletions
diff --git a/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m b/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m
index 5bcf2409..d415d94c 100644
--- a/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m
+++ b/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m
@@ -1,11 +1,23 @@
//
// ipjsuaAppDelegate.m
// ipjsua
-//
-// Created by Liong Sauw Ming on 13/3/13.
-// Copyright (c) 2013 Teluu. All rights reserved.
-//
-
+/*
+ * Copyright (C) 2013-2014 Teluu Inc. (http://www.teluu.com)
+ *
+ * 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
+ */
#import "ipjsuaAppDelegate.h"
#import <pjlib.h>
#import <pjsua.h>
@@ -33,8 +45,8 @@ static pj_thread_t *a_thread;
static void displayMsg(const char *msg)
{
NSString *str = [NSString stringWithFormat:@"%s", msg];
- [app performSelectorOnMainThread:@selector(displayMsg:) withObject:str
- waitUntilDone:NO];
+ dispatch_async(dispatch_get_main_queue(),
+ ^{app.viewController.textLabel.text = str;});
}
static void pjsuaOnStartedCb(pj_status_t status, const char* msg)
@@ -73,11 +85,6 @@ static void pjsuaOnAppConfigCb(pjsua_app_config *cfg)
PJ_UNUSED_ARG(cfg);
}
-- (void)displayMsg:(NSString *)str
-{
- app.viewController.textLabel.text = str;
-}
-
- (void)pjsuaStart
{
// TODO: read from config?
@@ -215,4 +222,27 @@ pj_bool_t showNotification(pjsua_call_id call_id)
return PJ_FALSE;
}
+void displayWindow(pjsua_vid_win_id wid)
+{
+#if PJSUA_HAS_VIDEO
+ pjsua_vid_win_info wi;
+
+ if (wid != PJSUA_INVALID_ID &&
+ pjsua_vid_win_get_info(wid, &wi) == PJ_SUCCESS)
+ {
+ UIView *view = (__bridge UIView *)wi.hwnd.info.ios.window;
+ if (view) {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ UIView *parent = app.viewController.view;
+ /* Add the video window as subview */
+ [parent addSubview:view];
+ /* Center it */
+ view.center = CGPointMake(parent.bounds.size.width/2.0,
+ parent.bounds.size.height/2.0);
+ });
+ }
+ }
+#endif
+}
+
@end