* #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/63/636c67f283442416312c1314bd966862d416cd5c.svn-base b/jni/pjproject-android/.svn/pristine/63/636c67f283442416312c1314bd966862d416cd5c.svn-base
new file mode 100644
index 0000000..119d1e5
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/63/636c67f283442416312c1314bd966862d416cd5c.svn-base
@@ -0,0 +1,79 @@
+<?xml version="1.0" ?>
+<Scenario site="$(HOSTNAME)" url="http://my.cdash.org/submit.php?project=PJSIP" wdir="$(PJDIR)">
+ <!-- *********************************************************
+ ** This file contains scenario for VAS and VAS-Direct **
+ ********************************************************* -->
+
+ <!-- ******************************
+ ** VAS **
+ ****************************** -->
+ <Submit group="Experimental" build="$(OS)-$(S60TARGETNAME)-VAS1" >
+ <Update />
+ <!-- Configure config_site.h -->
+ <FileWrite file="pjlib/include/pj/config_site.h">
+ <![CDATA[
+/* Written by ccdash */
+#define PJMEDIA_AUDIO_DEV_HAS_SYMB_VAS 1
+#define PJMEDIA_AUDIO_DEV_HAS_SYMB_APS 0
+#define PJMEDIA_AUDIO_DEV_HAS_SYMB_MDA 0
+#include <pj/config_site_sample.h>
+]]>
+ </FileWrite>
+ <!-- Configure symbian_ua.mmp -->
+ <FileWrite file="build.symbian/symbian_ua.mmp" replace_begin="// =BEGIN" replace_end="// =END">
+ <![CDATA[
+#define SND_HAS_APS 0
+#define SND_HAS_VAS 1
+#define SND_HAS_MDA 0
+]]>
+ </FileWrite>
+ <!-- Configure symbian_ua_gui.mmp -->
+ <FileWrite file="pjsip-apps/src/symbian_ua_gui/group/symbian_ua_gui.mmp" replace_begin="// =BEGIN" replace_end="// =END">
+ <![CDATA[
+#define SND_HAS_APS 0
+#define SND_HAS_VAS 1
+#define SND_HAS_MDA 0
+]]>
+ </FileWrite>
+ <Configure cmd="cmd /c echo success" />
+ <Build wdir="build.symbian" cmd='cmd /C "bldmake bldfiles && abld reallyclean $(S60TARGET) && abld build $(S60TARGET)"' />
+ </Submit>
+
+
+ <!-- ******************************
+ ** VAS-Direct **
+ ****************************** -->
+ <Submit group="Experimental" build="$(OS)-$(S60TARGETNAME)-VAS1-Direct" >
+ <Update />
+ <!-- Configure config_site.h -->
+ <FileWrite file="pjlib/include/pj/config_site.h">
+ <![CDATA[
+/* Written by ccdash */
+#define PJ_CONFIG_NOKIA_VAS_DIRECT
+#include <pj/config_site_sample.h>
+]]>
+ </FileWrite>
+ <Configure cmd="cmd /c echo success" />
+ <Build wdir="build.symbian" cmd='cmd /C "bldmake bldfiles && abld reallyclean $(S60TARGET) && abld build $(S60TARGET)"' />
+
+ <!-- Restore symbian_ua.mmp -->
+ <FileWrite file="build.symbian/symbian_ua.mmp" replace_begin="// =BEGIN" replace_end="// =END">
+ <![CDATA[
+#define SND_HAS_APS 0
+#define SND_HAS_VAS 0
+#define SND_HAS_MDA 1
+]]>
+ </FileWrite>
+ <!-- Restore symbian_ua_gui.mmp -->
+ <FileWrite file="pjsip-apps/src/symbian_ua_gui/group/symbian_ua_gui.mmp" replace_begin="// =BEGIN" replace_end="// =END">
+ <![CDATA[
+#define SND_HAS_APS 0
+#define SND_HAS_VAS 0
+#define SND_HAS_MDA 1
+]]>
+ </FileWrite>
+
+ </Submit>
+
+</Scenario>
+
diff --git a/jni/pjproject-android/.svn/pristine/63/63710ccda7b39d943be9d8de8a33a75effba24c4.svn-base b/jni/pjproject-android/.svn/pristine/63/63710ccda7b39d943be9d8de8a33a75effba24c4.svn-base
new file mode 100644
index 0000000..81bab90
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/63/63710ccda7b39d943be9d8de8a33a75effba24c4.svn-base
@@ -0,0 +1,158 @@
+
+ /******************************************************************
+
+ iLBC Speech Coder ANSI-C Source Code
+
+ LPC_decode.c
+
+ Copyright (C) The Internet Society (2004).
+ All Rights Reserved.
+
+ ******************************************************************/
+
+ #include <math.h>
+ #include <string.h>
+
+ #include "helpfun.h"
+ #include "lsf.h"
+ #include "iLBC_define.h"
+ #include "constants.h"
+
+ /*---------------------------------------------------------------*
+ * interpolation of lsf coefficients for the decoder
+ *--------------------------------------------------------------*/
+
+ void LSFinterpolate2a_dec(
+ float *a, /* (o) lpc coefficients for a sub-frame */
+ float *lsf1, /* (i) first lsf coefficient vector */
+ float *lsf2, /* (i) second lsf coefficient vector */
+ float coef, /* (i) interpolation weight */
+ int length /* (i) length of lsf vectors */
+ ){
+ float lsftmp[LPC_FILTERORDER];
+
+ interpolate(lsftmp, lsf1, lsf2, coef, length);
+ lsf2a(a, lsftmp);
+ }
+
+ /*---------------------------------------------------------------*
+ * obtain dequantized lsf coefficients from quantization index
+ *--------------------------------------------------------------*/
+
+ void SimplelsfDEQ(
+ float *lsfdeq, /* (o) dequantized lsf coefficients */
+ int *index, /* (i) quantization index */
+ int lpc_n /* (i) number of LPCs */
+ ){
+ int i, j, pos, cb_pos;
+
+
+
+
+
+ /* decode first LSF */
+
+ pos = 0;
+ cb_pos = 0;
+ for (i = 0; i < LSF_NSPLIT; i++) {
+ for (j = 0; j < dim_lsfCbTbl[i]; j++) {
+ lsfdeq[pos + j] = lsfCbTbl[cb_pos +
+ (long)(index[i])*dim_lsfCbTbl[i] + j];
+ }
+ pos += dim_lsfCbTbl[i];
+ cb_pos += size_lsfCbTbl[i]*dim_lsfCbTbl[i];
+ }
+
+ if (lpc_n>1) {
+
+ /* decode last LSF */
+
+ pos = 0;
+ cb_pos = 0;
+ for (i = 0; i < LSF_NSPLIT; i++) {
+ for (j = 0; j < dim_lsfCbTbl[i]; j++) {
+ lsfdeq[LPC_FILTERORDER + pos + j] =
+ lsfCbTbl[cb_pos +
+ (long)(index[LSF_NSPLIT + i])*
+ dim_lsfCbTbl[i] + j];
+ }
+ pos += dim_lsfCbTbl[i];
+ cb_pos += size_lsfCbTbl[i]*dim_lsfCbTbl[i];
+ }
+ }
+ }
+
+ /*----------------------------------------------------------------*
+ * obtain synthesis and weighting filters form lsf coefficients
+ *---------------------------------------------------------------*/
+
+ void DecoderInterpolateLSF(
+ float *syntdenum, /* (o) synthesis filter coefficients */
+ float *weightdenum, /* (o) weighting denumerator
+ coefficients */
+ float *lsfdeq, /* (i) dequantized lsf coefficients */
+ int length, /* (i) length of lsf coefficient vector */
+ iLBC_Dec_Inst_t *iLBCdec_inst
+ /* (i) the decoder state structure */
+ ){
+ int i, pos, lp_length;
+ float lp[LPC_FILTERORDER + 1], *lsfdeq2;
+
+
+
+
+
+
+ lsfdeq2 = lsfdeq + length;
+ lp_length = length + 1;
+
+ if (iLBCdec_inst->mode==30) {
+ /* sub-frame 1: Interpolation between old and first */
+
+ LSFinterpolate2a_dec(lp, iLBCdec_inst->lsfdeqold, lsfdeq,
+ lsf_weightTbl_30ms[0], length);
+ memcpy(syntdenum,lp,lp_length*sizeof(float));
+ bwexpand(weightdenum, lp, LPC_CHIRP_WEIGHTDENUM,
+ lp_length);
+
+ /* sub-frames 2 to 6: interpolation between first
+ and last LSF */
+
+ pos = lp_length;
+ for (i = 1; i < 6; i++) {
+ LSFinterpolate2a_dec(lp, lsfdeq, lsfdeq2,
+ lsf_weightTbl_30ms[i], length);
+ memcpy(syntdenum + pos,lp,lp_length*sizeof(float));
+ bwexpand(weightdenum + pos, lp,
+ LPC_CHIRP_WEIGHTDENUM, lp_length);
+ pos += lp_length;
+ }
+ }
+ else {
+ pos = 0;
+ for (i = 0; i < iLBCdec_inst->nsub; i++) {
+ LSFinterpolate2a_dec(lp, iLBCdec_inst->lsfdeqold,
+ lsfdeq, lsf_weightTbl_20ms[i], length);
+ memcpy(syntdenum+pos,lp,lp_length*sizeof(float));
+ bwexpand(weightdenum+pos, lp, LPC_CHIRP_WEIGHTDENUM,
+ lp_length);
+ pos += lp_length;
+ }
+ }
+
+ /* update memory */
+
+ if (iLBCdec_inst->mode==30)
+ memcpy(iLBCdec_inst->lsfdeqold, lsfdeq2,
+ length*sizeof(float));
+ else
+ memcpy(iLBCdec_inst->lsfdeqold, lsfdeq,
+ length*sizeof(float));
+
+ }
+
+
+
+
+
+
diff --git a/jni/pjproject-android/.svn/pristine/63/637e03e8462430da5ead456502208011b585e539.svn-base b/jni/pjproject-android/.svn/pristine/63/637e03e8462430da5ead456502208011b585e539.svn-base
new file mode 100644
index 0000000..ff1e3e4
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/63/637e03e8462430da5ead456502208011b585e539.svn-base
@@ -0,0 +1,70 @@
+/* Copyright (C) 2002 Jean-Marc Valin */
+/**
+ @file vbr.h
+ @brief Variable Bit-Rate (VBR) related routines
+*/
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of the Xiph.org Foundation nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+
+#ifndef VBR_H
+#define VBR_H
+
+#include "arch.h"
+
+#define VBR_MEMORY_SIZE 5
+
+extern const float vbr_nb_thresh[9][11];
+extern const float vbr_hb_thresh[5][11];
+extern const float vbr_uhb_thresh[2][11];
+
+/** VBR state. */
+typedef struct VBRState {
+ float energy_alpha;
+ float average_energy;
+ float last_energy;
+ float last_log_energy[VBR_MEMORY_SIZE];
+ float accum_sum;
+ float last_pitch_coef;
+ float soft_pitch;
+ float last_quality;
+ float noise_level;
+ float noise_accum;
+ float noise_accum_count;
+ int consec_noise;
+} VBRState;
+
+void vbr_init(VBRState *vbr);
+
+float vbr_analysis(VBRState *vbr, spx_word16_t *sig, int len, int pitch, float pitch_coef);
+
+void vbr_destroy(VBRState *vbr);
+
+#endif
diff --git a/jni/pjproject-android/.svn/pristine/63/637e9a5fd801339407eef69bd4bab1885cc326b7.svn-base b/jni/pjproject-android/.svn/pristine/63/637e9a5fd801339407eef69bd4bab1885cc326b7.svn-base
new file mode 100644
index 0000000..84baba9
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/63/637e9a5fd801339407eef69bd4bab1885cc326b7.svn-base
@@ -0,0 +1,395 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2011-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_EVENT_H__
+#define __PJMEDIA_EVENT_H__
+
+/**
+ * @file pjmedia/event.h
+ * @brief Event framework
+ */
+#include <pjmedia/format.h>
+#include <pjmedia/signatures.h>
+
+PJ_BEGIN_DECL
+
+/**
+ * @defgroup PJMEDIA_EVENT Event Framework
+ * @brief PJMEDIA event framework
+ * @{
+ */
+
+/**
+ * This enumeration describes list of media events.
+ */
+typedef enum pjmedia_event_type
+{
+ /**
+ * No event.
+ */
+ PJMEDIA_EVENT_NONE,
+
+ /**
+ * Media format has changed event.
+ */
+ PJMEDIA_EVENT_FMT_CHANGED = PJMEDIA_FOURCC('F', 'M', 'C', 'H'),
+
+ /**
+ * Video window is being closed.
+ */
+ PJMEDIA_EVENT_WND_CLOSING = PJMEDIA_FOURCC('W', 'N', 'C', 'L'),
+
+ /**
+ * Video window has been closed event.
+ */
+ PJMEDIA_EVENT_WND_CLOSED = PJMEDIA_FOURCC('W', 'N', 'C', 'O'),
+
+ /**
+ * Video window has been resized event.
+ */
+ PJMEDIA_EVENT_WND_RESIZED = PJMEDIA_FOURCC('W', 'N', 'R', 'Z'),
+
+ /**
+ * Mouse button has been pressed event.
+ */
+ PJMEDIA_EVENT_MOUSE_BTN_DOWN = PJMEDIA_FOURCC('M', 'S', 'D', 'N'),
+
+ /**
+ * Video keyframe has just been decoded event.
+ */
+ PJMEDIA_EVENT_KEYFRAME_FOUND = PJMEDIA_FOURCC('I', 'F', 'R', 'F'),
+
+ /**
+ * Video decoding error due to missing keyframe event.
+ */
+ PJMEDIA_EVENT_KEYFRAME_MISSING = PJMEDIA_FOURCC('I', 'F', 'R', 'M'),
+
+ /**
+ * Video orientation has been changed event.
+ */
+ PJMEDIA_EVENT_ORIENT_CHANGED = PJMEDIA_FOURCC('O', 'R', 'N', 'T')
+
+} pjmedia_event_type;
+
+/**
+ * Additional data/parameters for media format changed event
+ * (PJMEDIA_EVENT_FMT_CHANGED).
+ */
+typedef struct pjmedia_event_fmt_changed_data
+{
+ /** The media flow direction */
+ pjmedia_dir dir;
+
+ /** The new media format. */
+ pjmedia_format new_fmt;
+} pjmedia_event_fmt_changed_data;
+
+/**
+ * Additional data/parameters are not needed.
+ */
+typedef struct pjmedia_event_dummy_data
+{
+ /** Dummy data */
+ int dummy;
+} pjmedia_event_dummy_data;
+
+/**
+ * Additional data/parameters for window resized event
+ * (PJMEDIA_EVENT_WND_RESIZED).
+ */
+typedef struct pjmedia_event_wnd_resized_data
+{
+ /**
+ * The new window size.
+ */
+ pjmedia_rect_size new_size;
+} pjmedia_event_wnd_resized_data;
+
+/**
+ * Additional data/parameters for window closing event.
+ */
+typedef struct pjmedia_event_wnd_closing_data
+{
+ /** Consumer may set this field to PJ_TRUE to cancel the closing */
+ pj_bool_t cancel;
+} pjmedia_event_wnd_closing_data;
+
+/** Additional parameters for window changed event. */
+typedef pjmedia_event_dummy_data pjmedia_event_wnd_closed_data;
+
+/** Additional parameters for mouse button down event */
+typedef pjmedia_event_dummy_data pjmedia_event_mouse_btn_down_data;
+
+/** Additional parameters for keyframe found event */
+typedef pjmedia_event_dummy_data pjmedia_event_keyframe_found_data;
+
+/** Additional parameters for keyframe missing event */
+typedef pjmedia_event_dummy_data pjmedia_event_keyframe_missing_data;
+
+/**
+ * Maximum size of additional parameters section in pjmedia_event structure
+ */
+#define PJMEDIA_EVENT_DATA_MAX_SIZE sizeof(pjmedia_event_fmt_changed_data)
+
+/** Type of storage to hold user data in pjmedia_event structure */
+typedef char pjmedia_event_user_data[PJMEDIA_EVENT_DATA_MAX_SIZE];
+
+/**
+ * This structure describes a media event. It consists mainly of the event
+ * type and additional data/parameters for the event. Applications can
+ * use #pjmedia_event_init() to initialize this event structure with
+ * basic information about the event.
+ */
+typedef struct pjmedia_event
+{
+ /**
+ * The event type.
+ */
+ pjmedia_event_type type;
+
+ /**
+ * The media timestamp when the event occurs.
+ */
+ pj_timestamp timestamp;
+
+ /**
+ * Pointer information about the source of this event. This field
+ * is provided mainly for comparison purpose so that event subscribers
+ * can check which source the event originated from. Usage of this
+ * pointer for other purpose may require special care such as mutex
+ * locking or checking whether the object is already destroyed.
+ */
+ const void *src;
+
+ /**
+ * Pointer information about the publisher of this event. This field
+ * is provided mainly for comparison purpose so that event subscribers
+ * can check which object published the event. Usage of this
+ * pointer for other purpose may require special care such as mutex
+ * locking or checking whether the object is already destroyed.
+ */
+ const void *epub;
+
+ /**
+ * Additional data/parameters about the event. The type of data
+ * will be specific to the event type being reported.
+ */
+ union {
+ /** Media format changed event data. */
+ pjmedia_event_fmt_changed_data fmt_changed;
+
+ /** Window resized event data */
+ pjmedia_event_wnd_resized_data wnd_resized;
+
+ /** Window closing event data. */
+ pjmedia_event_wnd_closing_data wnd_closing;
+
+ /** Window closed event data */
+ pjmedia_event_wnd_closed_data wnd_closed;
+
+ /** Mouse button down event data */
+ pjmedia_event_mouse_btn_down_data mouse_btn_down;
+
+ /** Keyframe found event data */
+ pjmedia_event_keyframe_found_data keyframe_found;
+
+ /** Keyframe missing event data */
+ pjmedia_event_keyframe_missing_data keyframe_missing;
+
+ /** Storage for user event data */
+ pjmedia_event_user_data user;
+
+ /** Pointer to storage to user event data, if it's outside
+ * this struct
+ */
+ void *ptr;
+ } data;
+} pjmedia_event;
+
+/**
+ * The callback to receive media events.
+ *
+ * @param event The media event.
+ * @param user_data The user data associated with the callback.
+ *
+ * @return If the callback returns non-PJ_SUCCESS, this return
+ * code may be propagated back to the caller.
+ */
+typedef pj_status_t pjmedia_event_cb(pjmedia_event *event,
+ void *user_data);
+
+/**
+ * This enumeration describes flags for event publication via
+ * #pjmedia_event_publish().
+ */
+typedef enum pjmedia_event_publish_flag
+{
+ /**
+ * Publisher will only post the event to the event manager. It is the
+ * event manager that will later notify all the publisher's subscribers.
+ */
+ PJMEDIA_EVENT_PUBLISH_POST_EVENT = 1
+
+} pjmedia_event_publish_flag;
+
+/**
+ * Event manager flag.
+ */
+typedef enum pjmedia_event_mgr_flag
+{
+ /**
+ * Tell the event manager not to create any event worker thread.
+ */
+ PJMEDIA_EVENT_MGR_NO_THREAD = 1
+
+} pjmedia_event_mgr_flag;
+
+/**
+ * Opaque data type for event manager. Typically, the event manager
+ * is a singleton instance, although application may instantiate more than one
+ * instances of this if required.
+ */
+typedef struct pjmedia_event_mgr pjmedia_event_mgr;
+
+/**
+ * Create a new event manager instance. This will also set the pointer
+ * to the singleton instance if the value is still NULL.
+ *
+ * @param pool Pool to allocate memory from.
+ * @param options Options. Bitmask flags from #pjmedia_event_mgr_flag
+ * @param mgr Pointer to hold the created instance of the
+ * event manager.
+ *
+ * @return PJ_SUCCESS on success or the appropriate error code.
+ */
+PJ_DECL(pj_status_t) pjmedia_event_mgr_create(pj_pool_t *pool,
+ unsigned options,
+ pjmedia_event_mgr **mgr);
+
+/**
+ * Get the singleton instance of the event manager.
+ *
+ * @return The instance.
+ */
+PJ_DECL(pjmedia_event_mgr*) pjmedia_event_mgr_instance(void);
+
+/**
+ * Manually assign a specific event manager instance as the singleton
+ * instance. Normally this is not needed if only one instance is ever
+ * going to be created, as the library automatically assign the singleton
+ * instance.
+ *
+ * @param mgr The instance to be used as the singleton instance.
+ * Application may specify NULL to clear the singleton
+ * singleton instance.
+ */
+PJ_DECL(void) pjmedia_event_mgr_set_instance(pjmedia_event_mgr *mgr);
+
+/**
+ * Destroy an event manager. If the manager happens to be the singleton
+ * instance, the singleton instance will be set to NULL.
+ *
+ * @param mgr The eventmanager. Specify NULL to use
+ * the singleton instance.
+ */
+PJ_DECL(void) pjmedia_event_mgr_destroy(pjmedia_event_mgr *mgr);
+
+/**
+ * Initialize event structure with basic data about the event.
+ *
+ * @param event The event to be initialized.
+ * @param type The event type to be set for this event.
+ * @param ts Event timestamp. May be set to NULL to set the event
+ * timestamp to zero.
+ * @param src Event source.
+ */
+PJ_DECL(void) pjmedia_event_init(pjmedia_event *event,
+ pjmedia_event_type type,
+ const pj_timestamp *ts,
+ const void *src);
+
+/**
+ * Subscribe a callback function to events published by the specified
+ * publisher. Note that the subscriber may receive not only events emitted by
+ * the specific publisher specified in the argument, but also from other
+ * publishers contained by the publisher, if the publisher is republishing
+ * events from other publishers.
+ *
+ * @param mgr The event manager.
+ * @param cb The callback function to receive the event.
+ * @param user_data The user data to be associated with the callback
+ * function.
+ * @param epub The event publisher.
+ *
+ * @return PJ_SUCCESS on success or the appropriate error code.
+ */
+PJ_DECL(pj_status_t) pjmedia_event_subscribe(pjmedia_event_mgr *mgr,
+ pjmedia_event_cb *cb,
+ void *user_data,
+ void *epub);
+
+/**
+ * Unsubscribe the callback associated with the user data from a publisher.
+ * If the user data is not specified, this function will do the
+ * unsubscription for all user data. If the publisher, epub, is not
+ * specified, this function will do the unsubscription from all publishers.
+ *
+ * @param mgr The event manager.
+ * @param cb The callback function.
+ * @param user_data The user data associated with the callback
+ * function, can be NULL.
+ * @param epub The event publisher, can be NULL.
+ *
+ * @return PJ_SUCCESS on success or the appropriate error code.
+ */
+PJ_DECL(pj_status_t)
+pjmedia_event_unsubscribe(pjmedia_event_mgr *mgr,
+ pjmedia_event_cb *cb,
+ void *user_data,
+ void *epub);
+
+/**
+ * Publish the specified event to all subscribers of the specified event
+ * publisher. By default, the function will call all the subcribers'
+ * callbacks immediately. If the publisher uses the flag
+ * PJMEDIA_EVENT_PUBLISH_POST_EVENT, publisher will only post the event
+ * to the event manager and return immediately. It is the event manager
+ * that will later notify all the publisher's subscribers.
+ *
+ * @param mgr The event manager.
+ * @param epub The event publisher.
+ * @param event The event to be published.
+ * @param flag Publication flag.
+ *
+ * @return PJ_SUCCESS only if all subscription callbacks returned
+ * PJ_SUCCESS.
+ */
+PJ_DECL(pj_status_t) pjmedia_event_publish(pjmedia_event_mgr *mgr,
+ void *epub,
+ pjmedia_event *event,
+ pjmedia_event_publish_flag flag);
+
+
+/**
+ * @} PJMEDIA_EVENT
+ */
+
+
+PJ_END_DECL
+
+#endif /* __PJMEDIA_EVENT_H__ */
diff --git a/jni/pjproject-android/.svn/pristine/63/63d19a4230abc8af8f4d5aa6d5969e009ea1a820.svn-base b/jni/pjproject-android/.svn/pristine/63/63d19a4230abc8af8f4d5aa6d5969e009ea1a820.svn-base
new file mode 100644
index 0000000..9f63b22
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/63/63d19a4230abc8af8f4d5aa6d5969e009ea1a820.svn-base
@@ -0,0 +1,115 @@
+/*
+ * key.c
+ *
+ * key usage limits enforcement
+ *
+ * David A. Mcgrew
+ * Cisco Systems, Inc.
+ */
+/*
+ *
+ * Copyright (c) 2001-2006 Cisco Systems, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * Neither the name of the Cisco Systems, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "key.h"
+
+#define soft_limit 0x10000
+
+err_status_t
+key_limit_set(key_limit_t key, const xtd_seq_num_t s) {
+#ifdef NO_64BIT_MATH
+ if (high32(s) == 0 && low32(s) < soft_limit)
+ return err_status_bad_param;
+#else
+ if (s < soft_limit)
+ return err_status_bad_param;
+#endif
+ key->num_left = s;
+ key->state = key_state_normal;
+ return err_status_ok;
+}
+
+err_status_t
+key_limit_clone(key_limit_t original, key_limit_t *new_key) {
+ if (original == NULL)
+ return err_status_bad_param;
+ *new_key = original;
+ return err_status_ok;
+}
+
+err_status_t
+key_limit_check(const key_limit_t key) {
+ if (key->state == key_state_expired)
+ return err_status_key_expired;
+ return err_status_ok;
+}
+
+key_event_t
+key_limit_update(key_limit_t key) {
+#ifdef NO_64BIT_MATH
+ if (low32(key->num_left) == 0)
+ {
+ // carry
+ key->num_left = make64(high32(key->num_left)-1,low32(key->num_left) - 1);
+ }
+ else
+ {
+ // no carry
+ key->num_left = make64(high32(key->num_left),low32(key->num_left) - 1);
+ }
+ if (high32(key->num_left) != 0 || low32(key->num_left) >= soft_limit) {
+ return key_event_normal; /* we're above the soft limit */
+ }
+#else
+ key->num_left--;
+ if (key->num_left >= soft_limit) {
+ return key_event_normal; /* we're above the soft limit */
+ }
+#endif
+ if (key->state == key_state_normal) {
+ /* we just passed the soft limit, so change the state */
+ key->state = key_state_past_soft_limit;
+ }
+#ifdef NO_64BIT_MATH
+ if (low32(key->num_left) == 0 && high32(key->num_left == 0))
+#else
+ if (key->num_left < 1)
+#endif
+ { /* we just hit the hard limit */
+ key->state = key_state_expired;
+ return key_event_hard_limit;
+ }
+ return key_event_soft_limit;
+}
+
diff --git a/jni/pjproject-android/.svn/pristine/63/63d6e0cd3937811ab8c832adc46877ce8e9675bb.svn-base b/jni/pjproject-android/.svn/pristine/63/63d6e0cd3937811ab8c832adc46877ce8e9675bb.svn-base
new file mode 100644
index 0000000..8ac6948
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/63/63d6e0cd3937811ab8c832adc46877ce8e9675bb.svn-base
@@ -0,0 +1,163 @@
+/* $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 <pj/sock_select.h>
+#include <pj/array.h>
+#include <pj/assert.h>
+#include <pj/os.h>
+#include "os_symbian.h"
+
+
+struct symbian_fd_set
+{
+ unsigned count;
+ CPjSocket *sock[PJ_IOQUEUE_MAX_HANDLES];
+};
+
+
+PJ_DEF(void) PJ_FD_ZERO(pj_fd_set_t *fdsetp)
+{
+ symbian_fd_set *fds = (symbian_fd_set *)fdsetp;
+ fds->count = 0;
+}
+
+
+PJ_DEF(void) PJ_FD_SET(pj_sock_t fd, pj_fd_set_t *fdsetp)
+{
+ symbian_fd_set *fds = (symbian_fd_set *)fdsetp;
+
+ PJ_ASSERT_ON_FAIL(fds->count < PJ_IOQUEUE_MAX_HANDLES, return);
+ fds->sock[fds->count++] = (CPjSocket*)fd;
+}
+
+
+PJ_DEF(void) PJ_FD_CLR(pj_sock_t fd, pj_fd_set_t *fdsetp)
+{
+ symbian_fd_set *fds = (symbian_fd_set *)fdsetp;
+ unsigned i;
+
+ for (i=0; i<fds->count; ++i) {
+ if (fds->sock[i] == (CPjSocket*)fd) {
+ pj_array_erase(fds->sock, sizeof(fds->sock[0]), fds->count, i);
+ --fds->count;
+ return;
+ }
+ }
+}
+
+
+PJ_DEF(pj_bool_t) PJ_FD_ISSET(pj_sock_t fd, const pj_fd_set_t *fdsetp)
+{
+ symbian_fd_set *fds = (symbian_fd_set *)fdsetp;
+ unsigned i;
+
+ for (i=0; i<fds->count; ++i) {
+ if (fds->sock[i] == (CPjSocket*)fd) {
+ return PJ_TRUE;
+ }
+ }
+
+ return PJ_FALSE;
+}
+
+PJ_DEF(pj_size_t) PJ_FD_COUNT(const pj_fd_set_t *fdsetp)
+{
+ symbian_fd_set *fds = (symbian_fd_set *)fdsetp;
+ return fds->count;
+}
+
+
+PJ_DEF(int) pj_sock_select( int n,
+ pj_fd_set_t *readfds,
+ pj_fd_set_t *writefds,
+ pj_fd_set_t *exceptfds,
+ const pj_time_val *timeout)
+{
+ CPjTimeoutTimer *pjTimer;
+ unsigned i;
+
+ PJ_UNUSED_ARG(n);
+ PJ_UNUSED_ARG(writefds);
+ PJ_UNUSED_ARG(exceptfds);
+
+ if (timeout) {
+ pjTimer = PjSymbianOS::Instance()->SelectTimeoutTimer();
+ pjTimer->StartTimer(timeout->sec*1000 + timeout->msec);
+
+ } else {
+ pjTimer = NULL;
+ }
+
+ /* Scan for readable sockets */
+
+ if (readfds) {
+ symbian_fd_set *fds = (symbian_fd_set *)readfds;
+
+ do {
+ /* Scan sockets for readily available data */
+ for (i=0; i<fds->count; ++i) {
+ CPjSocket *pjsock = fds->sock[i];
+
+ if (pjsock->Reader()) {
+ if (pjsock->Reader()->HasData() && !pjsock->Reader()->IsActive()) {
+
+ /* Found socket with data ready */
+ PJ_FD_ZERO(readfds);
+ PJ_FD_SET((pj_sock_t)pjsock, readfds);
+
+ /* Cancel timer, if any */
+ if (pjTimer) {
+ pjTimer->Cancel();
+ }
+
+ /* Clear writable and exception fd_set */
+ if (writefds)
+ PJ_FD_ZERO(writefds);
+ if (exceptfds)
+ PJ_FD_ZERO(exceptfds);
+
+ return 1;
+
+ } else if (!pjsock->Reader()->IsActive())
+ pjsock->Reader()->StartRecvFrom();
+
+ } else {
+ pjsock->CreateReader();
+ pjsock->Reader()->StartRecvFrom();
+ }
+ }
+
+ PjSymbianOS::Instance()->WaitForActiveObjects();
+
+ } while (pjTimer==NULL || !pjTimer->HasTimedOut());
+ }
+
+
+ /* Timeout */
+
+ if (readfds)
+ PJ_FD_ZERO(readfds);
+ if (writefds)
+ PJ_FD_ZERO(writefds);
+ if (exceptfds)
+ PJ_FD_ZERO(exceptfds);
+
+ return 0;
+}
+