* #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/74/741946d078aee83ea851ea3e03ffddf5dafd1d08.svn-base b/jni/pjproject-android/.svn/pristine/74/741946d078aee83ea851ea3e03ffddf5dafd1d08.svn-base
new file mode 100644
index 0000000..969971f
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/74/741946d078aee83ea851ea3e03ffddf5dafd1d08.svn-base
Binary files differ
diff --git a/jni/pjproject-android/.svn/pristine/74/741e6fde75d71b7f461b54d1690ad870e63c91ed.svn-base b/jni/pjproject-android/.svn/pristine/74/741e6fde75d71b7f461b54d1690ad870e63c91ed.svn-base
new file mode 100644
index 0000000..1e433ee
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/74/741e6fde75d71b7f461b54d1690ad870e63c91ed.svn-base
@@ -0,0 +1,515 @@
+/* Copyright (C) 2005 Analog Devices */
+/**
+ @file filters_bfin.h
+ @brief Various analysis/synthesis filters (Blackfin version)
+*/
+/*
+ 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.
+*/
+
+#define OVERRIDE_NORMALIZE16
+int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len)
+{
+ spx_sig_t max_val=1;
+ int sig_shift;
+ __asm__
+ (
+ "%0 = 0;\n\t"
+ "I0 = %1;\n\t"
+ "L0 = 0;\n\t"
+ "R1 = [I0++];\n\t"
+ "LOOP norm_max%= LC0 = %2;\n\t"
+ "LOOP_BEGIN norm_max%=;\n\t"
+ "R2 = ABS R1 || R1 = [I0++];\n\t"
+ "%0 = MAX(%0, R2);\n\t"
+ "LOOP_END norm_max%=;\n\t"
+ : "=&d" (max_val)
+ : "a" (x), "a" (len)
+ : "R1", "R2"
+ );
+
+ sig_shift=0;
+ while (max_val>max_scale)
+ {
+ sig_shift++;
+ max_val >>= 1;
+ }
+
+ __asm__ __volatile__
+ (
+ "I0 = %0;\n\t"
+ "L0 = 0;\n\t"
+ "P1 = %1;\n\t"
+ "R0 = [I0++];\n\t"
+ "LOOP norm_shift%= LC0 = %3;\n\t"
+ "LOOP_BEGIN norm_shift%=;\n\t"
+ "R1 = ASHIFT R0 by %2.L || R0 = [I0++];\n\t"
+ "W[P1++] = R1;\n\t"
+ "LOOP_END norm_shift%=;\n\t"
+ "R1 = ASHIFT R0 by %2.L;\n\t"
+ "W[P1++] = R1;\n\t"
+ : : "a" (x), "a" (y), "d" (-sig_shift), "a" (len-1)
+ : "I0", "L0", "P1", "R0", "R1", "memory"
+ );
+ return sig_shift;
+}
+
+
+
+#define OVERRIDE_FILTER_MEM16
+void filter_mem16(const spx_word16_t *_x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *_y, int N, int ord, spx_mem_t *mem, char *stack)
+{
+ VARDECL(spx_word32_t *xy2);
+ VARDECL(spx_word32_t *numden_a);
+ spx_word32_t *xy;
+ spx_word16_t *numden;
+ int i;
+
+ ALLOC(xy2, (N+1), spx_word32_t);
+ ALLOC(numden_a, (2*ord+2), spx_word32_t);
+ xy = xy2+1;
+ numden = (spx_word16_t*) numden_a;
+
+ for (i=0;i<ord;i++)
+ {
+ numden[2*i] = num[i];
+ numden[2*i+1] = den[i];
+ }
+ __asm__ __volatile__
+ (
+ /* Register setup */
+ "R0 = %5;\n\t" /*ord */
+
+ "P0 = %3;\n\t"
+ "I0 = P0;\n\t"
+ "B0 = P0;\n\t" /* numden */
+ "L0 = 0;\n\t"
+
+ "P2 = %0;\n\t" /* Fused xy */
+ "I2 = P2;\n\t"
+ "L2 = 0;\n\t"
+
+ "P4 = %6;\n\t" /* mem */
+ "P0 = %1;\n\t" /* _x */
+ "P1 = %2;\n\t" /* _y */
+
+ /* First sample */
+ "R1 = [P4++];\n\t"
+ "R1 <<= 3;\n\t" /* shift mem */
+ "R1.L = R1 (RND);\n\t"
+ "R2 = W[P0++];\n\t" /* load x[0] */
+ "R1.L = R1.L + R2.L;\n\t"
+ "W[P1++] = R1;\n\t" /* store y[0] */
+ "R2 = PACK(R1.L, R2.L);\n\t" /* pack x16 and y16 */
+ "[P2] = R2;\n\t"
+
+ /* Samples 1 to ord-1 (using memory) */
+ "R0 += -1;\n\t"
+ "R3 = 0;\n\t"
+ "LC0 = R0;\n\t"
+ "LOOP filter_start%= LC0;\n\t"
+ "LOOP_BEGIN filter_start%=;\n\t"
+ "R3 += 1;\n\t"
+ "LC1 = R3;\n\t"
+
+ "R1 = [P4++];\n\t"
+ "A1 = R1;\n\t"
+ "A0 = 0;\n\t"
+ "I0 = B0;\n\t"
+ "I2 = P2;\n\t"
+ "P2 += 4;\n\t"
+ "R4 = [I0++] || R5 = [I2--];\n\t"
+ "LOOP filter_start_inner%= LC1;\n\t"
+ "LOOP_BEGIN filter_start_inner%=;\n\t"
+ "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
+ "LOOP_END filter_start_inner%=;\n\t"
+ "A0 += A1;\n\t"
+ "R4 = A0;\n\t"
+ "R4 <<= 3;\n\t" /* shift mem */
+ "R4.L = R4 (RND);\n\t"
+ "R2 = W[P0++];\n\t" /* load x */
+ "R4.L = R4.L + R2.L;\n\t"
+ "W[P1++] = R4;\n\t" /* store y */
+ //"R4 <<= 2;\n\t"
+ //"R2 <<= 2;\n\t"
+ "R2 = PACK(R4.L, R2.L);\n\t" /* pack x16 and y16 */
+ "[P2] = R2;\n\t"
+
+ "LOOP_END filter_start%=;\n\t"
+
+ /* Samples ord to N*/
+ "R0 = %5;\n\t"
+ "R0 <<= 1;\n\t"
+ "I0 = B0;\n\t" /* numden */
+ "R0 <<= 1;\n\t"
+ "L0 = R0;\n\t"
+
+ "R0 = %5;\n\t" /* org */
+ "R2 = %4;\n\t" /* N */
+ "R2 = R2 - R0;\n\t"
+ "R4 = [I0++];\n\t" /* numden */
+ "LC0 = R2;\n\t"
+ "P3 = R0;\n\t"
+ "R0 <<= 2;\n\t"
+ "R0 += 8;\n\t"
+ "I2 = P2;\n\t"
+ "M0 = R0;\n\t"
+ "A1 = A0 = 0;\n\t"
+ "R5 = [I2--];\n\t" /* load xy */
+ "LOOP filter_mid%= LC0;\n\t"
+ "LOOP_BEGIN filter_mid%=;\n\t"
+ "LOOP filter_mid_inner%= LC1=P3;\n\t"
+ "LOOP_BEGIN filter_mid_inner%=;\n\t"
+ "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
+ "LOOP_END filter_mid_inner%=;\n\t"
+ "R0 = (A0 += A1) || I2 += M0;\n\t"
+ "R0 = R0 << 3 || R5 = W[P0++];\n\t" /* load x */
+ "R0.L = R0 (RND);\n\t"
+ "R0.L = R0.L + R5.L;\n\t"
+ "R5 = PACK(R0.L, R5.L) || W[P1++] = R0;\n\t" /* shift y | store y */
+ "A1 = A0 = 0 || [I2--] = R5\n\t"
+ "LOOP_END filter_mid%=;\n\t"
+ "I2 += 4;\n\t"
+ "P2 = I2;\n\t"
+ /* Update memory */
+ "P4 = %6;\n\t"
+ "R0 = %5;\n\t"
+ "LC0 = R0;\n\t"
+ "P0 = B0;\n\t"
+ "A1 = A0 = 0;\n\t"
+ "LOOP mem_update%= LC0;\n\t"
+ "LOOP_BEGIN mem_update%=;\n\t"
+ "I2 = P2;\n\t"
+ "I0 = P0;\n\t"
+ "P0 += 4;\n\t"
+ "R0 = LC0;\n\t"
+ "LC1 = R0;\n\t"
+ "R5 = [I2--] || R4 = [I0++];\n\t"
+ "LOOP mem_accum%= LC1;\n\t"
+ "LOOP_BEGIN mem_accum%=;\n\t"
+ "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
+ "LOOP_END mem_accum%=;\n\t"
+ "R0 = (A0 += A1);\n\t"
+ "A1 = A0 = 0 || [P4++] = R0;\n\t"
+ "LOOP_END mem_update%=;\n\t"
+ "L0 = 0;\n\t"
+ : : "m" (xy), "m" (_x), "m" (_y), "m" (numden), "m" (N), "m" (ord), "m" (mem)
+ : "A0", "A1", "R0", "R1", "R2", "R3", "R4", "R5", "P0", "P1", "P2", "P3", "P4", "B0", "I0", "I2", "L0", "L2", "M0", "memory"
+ );
+
+}
+
+
+
+#define OVERRIDE_IIR_MEM16
+void iir_mem16(const spx_word16_t *_x, const spx_coef_t *den, spx_word16_t *_y, int N, int ord, spx_mem_t *mem, char *stack)
+{
+ VARDECL(spx_word16_t *y);
+ spx_word16_t *yy;
+
+ ALLOC(y, (N+2), spx_word16_t);
+ yy = y+2;
+
+ __asm__ __volatile__
+ (
+ /* Register setup */
+ "R0 = %5;\n\t" /*ord */
+
+ "P1 = %3;\n\t"
+ "I1 = P1;\n\t"
+ "B1 = P1;\n\t"
+ "L1 = 0;\n\t"
+
+ "P3 = %0;\n\t"
+ "I3 = P3;\n\t"
+ "L3 = 0;\n\t"
+
+ "P4 = %6;\n\t"
+ "P0 = %1;\n\t"
+ "P1 = %2;\n\t"
+
+ /* First sample */
+ "R1 = [P4++];\n\t"
+ "R1 = R1 << 3 (S);\n\t"
+ "R1.L = R1 (RND);\n\t"
+ "R2 = W[P0++];\n\t"
+ "R1 = R1 + R2;\n\t"
+ "W[P1++] = R1;\n\t"
+ "W[P3] = R1;\n\t"
+
+ /* Samples 1 to ord-1 (using memory) */
+ "R0 += -1;\n\t"
+ "R3 = 0;\n\t"
+ "LC0 = R0;\n\t"
+ "LOOP filter_start%= LC0;\n\t"
+ "LOOP_BEGIN filter_start%=;\n\t"
+ "R3 += 1;\n\t"
+ "LC1 = R3;\n\t"
+
+ "R1 = [P4++];\n\t"
+ "A1 = R1;\n\t"
+ "I1 = B1;\n\t"
+ "I3 = P3;\n\t"
+ "P3 += 2;\n\t"
+ "LOOP filter_start_inner%= LC1;\n\t"
+ "LOOP_BEGIN filter_start_inner%=;\n\t"
+ "R4.L = W[I1++];\n\t"
+ "R5.L = W[I3--];\n\t"
+ "A1 -= R4.L*R5.L (IS);\n\t"
+ "LOOP_END filter_start_inner%=;\n\t"
+
+ "R1 = A1;\n\t"
+ "R1 <<= 3;\n\t"
+ "R1.L = R1 (RND);\n\t"
+ "R2 = W[P0++];\n\t"
+ "R1 = R1 + R2;\n\t"
+ "W[P1++] = R1;\n\t"
+ "W[P3] = R1;\n\t"
+ "LOOP_END filter_start%=;\n\t"
+
+ /* Samples ord to N*/
+ "R0 = %5;\n\t"
+ "R0 <<= 1;\n\t"
+ "I1 = B1;\n\t"
+ "L1 = R0;\n\t"
+
+ "R0 = %5;\n\t"
+ "R2 = %4;\n\t"
+ "R2 = R2 - R0;\n\t"
+ "R4.L = W[I1++];\n\t"
+ "LC0 = R2;\n\t"
+ "LOOP filter_mid%= LC0;\n\t"
+ "LOOP_BEGIN filter_mid%=;\n\t"
+ "LC1 = R0;\n\t"
+ "A1 = 0;\n\t"
+ "I3 = P3;\n\t"
+ "P3 += 2;\n\t"
+ "R5.L = W[I3--];\n\t"
+ "LOOP filter_mid_inner%= LC1;\n\t"
+ "LOOP_BEGIN filter_mid_inner%=;\n\t"
+ "A1 -= R4.L*R5.L (IS) || R4.L = W[I1++] || R5.L = W[I3--];\n\t"
+ "LOOP_END filter_mid_inner%=;\n\t"
+ "R1 = A1;\n\t"
+ "R1 = R1 << 3 || R2 = W[P0++];\n\t"
+ "R1.L = R1 (RND);\n\t"
+ "R1 = R1 + R2;\n\t"
+ "W[P1++] = R1;\n\t"
+ "W[P3] = R1;\n\t"
+ "LOOP_END filter_mid%=;\n\t"
+
+ /* Update memory */
+ "P4 = %6;\n\t"
+ "R0 = %5;\n\t"
+ "LC0 = R0;\n\t"
+ "P1 = B1;\n\t"
+ "LOOP mem_update%= LC0;\n\t"
+ "LOOP_BEGIN mem_update%=;\n\t"
+ "A0 = 0;\n\t"
+ "I3 = P3;\n\t"
+ "I1 = P1;\n\t"
+ "P1 += 2;\n\t"
+ "R0 = LC0;\n\t"
+ "LC1=R0;\n\t"
+ "R5.L = W[I3--] || R4.L = W[I1++];\n\t"
+ "LOOP mem_accum%= LC1;\n\t"
+ "LOOP_BEGIN mem_accum%=;\n\t"
+ "A0 -= R4.L*R5.L (IS) || R4.L = W[I1++] || R5.L = W[I3--];\n\t"
+ "LOOP_END mem_accum%=;\n\t"
+ "R0 = A0;\n\t"
+ "[P4++] = R0;\n\t"
+ "LOOP_END mem_update%=;\n\t"
+ "L1 = 0;\n\t"
+ : : "m" (yy), "m" (_x), "m" (_y), "m" (den), "m" (N), "m" (ord), "m" (mem)
+ : "A0", "A1", "R0", "R1", "R2", "R3", "R4", "R5", "P0", "P1", "P2", "P3", "P4", "B1", "I1", "I3", "L1", "L3", "memory"
+ );
+
+}
+
+
+#define OVERRIDE_FIR_MEM16
+void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
+{
+ int i;
+ spx_coef_t den2[12];
+ spx_coef_t *den;
+ den = (spx_coef_t*)((((int)den2)+4)&0xfffffffc);
+ for (i=0;i<10;i++)
+ den[i] = 0;
+ filter_mem16(x, num, den, y, N, ord, mem, stack);
+}
+
+
+#define OVERRIDE_COMPUTE_IMPULSE_RESPONSE
+void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
+{
+ int i;
+ VARDECL(spx_word16_t *ytmp);
+ ALLOC(ytmp, N, spx_word16_t);
+ spx_word16_t *ytmp2 = ytmp;
+ y[0] = LPC_SCALING;
+ for (i=0;i<ord;i++)
+ y[i+1] = awk1[i];
+ i++;
+ for (;i<N;i++)
+ y[i] = 0;
+
+ N-=1;
+ __asm__ __volatile__
+ (
+ "I0 = %0;\n\t"
+ "I1 = %1;\n\t"
+ "L0 = 0;\n\t"
+ "L1 = 0;\n\t"
+ "L2 = 0;\n\t"
+ "L3 = 0;\n\t"
+ "R0 = 1;\n\t"
+ "R0 <<= 13;\n\t"
+ "W[I0] = R0.L;\n\t"
+ "R0 <<= 1;\n\t"
+ "W[I1] = R0.L;\n\t"
+ "R0 = %5;\n\t"
+ "LC0 = R0;\n\t"
+ "R2 = 0;\n\t"
+ "LOOP samples%= LC0;\n\t"
+ "LOOP_BEGIN samples%=;\n\t"
+ "R2 += 1;\n\t"
+ "R2 = MIN(R2, %4);\n\t"
+ "I0 = %0;\n\t"
+ "I1 = %1;\n\t"
+ "I2 = %2;\n\t"
+ "I3 = %3;\n\t"
+ "%0 += 2;\n\t"
+ "%1 += 2;\n\t"
+ "A1 = A0 = 0;\n\t"
+ "R0.L = W[I0--] || R1.L = W[I2++];\n\t"
+ "LC1 = R2;\n\t"
+ "LOOP filter%= LC1;\n\t"
+ "LOOP_BEGIN filter%=;\n\t"
+ "A0 -= R0.L*R1.L (IS) || R0.L = W[I1--] || R1.L = W[I3++];\n\t"
+ "A1 -= R0.L*R1.L (IS) || R0.L = W[I0--] || R1.L = W[I2++];\n\t"
+ "LOOP_END filter%=;\n\t"
+ "R0 = A0, R1 = A1;\n\t"
+ "R3 = W[%1] (X);\n\t"
+ "R3 <<= 13;\n\t"
+ "R0 = R0 + R3;\n\t"
+ "R3 = R0 >>> 13;\n\t"
+ "W[%0] = R3.L;\n\t"
+ "R0 <<= 1;\n\t"
+ "R1 = R1 + R0;\n\t"
+ "R1 >>>= 13;\n\t"
+ "W[%1] = R1.L;\n\t"
+ "LOOP_END samples%=;\n\t"
+ : "=a" (ytmp2), "=a" (y)
+ : "a" (awk2), "a" (ak), "d" (ord), "m" (N), "0" (ytmp2), "1" (y)
+ : "A0", "A1", "R0", "R1", "R2", "R3", "I0", "I1", "I2", "I3", "L0", "L1", "L2", "L3", "A0", "A1"
+ );
+}
+
+
+
+#if 0 /* Equivalent C function for filter_mem2 and compute_impulse_response */
+#define min(a,b) ((a)<(b) ? (a):(b))
+
+void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
+{
+ int i,j;
+ VARDECL(spx_word16_t *ytmp);
+ ALLOC(ytmp, N, spx_word16_t);
+
+ y[0] = LPC_SCALING;
+ for (i=0;i<ord;i++)
+ y[i+1] = awk1[i];
+ i++;
+ for (;i<N;i++)
+ y[i] = 0;
+
+ for (i=0;i<N;i++)
+ {
+ spx_word32_t yi = SHL32(EXTEND32(y[i]),LPC_SHIFT);
+ spx_word32_t yi2 = 0;
+ for (j=0;j<min(i,ord);j++)
+ {
+ yi = MAC16_16(yi, awk2[j], -ytmp[i-j-1]);
+ yi2 = MAC16_16(yi2, ak[j], -y[i-j-1]);
+ }
+ ytmp[i] = EXTRACT16(SHR32(yi,LPC_SHIFT));
+ yi2 = ADD32(yi2,SHL32(yi,1));
+ y[i] = EXTRACT16(SHR32(yi2,LPC_SHIFT));
+ }
+
+}
+
+
+void filter_mem2(const spx_sig_t *_x, const spx_coef_t *num, const spx_coef_t *den, spx_sig_t *_y, int N, int ord, spx_mem_t *mem)
+{
+ int i,j;
+ spx_word16_t xi,yi,nyi;
+ spx_word16_t x[N],y[N];
+ spx_word16_t *xx, *yy;
+ xx = x;
+ yy = y;
+ for (i=0;i<N;i++)
+ {
+ x[i] = EXTRACT16(SHR32(_x[i],SIG_SHIFT));
+ }
+
+ for (i=0;i<ord;i++)
+ {
+ spx_word32_t yi = mem[i];
+ for (j=0;j<i;j++)
+ {
+ yi = MAC16_16(yi, num[j], x[i-j-1]);
+ yi = MAC16_16(yi, den[j], -y[i-j-1]);
+ }
+ _y[i] = ADD32(_x[i],SHL32(yi,1));
+ y[i] = EXTRACT16(SHR32(_y[i],SIG_SHIFT));
+ }
+ for (i=ord;i<N;i++)
+ {
+ spx_word32_t yi = 0;
+ for (j=0;j<ord;j++)
+ {
+ yi = MAC16_16(yi, num[j], x[i-j-1]);
+ yi = MAC16_16(yi, den[j], -y[i-j-1]);
+ }
+ _y[i] = ADD32(_x[i],SHL32(yi,1));
+ y[i] = EXTRACT16(SHR32(_y[i],SIG_SHIFT));
+ }
+
+ for (i=0;i<ord;i++)
+ {
+ spx_mem_t m = 0;
+ for (j=0;j<ord-i;j++)
+ {
+ m = MAC16_16(m, x[N-1-j], num[j+i]);
+ m = MAC16_16(m, -y[N-1-j], den[j+i]);
+ }
+ mem[i] = m;
+ }
+}
+#endif
diff --git a/jni/pjproject-android/.svn/pristine/74/7429b813a6eb44c1c1c65df038f757bc4d938a98.svn-base b/jni/pjproject-android/.svn/pristine/74/7429b813a6eb44c1c1c65df038f757bc4d938a98.svn-base
new file mode 100644
index 0000000..0d02424
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/74/7429b813a6eb44c1c1c65df038f757bc4d938a98.svn-base
@@ -0,0 +1,30 @@
+
+ /******************************************************************
+
+ iLBC Speech Coder ANSI-C Source Code
+
+ gainquant.h
+
+ Copyright (C) The Internet Society (2004).
+ All Rights Reserved.
+
+ ******************************************************************/
+
+ #ifndef __iLBC_GAINQUANT_H
+ #define __iLBC_GAINQUANT_H
+
+ float gainquant(/* (o) quantized gain value */
+ float in, /* (i) gain value */
+ float maxIn,/* (i) maximum of gain value */
+ int cblen, /* (i) number of quantization indices */
+ int *index /* (o) quantization index */
+ );
+
+ float gaindequant( /* (o) quantized gain value */
+ int index, /* (i) quantization index */
+ float maxIn,/* (i) maximum of unquantized gain */
+ int cblen /* (i) number of quantization indices */
+ );
+
+ #endif
+
diff --git a/jni/pjproject-android/.svn/pristine/74/742e4c262c02842d68eaf2cc3feec17727037135.svn-base b/jni/pjproject-android/.svn/pristine/74/742e4c262c02842d68eaf2cc3feec17727037135.svn-base
new file mode 100644
index 0000000..51bd1bd
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/74/742e4c262c02842d68eaf2cc3feec17727037135.svn-base
@@ -0,0 +1,225 @@
+/* $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 "test.h"
+#include <pjlib.h>
+
+#if INCLUDE_FILE_TEST
+
+#define FILENAME "testfil1.txt"
+#define NEWNAME "testfil2.txt"
+#define INCLUDE_FILE_TIME_TEST 0
+
+static char buffer[11] = {'H', 'e', 'l', 'l', 'o', ' ',
+ 'W', 'o', 'r', 'l', 'd' };
+
+static int file_test_internal(void)
+{
+ enum { FILE_MAX_AGE = 1000 };
+ pj_oshandle_t fd = 0;
+ pj_status_t status;
+ char readbuf[sizeof(buffer)+16];
+ pj_file_stat stat;
+ pj_time_val start_time;
+ pj_ssize_t size;
+ pj_off_t pos;
+
+ PJ_LOG(3,("", "..file io test.."));
+
+ /* Get time. */
+ pj_gettimeofday(&start_time);
+
+ /* Delete original file if exists. */
+ if (pj_file_exists(FILENAME))
+ pj_file_delete(FILENAME);
+
+ /*
+ * Write data to the file.
+ */
+ status = pj_file_open(NULL, FILENAME, PJ_O_WRONLY, &fd);
+ if (status != PJ_SUCCESS) {
+ app_perror("...file_open() error", status);
+ return -10;
+ }
+
+ size = sizeof(buffer);
+ status = pj_file_write(fd, buffer, &size);
+ if (status != PJ_SUCCESS) {
+ app_perror("...file_write() error", status);
+ pj_file_close(fd);
+ return -20;
+ }
+ if (size != sizeof(buffer))
+ return -25;
+
+ status = pj_file_close(fd);
+ if (status != PJ_SUCCESS) {
+ app_perror("...file_close() error", status);
+ return -30;
+ }
+
+ /* Check the file existance and size. */
+ if (!pj_file_exists(FILENAME))
+ return -40;
+
+ if (pj_file_size(FILENAME) != sizeof(buffer))
+ return -50;
+
+ /* Get file stat. */
+ status = pj_file_getstat(FILENAME, &stat);
+ if (status != PJ_SUCCESS)
+ return -60;
+
+ /* Check stat size. */
+ if (stat.size != sizeof(buffer))
+ return -70;
+
+#if INCLUDE_FILE_TIME_TEST
+ /* Check file creation time >= start_time. */
+ if (!PJ_TIME_VAL_GTE(stat.ctime, start_time))
+ return -80;
+ /* Check file creation time is not much later. */
+ PJ_TIME_VAL_SUB(stat.ctime, start_time);
+ if (stat.ctime.sec > FILE_MAX_AGE)
+ return -90;
+
+ /* Check file modification time >= start_time. */
+ if (!PJ_TIME_VAL_GTE(stat.mtime, start_time))
+ return -80;
+ /* Check file modification time is not much later. */
+ PJ_TIME_VAL_SUB(stat.mtime, start_time);
+ if (stat.mtime.sec > FILE_MAX_AGE)
+ return -90;
+
+ /* Check file access time >= start_time. */
+ if (!PJ_TIME_VAL_GTE(stat.atime, start_time))
+ return -80;
+ /* Check file access time is not much later. */
+ PJ_TIME_VAL_SUB(stat.atime, start_time);
+ if (stat.atime.sec > FILE_MAX_AGE)
+ return -90;
+#endif
+
+ /*
+ * Re-open the file and read data.
+ */
+ status = pj_file_open(NULL, FILENAME, PJ_O_RDONLY, &fd);
+ if (status != PJ_SUCCESS) {
+ app_perror("...file_open() error", status);
+ return -100;
+ }
+
+ size = 0;
+ while (size < (pj_ssize_t)sizeof(readbuf)) {
+ pj_ssize_t read;
+ read = 1;
+ status = pj_file_read(fd, &readbuf[size], &read);
+ if (status != PJ_SUCCESS) {
+ PJ_LOG(3,("", "...error reading file after %d bytes (error follows)",
+ size));
+ app_perror("...error", status);
+ return -110;
+ }
+ if (read == 0) {
+ // EOF
+ break;
+ }
+ size += read;
+ }
+
+ if (size != sizeof(buffer))
+ return -120;
+
+ /*
+ if (!pj_file_eof(fd, PJ_O_RDONLY))
+ return -130;
+ */
+
+ if (pj_memcmp(readbuf, buffer, size) != 0)
+ return -140;
+
+ /* Seek test. */
+ status = pj_file_setpos(fd, 4, PJ_SEEK_SET);
+ if (status != PJ_SUCCESS) {
+ app_perror("...file_setpos() error", status);
+ return -141;
+ }
+
+ /* getpos test. */
+ status = pj_file_getpos(fd, &pos);
+ if (status != PJ_SUCCESS) {
+ app_perror("...file_getpos() error", status);
+ return -142;
+ }
+ if (pos != 4)
+ return -143;
+
+ status = pj_file_close(fd);
+ if (status != PJ_SUCCESS) {
+ app_perror("...file_close() error", status);
+ return -150;
+ }
+
+ /*
+ * Rename test.
+ */
+ status = pj_file_move(FILENAME, NEWNAME);
+ if (status != PJ_SUCCESS) {
+ app_perror("...file_move() error", status);
+ return -160;
+ }
+
+ if (pj_file_exists(FILENAME))
+ return -170;
+ if (!pj_file_exists(NEWNAME))
+ return -180;
+
+ if (pj_file_size(NEWNAME) != sizeof(buffer))
+ return -190;
+
+ /* Delete test. */
+ status = pj_file_delete(NEWNAME);
+ if (status != PJ_SUCCESS) {
+ app_perror("...file_delete() error", status);
+ return -200;
+ }
+
+ if (pj_file_exists(NEWNAME))
+ return -210;
+
+ PJ_LOG(3,("", "...success"));
+ return PJ_SUCCESS;
+}
+
+
+int file_test(void)
+{
+ int rc = file_test_internal();
+
+ /* Delete test file if exists. */
+ if (pj_file_exists(FILENAME))
+ pj_file_delete(FILENAME);
+
+ return rc;
+}
+
+#else
+int dummy_file_test;
+#endif
+
diff --git a/jni/pjproject-android/.svn/pristine/74/74683093ec716bf3a617f0e5b8087f192255bdd8.svn-base b/jni/pjproject-android/.svn/pristine/74/74683093ec716bf3a617f0e5b8087f192255bdd8.svn-base
new file mode 100644
index 0000000..97dfdc7
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/74/74683093ec716bf3a617f0e5b8087f192255bdd8.svn-base
@@ -0,0 +1,38 @@
+# $Id$
+
+# SDP template
+sdp_templ = \
+"""v=0\r
+o=- 1 1 $NET_TYPE $ADDR_TYPE $LOCAL_IP\r
+s=pjmedia\r
+t=0 0\r
+$SDP_LINES"""
+
+sdp_media_templ = \
+"""m=$MEDIA_TYPE $PORT $TRANSPORT 0\r
+c=$NET_TYPE $ADDR_TYPE $LOCAL_IP\r
+$SDP_LINES"""
+
+# Create SDP session
+def session(local_ip="127.0.0.1", extra_lines="", net_type="IN", addr_type="IP4"):
+ sdp = sdp_templ
+ sdp = sdp.replace("$NET_TYPE", net_type)
+ sdp = sdp.replace("$ADDR_TYPE", addr_type)
+ sdp = sdp.replace("$LOCAL_IP", local_ip)
+ sdp = sdp.replace("$SDP_LINES", extra_lines)
+ return sdp
+
+# Create basic SDP media
+def media(media_type="audio", local_port=4000, local_ip="127.0.0.1", extra_lines="",
+ net_type = "IN", addr_type="IP4", transport="RTP/AVP"):
+ sdp = sdp_media_templ
+ sdp = sdp.replace("$MEDIA_TYPE", media_type)
+ sdp = sdp.replace("$LOCAL_IP", local_ip)
+ sdp = sdp.replace("$PORT", str(local_port))
+ sdp = sdp.replace("$NET_TYPE", net_type)
+ sdp = sdp.replace("$ADDR_TYPE", addr_type)
+ sdp = sdp.replace("$TRANSPORT", transport)
+ sdp = sdp.replace("$SDP_LINES", extra_lines)
+ return sdp
+
+
diff --git a/jni/pjproject-android/.svn/pristine/74/7487d11ef3d0bbe9f90528d73ee1ff0f47e25b73.svn-base b/jni/pjproject-android/.svn/pristine/74/7487d11ef3d0bbe9f90528d73ee1ff0f47e25b73.svn-base
new file mode 100644
index 0000000..6f29915
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/74/7487d11ef3d0bbe9f90528d73ee1ff0f47e25b73.svn-base
@@ -0,0 +1,83 @@
+/* $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 <e32std.h>
+#include <e32base.h>
+#include <e32std.h>
+#include <e32cons.h>
+#include <stdlib.h>
+
+
+// Global Variables
+CConsoleBase* console;
+
+// Needed by APS
+TPtrC APP_UID = _L("A000000E");
+
+int app_main();
+
+
+////////////////////////////////////////////////////////////////////////////
+
+LOCAL_C void DoStartL()
+{
+ CActiveScheduler *scheduler = new (ELeave) CActiveScheduler;
+ CleanupStack::PushL(scheduler);
+ CActiveScheduler::Install(scheduler);
+
+ app_main();
+
+ CActiveScheduler::Install(NULL);
+ CleanupStack::Pop(scheduler);
+ delete scheduler;
+}
+
+
+////////////////////////////////////////////////////////////////////////////
+
+// E32Main()
+GLDEF_C TInt E32Main()
+{
+ // Mark heap usage
+ __UHEAP_MARK;
+
+ // Create cleanup stack
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+
+ // Create output console
+ TRAPD(createError, console = Console::NewL(_L("Console"), TSize(KConsFullScreen,KConsFullScreen)));
+ if (createError)
+ return createError;
+
+ TRAPD(startError, DoStartL());
+
+ //console->Printf(_L("[press any key to close]\n"));
+ //console->Getch();
+
+ delete console;
+ delete cleanup;
+
+ CloseSTDLIB();
+
+ // Mark end of heap usage, detect memory leaks
+ __UHEAP_MARKEND;
+ return KErrNone;
+}
+
diff --git a/jni/pjproject-android/.svn/pristine/74/7492db103f0980bb1ad9d4f43756904d7b69727a.svn-base b/jni/pjproject-android/.svn/pristine/74/7492db103f0980bb1ad9d4f43756904d7b69727a.svn-base
new file mode 100644
index 0000000..1c089a7
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/74/7492db103f0980bb1ad9d4f43756904d7b69727a.svn-base
@@ -0,0 +1,5 @@
+<resources>
+
+ <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar" />
+
+</resources>
\ No newline at end of file
diff --git a/jni/pjproject-android/.svn/pristine/74/74a2b243dc4fc142e5e41df22d5544e77ef1549d.svn-base b/jni/pjproject-android/.svn/pristine/74/74a2b243dc4fc142e5e41df22d5544e77ef1549d.svn-base
new file mode 100644
index 0000000..268c6a5
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/74/74a2b243dc4fc142e5e41df22d5544e77ef1549d.svn-base
@@ -0,0 +1,11 @@
+# $Id$
+#
+from inc_cfg import *
+
+# simple test
+test_param = TestParam(
+ "Resample (large filter) 8 KHZ to 22 KHZ",
+ [
+ InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 22050 --play-file wavs/input.8.wav --rec-file wavs/tmp.22.wav")
+ ]
+ )
diff --git a/jni/pjproject-android/.svn/pristine/74/74b30e67e7b8d45bb887ada97a1df1a6049800e1.svn-base b/jni/pjproject-android/.svn/pristine/74/74b30e67e7b8d45bb887ada97a1df1a6049800e1.svn-base
new file mode 100644
index 0000000..094ddea
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/74/74b30e67e7b8d45bb887ada97a1df1a6049800e1.svn-base
@@ -0,0 +1,58 @@
+include ../../../build.mak
+include ../../../build/common.mak
+
+export LIBDIR := ../../lib
+
+RULES_MAK := $(PJDIR)/build/rules.mak
+
+export MILENAGE_LIB := ../../lib/libmilenage-$(TARGET_NAME)$(LIBEXT)
+
+###############################################################################
+# Gather all flags.
+#
+export _CFLAGS := $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \
+ $(CFLAGS) $(CC_INC). $(CC_INC)../../milenage/include \
+ $(CC_INC)../../../pjlib/include
+export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
+ $(HOST_CXXFLAGS) $(CXXFLAGS)
+export _LDFLAGS := $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
+ $(LDFLAGS)
+
+export MILENAGE_SRCDIR = ../../milenage
+export MILENAGE_OBJS = milenage.o rijndael.o
+export MILENAGE_CFLAGS = $(_CFLAGS)
+
+
+export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT
+###############################################################################
+# Main entry
+#
+# $(TARGET) is defined in os-$(OS_NAME).mak file in current directory.
+#
+TARGETS := libmilenage
+
+all: $(TARGETS)
+
+doc:
+ cd .. && doxygen docs/doxygen.cfg
+
+dep: depend
+distclean: realclean
+
+.PHONY: dep depend libmilenage clean realclean distclean
+
+libmilenage:
+ $(MAKE) -f $(RULES_MAK) APP=MILENAGE app=libmilenage $(MILENAGE_LIB)
+
+clean print_lib:
+ $(MAKE) -f $(RULES_MAK) APP=MILENAGE app=libmilenage $@
+
+realclean:
+ $(subst @@,$(subst /,$(HOST_PSEP),.ilbc-$(TARGET_NAME).depend),$(HOST_RMR))
+
+ $(MAKE) -f $(RULES_MAK) APP=MILENAGE app=libmilenage $@
+
+depend:
+ $(MAKE) -f $(RULES_MAK) APP=MILENAGE app=libmilenage $@
+
+
diff --git a/jni/pjproject-android/.svn/pristine/74/74d32aed73ed5defa50a615163784ccd5ae01413.svn-base b/jni/pjproject-android/.svn/pristine/74/74d32aed73ed5defa50a615163784ccd5ae01413.svn-base
new file mode 100644
index 0000000..92491f1
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/74/74d32aed73ed5defa50a615163784ccd5ae01413.svn-base
@@ -0,0 +1,318 @@
+/* $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
+ */
+
+
+/**
+ * \page page_pjmedia_samples_playsine_c Samples: Using Custom Ports (Sine Wave Generator)
+ *
+ * This example demonstrate how to create a custom media port (in this case, a
+ * sine wave generator) and connect it to the sound device.
+ *
+ * This file is pjsip-apps/src/samples/playsine.c
+ *
+ * \includelineno playsine.c
+ */
+
+/*
+ * playsine.c
+ *
+ * PURPOSE:
+ * Demonstrate how to create and use custom media port which
+ * simply feed a sine wav to the sound player.
+ *
+ * USAGE:
+ * playsine [nchannel]
+ *
+ * where:
+ * nchannel is 1 for mono (this is the default) or 2 for stereo.
+ */
+
+#include <pjmedia.h>
+#include <pjlib.h>
+
+#include <stdlib.h> /* atoi() */
+#include <stdio.h>
+#include <math.h> /* sin() */
+
+/* For logging purpose. */
+#define THIS_FILE "playsine.c"
+
+
+/* Util to display the error message for the specified error code */
+static int app_perror( const char *sender, const char *title,
+ pj_status_t status)
+{
+ char errmsg[PJ_ERR_MSG_SIZE];
+
+ PJ_UNUSED_ARG(sender);
+
+ pj_strerror(status, errmsg, sizeof(errmsg));
+
+ printf("%s: %s [code=%d]\n", title, errmsg, status);
+ return 1;
+}
+
+
+/* Struct attached to sine generator */
+typedef struct
+{
+ pj_int16_t *samples; /* Sine samples. */
+} port_data;
+
+
+/* This callback is called to feed more samples */
+static pj_status_t sine_get_frame( pjmedia_port *port,
+ pjmedia_frame *frame)
+{
+ port_data *sine = port->port_data.pdata;
+ pj_int16_t *samples = frame->buf;
+ unsigned i, left, right;
+ pj_size_t count;
+
+ /* Get number of samples */
+ count = frame->size / 2 / PJMEDIA_PIA_CCNT(&port->info);
+
+ left = 0;
+ right = 0;
+
+ for (i=0; i<count; ++i) {
+ *samples++ = sine->samples[left];
+ ++left;
+
+ if (PJMEDIA_PIA_CCNT(&port->info) == 2) {
+ *samples++ = sine->samples[right];
+ right += 2; /* higher pitch so we can distinguish left and right. */
+ if (right >= count)
+ right = 0;
+ }
+ }
+
+ /* Must set frame->type correctly, otherwise the sound device
+ * will refuse to play.
+ */
+ frame->type = PJMEDIA_FRAME_TYPE_AUDIO;
+
+ return PJ_SUCCESS;
+}
+
+#ifndef M_PI
+#define M_PI (3.14159265)
+#endif
+
+/*
+ * Create a media port to generate sine wave samples.
+ */
+static pj_status_t create_sine_port(pj_pool_t *pool,
+ unsigned sampling_rate,
+ unsigned channel_count,
+ pjmedia_port **p_port)
+{
+ pjmedia_port *port;
+ unsigned i;
+ unsigned count;
+ pj_str_t name;
+ port_data *sine;
+
+ PJ_ASSERT_RETURN(pool && channel_count > 0 && channel_count <= 2,
+ PJ_EINVAL);
+
+ port = pj_pool_zalloc(pool, sizeof(pjmedia_port));
+ PJ_ASSERT_RETURN(port != NULL, PJ_ENOMEM);
+
+ /* Fill in port info. */
+ name = pj_str("sine generator");
+ pjmedia_port_info_init(&port->info, &name,
+ PJMEDIA_SIG_CLASS_PORT_AUD('s', 'i'),
+ sampling_rate,
+ channel_count,
+ 16, sampling_rate * 20 / 1000 * channel_count);
+
+ /* Set the function to feed frame */
+ port->get_frame = &sine_get_frame;
+
+ /* Create sine port data */
+ port->port_data.pdata = sine = pj_pool_zalloc(pool, sizeof(port_data));
+
+ /* Create samples */
+ count = PJMEDIA_PIA_SPF(&port->info) / channel_count;
+ sine->samples = pj_pool_alloc(pool, count * sizeof(pj_int16_t));
+ PJ_ASSERT_RETURN(sine->samples != NULL, PJ_ENOMEM);
+
+ /* initialise sinusoidal wavetable */
+ for( i=0; i<count; i++ )
+ {
+ sine->samples[i] = (pj_int16_t) (10000.0 *
+ sin(((double)i/(double)count) * M_PI * 8.) );
+ }
+
+ *p_port = port;
+
+ return PJ_SUCCESS;
+}
+
+
+/* Show usage */
+static void usage(void)
+{
+ puts("");
+ puts("Usage: playsine [nchannel]");
+ puts("");
+ puts("where");
+ puts(" nchannel is number of audio channels (1 for mono, or 2 for stereo).");
+ puts(" Default is 1 (mono).");
+ puts("");
+}
+
+
+/*
+ * main()
+ */
+int main(int argc, char *argv[])
+{
+ pj_caching_pool cp;
+ pjmedia_endpt *med_endpt;
+ pj_pool_t *pool;
+ pjmedia_port *sine_port;
+ pjmedia_snd_port *snd_port;
+ char tmp[10];
+ int channel_count = 1;
+ pj_status_t status;
+
+ if (argc == 2) {
+ channel_count = atoi(argv[1]);
+ if (channel_count < 1 || channel_count > 2) {
+ puts("Error: invalid arguments");
+ usage();
+ return 1;
+ }
+ }
+
+ /* Must init PJLIB first: */
+ status = pj_init();
+ PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+ /* Must create a pool factory before we can allocate any memory. */
+ pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
+
+ /*
+ * Initialize media endpoint.
+ * This will implicitly initialize PJMEDIA too.
+ */
+ status = pjmedia_endpt_create(&cp.factory, NULL, 1, &med_endpt);
+ PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+ /* Create memory pool for our sine generator */
+ pool = pj_pool_create( &cp.factory, /* pool factory */
+ "wav", /* pool name. */
+ 4000, /* init size */
+ 4000, /* increment size */
+ NULL /* callback on error */
+ );
+
+ /* Create a media port to generate sine wave samples. */
+ status = create_sine_port( pool, /* memory pool */
+ 11025, /* sampling rate */
+ channel_count,/* # of channels */
+ &sine_port /* returned port */
+ );
+ if (status != PJ_SUCCESS) {
+ app_perror(THIS_FILE, "Unable to create sine port", status);
+ return 1;
+ }
+
+ /* Create sound player port. */
+ status = pjmedia_snd_port_create_player(
+ pool, /* pool */
+ -1, /* use default dev. */
+ PJMEDIA_PIA_SRATE(&sine_port->info),/* clock rate. */
+ PJMEDIA_PIA_CCNT(&sine_port->info),/* # of channels. */
+ PJMEDIA_PIA_SPF(&sine_port->info), /* samples per frame. */
+ PJMEDIA_PIA_BITS(&sine_port->info),/* bits per sample. */
+ 0, /* options */
+ &snd_port /* returned port */
+ );
+ if (status != PJ_SUCCESS) {
+ app_perror(THIS_FILE, "Unable to open sound device", status);
+ return 1;
+ }
+
+ /* Connect sine generator port to the sound player
+ * Stream playing will commence immediately.
+ */
+ status = pjmedia_snd_port_connect( snd_port, sine_port);
+ PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+
+
+ /*
+ * Audio should be playing in a loop now, using sound device's thread.
+ */
+
+
+ /* Sleep to allow log messages to flush */
+ pj_thread_sleep(100);
+
+
+ puts("Playing sine wave..");
+ puts("");
+ puts("Press <ENTER> to stop playing and quit");
+
+ if (fgets(tmp, sizeof(tmp), stdin) == NULL) {
+ puts("EOF while reading stdin, will quit now..");
+ }
+
+
+ /* Start deinitialization: */
+
+ /* Disconnect sound port from file port */
+ status = pjmedia_snd_port_disconnect(snd_port);
+ PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+ /* Without this sleep, Windows/DirectSound will repeteadly
+ * play the last frame during destroy.
+ */
+ pj_thread_sleep(100);
+
+ /* Destroy sound device */
+ status = pjmedia_snd_port_destroy( snd_port );
+ PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+
+ /* Destroy sine generator */
+ status = pjmedia_port_destroy( sine_port );
+ PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+
+ /* Release application pool */
+ pj_pool_release( pool );
+
+ /* Destroy media endpoint. */
+ pjmedia_endpt_destroy( med_endpt );
+
+ /* Destroy pool factory */
+ pj_caching_pool_destroy( &cp );
+
+ /* Shutdown PJLIB */
+ pj_shutdown();
+
+
+ /* Done. */
+ return 0;
+}
diff --git a/jni/pjproject-android/.svn/pristine/74/74f97e096c0268a9cfd75f4689b1a7b97e9061ea.svn-base b/jni/pjproject-android/.svn/pristine/74/74f97e096c0268a9cfd75f4689b1a7b97e9061ea.svn-base
new file mode 100644
index 0000000..45adc01
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/74/74f97e096c0268a9cfd75f4689b1a7b97e9061ea.svn-base
@@ -0,0 +1,120 @@
+//------------------------------------------------------------------------------
+// File: MsgThrd.h
+//
+// Desc: DirectShow base classes - provides support for a worker thread
+// class to which one can asynchronously post messages.
+//
+// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
+//------------------------------------------------------------------------------
+
+
+// Message class - really just a structure.
+//
+class CMsg {
+public:
+ UINT uMsg;
+ DWORD dwFlags;
+ LPVOID lpParam;
+ CAMEvent *pEvent;
+
+ CMsg(UINT u, DWORD dw, __inout_opt LPVOID lp, __in_opt CAMEvent *pEvnt)
+ : uMsg(u), dwFlags(dw), lpParam(lp), pEvent(pEvnt) {}
+
+ CMsg()
+ : uMsg(0), dwFlags(0L), lpParam(NULL), pEvent(NULL) {}
+};
+
+// This is the actual thread class. It exports all the usual thread control
+// functions. The created thread is different from a normal WIN32 thread in
+// that it is prompted to perform particaular tasks by responding to messages
+// posted to its message queue.
+//
+class AM_NOVTABLE CMsgThread {
+private:
+ static DWORD WINAPI DefaultThreadProc(__inout LPVOID lpParam);
+ DWORD m_ThreadId;
+ HANDLE m_hThread;
+
+protected:
+
+ // if you want to override GetThreadMsg to block on other things
+ // as well as this queue, you need access to this
+ CGenericList<CMsg> m_ThreadQueue;
+ CCritSec m_Lock;
+ HANDLE m_hSem;
+ LONG m_lWaiting;
+
+public:
+ CMsgThread()
+ : m_ThreadId(0),
+ m_hThread(NULL),
+ m_lWaiting(0),
+ m_hSem(NULL),
+ // make a list with a cache of 5 items
+ m_ThreadQueue(NAME("MsgThread list"), 5)
+ {
+ }
+
+ ~CMsgThread();
+ // override this if you want to block on other things as well
+ // as the message loop
+ void virtual GetThreadMsg(__out CMsg *msg);
+
+ // override this if you want to do something on thread startup
+ virtual void OnThreadInit() {
+ };
+
+ BOOL CreateThread();
+
+ BOOL WaitForThreadExit(__out LPDWORD lpdwExitCode) {
+ if (m_hThread != NULL) {
+ WaitForSingleObject(m_hThread, INFINITE);
+ return GetExitCodeThread(m_hThread, lpdwExitCode);
+ }
+ return FALSE;
+ }
+
+ DWORD ResumeThread() {
+ return ::ResumeThread(m_hThread);
+ }
+
+ DWORD SuspendThread() {
+ return ::SuspendThread(m_hThread);
+ }
+
+ int GetThreadPriority() {
+ return ::GetThreadPriority(m_hThread);
+ }
+
+ BOOL SetThreadPriority(int nPriority) {
+ return ::SetThreadPriority(m_hThread, nPriority);
+ }
+
+ HANDLE GetThreadHandle() {
+ return m_hThread;
+ }
+
+ DWORD GetThreadId() {
+ return m_ThreadId;
+ }
+
+
+ void PutThreadMsg(UINT uMsg, DWORD dwMsgFlags,
+ __in_opt LPVOID lpMsgParam, __in_opt CAMEvent *pEvent = NULL) {
+ CAutoLock lck(&m_Lock);
+ CMsg* pMsg = new CMsg(uMsg, dwMsgFlags, lpMsgParam, pEvent);
+ m_ThreadQueue.AddTail(pMsg);
+ if (m_lWaiting != 0) {
+ ReleaseSemaphore(m_hSem, m_lWaiting, 0);
+ m_lWaiting = 0;
+ }
+ }
+
+ // This is the function prototype of the function that the client
+ // supplies. It is always called on the created thread, never on
+ // the creator thread.
+ //
+ virtual LRESULT ThreadMessageProc(
+ UINT uMsg, DWORD dwFlags, __inout_opt LPVOID lpParam, __in_opt CAMEvent *pEvent) = 0;
+};
+