* #27232: jni: added pjproject checkout as regular git content
We will remove it once the next release of pjsip (with Android support)
comes out and is merged into SFLphone.
diff --git a/jni/pjproject-android/.svn/pristine/f2/f201bdc8edce48369cd2f6315e3ea635ca47a6e1.svn-base b/jni/pjproject-android/.svn/pristine/f2/f201bdc8edce48369cd2f6315e3ea635ca47a6e1.svn-base
new file mode 100644
index 0000000..de1dcbd
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f2/f201bdc8edce48369cd2f6315e3ea635ca47a6e1.svn-base
@@ -0,0 +1,40 @@
+#if defined(PJ_BUILD_DLL)
+
+TARGET null_audio.dll
+TARGETTYPE dll
+UID 0x0 0xA0000000
+
+
+CAPABILITY None
+LIBRARY pjlib.lib charconv.lib euser.lib estlib.lib
+MACRO PJ_DLL
+MACRO PJ_EXPORTING
+
+DEFFILE .\null_audio.def
+
+#else
+
+TARGET null_audio.lib
+TARGETTYPE lib
+
+#endif
+
+SOURCEPATH ..\pjmedia\src\pjmedia
+
+OPTION CW -lang c++
+OPTION ARMCC --gnu
+
+MACRO PJ_M_I386=1
+MACRO PJ_SYMBIAN=1
+
+//
+// Platform independent source
+//
+SOURCE nullsound.c
+
+SYSTEMINCLUDE ..\pjlib\include
+SYSTEMINCLUDE ..\pjmedia\include
+
+SYSTEMINCLUDE \epoc32\include
+SYSTEMINCLUDE \epoc32\include\libc
+
diff --git a/jni/pjproject-android/.svn/pristine/f2/f2204396207187e2e8bea84430165726727adfb5.svn-base b/jni/pjproject-android/.svn/pristine/f2/f2204396207187e2e8bea84430165726727adfb5.svn-base
new file mode 100644
index 0000000..4ee7bfe
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f2/f2204396207187e2e8bea84430165726727adfb5.svn-base
@@ -0,0 +1,28 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+sdp = \
+"""
+v=0
+o=- 0 0 IN IP4 127.0.0.1
+s=-
+c=IN IP4 127.0.0.1
+t=0 0
+m=audio 5000 RTP/AVP 0
+a=crypto:1 aes_cm_128_hmac_sha1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
+m=xapplicationx 4000 RTP/AVP 100
+a=rtpmap:100 myapp/80000
+"""
+
+pjsua_args = "--null-audio --auto-answer 200 --use-srtp 1 --srtp-secure 0"
+extra_headers = ""
+include = ["Content-Type: application/sdp", # response must include SDP
+ "m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+a=crypto[\\s\\S]+m=xapplicationx 0 RTP/AVP"
+ ]
+exclude = []
+
+sendto_cfg = sip.SendtoCfg("SRTP audio and unknown media", pjsua_args, sdp, 200,
+ extra_headers=extra_headers,
+ resp_inc=include, resp_exc=exclude)
+
diff --git a/jni/pjproject-android/.svn/pristine/f2/f24f6e618b0b15fc1bb33e28a03544bb32ba541a.svn-base b/jni/pjproject-android/.svn/pristine/f2/f24f6e618b0b15fc1bb33e28a03544bb32ba541a.svn-base
new file mode 100644
index 0000000..69af572
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f2/f24f6e618b0b15fc1bb33e28a03544bb32ba541a.svn-base
@@ -0,0 +1,9 @@
+<p> </p>
+<hr><center>
+PJSIP Open Source, high performance, small footprint, and very very portable SIP stack<br>
+Copyright (C) 2006-2008 Teluu Inc.
+</center>
+<!--#include virtual="/footer.html" -->
+
+</BODY>
+</HTML>
diff --git a/jni/pjproject-android/.svn/pristine/f2/f296394c240419f247e79e983dc3e18964be1655.svn-base b/jni/pjproject-android/.svn/pristine/f2/f296394c240419f247e79e983dc3e18964be1655.svn-base
new file mode 100644
index 0000000..de0aa0e
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f2/f296394c240419f247e79e983dc3e18964be1655.svn-base
@@ -0,0 +1,97 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2008-2011 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 <pjlib-util/hmac_md5.h>
+#include <pj/string.h>
+
+
+PJ_DEF(void) pj_hmac_md5_init(pj_hmac_md5_context *hctx,
+ const pj_uint8_t *key, unsigned key_len)
+{
+ pj_uint8_t k_ipad[64];
+ pj_uint8_t tk[16];
+ int i;
+
+ /* if key is longer than 64 bytes reset it to key=MD5(key) */
+ if (key_len > 64) {
+ pj_md5_context tctx;
+
+ pj_md5_init(&tctx);
+ pj_md5_update(&tctx, key, key_len);
+ pj_md5_final(&tctx, tk);
+
+ key = tk;
+ key_len = 16;
+ }
+
+ /*
+ * HMAC = H(K XOR opad, H(K XOR ipad, text))
+ */
+
+ /* start out by storing key in pads */
+ pj_bzero( k_ipad, sizeof(k_ipad));
+ pj_bzero( hctx->k_opad, sizeof(hctx->k_opad));
+ pj_memcpy( k_ipad, key, key_len);
+ pj_memcpy( hctx->k_opad, key, key_len);
+
+ /* XOR key with ipad and opad values */
+ for (i=0; i<64; i++) {
+ k_ipad[i] ^= 0x36;
+ hctx->k_opad[i] ^= 0x5c;
+ }
+ /*
+ * perform inner MD5
+ */
+ pj_md5_init(&hctx->context);
+ pj_md5_update(&hctx->context, k_ipad, 64);
+
+}
+
+PJ_DEF(void) pj_hmac_md5_update(pj_hmac_md5_context *hctx,
+ const pj_uint8_t *input,
+ unsigned input_len)
+{
+ pj_md5_update(&hctx->context, input, input_len);
+}
+
+PJ_DEF(void) pj_hmac_md5_final(pj_hmac_md5_context *hctx,
+ pj_uint8_t digest[16])
+{
+ pj_md5_final(&hctx->context, digest);
+
+ /*
+ * perform outer MD5
+ */
+ pj_md5_init(&hctx->context);
+ pj_md5_update(&hctx->context, hctx->k_opad, 64);
+ pj_md5_update(&hctx->context, digest, 16);
+ pj_md5_final(&hctx->context, digest);
+}
+
+PJ_DEF(void) pj_hmac_md5( const pj_uint8_t *input, unsigned input_len,
+ const pj_uint8_t *key, unsigned key_len,
+ pj_uint8_t digest[16] )
+{
+ pj_hmac_md5_context ctx;
+
+ pj_hmac_md5_init(&ctx, key, key_len);
+ pj_hmac_md5_update(&ctx, input, input_len);
+ pj_hmac_md5_final(&ctx, digest);
+}
+
diff --git a/jni/pjproject-android/.svn/pristine/f2/f29a8cff22d7a3245237a5dbc3a8377eabe6c84e.svn-base b/jni/pjproject-android/.svn/pristine/f2/f29a8cff22d7a3245237a5dbc3a8377eabe6c84e.svn-base
new file mode 100644
index 0000000..f2bf30e
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f2/f29a8cff22d7a3245237a5dbc3a8377eabe6c84e.svn-base
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<designerData version="1.1.0">
+ <componentManifest>
+ <manifestEntry id="com.nokia.sdt.series60.CAknApplication" version="1.1.0"/>
+ <manifestEntry id="com.nokia.sdt.series60.NonLayoutBase" version="1.0.0"/>
+ <manifestEntry id="com.nokia.sdt.series60.CommonBase" version="1.0.0"/>
+ <manifestEntry id="com.nokia.sdt.series60.CAknDocument" version="1.0.0"/>
+ <manifestEntry id="com.nokia.sdt.series60.CAknViewAppUi" version="1.0.0"/>
+ <manifestEntry id="com.nokia.sdt.series60.CAknAppUi" version="1.0.0"/>
+ <manifestEntry id="com.nokia.sdt.series60.CAknAppUiBase" version="1.0.0"/>
+ <manifestEntry id="com.nokia.sdt.series60.DesignTimeContainer" version="1.0.0"/>
+ <manifestEntry id="com.nokia.sdt.series60.StatusPane" version="1.0.0"/>
+ <manifestEntry id="com.nokia.sdt.series60.ControlBase" version="1.0.0"/>
+ <manifestEntry id="com.nokia.sdt.series60.StatusPaneCaption" version="1.0.0"/>
+ <manifestEntry id="com.nokia.sdt.series60.StatusPaneTitleBase" version="1.0.0"/>
+ <manifestEntry id="com.nokia.sdt.series60.CBA" version="1.0.0"/>
+ <manifestEntry id="com.nokia.sdt.series60.CBABase" version="1.0.0"/>
+ <manifestEntry id="com.nokia.sdt.series60.AvkonViewReference" version="1.0.0"/>
+ <manifestEntry id="com.nokia.sdt.series60.DesignReference" version="1.0.0"/>
+ </componentManifest>
+ <property id="com.nokia.sdt.symbian.dm.RESOURCE_DIRECTORY_ID">data</property>
+ <property id="com.nokia.sdt.component.symbian.version">3.2.0</property>
+ <property id="com.nokia.sdt.component.symbian.vendor">com.nokia.series60</property>
+ <property id="com.nokia.sdt.symbian.dm.COMPONENT_PROVIDER">com.nokia.sdt.component.symbian.Symbian-Provider</property>
+ <property id="com.nokia.sdt.symbian.dm.INCLUDE_DIRECTORY_ID">inc</property>
+ <property id="com.nokia.sdt.symbian.dm.ROOT_CONTAINER">pjsuaAppUi</property>
+ <property id="com.nokia.sdt.symbian.dm.SOURCE_DIRECTORY_ID">src</property>
+ <property id="com.nokia.sdt.symbian.dm.ROOT_APPLICATION_NAME">pjsua</property>
+ <property id="com.nokia.sdt.symbian.dm.SOURCEGEN_PROVIDER">com.nokia.sdt.sourcegen.Symbian-Provider</property>
+ <property id="com.nokia.sdt.symbian.dm.BUILD_DIRECTORY_ID">group</property>
+ <component id="com.nokia.sdt.series60.CAknApplication">
+ <property id="className">CpjsuaApplication</property>
+ <property id="documentBase">pjsua</property>
+ <property id="name">pjsuaApplication</property>
+ <property id="uid">0xE44C2D02</property>
+ <component id="com.nokia.sdt.series60.CAknDocument">
+ <property id="className">CpjsuaDocument</property>
+ <property id="name">pjsuaDocument</property>
+ <component id="com.nokia.sdt.series60.CAknViewAppUi">
+ <property id="initialDesign" type="componentRef">aknViewReference1</property>
+ <property id="className">CpjsuaAppUi</property>
+ <compoundProperty id="location">
+ <property id="x">51</property>
+ <property id="y">44</property>
+ </compoundProperty>
+ <property id="name">pjsuaAppUi</property>
+ <compoundProperty id="size">
+ <property id="width">240</property>
+ <property id="height">320</property>
+ </compoundProperty>
+ <component id="com.nokia.sdt.series60.StatusPane">
+ <compoundProperty id="location">
+ <property id="x">20</property>
+ </compoundProperty>
+ <property id="name">statusPane</property>
+ <compoundProperty id="size">
+ <property id="width">204</property>
+ <property id="height">63</property>
+ </compoundProperty>
+ <component id="com.nokia.sdt.series60.StatusPaneCaption">
+ <property id="shortCaption" type="i18n">STR_pjsuaApplication_5</property>
+ <compoundProperty id="location">
+ <property id="x">56</property>
+ </compoundProperty>
+ <property id="longCaption" type="i18n">STR_pjsuaApplication_4</property>
+ <property id="name">caption</property>
+ <compoundProperty id="size">
+ <property id="width">148</property>
+ <property id="height">43</property>
+ </compoundProperty>
+ </component>
+ </component>
+ <component id="com.nokia.sdt.series60.CBA">
+ <compoundProperty id="location">
+ <property id="y">288</property>
+ </compoundProperty>
+ <compoundProperty id="info">
+ <property id="leftText" type="i18n">STR_pjsuaApplication_1</property>
+ <property id="rightText" type="i18n">STR_pjsuaApplication_2</property>
+ <property id="middleText" type="i18n">STR_pjsuaApplication_3</property>
+ <property id="leftId"></property>
+ <property id="rightId">EAknSoftkeyBack</property>
+ <property id="type">R_AVKON_SOFTKEYS_EXIT</property>
+ </compoundProperty>
+ <property id="name">controlPane</property>
+ <compoundProperty id="size">
+ <property id="width">240</property>
+ <property id="height">32</property>
+ </compoundProperty>
+ </component>
+ <component id="com.nokia.sdt.series60.AvkonViewReference">
+ <property id="filePath">pjsuaContainer.uidesign</property>
+ <compoundProperty id="tabImage"/>
+ <property id="baseName">pjsuaContainer</property>
+ <property id="name">aknViewReference1</property>
+ </component>
+ </component>
+ </component>
+ </component>
+ <stringBundle>
+ <stringTable language="LANG_English">
+ <string id="STR_pjsuaApplication_1"/>
+ <string id="STR_pjsuaApplication_2"/>
+ <string id="STR_pjsuaApplication_3"/>
+ <string id="STR_pjsuaApplication_4">pjsua</string>
+ <string id="STR_pjsuaApplication_5">pjsua</string>
+ </stringTable>
+ </stringBundle>
+ <macroTable/>
+ <sourceMappingState>
+ <resourceMappings>
+ <resourceMapping instanceName="pjsuaAppUi">r_application_pjsua_app_ui</resourceMapping>
+ <resourceMapping instanceName="statusPane">r_application_status_pane</resourceMapping>
+ <resourceMapping instanceName="pjsuaAppUi" rsrcId="localisable_app_info">r_localisable_app_info</resourceMapping>
+ <resourceMapping instanceName="aknViewReference1" rsrcId="tabText">r_application_akn_view_reference1</resourceMapping>
+ </resourceMappings>
+ <enumMappings>
+ <enumMapping instanceName="aknViewReference1" propertyId="" nameAlgorithm="com.nokia.sdt.component.symbian.NAME_ALG_VIEW_UID">EPjsuaContainerViewId</enumMapping>
+ </enumMappings>
+ <arrayMappings/>
+ </sourceMappingState>
+ <generatedFiles>
+ <file>src/pjsuaapplication.cpp</file>
+ <file>src/pjsuacontainerview.cpp</file>
+ <file>src/pjsuadocument.cpp</file>
+ <file>inc/pjsuadocument.h</file>
+ <file>inc/pjsuacontainerview.h</file>
+ <file>inc/pjsuaappui.h</file>
+ <file>inc/pjsuaapplication.h</file>
+ <file>src/pjsuaappui.cpp</file>
+ <file>data/pjsua.rss</file>
+ <file>data/pjsuacontainer.rssi</file>
+ <file>inc/pjsua.hrh</file>
+ <file>data/pjsua.loc</file>
+ <file>data/pjsua.l01</file>
+ <file>data/pjsuacontainer.loc</file>
+ <file>data/pjsuacontainer.l01</file>
+ </generatedFiles>
+</designerData>
diff --git a/jni/pjproject-android/.svn/pristine/f2/f2c029797d046e25a0f541c36b7e5c1cfccd3bd8.svn-base b/jni/pjproject-android/.svn/pristine/f2/f2c029797d046e25a0f541c36b7e5c1cfccd3bd8.svn-base
new file mode 100644
index 0000000..3159c95
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f2/f2c029797d046e25a0f541c36b7e5c1cfccd3bd8.svn-base
@@ -0,0 +1,214 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2008-2011 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
+ */
+#ifndef __PJMEDIA_VIDEODEV_CONFIG_H__
+#define __PJMEDIA_VIDEODEV_CONFIG_H__
+
+/**
+ * @file config.h
+ * @brief Video config.
+ */
+#include <pjmedia/types.h>
+#include <pj/pool.h>
+
+
+PJ_BEGIN_DECL
+
+/**
+ * @defgroup video_device_api Video Device API
+ * @brief PJMEDIA video device abstraction API.
+ */
+
+/**
+ * @defgroup s1_video_device_config Compile time configurations
+ * @ingroup video_device_api
+ * @brief Compile time configurations
+ * @{
+ */
+
+/**
+ * This setting controls the maximum number of formats that can be
+ * supported by a video device.
+ *
+ * Default: 16
+ */
+#ifndef PJMEDIA_VID_DEV_INFO_FMT_CNT
+# define PJMEDIA_VID_DEV_INFO_FMT_CNT 16
+#endif
+
+
+/**
+ * This setting controls whether SDL support should be included.
+ *
+ * Default: 0 (or detected by configure)
+ */
+#ifndef PJMEDIA_VIDEO_DEV_HAS_SDL
+# define PJMEDIA_VIDEO_DEV_HAS_SDL 0
+# define PJMEDIA_VIDEO_DEV_SDL_HAS_OPENGL 0
+#endif
+
+
+/**
+ * This setting controls whether QT support should be included.
+ *
+ * Default: 0 (or detected by configure)
+ */
+#ifndef PJMEDIA_VIDEO_DEV_HAS_QT
+# define PJMEDIA_VIDEO_DEV_HAS_QT 0
+#endif
+
+
+/**
+ * This setting controls whether IOS support should be included.
+ *
+ * Default: 0 (or detected by configure)
+ */
+#ifndef PJMEDIA_VIDEO_DEV_HAS_IOS
+# define PJMEDIA_VIDEO_DEV_HAS_IOS 0
+#endif
+
+
+/**
+ * This setting controls whether Direct Show support should be included.
+ *
+ * Default: 0 (unfinished)
+ */
+#ifndef PJMEDIA_VIDEO_DEV_HAS_DSHOW
+# define PJMEDIA_VIDEO_DEV_HAS_DSHOW 0 //PJ_WIN32
+#endif
+
+
+/**
+ * This setting controls whether colorbar source support should be included.
+ *
+ * Default: 1
+ */
+#ifndef PJMEDIA_VIDEO_DEV_HAS_CBAR_SRC
+# define PJMEDIA_VIDEO_DEV_HAS_CBAR_SRC 1
+#endif
+
+
+/**
+ * This setting controls whether ffmpeg support should be included.
+ *
+ * Default: 0 (unfinished)
+ */
+#ifndef PJMEDIA_VIDEO_DEV_HAS_FFMPEG
+# define PJMEDIA_VIDEO_DEV_HAS_FFMPEG 0
+#endif
+
+
+/**
+ * Video4Linux2
+ *
+ * Default: 0 (or detected by configure)
+ */
+#ifndef PJMEDIA_VIDEO_DEV_HAS_V4L2
+# define PJMEDIA_VIDEO_DEV_HAS_V4L2 0
+#endif
+
+
+/**
+ * Enable support for AVI player virtual capture device.
+ *
+ * Default: 1
+ */
+#ifndef PJMEDIA_VIDEO_DEV_HAS_AVI
+# define PJMEDIA_VIDEO_DEV_HAS_AVI 1
+#endif
+
+/**
+ * Specify the SDL library name to be linked with Visual Studio project.
+ * By default, the name is autodetected based on SDL version ("sdl.lib" or
+ * "sdl2.lib"), but application may explicitly specify the library name if this
+ * autodetection fails. Common names are: "sdl2.lib" or "sdl.lib".
+ *
+ * Default: undeclared.
+ */
+#ifndef PJMEDIA_SDL_LIB
+# undef PJMEDIA_SDL_LIB
+#endif
+
+/**
+ * @}
+ */
+
+PJ_END_DECL
+
+
+#endif /* __PJMEDIA_VIDEODEV_CONFIG_H__ */
+
+/*
+ --------------------- DOCUMENTATION FOLLOWS ---------------------------
+ */
+
+/**
+ * @addtogroup video_device_api Video Device API
+ * @{
+
+PJMEDIA Video Device API is a cross-platform video API appropriate for use with
+VoIP applications and many other types of video streaming applications.
+
+The API abstracts many different video API's on various platforms, such as:
+ - native Direct Show video for Win32 and Windows Mobile devices
+ - null-video implementation
+ - and more to be implemented in the future
+
+The Video Device API/library is an evolution from PJMEDIA @ref PJMED_SND and
+contains many enhancements:
+
+ - Forward compatibility:
+\n
+ The new API has been designed to be extensible, it will support new API's as
+ well as new features that may be introduced in the future without breaking
+ compatibility with applications that use this API as well as compatibility
+ with existing device implementations.
+
+ - Device capabilities:
+\n
+ At the heart of the API is device capabilities management, where all possible
+ video capabilities of video devices should be able to be handled in a generic
+ manner. With this framework, new capabilities that may be discovered in the
+ future can be handled in manner without breaking existing applications.
+
+ - Built-in features:
+\n
+ The device capabilities framework enables applications to use and control
+ video features built-in in the device, such as:
+ - built-in formats,
+ - etc.
+
+ - Codec support:
+\n
+ Some video devices support built-in hardware video codecs, and application
+ can use the video device in encoded mode to make use of these hardware
+ codecs.
+
+ - Multiple backends:
+\n
+ The new API supports multiple video backends (called factories or drivers in
+ the code) to be active simultaneously, and video backends may be added or
+ removed during run-time.
+
+*/
+
+
+/**
+ * @}
+ */
+
diff --git a/jni/pjproject-android/.svn/pristine/f2/f2ce1b1a2f4426f801a9b7909a3a33f6379a51ea.svn-base b/jni/pjproject-android/.svn/pristine/f2/f2ce1b1a2f4426f801a9b7909a3a33f6379a51ea.svn-base
new file mode 100644
index 0000000..b70396e
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f2/f2ce1b1a2f4426f801a9b7909a3a33f6379a51ea.svn-base
@@ -0,0 +1,517 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2008-2011 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
+ */
+
+/* Video device with ffmpeg backend, currently only capture devices are
+ * implemented.
+ *
+ * Issues:
+ * - no device enumeration (ffmpeg limitation), so this uses "host API" enum
+ * instead
+ * - need stricter filter on "host API" enum, currently audio capture devs are
+ * still listed.
+ * - no format enumeration, currently hardcoded to PJMEDIA_FORMAT_RGB24 only
+ * - tested on Vista only (vfw backend) with virtual cam
+ * - vfw backend produce bottom up pictures
+ * - using VS IDE, this cannot run under debugger!
+ */
+
+#include <pjmedia-videodev/videodev_imp.h>
+#include <pj/assert.h>
+#include <pj/log.h>
+#include <pj/os.h>
+#include <pj/unicode.h>
+
+
+#if defined(PJMEDIA_VIDEO_DEV_HAS_FFMPEG) && PJMEDIA_VIDEO_DEV_HAS_FFMPEG != 0
+
+
+#define THIS_FILE "ffmpeg.c"
+
+#include "../pjmedia/ffmpeg_util.h"
+#include <libavdevice/avdevice.h>
+#include <libavformat/avformat.h>
+
+#define MAX_DEV_CNT 8
+
+typedef struct ffmpeg_dev_info
+{
+ pjmedia_vid_dev_info base;
+ AVInputFormat *host_api;
+ const char *def_devname;
+} ffmpeg_dev_info;
+
+
+typedef struct ffmpeg_factory
+{
+ pjmedia_vid_dev_factory base;
+ pj_pool_factory *pf;
+ pj_pool_t *pool;
+ pj_pool_t *dev_pool;
+ unsigned dev_count;
+ ffmpeg_dev_info dev_info[MAX_DEV_CNT];
+} ffmpeg_factory;
+
+
+typedef struct ffmpeg_stream
+{
+ pjmedia_vid_dev_stream base;
+ ffmpeg_factory *factory;
+ pj_pool_t *pool;
+ pjmedia_vid_dev_param param;
+ AVFormatContext *ff_fmt_ctx;
+} ffmpeg_stream;
+
+
+/* Prototypes */
+static pj_status_t ffmpeg_factory_init(pjmedia_vid_dev_factory *f);
+static pj_status_t ffmpeg_factory_destroy(pjmedia_vid_dev_factory *f);
+static pj_status_t ffmpeg_factory_refresh(pjmedia_vid_dev_factory *f);
+static unsigned ffmpeg_factory_get_dev_count(pjmedia_vid_dev_factory *f);
+static pj_status_t ffmpeg_factory_get_dev_info(pjmedia_vid_dev_factory *f,
+ unsigned index,
+ pjmedia_vid_dev_info *info);
+static pj_status_t ffmpeg_factory_default_param(pj_pool_t *pool,
+ pjmedia_vid_dev_factory *f,
+ unsigned index,
+ pjmedia_vid_dev_param *param);
+static pj_status_t ffmpeg_factory_create_stream(
+ pjmedia_vid_dev_factory *f,
+ pjmedia_vid_dev_param *param,
+ const pjmedia_vid_dev_cb *cb,
+ void *user_data,
+ pjmedia_vid_dev_stream **p_vid_strm);
+
+static pj_status_t ffmpeg_stream_get_param(pjmedia_vid_dev_stream *strm,
+ pjmedia_vid_dev_param *param);
+static pj_status_t ffmpeg_stream_get_cap(pjmedia_vid_dev_stream *strm,
+ pjmedia_vid_dev_cap cap,
+ void *value);
+static pj_status_t ffmpeg_stream_set_cap(pjmedia_vid_dev_stream *strm,
+ pjmedia_vid_dev_cap cap,
+ const void *value);
+static pj_status_t ffmpeg_stream_start(pjmedia_vid_dev_stream *strm);
+static pj_status_t ffmpeg_stream_get_frame(pjmedia_vid_dev_stream *s,
+ pjmedia_frame *frame);
+static pj_status_t ffmpeg_stream_stop(pjmedia_vid_dev_stream *strm);
+static pj_status_t ffmpeg_stream_destroy(pjmedia_vid_dev_stream *strm);
+
+/* Operations */
+static pjmedia_vid_dev_factory_op factory_op =
+{
+ &ffmpeg_factory_init,
+ &ffmpeg_factory_destroy,
+ &ffmpeg_factory_get_dev_count,
+ &ffmpeg_factory_get_dev_info,
+ &ffmpeg_factory_default_param,
+ &ffmpeg_factory_create_stream,
+ &ffmpeg_factory_refresh
+};
+
+static pjmedia_vid_dev_stream_op stream_op =
+{
+ &ffmpeg_stream_get_param,
+ &ffmpeg_stream_get_cap,
+ &ffmpeg_stream_set_cap,
+ &ffmpeg_stream_start,
+ &ffmpeg_stream_get_frame,
+ NULL,
+ &ffmpeg_stream_stop,
+ &ffmpeg_stream_destroy
+};
+
+
+static void print_ffmpeg_err(int err)
+{
+ char errbuf[512];
+ if (av_strerror(err, errbuf, sizeof(errbuf)) >= 0)
+ PJ_LOG(1, (THIS_FILE, "ffmpeg err %d: %s", err, errbuf));
+
+}
+
+static void print_ffmpeg_log(void* ptr, int level, const char* fmt, va_list vl)
+{
+ PJ_UNUSED_ARG(ptr);
+ PJ_UNUSED_ARG(level);
+ vfprintf(stdout, fmt, vl);
+}
+
+
+static pj_status_t ffmpeg_capture_open(AVFormatContext **ctx,
+ AVInputFormat *ifmt,
+ const char *dev_name,
+ const pjmedia_vid_dev_param *param)
+{
+ AVFormatParameters fp;
+ pjmedia_video_format_detail *vfd;
+ int err;
+
+ PJ_ASSERT_RETURN(ctx && ifmt && dev_name && param, PJ_EINVAL);
+ PJ_ASSERT_RETURN(param->fmt.detail_type == PJMEDIA_FORMAT_DETAIL_VIDEO,
+ PJ_EINVAL);
+
+ vfd = pjmedia_format_get_video_format_detail(¶m->fmt, PJ_TRUE);
+
+ /* Init ffmpeg format context */
+ *ctx = avformat_alloc_context();
+
+ /* Init ffmpeg format param */
+ pj_bzero(&fp, sizeof(fp));
+ fp.prealloced_context = 1;
+ fp.width = vfd->size.w;
+ fp.height = vfd->size.h;
+ fp.pix_fmt = PIX_FMT_BGR24;
+ fp.time_base.num = vfd->fps.denum;
+ fp.time_base.den = vfd->fps.num;
+
+ /* Open capture stream */
+ err = av_open_input_stream(ctx, NULL, dev_name, ifmt, &fp);
+ if (err < 0) {
+ *ctx = NULL; /* ffmpeg freed its states on failure, do we must too */
+ print_ffmpeg_err(err);
+ return PJ_EUNKNOWN;
+ }
+
+ return PJ_SUCCESS;
+}
+
+static void ffmpeg_capture_close(AVFormatContext *ctx)
+{
+ if (ctx)
+ av_close_input_stream(ctx);
+}
+
+
+/****************************************************************************
+ * Factory operations
+ */
+/*
+ * Init ffmpeg_ video driver.
+ */
+pjmedia_vid_dev_factory* pjmedia_ffmpeg_factory(pj_pool_factory *pf)
+{
+ ffmpeg_factory *f;
+ pj_pool_t *pool;
+
+ pool = pj_pool_create(pf, "ffmpeg_cap_dev", 1000, 1000, NULL);
+ f = PJ_POOL_ZALLOC_T(pool, ffmpeg_factory);
+
+ f->pool = pool;
+ f->pf = pf;
+ f->base.op = &factory_op;
+
+ avdevice_register_all();
+
+ return &f->base;
+}
+
+
+/* API: init factory */
+static pj_status_t ffmpeg_factory_init(pjmedia_vid_dev_factory *f)
+{
+ return ffmpeg_factory_refresh(f);
+}
+
+/* API: destroy factory */
+static pj_status_t ffmpeg_factory_destroy(pjmedia_vid_dev_factory *f)
+{
+ ffmpeg_factory *ff = (ffmpeg_factory*)f;
+ pj_pool_t *pool = ff->pool;
+
+ ff->dev_count = 0;
+ ff->pool = NULL;
+ if (ff->dev_pool)
+ pj_pool_release(ff->dev_pool);
+ if (pool)
+ pj_pool_release(pool);
+
+ return PJ_SUCCESS;
+}
+
+/* API: refresh the list of devices */
+static pj_status_t ffmpeg_factory_refresh(pjmedia_vid_dev_factory *f)
+{
+ ffmpeg_factory *ff = (ffmpeg_factory*)f;
+ AVInputFormat *p;
+ ffmpeg_dev_info *info;
+
+ av_log_set_callback(&print_ffmpeg_log);
+ av_log_set_level(AV_LOG_DEBUG);
+
+ if (ff->dev_pool) {
+ pj_pool_release(ff->dev_pool);
+ ff->dev_pool = NULL;
+ }
+
+ /* TODO: this should enumerate devices, now it enumerates host APIs */
+ ff->dev_count = 0;
+ ff->dev_pool = pj_pool_create(ff->pf, "ffmpeg_cap_dev", 500, 500, NULL);
+
+ p = av_iformat_next(NULL);
+ while (p) {
+ if (p->flags & AVFMT_NOFILE) {
+ unsigned i;
+
+ info = &ff->dev_info[ff->dev_count++];
+ pj_bzero(info, sizeof(*info));
+ pj_ansi_strncpy(info->base.name, "default",
+ sizeof(info->base.name));
+ pj_ansi_snprintf(info->base.driver, sizeof(info->base.driver),
+ "%s (ffmpeg)", p->name);
+ info->base.dir = PJMEDIA_DIR_CAPTURE;
+ info->base.has_callback = PJ_FALSE;
+
+ info->host_api = p;
+
+#if (defined(PJ_WIN32) && PJ_WIN32!=0) || \
+ (defined(PJ_WIN64) && PJ_WIN64!=0)
+ info->def_devname = "0";
+#elif defined(PJ_LINUX) && PJ_LINUX!=0
+ info->def_devname = "/dev/video0";
+#endif
+
+ /* Set supported formats, currently hardcoded to RGB24 only */
+ info->base.caps = PJMEDIA_VID_DEV_CAP_FORMAT;
+ info->base.fmt_cnt = 1;
+ for (i = 0; i < info->base.fmt_cnt; ++i) {
+ pjmedia_format *fmt = &info->base.fmt[i];
+
+ fmt->id = PJMEDIA_FORMAT_RGB24;
+ fmt->type = PJMEDIA_TYPE_VIDEO;
+ fmt->detail_type = PJMEDIA_FORMAT_DETAIL_NONE;
+ }
+ }
+ p = av_iformat_next(p);
+ }
+
+ return PJ_SUCCESS;
+}
+
+/* API: get number of devices */
+static unsigned ffmpeg_factory_get_dev_count(pjmedia_vid_dev_factory *f)
+{
+ ffmpeg_factory *ff = (ffmpeg_factory*)f;
+ return ff->dev_count;
+}
+
+/* API: get device info */
+static pj_status_t ffmpeg_factory_get_dev_info(pjmedia_vid_dev_factory *f,
+ unsigned index,
+ pjmedia_vid_dev_info *info)
+{
+ ffmpeg_factory *ff = (ffmpeg_factory*)f;
+
+ PJ_ASSERT_RETURN(index < ff->dev_count, PJMEDIA_EVID_INVDEV);
+
+ pj_memcpy(info, &ff->dev_info[index].base, sizeof(*info));
+
+ return PJ_SUCCESS;
+}
+
+/* API: create default device parameter */
+static pj_status_t ffmpeg_factory_default_param(pj_pool_t *pool,
+ pjmedia_vid_dev_factory *f,
+ unsigned index,
+ pjmedia_vid_dev_param *param)
+{
+ ffmpeg_factory *ff = (ffmpeg_factory*)f;
+ ffmpeg_dev_info *info;
+
+ PJ_ASSERT_RETURN(index < ff->dev_count, PJMEDIA_EVID_INVDEV);
+
+ PJ_UNUSED_ARG(pool);
+
+ info = &ff->dev_info[index];
+
+ pj_bzero(param, sizeof(*param));
+ param->dir = PJMEDIA_DIR_CAPTURE;
+ param->cap_id = index;
+ param->rend_id = PJMEDIA_VID_INVALID_DEV;
+ param->clock_rate = 0;
+
+ /* Set the device capabilities here */
+ param->flags = PJMEDIA_VID_DEV_CAP_FORMAT;
+ param->clock_rate = 90000;
+ pjmedia_format_init_video(¶m->fmt, 0, 320, 240, 25, 1);
+ param->fmt.id = info->base.fmt[0].id;
+
+ return PJ_SUCCESS;
+}
+
+
+
+/* API: create stream */
+static pj_status_t ffmpeg_factory_create_stream(
+ pjmedia_vid_dev_factory *f,
+ pjmedia_vid_dev_param *param,
+ const pjmedia_vid_dev_cb *cb,
+ void *user_data,
+ pjmedia_vid_dev_stream **p_vid_strm)
+{
+ ffmpeg_factory *ff = (ffmpeg_factory*)f;
+ pj_pool_t *pool;
+ ffmpeg_stream *strm;
+
+ PJ_ASSERT_RETURN(f && param && p_vid_strm, PJ_EINVAL);
+ PJ_ASSERT_RETURN(param->dir == PJMEDIA_DIR_CAPTURE, PJ_EINVAL);
+ PJ_ASSERT_RETURN((unsigned)param->cap_id < ff->dev_count, PJ_EINVAL);
+ PJ_ASSERT_RETURN(param->fmt.detail_type == PJMEDIA_FORMAT_DETAIL_VIDEO,
+ PJ_EINVAL);
+
+ PJ_UNUSED_ARG(cb);
+ PJ_UNUSED_ARG(user_data);
+
+ /* Create and Initialize stream descriptor */
+ pool = pj_pool_create(ff->pf, "ffmpeg-dev", 1000, 1000, NULL);
+ PJ_ASSERT_RETURN(pool != NULL, PJ_ENOMEM);
+
+ strm = PJ_POOL_ZALLOC_T(pool, struct ffmpeg_stream);
+ strm->factory = (ffmpeg_factory*)f;
+ strm->pool = pool;
+ pj_memcpy(&strm->param, param, sizeof(*param));
+
+ /* Done */
+ strm->base.op = &stream_op;
+ *p_vid_strm = &strm->base;
+
+ return PJ_SUCCESS;
+}
+
+/* API: Get stream info. */
+static pj_status_t ffmpeg_stream_get_param(pjmedia_vid_dev_stream *s,
+ pjmedia_vid_dev_param *pi)
+{
+ ffmpeg_stream *strm = (ffmpeg_stream*)s;
+
+ PJ_ASSERT_RETURN(strm && pi, PJ_EINVAL);
+
+ pj_memcpy(pi, &strm->param, sizeof(*pi));
+
+ return PJ_SUCCESS;
+}
+
+/* API: get capability */
+static pj_status_t ffmpeg_stream_get_cap(pjmedia_vid_dev_stream *s,
+ pjmedia_vid_dev_cap cap,
+ void *pval)
+{
+ ffmpeg_stream *strm = (ffmpeg_stream*)s;
+
+ PJ_UNUSED_ARG(strm);
+ PJ_UNUSED_ARG(cap);
+ PJ_UNUSED_ARG(pval);
+
+ return PJMEDIA_EVID_INVCAP;
+}
+
+/* API: set capability */
+static pj_status_t ffmpeg_stream_set_cap(pjmedia_vid_dev_stream *s,
+ pjmedia_vid_dev_cap cap,
+ const void *pval)
+{
+ ffmpeg_stream *strm = (ffmpeg_stream*)s;
+
+ PJ_UNUSED_ARG(strm);
+ PJ_UNUSED_ARG(cap);
+ PJ_UNUSED_ARG(pval);
+
+ return PJMEDIA_EVID_INVCAP;
+}
+
+
+/* API: Start stream. */
+static pj_status_t ffmpeg_stream_start(pjmedia_vid_dev_stream *s)
+{
+ ffmpeg_stream *strm = (ffmpeg_stream*)s;
+ ffmpeg_dev_info *info;
+ pj_status_t status;
+
+ info = &strm->factory->dev_info[strm->param.cap_id];
+
+ PJ_LOG(4, (THIS_FILE, "Starting ffmpeg capture stream"));
+
+ status = ffmpeg_capture_open(&strm->ff_fmt_ctx, info->host_api,
+ info->def_devname, &strm->param);
+ if (status != PJ_SUCCESS) {
+ /* must set ffmpeg states to NULL on any failure */
+ strm->ff_fmt_ctx = NULL;
+ }
+
+ return status;
+}
+
+
+/* API: Get frame from stream */
+static pj_status_t ffmpeg_stream_get_frame(pjmedia_vid_dev_stream *s,
+ pjmedia_frame *frame)
+{
+ ffmpeg_stream *strm = (ffmpeg_stream*)s;
+ AVPacket p;
+ int err;
+
+ err = av_read_frame(strm->ff_fmt_ctx, &p);
+ if (err < 0) {
+ print_ffmpeg_err(err);
+ return PJ_EUNKNOWN;
+ }
+
+ pj_bzero(frame, sizeof(*frame));
+ frame->type = PJMEDIA_FRAME_TYPE_VIDEO;
+ frame->buf = p.data;
+ frame->size = p.size;
+
+ return PJ_SUCCESS;
+}
+
+
+/* API: Stop stream. */
+static pj_status_t ffmpeg_stream_stop(pjmedia_vid_dev_stream *s)
+{
+ ffmpeg_stream *strm = (ffmpeg_stream*)s;
+
+ PJ_LOG(4, (THIS_FILE, "Stopping ffmpeg capture stream"));
+
+ ffmpeg_capture_close(strm->ff_fmt_ctx);
+ strm->ff_fmt_ctx = NULL;
+
+ return PJ_SUCCESS;
+}
+
+
+/* API: Destroy stream. */
+static pj_status_t ffmpeg_stream_destroy(pjmedia_vid_dev_stream *s)
+{
+ ffmpeg_stream *strm = (ffmpeg_stream*)s;
+
+ PJ_ASSERT_RETURN(strm != NULL, PJ_EINVAL);
+
+ ffmpeg_stream_stop(s);
+
+ pj_pool_release(strm->pool);
+
+ return PJ_SUCCESS;
+}
+
+#ifdef _MSC_VER
+# pragma comment( lib, "avdevice.lib")
+# pragma comment( lib, "avformat.lib")
+# pragma comment( lib, "avutil.lib")
+#endif
+
+
+#endif /* PJMEDIA_VIDEO_DEV_HAS_FFMPEG */
diff --git a/jni/pjproject-android/.svn/pristine/f2/f2f25636913f41c023ced260884e7b41bc456cb8.svn-base b/jni/pjproject-android/.svn/pristine/f2/f2f25636913f41c023ced260884e7b41bc456cb8.svn-base
new file mode 100644
index 0000000..ef20f92
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f2/f2f25636913f41c023ced260884e7b41bc456cb8.svn-base
@@ -0,0 +1,53 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2008-2011 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 "TargetConditionals.h"
+
+#if !defined TARGET_IPHONE_SIMULATOR || TARGET_IPHONE_SIMULATOR == 0
+
+#include <pj/os.h>
+#include <pj/string.h>
+
+#include <UIKit/UIDevice.h>
+
+void pj_iphone_os_get_sys_info(pj_sys_info *si, pj_str_t *si_buffer)
+{
+ unsigned buf_len = si_buffer->slen, left = si_buffer->slen, len;
+ UIDevice *device = [UIDevice currentDevice];
+
+ if ([device respondsToSelector:@selector(isMultitaskingSupported)])
+ si->flags |= PJ_SYS_HAS_IOS_BG;
+
+#define ALLOC_CP_STR(str,field) \
+ do { \
+ len = [str length]; \
+ if (len && left >= len+1) { \
+ si->field.ptr = si_buffer->ptr + buf_len - left; \
+ si->field.slen = len; \
+ [str getCString:si->field.ptr maxLength:len+1 \
+ encoding:NSASCIIStringEncoding]; \
+ left -= (len+1); \
+ } \
+ } while (0)
+
+ ALLOC_CP_STR([device systemName], os_name);
+ ALLOC_CP_STR([device systemVersion], machine);
+}
+
+#endif
diff --git a/jni/pjproject-android/.svn/pristine/f2/f2f997e2ec08c420f3add4168e6607339ec63f59.svn-base b/jni/pjproject-android/.svn/pristine/f2/f2f997e2ec08c420f3add4168e6607339ec63f59.svn-base
new file mode 100644
index 0000000..cbb9f82
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/f2/f2f997e2ec08c420f3add4168e6607339ec63f59.svn-base
@@ -0,0 +1,68 @@
+
+ /******************************************************************
+
+ iLBC Speech Coder ANSI-C Source Code
+
+ packing.h
+
+ Copyright (C) The Internet Society (2004).
+ All Rights Reserved.
+
+ ******************************************************************/
+
+ #ifndef __PACKING_H
+ #define __PACKING_H
+
+ void packsplit(
+ int *index, /* (i) the value to split */
+ int *firstpart, /* (o) the value specified by most
+ significant bits */
+ int *rest, /* (o) the value specified by least
+ significant bits */
+ int bitno_firstpart, /* (i) number of bits in most
+ significant part */
+ int bitno_total /* (i) number of bits in full range
+ of value */
+ );
+
+ void packcombine(
+ int *index, /* (i/o) the msb value in the
+ combined value out */
+ int rest, /* (i) the lsb value */
+ int bitno_rest /* (i) the number of bits in the
+ lsb part */
+ );
+
+ void dopack(
+ unsigned char **bitstream, /* (i/o) on entrance pointer to
+ place in bitstream to pack
+ new data, on exit pointer
+ to place in bitstream to
+ pack future data */
+ int index, /* (i) the value to pack */
+ int bitno, /* (i) the number of bits that the
+ value will fit within */
+ int *pos /* (i/o) write position in the
+ current byte */
+ );
+
+
+
+
+
+ void unpack(
+ unsigned char **bitstream, /* (i/o) on entrance pointer to
+ place in bitstream to
+ unpack new data from, on
+ exit pointer to place in
+ bitstream to unpack future
+ data from */
+ int *index, /* (o) resulting value */
+ int bitno, /* (i) number of bits used to
+ represent the value */
+ int *pos /* (i/o) read position in the
+ current byte */
+ );
+
+ #endif
+