Fixed #1183
* QT capture device for Mac
* iOS device for iOS (capture device only works for iOS 4.0 or above)
* Add NSAutoReleasePool for sdl_dev (Mac)
* Add NSAutoReleasePool for vid_dev_test (Mac)
* build system for compilation of Obj-C files (.m)
git-svn-id: https://svn.pjsip.org/repos/pjproject/branches/projects/2.0-dev@3395 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjmedia/src/test/test.c b/pjmedia/src/test/test.c
index bd4e406..6d5b022 100644
--- a/pjmedia/src/test/test.c
+++ b/pjmedia/src/test/test.c
@@ -47,15 +47,21 @@
{
int rc = 0;
pj_caching_pool caching_pool;
+ pj_pool_t *pool;
pj_init();
pj_caching_pool_init(&caching_pool, &pj_pool_factory_default_policy, 0);
-
+ pool = pj_pool_create(&caching_pool.factory, "test", 1000, 512, NULL);
+
pj_log_set_decor(PJ_LOG_HAS_NEWLINE);
pj_log_set_level(3);
mem = &caching_pool.factory;
+ pjmedia_video_format_mgr_create(pool, 64, 0, NULL);
+ pjmedia_converter_mgr_create(pool, NULL);
+ pjmedia_vid_codec_mgr_create(pool, NULL);
+
#if HAS_VID_DEV_TEST
DO_TEST(vid_dev_test());
#endif
@@ -89,6 +95,11 @@
PJ_LOG(3,(THIS_FILE,"Looks like everything is okay!"));
}
+ pjmedia_video_format_mgr_destroy(pjmedia_video_format_mgr_instance());
+ pjmedia_converter_mgr_destroy(pjmedia_converter_mgr_instance());
+ pjmedia_vid_codec_mgr_destroy(pjmedia_vid_codec_mgr_instance());
+
+ pj_pool_release(pool);
pj_caching_pool_destroy(&caching_pool);
return rc;
diff --git a/pjmedia/src/test/vid_dev_test.c b/pjmedia/src/test/vid_dev_test.c
index 007ef3b..0f6ada9 100644
--- a/pjmedia/src/test/vid_dev_test.c
+++ b/pjmedia/src/test/vid_dev_test.c
@@ -23,6 +23,18 @@
#include <pjmedia/vid_codec.h>
#include <pjmedia_videodev.h>
+#if defined(PJ_DARWINOS) && PJ_DARWINOS!=0
+# include "TargetConditionals.h"
+# if !TARGET_OS_IPHONE
+# define VID_DEV_TEST_MAC_OS 1
+# endif
+#endif
+
+#if VID_DEV_TEST_MAC_OS
+# include <Foundation/NSAutoreleasePool.h>
+# include <AppKit/NSApplication.h>
+#endif
+
#define THIS_FILE "vid_dev_test.c"
pj_status_t pjmedia_libswscale_converter_init(pjmedia_converter_mgr *mgr,
@@ -386,6 +398,10 @@
}
}
+#if VID_DEV_TEST_MAC_OS
+ CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false);
+#endif
+
pj_thread_sleep(150000);
on_return:
@@ -472,6 +488,10 @@
rc = 160; goto on_return;
}
+#if VID_DEV_TEST_MAC_OS
+ CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false);
+#endif
+
/* Sleep while the webcam is being displayed... */
pj_thread_sleep(20000);
@@ -491,6 +511,12 @@
int rc = 0;
pj_status_t status;
+#if VID_DEV_TEST_MAC_OS
+ NSAutoreleasePool *apool = [[NSAutoreleasePool alloc] init];
+
+ [NSApplication sharedApplication];
+#endif
+
PJ_LOG(3, (THIS_FILE, "Video device tests.."));
pool = pj_pool_create(mem, "Viddev test", 256, 256, 0);
@@ -523,6 +549,10 @@
pjmedia_vid_subsys_shutdown();
pj_pool_release(pool);
+#if VID_DEV_TEST_MAC_OS
+ [apool release];
+#endif
+
return rc;
}
diff --git a/pjmedia/src/test/vid_dev_test_m.m b/pjmedia/src/test/vid_dev_test_m.m
new file mode 100644
index 0000000..4872647
--- /dev/null
+++ b/pjmedia/src/test/vid_dev_test_m.m
@@ -0,0 +1,21 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
+ * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
+ *
+ * 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
+ */
+
+#include "vid_dev_test.c"