* #36737: switch back to svn repo, remove assert in sip_transaction.c
diff --git a/jni/pjproject-android/.svn/pristine/26/2644c728f51e9e00fbc89ee5d64b0417b93d9918.svn-base b/jni/pjproject-android/.svn/pristine/26/2644c728f51e9e00fbc89ee5d64b0417b93d9918.svn-base
new file mode 100644
index 0000000..f9f0a0d
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/26/2644c728f51e9e00fbc89ee5d64b0417b93d9918.svn-base
@@ -0,0 +1,968 @@
+/* $Id$ */
+/*
+ * Copyright (C) 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
+ */
+
+
+/**
+ * \page page_pjmedia_samples_vid_streamutil_c Samples: Video Streaming
+ *
+ * This example mainly demonstrates how to stream video to remote
+ * peer using RTP.
+ *
+ * This file is pjsip-apps/src/samples/vid_streamutil.c
+ *
+ * \includelineno vid_streamutil.c
+ */
+
+#include <pjlib.h>
+#include <pjlib-util.h>
+#include <pjmedia.h>
+#include <pjmedia-codec.h>
+#include <pjmedia/transport_srtp.h>
+
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+
+
+#include <stdlib.h> /* atoi() */
+#include <stdio.h>
+
+#include "util.h"
+
+
+static const char *desc =
+ " vid_streamutil \n"
+ "\n"
+ " PURPOSE: \n"
+ " Demonstrate how to use pjmedia video stream component to \n"
+ " transmit/receive RTP packets to/from video device/file. \n"
+ "\n"
+ "\n"
+ " USAGE: \n"
+ " vid_streamutil [options] \n"
+ "\n"
+ "\n"
+ " Options: \n"
+ " --codec=CODEC Set the codec name. \n"
+ " --local-port=PORT Set local RTP port (default=4000) \n"
+ " --remote=IP:PORT Set the remote peer. If this option is set, \n"
+ " the program will transmit RTP audio to the \n"
+ " specified address. (default: recv only) \n"
+ " --play-file=AVI Send video from the AVI file instead of from \n"
+ " the video device. \n"
+ " --send-recv Set stream direction to bidirectional. \n"
+ " --send-only Set stream direction to send only \n"
+ " --recv-only Set stream direction to recv only (default) \n"
+
+ " --send-width Video width to be sent \n"
+ " --send-height Video height to be sent \n"
+ " --send-width and --send-height not applicable \n"
+ " for file streaming (see --play-file) \n"
+
+ " --send-pt Payload type for sending \n"
+ " --recv-pt Payload type for receiving \n"
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+ " --use-srtp[=NAME] Enable SRTP with crypto suite NAME \n"
+ " e.g: AES_CM_128_HMAC_SHA1_80 (default), \n"
+ " AES_CM_128_HMAC_SHA1_32 \n"
+ " Use this option along with the TX & RX keys, \n"
+ " formated of 60 hex digits (e.g: E148DA..) \n"
+ " --srtp-tx-key SRTP key for transmiting \n"
+ " --srtp-rx-key SRTP key for receiving \n"
+#endif
+
+ "\n"
+;
+
+#define THIS_FILE "vid_streamutil.c"
+
+
+/* If set, local renderer will be created to play original file */
+#define HAS_LOCAL_RENDERER_FOR_PLAY_FILE 1
+
+
+/* Default width and height for the renderer, better be set to maximum
+ * acceptable size.
+ */
+#define DEF_RENDERER_WIDTH 640
+#define DEF_RENDERER_HEIGHT 480
+
+
+/* Prototype */
+static void print_stream_stat(pjmedia_vid_stream *stream,
+ const pjmedia_vid_codec_param *codec_param);
+
+/* Prototype for LIBSRTP utility in file datatypes.c */
+int hex_string_to_octet_string(char *raw, char *hex, int len);
+
+/*
+ * Register all codecs.
+ */
+static pj_status_t init_codecs(pj_pool_factory *pf)
+{
+ pj_status_t status;
+
+ /* To suppress warning about unused var when all codecs are disabled */
+ PJ_UNUSED_ARG(status);
+
+#if defined(PJMEDIA_HAS_FFMPEG_VID_CODEC) && PJMEDIA_HAS_FFMPEG_VID_CODEC != 0
+ status = pjmedia_codec_ffmpeg_vid_init(NULL, pf);
+ PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
+#endif
+
+ return PJ_SUCCESS;
+}
+
+/*
+ * Register all codecs.
+ */
+static void deinit_codecs()
+{
+#if defined(PJMEDIA_HAS_FFMPEG_VID_CODEC) && PJMEDIA_HAS_FFMPEG_VID_CODEC != 0
+ pjmedia_codec_ffmpeg_vid_deinit();
+#endif
+}
+
+static pj_status_t create_file_player( pj_pool_t *pool,
+ const char *file_name,
+ pjmedia_port **p_play_port)
+{
+ pjmedia_avi_streams *avi_streams;
+ pjmedia_avi_stream *vid_stream;
+ pjmedia_port *play_port;
+ pj_status_t status;
+
+ status = pjmedia_avi_player_create_streams(pool, file_name, 0, &avi_streams);
+ if (status != PJ_SUCCESS)
+ return status;
+
+ vid_stream = pjmedia_avi_streams_get_stream_by_media(avi_streams,
+ 0,
+ PJMEDIA_TYPE_VIDEO);
+ if (!vid_stream)
+ return PJ_ENOTFOUND;
+
+ play_port = pjmedia_avi_stream_get_port(vid_stream);
+ pj_assert(play_port);
+
+ *p_play_port = play_port;
+
+ return PJ_SUCCESS;
+}
+
+/*
+ * Create stream based on the codec, dir, remote address, etc.
+ */
+static pj_status_t create_stream( pj_pool_t *pool,
+ pjmedia_endpt *med_endpt,
+ const pjmedia_vid_codec_info *codec_info,
+ pjmedia_vid_codec_param *codec_param,
+ pjmedia_dir dir,
+ pj_int8_t rx_pt,
+ pj_int8_t tx_pt,
+ pj_uint16_t local_port,
+ const pj_sockaddr_in *rem_addr,
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+ pj_bool_t use_srtp,
+ const pj_str_t *crypto_suite,
+ const pj_str_t *srtp_tx_key,
+ const pj_str_t *srtp_rx_key,
+#endif
+ pjmedia_vid_stream **p_stream )
+{
+ pjmedia_vid_stream_info info;
+ pjmedia_transport *transport = NULL;
+ pj_status_t status;
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+ pjmedia_transport *srtp_tp = NULL;
+#endif
+
+ /* Reset stream info. */
+ pj_bzero(&info, sizeof(info));
+
+ /* Initialize stream info formats */
+ info.type = PJMEDIA_TYPE_VIDEO;
+ info.dir = dir;
+ info.codec_info = *codec_info;
+ info.tx_pt = (tx_pt == -1)? codec_info->pt : tx_pt;
+ info.rx_pt = (rx_pt == -1)? codec_info->pt : rx_pt;
+ info.ssrc = pj_rand();
+ if (codec_param)
+ info.codec_param = codec_param;
+
+ /* Copy remote address */
+ pj_memcpy(&info.rem_addr, rem_addr, sizeof(pj_sockaddr_in));
+
+ /* If remote address is not set, set to an arbitrary address
+ * (otherwise stream will assert).
+ */
+ if (info.rem_addr.addr.sa_family == 0) {
+ const pj_str_t addr = pj_str("127.0.0.1");
+ pj_sockaddr_in_init(&info.rem_addr.ipv4, &addr, 0);
+ }
+
+ /* Create media transport */
+ status = pjmedia_transport_udp_create(med_endpt, NULL, local_port,
+ 0, &transport);
+ if (status != PJ_SUCCESS)
+ return status;
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+ /* Check if SRTP enabled */
+ if (use_srtp) {
+ pjmedia_srtp_crypto tx_plc, rx_plc;
+
+ status = pjmedia_transport_srtp_create(med_endpt, transport,
+ NULL, &srtp_tp);
+ if (status != PJ_SUCCESS)
+ return status;
+
+ pj_bzero(&tx_plc, sizeof(pjmedia_srtp_crypto));
+ pj_bzero(&rx_plc, sizeof(pjmedia_srtp_crypto));
+
+ tx_plc.key = *srtp_tx_key;
+ tx_plc.name = *crypto_suite;
+ rx_plc.key = *srtp_rx_key;
+ rx_plc.name = *crypto_suite;
+
+ status = pjmedia_transport_srtp_start(srtp_tp, &tx_plc, &rx_plc);
+ if (status != PJ_SUCCESS)
+ return status;
+
+ transport = srtp_tp;
+ }
+#endif
+
+ /* Now that the stream info is initialized, we can create the
+ * stream.
+ */
+
+ status = pjmedia_vid_stream_create( med_endpt, pool, &info,
+ transport,
+ NULL, p_stream);
+
+ if (status != PJ_SUCCESS) {
+ app_perror(THIS_FILE, "Error creating stream", status);
+ pjmedia_transport_close(transport);
+ return status;
+ }
+
+
+ return PJ_SUCCESS;
+}
+
+
+typedef struct play_file_data
+{
+ const char *file_name;
+ pjmedia_port *play_port;
+ pjmedia_port *stream_port;
+ pjmedia_vid_codec *decoder;
+ pjmedia_port *renderer;
+ void *read_buf;
+ pj_size_t read_buf_size;
+ void *dec_buf;
+ pj_size_t dec_buf_size;
+} play_file_data;
+
+
+static void clock_cb(const pj_timestamp *ts, void *user_data)
+{
+ play_file_data *play_file = (play_file_data*)user_data;
+ pjmedia_frame read_frame, write_frame;
+ pj_status_t status;
+
+ PJ_UNUSED_ARG(ts);
+
+ /* Read frame from file */
+ read_frame.buf = play_file->read_buf;
+ read_frame.size = play_file->read_buf_size;
+ pjmedia_port_get_frame(play_file->play_port, &read_frame);
+
+ /* Decode frame, if needed */
+ if (play_file->decoder) {
+ pjmedia_vid_codec *decoder = play_file->decoder;
+
+ write_frame.buf = play_file->dec_buf;
+ write_frame.size = play_file->dec_buf_size;
+ status = pjmedia_vid_codec_decode(decoder, 1, &read_frame,
+ (unsigned)write_frame.size,
+ &write_frame);
+ if (status != PJ_SUCCESS)
+ return;
+ } else {
+ write_frame = read_frame;
+ }
+
+ /* Display frame locally */
+ if (play_file->renderer)
+ pjmedia_port_put_frame(play_file->renderer, &write_frame);
+
+ /* Send frame */
+ pjmedia_port_put_frame(play_file->stream_port, &write_frame);
+}
+
+
+/*
+ * usage()
+ */
+static void usage()
+{
+ puts(desc);
+}
+
+/*
+ * main()
+ */
+int main(int argc, char *argv[])
+{
+ pj_caching_pool cp;
+ pjmedia_endpt *med_endpt;
+ pj_pool_t *pool;
+ pjmedia_vid_stream *stream = NULL;
+ pjmedia_port *enc_port, *dec_port;
+ pj_status_t status;
+
+ pjmedia_vid_port *capture=NULL, *renderer=NULL;
+ pjmedia_vid_port_param vpp;
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+ /* SRTP variables */
+ pj_bool_t use_srtp = PJ_FALSE;
+ char tmp_tx_key[64];
+ char tmp_rx_key[64];
+ pj_str_t srtp_tx_key = {NULL, 0};
+ pj_str_t srtp_rx_key = {NULL, 0};
+ pj_str_t srtp_crypto_suite = {NULL, 0};
+ int tmp_key_len;
+#endif
+
+ /* Default values */
+ const pjmedia_vid_codec_info *codec_info;
+ pjmedia_vid_codec_param codec_param;
+ pjmedia_dir dir = PJMEDIA_DIR_DECODING;
+ pj_sockaddr_in remote_addr;
+ pj_uint16_t local_port = 4000;
+ char *codec_id = NULL;
+ pjmedia_rect_size tx_size = {0};
+ pj_int8_t rx_pt = -1, tx_pt = -1;
+
+ play_file_data play_file = { NULL };
+ pjmedia_port *play_port = NULL;
+ pjmedia_vid_codec *play_decoder = NULL;
+ pjmedia_clock *play_clock = NULL;
+
+ enum {
+ OPT_CODEC = 'c',
+ OPT_LOCAL_PORT = 'p',
+ OPT_REMOTE = 'r',
+ OPT_PLAY_FILE = 'f',
+ OPT_SEND_RECV = 'b',
+ OPT_SEND_ONLY = 's',
+ OPT_RECV_ONLY = 'i',
+ OPT_SEND_WIDTH = 'W',
+ OPT_SEND_HEIGHT = 'H',
+ OPT_RECV_PT = 't',
+ OPT_SEND_PT = 'T',
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+ OPT_USE_SRTP = 'S',
+#endif
+ OPT_SRTP_TX_KEY = 'x',
+ OPT_SRTP_RX_KEY = 'y',
+ OPT_HELP = 'h',
+ };
+
+ struct pj_getopt_option long_options[] = {
+ { "codec", 1, 0, OPT_CODEC },
+ { "local-port", 1, 0, OPT_LOCAL_PORT },
+ { "remote", 1, 0, OPT_REMOTE },
+ { "play-file", 1, 0, OPT_PLAY_FILE },
+ { "send-recv", 0, 0, OPT_SEND_RECV },
+ { "send-only", 0, 0, OPT_SEND_ONLY },
+ { "recv-only", 0, 0, OPT_RECV_ONLY },
+ { "send-width", 1, 0, OPT_SEND_WIDTH },
+ { "send-height", 1, 0, OPT_SEND_HEIGHT },
+ { "recv-pt", 1, 0, OPT_RECV_PT },
+ { "send-pt", 1, 0, OPT_SEND_PT },
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+ { "use-srtp", 2, 0, OPT_USE_SRTP },
+ { "srtp-tx-key", 1, 0, OPT_SRTP_TX_KEY },
+ { "srtp-rx-key", 1, 0, OPT_SRTP_RX_KEY },
+#endif
+ { "help", 0, 0, OPT_HELP },
+ { NULL, 0, 0, 0 },
+ };
+
+ int c;
+ int option_index;
+
+
+ pj_bzero(&remote_addr, sizeof(remote_addr));
+
+
+ /* init PJLIB : */
+ status = pj_init();
+ PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+
+ /* Parse arguments */
+ pj_optind = 0;
+ while((c=pj_getopt_long(argc,argv, "h", long_options, &option_index))!=-1)
+ {
+ switch (c) {
+ case OPT_CODEC:
+ codec_id = pj_optarg;
+ break;
+
+ case OPT_LOCAL_PORT:
+ local_port = (pj_uint16_t) atoi(pj_optarg);
+ if (local_port < 1) {
+ printf("Error: invalid local port %s\n", pj_optarg);
+ return 1;
+ }
+ break;
+
+ case OPT_REMOTE:
+ {
+ pj_str_t ip = pj_str(strtok(pj_optarg, ":"));
+ pj_uint16_t port = (pj_uint16_t) atoi(strtok(NULL, ":"));
+
+ status = pj_sockaddr_in_init(&remote_addr, &ip, port);
+ if (status != PJ_SUCCESS) {
+ app_perror(THIS_FILE, "Invalid remote address", status);
+ return 1;
+ }
+ }
+ break;
+
+ case OPT_PLAY_FILE:
+ play_file.file_name = pj_optarg;
+ break;
+
+ case OPT_SEND_RECV:
+ dir = PJMEDIA_DIR_ENCODING_DECODING;
+ break;
+
+ case OPT_SEND_ONLY:
+ dir = PJMEDIA_DIR_ENCODING;
+ break;
+
+ case OPT_RECV_ONLY:
+ dir = PJMEDIA_DIR_DECODING;
+ break;
+
+ case OPT_SEND_WIDTH:
+ tx_size.w = (unsigned)atoi(pj_optarg);
+ break;
+
+ case OPT_SEND_HEIGHT:
+ tx_size.h = (unsigned)atoi(pj_optarg);
+ break;
+
+ case OPT_RECV_PT:
+ rx_pt = (pj_int8_t)atoi(pj_optarg);
+ break;
+
+ case OPT_SEND_PT:
+ tx_pt = (pj_int8_t)atoi(pj_optarg);
+ break;
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+ case OPT_USE_SRTP:
+ use_srtp = PJ_TRUE;
+ if (pj_optarg) {
+ pj_strset(&srtp_crypto_suite, pj_optarg, strlen(pj_optarg));
+ } else {
+ srtp_crypto_suite = pj_str("AES_CM_128_HMAC_SHA1_80");
+ }
+ break;
+
+ case OPT_SRTP_TX_KEY:
+ tmp_key_len = hex_string_to_octet_string(tmp_tx_key, pj_optarg,
+ (int)strlen(pj_optarg));
+ pj_strset(&srtp_tx_key, tmp_tx_key, tmp_key_len/2);
+ break;
+
+ case OPT_SRTP_RX_KEY:
+ tmp_key_len = hex_string_to_octet_string(tmp_rx_key, pj_optarg,
+ (int)strlen(pj_optarg));
+ pj_strset(&srtp_rx_key, tmp_rx_key, tmp_key_len/2);
+ break;
+#endif
+
+ case OPT_HELP:
+ usage();
+ return 1;
+
+ default:
+ printf("Invalid options %s\n", argv[pj_optind]);
+ return 1;
+ }
+
+ }
+
+
+ /* Verify arguments. */
+ if (dir & PJMEDIA_DIR_ENCODING) {
+ if (remote_addr.sin_addr.s_addr == 0) {
+ printf("Error: remote address must be set\n");
+ return 1;
+ }
+ }
+
+ if (play_file.file_name != NULL && dir != PJMEDIA_DIR_ENCODING) {
+ printf("Direction is set to --send-only because of --play-file\n");
+ dir = PJMEDIA_DIR_ENCODING;
+ }
+
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+ /* SRTP validation */
+ if (use_srtp) {
+ if (!srtp_tx_key.slen || !srtp_rx_key.slen)
+ {
+ printf("Error: Key for each SRTP stream direction must be set\n");
+ return 1;
+ }
+ }
+#endif
+
+ /* 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 application purpose */
+ pool = pj_pool_create( &cp.factory, /* pool factory */
+ "app", /* pool name. */
+ 4000, /* init size */
+ 4000, /* increment size */
+ NULL /* callback on error */
+ );
+
+ /* Init video format manager */
+ pjmedia_video_format_mgr_create(pool, 64, 0, NULL);
+
+ /* Init video converter manager */
+ pjmedia_converter_mgr_create(pool, NULL);
+
+ /* Init event manager */
+ pjmedia_event_mgr_create(pool, 0, NULL);
+
+ /* Init video codec manager */
+ pjmedia_vid_codec_mgr_create(pool, NULL);
+
+ /* Init video subsystem */
+ pjmedia_vid_dev_subsys_init(&cp.factory);
+
+ /* Register all supported codecs */
+ status = init_codecs(&cp.factory);
+ PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+
+ /* Find which codec to use. */
+ if (codec_id) {
+ unsigned count = 1;
+ pj_str_t str_codec_id = pj_str(codec_id);
+
+ status = pjmedia_vid_codec_mgr_find_codecs_by_id(NULL,
+ &str_codec_id, &count,
+ &codec_info, NULL);
+ if (status != PJ_SUCCESS) {
+ printf("Error: unable to find codec %s\n", codec_id);
+ return 1;
+ }
+ } else {
+ static pjmedia_vid_codec_info info[1];
+ unsigned count = PJ_ARRAY_SIZE(info);
+
+ /* Default to first codec */
+ pjmedia_vid_codec_mgr_enum_codecs(NULL, &count, info, NULL);
+ codec_info = &info[0];
+ }
+
+ /* Get codec default param for info */
+ status = pjmedia_vid_codec_mgr_get_default_param(NULL, codec_info,
+ &codec_param);
+ pj_assert(status == PJ_SUCCESS);
+
+ /* Set outgoing video size */
+ if (tx_size.w && tx_size.h)
+ codec_param.enc_fmt.det.vid.size = tx_size;
+
+#if DEF_RENDERER_WIDTH && DEF_RENDERER_HEIGHT
+ /* Set incoming video size */
+ if (DEF_RENDERER_WIDTH > codec_param.dec_fmt.det.vid.size.w)
+ codec_param.dec_fmt.det.vid.size.w = DEF_RENDERER_WIDTH;
+ if (DEF_RENDERER_HEIGHT > codec_param.dec_fmt.det.vid.size.h)
+ codec_param.dec_fmt.det.vid.size.h = DEF_RENDERER_HEIGHT;
+#endif
+
+ if (play_file.file_name) {
+ pjmedia_video_format_detail *file_vfd;
+ pjmedia_clock_param clock_param;
+ char fmt_name[5];
+
+ /* Create file player */
+ status = create_file_player(pool, play_file.file_name, &play_port);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+
+ /* Collect format info */
+ file_vfd = pjmedia_format_get_video_format_detail(&play_port->info.fmt,
+ PJ_TRUE);
+ PJ_LOG(2, (THIS_FILE, "Reading video stream %dx%d %s @%.2ffps",
+ file_vfd->size.w, file_vfd->size.h,
+ pjmedia_fourcc_name(play_port->info.fmt.id, fmt_name),
+ (1.0*file_vfd->fps.num/file_vfd->fps.denum)));
+
+ /* Allocate file read buffer */
+ play_file.read_buf_size = PJMEDIA_MAX_VIDEO_ENC_FRAME_SIZE;
+ play_file.read_buf = pj_pool_zalloc(pool, play_file.read_buf_size);
+
+ /* Create decoder, if the file and the stream uses different codec */
+ if (codec_info->fmt_id != (pjmedia_format_id)play_port->info.fmt.id) {
+ const pjmedia_video_format_info *dec_vfi;
+ pjmedia_video_apply_fmt_param dec_vafp = {0};
+ const pjmedia_vid_codec_info *codec_info2;
+ pjmedia_vid_codec_param codec_param2;
+
+ /* Find decoder */
+ status = pjmedia_vid_codec_mgr_get_codec_info2(NULL,
+ play_port->info.fmt.id,
+ &codec_info2);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+
+ /* Init decoder */
+ status = pjmedia_vid_codec_mgr_alloc_codec(NULL, codec_info2,
+ &play_decoder);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+
+ status = play_decoder->op->init(play_decoder, pool);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+
+ /* Open decoder */
+ status = pjmedia_vid_codec_mgr_get_default_param(NULL, codec_info2,
+ &codec_param2);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+
+ codec_param2.dir = PJMEDIA_DIR_DECODING;
+ status = play_decoder->op->open(play_decoder, &codec_param2);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+
+ /* Get decoder format info and apply param */
+ dec_vfi = pjmedia_get_video_format_info(NULL,
+ codec_info2->dec_fmt_id[0]);
+ if (!dec_vfi || !dec_vfi->apply_fmt) {
+ status = PJ_ENOTSUP;
+ goto on_exit;
+ }
+ dec_vafp.size = file_vfd->size;
+ (*dec_vfi->apply_fmt)(dec_vfi, &dec_vafp);
+
+ /* Allocate buffer to receive decoder output */
+ play_file.dec_buf_size = dec_vafp.framebytes;
+ play_file.dec_buf = pj_pool_zalloc(pool, play_file.dec_buf_size);
+ }
+
+ /* Create player clock */
+ clock_param.usec_interval = PJMEDIA_PTIME(&file_vfd->fps);
+ clock_param.clock_rate = codec_info->clock_rate;
+ status = pjmedia_clock_create2(pool, &clock_param,
+ PJMEDIA_CLOCK_NO_HIGHEST_PRIO,
+ &clock_cb, &play_file, &play_clock);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+
+ /* Override stream codec param for encoding direction */
+ codec_param.enc_fmt.det.vid.size = file_vfd->size;
+ codec_param.enc_fmt.det.vid.fps = file_vfd->fps;
+
+ } else {
+ pjmedia_vid_port_param_default(&vpp);
+
+ /* Set as active for all video devices */
+ vpp.active = PJ_TRUE;
+
+ /* Create video device port. */
+ if (dir & PJMEDIA_DIR_ENCODING) {
+ /* Create capture */
+ status = pjmedia_vid_dev_default_param(
+ pool,
+ PJMEDIA_VID_DEFAULT_CAPTURE_DEV,
+ &vpp.vidparam);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+
+ pjmedia_format_copy(&vpp.vidparam.fmt, &codec_param.enc_fmt);
+ vpp.vidparam.fmt.id = codec_param.dec_fmt.id;
+ vpp.vidparam.dir = PJMEDIA_DIR_CAPTURE;
+
+ status = pjmedia_vid_port_create(pool, &vpp, &capture);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+ }
+
+ if (dir & PJMEDIA_DIR_DECODING) {
+ /* Create renderer */
+ status = pjmedia_vid_dev_default_param(
+ pool,
+ PJMEDIA_VID_DEFAULT_RENDER_DEV,
+ &vpp.vidparam);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+
+ pjmedia_format_copy(&vpp.vidparam.fmt, &codec_param.dec_fmt);
+ vpp.vidparam.dir = PJMEDIA_DIR_RENDER;
+ vpp.vidparam.disp_size = vpp.vidparam.fmt.det.vid.size;
+ vpp.vidparam.flags |= PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS;
+ vpp.vidparam.window_flags = PJMEDIA_VID_DEV_WND_BORDER |
+ PJMEDIA_VID_DEV_WND_RESIZABLE;
+
+ status = pjmedia_vid_port_create(pool, &vpp, &renderer);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+ }
+ }
+
+ /* Set to ignore fmtp */
+ codec_param.ignore_fmtp = PJ_TRUE;
+
+ /* Create stream based on program arguments */
+ status = create_stream(pool, med_endpt, codec_info, &codec_param,
+ dir, rx_pt, tx_pt, local_port, &remote_addr,
+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
+ use_srtp, &srtp_crypto_suite,
+ &srtp_tx_key, &srtp_rx_key,
+#endif
+ &stream);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+
+ /* Get the port interface of the stream */
+ status = pjmedia_vid_stream_get_port(stream, PJMEDIA_DIR_ENCODING,
+ &enc_port);
+ PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+ status = pjmedia_vid_stream_get_port(stream, PJMEDIA_DIR_DECODING,
+ &dec_port);
+ PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
+
+ /* Start streaming */
+ status = pjmedia_vid_stream_start(stream);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+
+ /* Start renderer */
+ if (renderer) {
+ status = pjmedia_vid_port_connect(renderer, dec_port, PJ_FALSE);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+ status = pjmedia_vid_port_start(renderer);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+ }
+
+ /* Start capture */
+ if (capture) {
+ status = pjmedia_vid_port_connect(capture, enc_port, PJ_FALSE);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+ status = pjmedia_vid_port_start(capture);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+ }
+
+ /* Start playing file */
+ if (play_file.file_name) {
+
+#if HAS_LOCAL_RENDERER_FOR_PLAY_FILE
+ /* Create local renderer */
+ pjmedia_vid_port_param_default(&vpp);
+ vpp.active = PJ_FALSE;
+ status = pjmedia_vid_dev_default_param(
+ pool,
+ PJMEDIA_VID_DEFAULT_RENDER_DEV,
+ &vpp.vidparam);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+
+ vpp.vidparam.dir = PJMEDIA_DIR_RENDER;
+ pjmedia_format_copy(&vpp.vidparam.fmt, &codec_param.dec_fmt);
+ vpp.vidparam.fmt.det.vid.size = play_port->info.fmt.det.vid.size;
+ vpp.vidparam.fmt.det.vid.fps = play_port->info.fmt.det.vid.fps;
+ vpp.vidparam.disp_size = vpp.vidparam.fmt.det.vid.size;
+ vpp.vidparam.flags |= PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS;
+ vpp.vidparam.window_flags = PJMEDIA_VID_DEV_WND_BORDER |
+ PJMEDIA_VID_DEV_WND_RESIZABLE;
+
+ status = pjmedia_vid_port_create(pool, &vpp, &renderer);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+ status = pjmedia_vid_port_start(renderer);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+#endif
+
+ /* Init play file data */
+ play_file.play_port = play_port;
+ play_file.stream_port = enc_port;
+ play_file.decoder = play_decoder;
+ if (renderer) {
+ play_file.renderer = pjmedia_vid_port_get_passive_port(renderer);
+ }
+
+ status = pjmedia_clock_start(play_clock);
+ if (status != PJ_SUCCESS)
+ goto on_exit;
+ }
+
+ /* Done */
+
+ if (dir == PJMEDIA_DIR_DECODING)
+ printf("Stream is active, dir is recv-only, local port is %d\n",
+ local_port);
+ else if (dir == PJMEDIA_DIR_ENCODING)
+ printf("Stream is active, dir is send-only, sending to %s:%d\n",
+ pj_inet_ntoa(remote_addr.sin_addr),
+ pj_ntohs(remote_addr.sin_port));
+ else
+ printf("Stream is active, send/recv, local port is %d, "
+ "sending to %s:%d\n",
+ local_port,
+ pj_inet_ntoa(remote_addr.sin_addr),
+ pj_ntohs(remote_addr.sin_port));
+
+ if (dir & PJMEDIA_DIR_ENCODING)
+ PJ_LOG(2, (THIS_FILE, "Sending %dx%d %.*s @%.2ffps",
+ codec_param.enc_fmt.det.vid.size.w,
+ codec_param.enc_fmt.det.vid.size.h,
+ codec_info->encoding_name.slen,
+ codec_info->encoding_name.ptr,
+ (1.0*codec_param.enc_fmt.det.vid.fps.num/
+ codec_param.enc_fmt.det.vid.fps.denum)));
+
+ for (;;) {
+ char tmp[10];
+
+ puts("");
+ puts("Commands:");
+ puts(" q Quit");
+ puts("");
+
+ printf("Command: "); fflush(stdout);
+
+ if (fgets(tmp, sizeof(tmp), stdin) == NULL) {
+ puts("EOF while reading stdin, will quit now..");
+ break;
+ }
+
+ if (tmp[0] == 'q')
+ break;
+
+ }
+
+
+
+ /* Start deinitialization: */
+on_exit:
+
+ /* Stop video devices */
+ if (capture)
+ pjmedia_vid_port_stop(capture);
+ if (renderer)
+ pjmedia_vid_port_stop(renderer);
+
+ /* Stop and destroy file clock */
+ if (play_clock) {
+ pjmedia_clock_stop(play_clock);
+ pjmedia_clock_destroy(play_clock);
+ }
+
+ /* Destroy file reader/player */
+ if (play_port)
+ pjmedia_port_destroy(play_port);
+
+ /* Destroy file decoder */
+ if (play_decoder) {
+ play_decoder->op->close(play_decoder);
+ pjmedia_vid_codec_mgr_dealloc_codec(NULL, play_decoder);
+ }
+
+ /* Destroy video devices */
+ if (capture)
+ pjmedia_vid_port_destroy(capture);
+ if (renderer)
+ pjmedia_vid_port_destroy(renderer);
+
+ /* Destroy stream */
+ if (stream) {
+ pjmedia_transport *tp;
+
+ tp = pjmedia_vid_stream_get_transport(stream);
+ pjmedia_vid_stream_destroy(stream);
+
+ pjmedia_transport_close(tp);
+ }
+
+ /* Deinit codecs */
+ deinit_codecs();
+
+ /* Shutdown video subsystem */
+ pjmedia_vid_dev_subsys_shutdown();
+
+ /* Destroy event manager */
+ pjmedia_event_mgr_destroy(NULL);
+
+ /* 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();
+
+ return (status == PJ_SUCCESS) ? 0 : 1;
+}
+
+
+#else
+
+int main(int argc, char *argv[])
+{
+ PJ_UNUSED_ARG(argc);
+ PJ_UNUSED_ARG(argv);
+ puts("Error: this sample requires video capability (PJMEDIA_HAS_VIDEO == 1)");
+ return -1;
+}
+
+#endif /* PJMEDIA_HAS_VIDEO */
diff --git a/jni/pjproject-android/.svn/pristine/26/265122c01d4deda308d8f3b41d5c71c6cb3e4292.svn-base b/jni/pjproject-android/.svn/pristine/26/265122c01d4deda308d8f3b41d5c71c6cb3e4292.svn-base
new file mode 100644
index 0000000..a3e0ae7
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/26/265122c01d4deda308d8f3b41d5c71c6cb3e4292.svn-base
@@ -0,0 +1 @@
+#include "../../../portaudio/include/pa_linux_alsa.h"
diff --git a/jni/pjproject-android/.svn/pristine/26/2669873f891113a8f45506e825d0215306e95405.svn-base b/jni/pjproject-android/.svn/pristine/26/2669873f891113a8f45506e825d0215306e95405.svn-base
new file mode 100644
index 0000000..f2fe155
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/26/2669873f891113a8f45506e825d0215306e95405.svn-base
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/jni/pjproject-android/.svn/pristine/26/26bcc736695e47196e17786cdb0076dde3671c1f.svn-base b/jni/pjproject-android/.svn/pristine/26/26bcc736695e47196e17786cdb0076dde3671c1f.svn-base
new file mode 100644
index 0000000..0655aca
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/26/26bcc736695e47196e17786cdb0076dde3671c1f.svn-base
@@ -0,0 +1,573 @@
+/*
+ * xfm.c
+ *
+ * Crypto transform implementation
+ *
+ * David A. McGrew
+ * Cisco Systems, Inc.
+ */
+
+#include "cryptoalg.h"
+#include "aes_cbc.h"
+#include "hmac.h"
+#include "crypto_kernel.h" /* for crypto_get_random() */
+
+#define KEY_LEN 16
+#define ENC_KEY_LEN 16
+#define MAC_KEY_LEN 16
+#define IV_LEN 16
+#define TAG_LEN 12
+#define MAX_EXPAND 27
+
+err_status_t
+aes_128_cbc_hmac_sha1_96_func(void *key,
+ void *clear,
+ unsigned clear_len,
+ void *iv,
+ void *opaque,
+ unsigned *opaque_len,
+ void *auth_tag) {
+ aes_cbc_ctx_t aes_ctx;
+ hmac_ctx_t hmac_ctx;
+ unsigned char enc_key[ENC_KEY_LEN];
+ unsigned char mac_key[MAC_KEY_LEN];
+ err_status_t status;
+
+ /* check if we're doing authentication only */
+ if ((iv == NULL) && (opaque == NULL) && (opaque_len == NULL)) {
+
+ /* perform authentication only */
+
+ } else if ((iv == NULL) || (opaque == NULL) || (opaque_len == NULL)) {
+
+ /*
+ * bad parameter - we expect either all three pointers to be NULL,
+ * or none of those pointers to be NULL
+ */
+ return err_status_fail;
+
+ } else {
+
+ /* derive encryption and authentication keys from the input key */
+ status = hmac_init(&hmac_ctx, key, KEY_LEN);
+ if (status) return status;
+ status = hmac_compute(&hmac_ctx, "ENC", 3, ENC_KEY_LEN, enc_key);
+ if (status) return status;
+
+ status = hmac_init(&hmac_ctx, key, KEY_LEN);
+ if (status) return status;
+ status = hmac_compute(&hmac_ctx, "MAC", 3, MAC_KEY_LEN, mac_key);
+ if (status) return status;
+
+
+ /* perform encryption and authentication */
+
+ /* set aes key */
+ status = aes_cbc_context_init(&aes_ctx, key, direction_encrypt);
+ if (status) return status;
+
+ /* set iv */
+ status = crypto_get_random(iv, IV_LEN);
+ if (status) return status;
+ status = aes_cbc_set_iv(&aes_ctx, iv);
+
+ /* encrypt the opaque data */
+ status = aes_cbc_nist_encrypt(&aes_ctx, opaque, opaque_len);
+ if (status) return status;
+
+ /* authenticate clear and opaque data */
+ status = hmac_init(&hmac_ctx, mac_key, MAC_KEY_LEN);
+ if (status) return status;
+
+ status = hmac_start(&hmac_ctx);
+ if (status) return status;
+
+ status = hmac_update(&hmac_ctx, clear, clear_len);
+ if (status) return status;
+
+ status = hmac_compute(&hmac_ctx, opaque, *opaque_len, TAG_LEN, auth_tag);
+ if (status) return status;
+
+ }
+
+ return err_status_ok;
+}
+
+err_status_t
+aes_128_cbc_hmac_sha1_96_inv(void *key,
+ void *clear,
+ unsigned clear_len,
+ void *iv,
+ void *opaque,
+ unsigned *opaque_len,
+ void *auth_tag) {
+ aes_cbc_ctx_t aes_ctx;
+ hmac_ctx_t hmac_ctx;
+ unsigned char enc_key[ENC_KEY_LEN];
+ unsigned char mac_key[MAC_KEY_LEN];
+ unsigned char tmp_tag[TAG_LEN];
+ unsigned char *tag = auth_tag;
+ err_status_t status;
+ int i;
+
+ /* check if we're doing authentication only */
+ if ((iv == NULL) && (opaque == NULL) && (opaque_len == NULL)) {
+
+ /* perform authentication only */
+
+ } else if ((iv == NULL) || (opaque == NULL) || (opaque_len == NULL)) {
+
+ /*
+ * bad parameter - we expect either all three pointers to be NULL,
+ * or none of those pointers to be NULL
+ */
+ return err_status_fail;
+
+ } else {
+
+ /* derive encryption and authentication keys from the input key */
+ status = hmac_init(&hmac_ctx, key, KEY_LEN);
+ if (status) return status;
+ status = hmac_compute(&hmac_ctx, "ENC", 3, ENC_KEY_LEN, enc_key);
+ if (status) return status;
+
+ status = hmac_init(&hmac_ctx, key, KEY_LEN);
+ if (status) return status;
+ status = hmac_compute(&hmac_ctx, "MAC", 3, MAC_KEY_LEN, mac_key);
+ if (status) return status;
+
+ /* perform encryption and authentication */
+
+ /* set aes key */
+ status = aes_cbc_context_init(&aes_ctx, key, direction_decrypt);
+ if (status) return status;
+
+ /* set iv */
+ status = rand_source_get_octet_string(iv, IV_LEN);
+ if (status) return status;
+ status = aes_cbc_set_iv(&aes_ctx, iv);
+
+ /* encrypt the opaque data */
+ status = aes_cbc_nist_decrypt(&aes_ctx, opaque, opaque_len);
+ if (status) return status;
+
+ /* authenticate clear and opaque data */
+ status = hmac_init(&hmac_ctx, mac_key, MAC_KEY_LEN);
+ if (status) return status;
+
+ status = hmac_start(&hmac_ctx);
+ if (status) return status;
+
+ status = hmac_update(&hmac_ctx, clear, clear_len);
+ if (status) return status;
+
+ status = hmac_compute(&hmac_ctx, opaque, *opaque_len, TAG_LEN, tmp_tag);
+ if (status) return status;
+
+ /* compare the computed tag with the one provided as input */
+ for (i=0; i < TAG_LEN; i++)
+ if (tmp_tag[i] != tag[i])
+ return err_status_auth_fail;
+
+ }
+
+ return err_status_ok;
+}
+
+
+#define ENC 1
+
+// eVC4 declares DEBUG
+#undef DEBUG
+
+#define DEBUG 0
+
+err_status_t
+aes_128_cbc_hmac_sha1_96_enc(void *key,
+ const void *clear,
+ unsigned clear_len,
+ void *iv,
+ void *opaque,
+ unsigned *opaque_len) {
+ aes_cbc_ctx_t aes_ctx;
+ hmac_ctx_t hmac_ctx;
+ unsigned char enc_key[ENC_KEY_LEN];
+ unsigned char mac_key[MAC_KEY_LEN];
+ unsigned char *auth_tag;
+ err_status_t status;
+
+ /* check if we're doing authentication only */
+ if ((iv == NULL) && (opaque == NULL) && (opaque_len == NULL)) {
+
+ /* perform authentication only */
+
+ } else if ((iv == NULL) || (opaque == NULL) || (opaque_len == NULL)) {
+
+ /*
+ * bad parameter - we expect either all three pointers to be NULL,
+ * or none of those pointers to be NULL
+ */
+ return err_status_fail;
+
+ } else {
+
+#if DEBUG
+ printf("ENC using key %s\n", octet_string_hex_string(key, KEY_LEN));
+#endif
+
+ /* derive encryption and authentication keys from the input key */
+ status = hmac_init(&hmac_ctx, key, KEY_LEN);
+ if (status) return status;
+ status = hmac_compute(&hmac_ctx, "ENC", 3, ENC_KEY_LEN, enc_key);
+ if (status) return status;
+
+ status = hmac_init(&hmac_ctx, key, KEY_LEN);
+ if (status) return status;
+ status = hmac_compute(&hmac_ctx, "MAC", 3, MAC_KEY_LEN, mac_key);
+ if (status) return status;
+
+
+ /* perform encryption and authentication */
+
+ /* set aes key */
+ status = aes_cbc_context_init(&aes_ctx, key, direction_encrypt);
+ if (status) return status;
+
+ /* set iv */
+ status = rand_source_get_octet_string(iv, IV_LEN);
+ if (status) return status;
+ status = aes_cbc_set_iv(&aes_ctx, iv);
+ if (status) return status;
+
+#if DEBUG
+ printf("plaintext len: %d\n", *opaque_len);
+ printf("iv: %s\n", octet_string_hex_string(iv, IV_LEN));
+ printf("plaintext: %s\n", octet_string_hex_string(opaque, *opaque_len));
+#endif
+
+#if ENC
+ /* encrypt the opaque data */
+ status = aes_cbc_nist_encrypt(&aes_ctx, opaque, opaque_len);
+ if (status) return status;
+#endif
+
+#if DEBUG
+ printf("ciphertext len: %d\n", *opaque_len);
+ printf("ciphertext: %s\n", octet_string_hex_string(opaque, *opaque_len));
+#endif
+
+ /*
+ * authenticate clear and opaque data, then write the
+ * authentication tag to the location immediately following the
+ * ciphertext
+ */
+ status = hmac_init(&hmac_ctx, mac_key, MAC_KEY_LEN);
+ if (status) return status;
+
+ status = hmac_start(&hmac_ctx);
+ if (status) return status;
+
+ status = hmac_update(&hmac_ctx, clear, clear_len);
+ if (status) return status;
+#if DEBUG
+ printf("hmac input: %s\n",
+ octet_string_hex_string(clear, clear_len));
+#endif
+ auth_tag = (unsigned char *)opaque;
+ auth_tag += *opaque_len;
+ status = hmac_compute(&hmac_ctx, opaque, *opaque_len, TAG_LEN, auth_tag);
+ if (status) return status;
+#if DEBUG
+ printf("hmac input: %s\n",
+ octet_string_hex_string(opaque, *opaque_len));
+#endif
+ /* bump up the opaque_len to reflect the authentication tag */
+ *opaque_len += TAG_LEN;
+
+#if DEBUG
+ printf("prot data len: %d\n", *opaque_len);
+ printf("prot data: %s\n", octet_string_hex_string(opaque, *opaque_len));
+#endif
+ }
+
+ return err_status_ok;
+}
+
+err_status_t
+aes_128_cbc_hmac_sha1_96_dec(void *key,
+ const void *clear,
+ unsigned clear_len,
+ void *iv,
+ void *opaque,
+ unsigned *opaque_len) {
+ aes_cbc_ctx_t aes_ctx;
+ hmac_ctx_t hmac_ctx;
+ unsigned char enc_key[ENC_KEY_LEN];
+ unsigned char mac_key[MAC_KEY_LEN];
+ unsigned char tmp_tag[TAG_LEN];
+ unsigned char *auth_tag;
+ unsigned ciphertext_len;
+ err_status_t status;
+ int i;
+
+ /* check if we're doing authentication only */
+ if ((iv == NULL) && (opaque == NULL) && (opaque_len == NULL)) {
+
+ /* perform authentication only */
+
+ } else if ((iv == NULL) || (opaque == NULL) || (opaque_len == NULL)) {
+
+ /*
+ * bad parameter - we expect either all three pointers to be NULL,
+ * or none of those pointers to be NULL
+ */
+ return err_status_fail;
+
+ } else {
+#if DEBUG
+ printf("DEC using key %s\n", octet_string_hex_string(key, KEY_LEN));
+#endif
+
+ /* derive encryption and authentication keys from the input key */
+ status = hmac_init(&hmac_ctx, key, KEY_LEN);
+ if (status) return status;
+ status = hmac_compute(&hmac_ctx, "ENC", 3, ENC_KEY_LEN, enc_key);
+ if (status) return status;
+
+ status = hmac_init(&hmac_ctx, key, KEY_LEN);
+ if (status) return status;
+ status = hmac_compute(&hmac_ctx, "MAC", 3, MAC_KEY_LEN, mac_key);
+ if (status) return status;
+
+#if DEBUG
+ printf("prot data len: %d\n", *opaque_len);
+ printf("prot data: %s\n", octet_string_hex_string(opaque, *opaque_len));
+#endif
+
+ /*
+ * set the protected data length to that of the ciphertext, by
+ * subtracting out the length of the authentication tag
+ */
+ ciphertext_len = *opaque_len - TAG_LEN;
+
+#if DEBUG
+ printf("ciphertext len: %d\n", ciphertext_len);
+#endif
+ /* verify the authentication tag */
+
+ /*
+ * compute the authentication tag for the clear and opaque data,
+ * and write it to a temporary location
+ */
+ status = hmac_init(&hmac_ctx, mac_key, MAC_KEY_LEN);
+ if (status) return status;
+
+ status = hmac_start(&hmac_ctx);
+ if (status) return status;
+
+ status = hmac_update(&hmac_ctx, clear, clear_len);
+ if (status) return status;
+
+#if DEBUG
+ printf("hmac input: %s\n",
+ octet_string_hex_string(clear, clear_len));
+#endif
+
+ status = hmac_compute(&hmac_ctx, opaque, ciphertext_len, TAG_LEN, tmp_tag);
+ if (status) return status;
+
+#if DEBUG
+ printf("hmac input: %s\n",
+ octet_string_hex_string(opaque, ciphertext_len));
+#endif
+
+ /*
+ * compare the computed tag with the one provided as input (which
+ * immediately follows the ciphertext)
+ */
+ auth_tag = (unsigned char *)opaque;
+ auth_tag += ciphertext_len;
+#if DEBUG
+ printf("auth_tag: %s\n", octet_string_hex_string(auth_tag, TAG_LEN));
+ printf("tmp_tag: %s\n", octet_string_hex_string(tmp_tag, TAG_LEN));
+#endif
+ for (i=0; i < TAG_LEN; i++) {
+ if (tmp_tag[i] != auth_tag[i])
+ return err_status_auth_fail;
+ }
+
+ /* bump down the opaque_len to reflect the authentication tag */
+ *opaque_len -= TAG_LEN;
+
+ /* decrypt the confidential data */
+ status = aes_cbc_context_init(&aes_ctx, key, direction_decrypt);
+ if (status) return status;
+ status = aes_cbc_set_iv(&aes_ctx, iv);
+ if (status) return status;
+
+#if DEBUG
+ printf("ciphertext: %s\n", octet_string_hex_string(opaque, *opaque_len));
+ printf("iv: %s\n", octet_string_hex_string(iv, IV_LEN));
+#endif
+
+#if ENC
+ status = aes_cbc_nist_decrypt(&aes_ctx, opaque, &ciphertext_len);
+ if (status) return status;
+#endif
+
+#if DEBUG
+ printf("plaintext len: %d\n", ciphertext_len);
+ printf("plaintext: %s\n",
+ octet_string_hex_string(opaque, ciphertext_len));
+#endif
+
+ /* indicate the length of the plaintext */
+ *opaque_len = ciphertext_len;
+ }
+
+ return err_status_ok;
+}
+
+cryptoalg_ctx_t cryptoalg_ctx = {
+ aes_128_cbc_hmac_sha1_96_enc,
+ aes_128_cbc_hmac_sha1_96_dec,
+ KEY_LEN,
+ IV_LEN,
+ TAG_LEN,
+ MAX_EXPAND,
+};
+
+cryptoalg_t cryptoalg = &cryptoalg_ctx;
+
+#define NULL_TAG_LEN 12
+
+err_status_t
+null_enc(void *key,
+ const void *clear,
+ unsigned clear_len,
+ void *iv,
+ void *opaque,
+ unsigned *opaque_len) {
+ int i;
+ unsigned char *auth_tag;
+ unsigned char *init_vec = iv;
+
+ /* check if we're doing authentication only */
+ if ((iv == NULL) && (opaque == NULL) && (opaque_len == NULL)) {
+
+ /* perform authentication only */
+
+ } else if ((iv == NULL) || (opaque == NULL) || (opaque_len == NULL)) {
+
+ /*
+ * bad parameter - we expect either all three pointers to be NULL,
+ * or none of those pointers to be NULL
+ */
+ return err_status_fail;
+
+ } else {
+
+#if DEBUG
+ printf("NULL ENC using key %s\n", octet_string_hex_string(key, KEY_LEN));
+ printf("NULL_TAG_LEN: %d\n", NULL_TAG_LEN);
+ printf("plaintext len: %d\n", *opaque_len);
+#endif
+ for (i=0; i < IV_LEN; i++)
+ init_vec[i] = i + (i * 16);
+#if DEBUG
+ printf("iv: %s\n",
+ octet_string_hex_string(iv, IV_LEN));
+ printf("plaintext: %s\n",
+ octet_string_hex_string(opaque, *opaque_len));
+#endif
+ auth_tag = opaque;
+ auth_tag += *opaque_len;
+ for (i=0; i < NULL_TAG_LEN; i++)
+ auth_tag[i] = i + (i * 16);
+ *opaque_len += NULL_TAG_LEN;
+#if DEBUG
+ printf("protected data len: %d\n", *opaque_len);
+ printf("protected data: %s\n",
+ octet_string_hex_string(opaque, *opaque_len));
+#endif
+
+ }
+
+ return err_status_ok;
+}
+
+err_status_t
+null_dec(void *key,
+ const void *clear,
+ unsigned clear_len,
+ void *iv,
+ void *opaque,
+ unsigned *opaque_len) {
+ unsigned char *auth_tag;
+
+ /* check if we're doing authentication only */
+ if ((iv == NULL) && (opaque == NULL) && (opaque_len == NULL)) {
+
+ /* perform authentication only */
+
+ } else if ((iv == NULL) || (opaque == NULL) || (opaque_len == NULL)) {
+
+ /*
+ * bad parameter - we expect either all three pointers to be NULL,
+ * or none of those pointers to be NULL
+ */
+ return err_status_fail;
+
+ } else {
+
+#if DEBUG
+ printf("NULL DEC using key %s\n", octet_string_hex_string(key, KEY_LEN));
+
+ printf("protected data len: %d\n", *opaque_len);
+ printf("protected data: %s\n",
+ octet_string_hex_string(opaque, *opaque_len));
+#endif
+ auth_tag = opaque;
+ auth_tag += (*opaque_len - NULL_TAG_LEN);
+#if DEBUG
+ printf("iv: %s\n", octet_string_hex_string(iv, IV_LEN));
+#endif
+ *opaque_len -= NULL_TAG_LEN;
+#if DEBUG
+ printf("plaintext len: %d\n", *opaque_len);
+ printf("plaintext: %s\n",
+ octet_string_hex_string(opaque, *opaque_len));
+#endif
+ }
+
+ return err_status_ok;
+}
+
+cryptoalg_ctx_t null_cryptoalg_ctx = {
+ null_enc,
+ null_dec,
+ KEY_LEN,
+ IV_LEN,
+ NULL_TAG_LEN,
+ MAX_EXPAND,
+};
+
+cryptoalg_t null_cryptoalg = &null_cryptoalg_ctx;
+
+int
+cryptoalg_get_id(cryptoalg_t c) {
+ if (c == cryptoalg)
+ return 1;
+ return 0;
+}
+
+cryptoalg_t
+cryptoalg_find_by_id(int id) {
+ switch(id) {
+ case 1:
+ return cryptoalg;
+ default:
+ break;
+ }
+ return 0;
+}
diff --git a/jni/pjproject-android/.svn/pristine/26/26c1fd9aab36d5f17643f99105dfd5dc4a981259.svn-base b/jni/pjproject-android/.svn/pristine/26/26c1fd9aab36d5f17643f99105dfd5dc4a981259.svn-base
new file mode 100644
index 0000000..5bfbe82
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/26/26c1fd9aab36d5f17643f99105dfd5dc4a981259.svn-base
@@ -0,0 +1,161 @@
+Microsoft eMbedded Visual Tools Workspace File, Format Version 4.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "pjlib_util_wince"="..\..\..\pjlib-util\build\wince-evc4\pjlib_util_wince.vcp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "pjlib_wince"="..\..\..\pjlib\build\wince-evc4\pjlib_wince.vcp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "pjmedia_codec_wince"="..\..\..\pjmedia\build\wince-evc4\pjmedia_codec_wince.vcp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "pjmedia_wince"="..\..\..\pjmedia\build\wince-evc4\pjmedia_wince.vcp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "pjnath_wince"="..\..\..\pjnath\build\wince-evc4\pjnath_wince.vcp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "pjsip_core_wince"=".\pjsip_core_wince.vcp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "pjsip_simple_wince"=".\pjsip_simple_wince.vcp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "pjsip_ua_wince"=".\pjsip_ua_wince.vcp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "pjsua_lib_wince"=".\pjsua_lib_wince.vcp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "test_pjsip_wince"=".\test_pjsip_wince.vcp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name pjlib_util_wince
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name pjlib_wince
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name pjsip_core_wince
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name pjsip_simple_wince
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name pjsip_ua_wince
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name pjsua_lib_wince
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name pjnath_wince
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name pjmedia_wince
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/jni/pjproject-android/.svn/pristine/26/26dec76feabf12476609e94bc08cec68cfd66ed4.svn-base b/jni/pjproject-android/.svn/pristine/26/26dec76feabf12476609e94bc08cec68cfd66ed4.svn-base
new file mode 100644
index 0000000..010e52d
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/26/26dec76feabf12476609e94bc08cec68cfd66ed4.svn-base
@@ -0,0 +1,856 @@
+/***********************************************************************
+**
+** ITU-T G.722.1 (2005-05) - Fixed point implementation for main body and Annex C
+** > Software Release 2.1 (2008-06)
+** (Simple repackaging; no change from 2005-05 Release 2.0 code)
+**
+** © 2004 Polycom, Inc.
+**
+** All rights reserved.
+**
+***********************************************************************/
+
+/***********************************************************************
+ Filename: dct4_s.h
+
+ Purpose: Contains tables used by dct4_s.c
+
+ Design Notes:
+
+***********************************************************************/
+
+/***************************************************************************
+ Include files
+***************************************************************************/
+
+typedef struct
+{
+ Word16 cosine;
+ Word16 minus_sine;
+} cos_msin_t;
+
+/***************************************************************************
+ The dct_core_s table was generated by the following code
+
+ for(i=0;i<10;++i)
+ {
+ for(k=0;k<10;++k)
+ {
+ dct_core_s[i][k]=(short) (FTOI(((.9*32768.)*cos(3.1415926*(k+0.5)*(i+0.5)/10.))));
+ }
+ }
+***************************************************************************/
+Word16 dct_core_s[10][10] = {
+{ 29400, 28676, 27246, 25145, 22425, 19153, 15409, 11286, 6885, 2314 },
+{ 28676, 22425, 11286, -2314, -15409, -25145, -29400, -27246, -19153, -6885 },
+{ 27246, 11286, -11286, -27246, -27246, -11286, 11286, 27246, 27246, 11286 },
+{ 25145, -2314, -27246, -22425, 6885, 28676, 19153, -11286, -29400, -15409 },
+{ 22425, -15409, -27246, 6885, 29400, 2314, -28676, -11286, 25145, 19153 },
+{ 19153, -25145, -11286, 28676, 2314, -29400, 6885, 27246, -15409, -22425 },
+{ 15409, -29400, 11286, 19153, -28676, 6885, 22425, -27246, 2314, 25145 },
+{ 11286, -27246, 27246, -11286, -11286, 27246, -27246, 11286, 11286, -27246 },
+{ 6885, -19153, 27246, -29400, 25145, -15409, 2314, 11286, -22425, 28676 },
+{ 2314, -6885, 11286, -15409, 19153, -22425, 25145, -27246, 28676, -29400 }
+};
+
+Word16 syn_bias_7khz[DCT_LENGTH] = {
+ -4, 4, -5, -2, 0, -4, 6, 2, -2, -4,
+ -3, 3, 0, 0, -2, 4, 0, 0, 3, -6,
+ 8, 5, 4, 5, -8, 0, -2, 0, 0, -3,
+ 3, 0, 0, 0, 1, -1, -2, 0, 0, 2,
+ -2, -5, -2, 3, 2, -1, -1, -6, 3, 1,
+ -7, 4, 4, 0, 1, 4, 1, 0, 1, -5,
+ -1, 1, -6, 0, -1, -1, 3, 0, -2, 1,
+ 2, -4, 0, 9, 0, -3, 1, 1, 1, 0,
+ -3, -2, -1, -4, -2, 0, 5, 2, -3, 5,
+ 0, -2, 4, 4, 0, -6, -4, 2, 0, 0,
+ 0, -1, -1, -2, 0, 6, 1, 0, 0, -1,
+ 0, -4, -1, 0, -4, 1, -1, -5, 0, 1,
+ 2, 4, 0, -8, -4, 0, -2, -2, 2, 5,
+ -3, -1, 1, -4, 0, 0, 0, -1, -3, 0,
+ -5, -4, 0, -2, 0, 7, 1, 0, 5, -2,
+ -1, 2, 2, -2, 3, 7, -3, 4, 1, -4,
+ 0, 0, 3, -7, -5, 0, 0, 4, 0, -2,
+ -1, 0, -5, 0, 2, 0, 11, 5, -1, 0,
+ 2, 2, -2, -2, 5, 4, -3, 1, 0, -2,
+ 1, 3, 2, 0, 1, 0, 0, 0, 5, 6,
+ -2, -1, 0, 2, 3, 2, 0, -3, 4, 5,
+ 0, -1, 0, 3, 1, -2, -3, -2, -1, 2,
+ -1, -1, -2, -7, 4, 6, -5, -6, -3, -4,
+ 0, 2, -5, -2, 3, 0, 0, 0, 2, -2,
+ -4, 3, 3, 1, 0, 0, 4, -1, 8, 13,
+ 1, 2, 0, 2, 0, -1, 4, -3, 1, 0,
+ -1, 3, 0, 0, -5, 0, 6, 2, 4, 5,
+ 2, -1, -1, 3, 6, 1, 1, 2, -4, 0,
+ -1, -6, -2, -2, 2, 1, 2, 6, 2, 0,
+ -2, -2, 0, -1, 2, 0, 0, 3, -2, 1,
+ 3, 1, 2, -1, -2, 2, 2, -4, 0, 0,
+ -3, 0, -4, -3, 6, 7, 2, 2, 0, -3};
+
+Word16 dither[DCT_LENGTH]= {
+ 1, 0, 0, 0, 1, 0, 0, 1, 1, 1,
+ 1, 0, 0, 0, 1, 1, 1, 1, 1, 0,
+ 0, 1, 1, 1, 0, 1, 1, 0, 0, 0,
+ 1, 0, 0, 1, 0, 1, 0, 0, 1, 0,
+ 1, 0, 0, 0, 1, 0, 1, 0, 0, 0,
+ 1, 1, 1, 1, 1, 0, 0, 1, 0, 0,
+ 0, 0, 1, 0, 0, 0, 1, 0, 0, 1,
+ 1, 1, 1, 1, 1, 0, 1, 0, 0, 1,
+ 1, 0, 0, 1, 0, 0, 0, 1, 0, 1,
+ 0, 0, 1, 1, 0, 1, 0, 1, 1, 1,
+ 1, 0, 0, 0, 0, 1, 1, 1, 1, 1,
+ 0, 0, 0, 1, 0, 1, 0, 0, 0, 1,
+ 1, 1, 0, 0, 1, 1, 1, 1, 1, 0,
+ 0, 1, 1, 1, 1, 0, 1, 1, 1, 0,
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 1, 1, 1, 1, 0, 0, 0, 0,
+ 1, 1, 0, 1, 0, 0, 1, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 1, 1, 1,
+ 1, 0, 0, 0, 0, 0, 1, 1, 1, 1,
+ 1, 0, 0, 1, 1, 0, 1, 1, 0, 0,
+ 1, 1, 1, 0, 1, 1, 0, 1, 0, 1,
+ 0, 0, 1, 1, 1, 1, 1, 1, 0, 1,
+ 0, 1, 1, 1, 1, 0, 1, 1, 1, 0,
+ 1, 1, 1, 0, 1, 1, 1, 0, 1, 0,
+ 1, 1, 0, 0, 1, 0, 0, 1, 0, 1,
+ 0, 1, 1, 0, 1, 0, 1, 0, 1, 1,
+ 1, 0, 1, 0, 1, 0, 1, 1, 1, 1,
+ 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 1, 0, 0, 0, 1, 0, 0, 1, 0, 1,
+ 1, 0, 1, 1, 0, 0, 1, 1, 0, 1,
+ 1, 0, 1, 1, 1, 1, 1, 1, 0, 1,
+ 1, 1, 1, 0, 1, 0, 0, 0, 1, 0};
+
+Word16 max_dither[MAX_DCT_LENGTH]= {
+ 1, 0, 1, 0, 1, 1, 0, 1, 0, 1,
+ 1, 1, 0, 0, 0, 0, 0, 1, 1, 1,
+ 1, 1, 1, 0, 1, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 0, 1, 0, 1, 1, 1, 1,
+ 0, 1, 0, 1, 1, 1, 1, 1, 1, 0,
+ 1, 0, 1, 1, 0, 1, 0, 0, 0, 1,
+ 0, 1, 1, 1, 1, 1, 0, 1, 1, 0,
+ 0, 0, 1, 1, 0, 0, 0, 1, 1, 1,
+ 1, 0, 1, 1, 1, 1, 1, 0, 0, 0,
+ 1, 0, 1, 0, 1, 0, 0, 0, 1, 1,
+ 0, 1, 1, 1, 1, 1, 1, 0, 1, 0,
+ 0, 0, 1, 0, 1, 0, 0, 0, 1, 0,
+ 0, 1, 0, 1, 0, 0, 0, 0, 1, 0,
+ 1, 0, 0, 1, 0, 1, 0, 0, 0, 1,
+ 0, 1, 0, 0, 1, 1, 1, 1, 0, 1,
+ 1, 0, 0, 0, 1, 1, 0, 1, 0, 1,
+ 0, 1, 0, 1, 0, 1, 1, 1, 0, 1,
+ 1, 0, 0, 1, 1, 1, 1, 0, 1, 1,
+ 1, 1, 1, 0, 1, 1, 0, 0, 0, 0,
+ 1, 0, 1, 0, 0, 0, 0, 1, 1, 0,
+ 1, 1, 0, 0, 0, 0, 1, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+ 0, 0, 1, 1, 1, 0, 1, 1, 1, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 0, 0,
+ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
+ 0, 0, 1, 1, 0, 1, 0, 1, 0, 1,
+ 0, 0, 1, 1, 1, 1, 1, 1, 0, 1,
+ 0, 1, 1, 1, 0, 1, 0, 1, 0, 0,
+ 0, 1, 0, 1, 1, 0, 0, 0, 1, 0,
+ 1, 1, 0, 0, 1, 1, 1, 1, 0, 0,
+ 0, 0, 1, 1, 1, 1, 0, 0, 1, 1,
+ 1, 1, 1, 0, 1, 0, 0, 0, 1, 0,
+ 0, 1, 1, 1, 0, 1, 0, 1, 0, 0,
+ 1, 1, 0, 1, 0, 1, 1, 0, 0, 0,
+ 0, 1, 1, 0, 1, 1, 1, 0, 1, 1,
+ 0, 0, 1, 1, 1, 1, 1, 1, 0, 1,
+ 1, 1, 0, 0, 0, 1, 1, 1, 1, 0,
+ 0, 1, 0, 1, 0, 1, 1, 0, 1, 0,
+ 1, 1, 1, 0, 0, 1, 1, 0, 0, 1,
+ 0, 1, 0, 0, 0, 1, 1, 0, 0, 1,
+ 0, 0, 1, 1, 0, 1, 0, 1, 0, 1,
+ 1, 1, 0, 1, 0, 0, 1, 1, 0, 0,
+ 1, 0, 1, 0, 1, 0, 0, 1, 0, 0,
+ 0, 1, 0, 1, 1, 1, 1, 1, 1, 0,
+ 0, 1, 1, 0, 0, 0, 1, 1, 1, 0,
+ 1, 1, 1, 0, 1, 1, 1, 0, 0, 0,
+ 0, 0, 1, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 1, 0, 1,
+ 1, 1, 1, 1, 0, 0, 1, 0, 1, 0,
+ 0, 1, 0, 1, 1, 1, 1, 1, 1, 0,
+ 0, 0, 1, 0, 1, 0, 0, 1, 0, 1,
+ 1, 0, 1, 0, 1, 1, 0, 0, 1, 1,
+ 1, 1, 1, 0, 1, 0, 0, 1, 1, 1,
+ 0, 1, 0, 1, 0, 1, 0, 0, 0, 1,
+ 1, 0, 0, 1, 0, 0, 1, 1, 0, 1,
+ 1, 0, 1, 0, 1, 1, 0, 0, 1, 1,
+ 0, 0, 0, 1, 0, 1, 1, 1, 0, 0,
+ 1, 0, 1, 0, 1, 1, 0, 0, 0, 1,
+ 1, 0, 1, 0, 0, 1, 1, 1, 0, 1,
+ 0, 0, 1, 1, 1, 1, 1, 0, 0, 0,
+ 0, 1, 0, 1, 0, 0, 1, 0, 1, 0,
+ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0,
+ 0, 1, 0, 1, 0, 1, 0, 0, 0, 0
+};
+
+
+/********************************************************************************
+ The s_cos_min tables were generated by the following code:
+ double angle, scale;
+ int index;
+
+ for (index = 0;index < length;index++)
+ {
+ angle = scale * ((double)index + 0.5);
+ table[index].cosine = (short) (FTOI((18427)* cos(angle)));
+ table[index].minus_sine = (short) (FTOI((18427)*(-sin(angle))));
+ }
+
+
+********************************************************************************/
+
+cos_msin_t s_cos_msin_2[DCT_LENGTH_DIV_32] = {
+ { 18413 , -723 } ,
+ { 18299 , -2166 } ,
+ { 18073 , -3595 } ,
+ { 17735 , -5002 } ,
+ { 17288 , -6378 } ,
+ { 16734 , -7715 } ,
+ { 16077 , -9004 } ,
+ { 15321 , -10237 } ,
+ { 14471 , -11408 } ,
+ { 13531 , -12508 }
+ };
+cos_msin_t s_cos_msin_4[DCT_LENGTH_DIV_16] = {
+ { 18423 , -362 } ,
+ { 18395 , -1085 } ,
+ { 18338 , -1806 } ,
+ { 18253 , -2525 } ,
+ { 18140 , -3239 } ,
+ { 17999 , -3949 } ,
+ { 17830 , -4653 } ,
+ { 17634 , -5349 } ,
+ { 17410 , -6037 } ,
+ { 17159 , -6716 } ,
+ { 16883 , -7385 } ,
+ { 16580 , -8042 } ,
+ { 16251 , -8686 } ,
+ { 15898 , -9318 } ,
+ { 15520 , -9935 } ,
+ { 15118 , -10536 } ,
+ { 14692 , -11122 } ,
+ { 14244 , -11690 } ,
+ { 13774 , -12240 } ,
+ { 13283 , -12772 }
+ };
+cos_msin_t s_cos_msin_8[DCT_LENGTH_DIV_8] = {
+ { 18426 , -181 } ,
+ { 18419 , -543 } ,
+ { 18405 , -904 } ,
+ { 18384 , -1265 } ,
+ { 18355 , -1626 } ,
+ { 18320 , -1986 } ,
+ { 18277 , -2345 } ,
+ { 18228 , -2704 } ,
+ { 18171 , -3061 } ,
+ { 18107 , -3417 } ,
+ { 18037 , -3772 } ,
+ { 17959 , -4126 } ,
+ { 17875 , -4477 } ,
+ { 17783 , -4827 } ,
+ { 17685 , -5176 } ,
+ { 17580 , -5522 } ,
+ { 17468 , -5866 } ,
+ { 17350 , -6208 } ,
+ { 17225 , -6547 } ,
+ { 17093 , -6884 } ,
+ { 16954 , -7219 } ,
+ { 16809 , -7550 } ,
+ { 16658 , -7879 } ,
+ { 16500 , -8204 } ,
+ { 16336 , -8526 } ,
+ { 16165 , -8846 } ,
+ { 15988 , -9161 } ,
+ { 15805 , -9473 } ,
+ { 15616 , -9782 } ,
+ { 15421 , -10087 } ,
+ { 15220 , -10387 } ,
+ { 15013 , -10684 } ,
+ { 14801 , -10977 } ,
+ { 14582 , -11265 } ,
+ { 14358 , -11550 } ,
+ { 14129 , -11829 } ,
+ { 13894 , -12104 } ,
+ { 13654 , -12375 } ,
+ { 13408 , -12641 } ,
+ { 13157 , -12901 }
+ };
+cos_msin_t s_cos_msin_16[DCT_LENGTH_DIV_4] = {
+ { 18427 , -90 } ,
+ { 18425 , -271 } ,
+ { 18421 , -452 } ,
+ { 18416 , -633 } ,
+ { 18409 , -814 } ,
+ { 18400 , -995 } ,
+ { 18389 , -1175 } ,
+ { 18377 , -1356 } ,
+ { 18363 , -1536 } ,
+ { 18347 , -1716 } ,
+ { 18329 , -1896 } ,
+ { 18310 , -2076 } ,
+ { 18288 , -2256 } ,
+ { 18265 , -2435 } ,
+ { 18241 , -2614 } ,
+ { 18214 , -2793 } ,
+ { 18186 , -2972 } ,
+ { 18156 , -3150 } ,
+ { 18124 , -3328 } ,
+ { 18090 , -3506 } ,
+ { 18055 , -3684 } ,
+ { 18018 , -3861 } ,
+ { 17979 , -4037 } ,
+ { 17939 , -4214 } ,
+ { 17897 , -4390 } ,
+ { 17853 , -4565 } ,
+ { 17807 , -4740 } ,
+ { 17760 , -4915 } ,
+ { 17710 , -5089 } ,
+ { 17660 , -5262 } ,
+ { 17607 , -5436 } ,
+ { 17553 , -5608 } ,
+ { 17497 , -5780 } ,
+ { 17439 , -5952 } ,
+ { 17380 , -6123 } ,
+ { 17319 , -6293 } ,
+ { 17257 , -6463 } ,
+ { 17192 , -6632 } ,
+ { 17126 , -6800 } ,
+ { 17059 , -6968 } ,
+ { 16990 , -7135 } ,
+ { 16919 , -7302 } ,
+ { 16846 , -7467 } ,
+ { 16772 , -7632 } ,
+ { 16696 , -7797 } ,
+ { 16619 , -7960 } ,
+ { 16540 , -8123 } ,
+ { 16459 , -8285 } ,
+ { 16377 , -8446 } ,
+ { 16294 , -8607 } ,
+ { 16208 , -8766 } ,
+ { 16121 , -8925 } ,
+ { 16033 , -9083 } ,
+ { 15943 , -9240 } ,
+ { 15852 , -9396 } ,
+ { 15759 , -9551 } ,
+ { 15664 , -9705 } ,
+ { 15568 , -9858 } ,
+ { 15471 , -10011 } ,
+ { 15372 , -10162 } ,
+ { 15271 , -10313 } ,
+ { 15169 , -10462 } ,
+ { 15066 , -10610 } ,
+ { 14961 , -10758 } ,
+ { 14854 , -10904 } ,
+ { 14747 , -11049 } ,
+ { 14637 , -11194 } ,
+ { 14527 , -11337 } ,
+ { 14415 , -11479 } ,
+ { 14301 , -11620 } ,
+ { 14187 , -11760 } ,
+ { 14071 , -11898 } ,
+ { 13953 , -12036 } ,
+ { 13834 , -12172 } ,
+ { 13714 , -12308 } ,
+ { 13593 , -12442 } ,
+ { 13470 , -12575 } ,
+ { 13346 , -12706 } ,
+ { 13220 , -12837 } ,
+ { 13094 , -12966 }
+ };
+cos_msin_t s_cos_msin_32[DCT_LENGTH_DIV_2] = {
+ { 18427 , -45 } ,
+ { 18427 , -136 } ,
+ { 18426 , -226 } ,
+ { 18424 , -317 } ,
+ { 18423 , -407 } ,
+ { 18420 , -497 } ,
+ { 18418 , -588 } ,
+ { 18415 , -678 } ,
+ { 18411 , -769 } ,
+ { 18407 , -859 } ,
+ { 18403 , -949 } ,
+ { 18398 , -1040 } ,
+ { 18392 , -1130 } ,
+ { 18387 , -1220 } ,
+ { 18380 , -1310 } ,
+ { 18374 , -1401 } ,
+ { 18367 , -1491 } ,
+ { 18359 , -1581 } ,
+ { 18351 , -1671 } ,
+ { 18343 , -1761 } ,
+ { 18334 , -1851 } ,
+ { 18324 , -1941 } ,
+ { 18315 , -2031 } ,
+ { 18305 , -2121 } ,
+ { 18294 , -2211 } ,
+ { 18283 , -2301 } ,
+ { 18271 , -2390 } ,
+ { 18259 , -2480 } ,
+ { 18247 , -2570 } ,
+ { 18234 , -2659 } ,
+ { 18221 , -2749 } ,
+ { 18207 , -2838 } ,
+ { 18193 , -2927 } ,
+ { 18178 , -3017 } ,
+ { 18163 , -3106 } ,
+ { 18148 , -3195 } ,
+ { 18132 , -3284 } ,
+ { 18116 , -3373 } ,
+ { 18099 , -3462 } ,
+ { 18082 , -3551 } ,
+ { 18064 , -3639 } ,
+ { 18046 , -3728 } ,
+ { 18027 , -3816 } ,
+ { 18009 , -3905 } ,
+ { 17989 , -3993 } ,
+ { 17969 , -4081 } ,
+ { 17949 , -4170 } ,
+ { 17928 , -4258 } ,
+ { 17907 , -4346 } ,
+ { 17886 , -4434 } ,
+ { 17864 , -4521 } ,
+ { 17841 , -4609 } ,
+ { 17818 , -4696 } ,
+ { 17795 , -4784 } ,
+ { 17772 , -4871 } ,
+ { 17747 , -4958 } ,
+ { 17723 , -5045 } ,
+ { 17698 , -5132 } ,
+ { 17672 , -5219 } ,
+ { 17647 , -5306 } ,
+ { 17620 , -5392 } ,
+ { 17594 , -5479 } ,
+ { 17567 , -5565 } ,
+ { 17539 , -5651 } ,
+ { 17511 , -5737 } ,
+ { 17483 , -5823 } ,
+ { 17454 , -5909 } ,
+ { 17425 , -5994 } ,
+ { 17395 , -6080 } ,
+ { 17365 , -6165 } ,
+ { 17335 , -6250 } ,
+ { 17304 , -6335 } ,
+ { 17272 , -6420 } ,
+ { 17241 , -6505 } ,
+ { 17208 , -6590 } ,
+ { 17176 , -6674 } ,
+ { 17143 , -6758 } ,
+ { 17110 , -6842 } ,
+ { 17076 , -6926 } ,
+ { 17042 , -7010 } ,
+ { 17007 , -7093 } ,
+ { 16972 , -7177 } ,
+ { 16937 , -7260 } ,
+ { 16901 , -7343 } ,
+ { 16864 , -7426 } ,
+ { 16828 , -7509 } ,
+ { 16791 , -7591 } ,
+ { 16753 , -7674 } ,
+ { 16715 , -7756 } ,
+ { 16677 , -7838 } ,
+ { 16638 , -7919 } ,
+ { 16599 , -8001 } ,
+ { 16560 , -8082 } ,
+ { 16520 , -8164 } ,
+ { 16480 , -8245 } ,
+ { 16439 , -8325 } ,
+ { 16398 , -8406 } ,
+ { 16357 , -8486 } ,
+ { 16315 , -8567 } ,
+ { 16272 , -8647 } ,
+ { 16230 , -8726 } ,
+ { 16187 , -8806 } ,
+ { 16143 , -8885 } ,
+ { 16100 , -8964 } ,
+ { 16055 , -9043 } ,
+ { 16011 , -9122 } ,
+ { 15966 , -9200 } ,
+ { 15920 , -9279 } ,
+ { 15875 , -9357 } ,
+ { 15829 , -9435 } ,
+ { 15782 , -9512 } ,
+ { 15735 , -9589 } ,
+ { 15688 , -9667 } ,
+ { 15640 , -9744 } ,
+ { 15592 , -9820 } ,
+ { 15544 , -9897 } ,
+ { 15495 , -9973 } ,
+ { 15446 , -10049 } ,
+ { 15396 , -10124 } ,
+ { 15347 , -10200 } ,
+ { 15296 , -10275 } ,
+ { 15246 , -10350 } ,
+ { 15195 , -10425 } ,
+ { 15143 , -10499 } ,
+ { 15092 , -10573 } ,
+ { 15040 , -10647 } ,
+ { 14987 , -10721 } ,
+ { 14934 , -10794 } ,
+ { 14881 , -10868 } ,
+ { 14828 , -10941 } ,
+ { 14774 , -11013 } ,
+ { 14719 , -11086 } ,
+ { 14665 , -11158 } ,
+ { 14610 , -11230 } ,
+ { 14555 , -11301 } ,
+ { 14499 , -11372 } ,
+ { 14443 , -11444 } ,
+ { 14387 , -11514 } ,
+ { 14330 , -11585 } ,
+ { 14273 , -11655 } ,
+ { 14216 , -11725 } ,
+ { 14158 , -11795 } ,
+ { 14100 , -11864 } ,
+ { 14041 , -11933 } ,
+ { 13983 , -12002 } ,
+ { 13924 , -12070 } ,
+ { 13864 , -12138 } ,
+ { 13804 , -12206 } ,
+ { 13744 , -12274 } ,
+ { 13684 , -12341 } ,
+ { 13623 , -12408 } ,
+ { 13562 , -12475 } ,
+ { 13501 , -12541 } ,
+ { 13439 , -12608 } ,
+ { 13377 , -12673 } ,
+ { 13314 , -12739 } ,
+ { 13252 , -12804 } ,
+ { 13189 , -12869 } ,
+ { 13125 , -12934 } ,
+ { 13062 , -12998 }
+ };
+cos_msin_t s_cos_msin_64[DCT_LENGTH] = {
+{18426, -21},
+{18426, -66},
+{18426, -110},
+{18426, -154},
+{18425, -198},
+{18425, -242},
+{18424, -286},
+{18424, -331},
+{18423, -374},
+{18421, -419},
+{18421, -463},
+{18419, -507},
+{18418, -552},
+{18417, -595},
+{18415, -639},
+{18414, -684},
+{18412, -728},
+{18410, -772},
+{18408, -816},
+{18406, -860},
+{18404, -904},
+{18402, -949},
+{18400, -992},
+{18397, -1037},
+{18394, -1081},
+{18392, -1125},
+{18389, -1169},
+{18387, -1213},
+{18384, -1257},
+{18380, -1301},
+{18378, -1345},
+{18374, -1389},
+{18371, -1433},
+{18367, -1477},
+{18364, -1521},
+{18360, -1566},
+{18356, -1609},
+{18352, -1653},
+{18348, -1697},
+{18344, -1742},
+{18339, -1785},
+{18335, -1829},
+{18331, -1873},
+{18326, -1917},
+{18322, -1961},
+{18317, -2005},
+{18312, -2049},
+{18307, -2092},
+{18302, -2137},
+{18297, -2180},
+{18292, -2224},
+{18286, -2268},
+{18281, -2312},
+{18275, -2356},
+{18270, -2399},
+{18264, -2443},
+{18258, -2487},
+{18252, -2531},
+{18246, -2574},
+{18240, -2618},
+{18233, -2662},
+{18227, -2706},
+{18220, -2749},
+{18214, -2793},
+{18207, -2836},
+{18200, -2880},
+{18193, -2924},
+{18186, -2967},
+{18179, -3011},
+{18172, -3055},
+{18164, -3098},
+{18157, -3142},
+{18149, -3185},
+{18141, -3229},
+{18134, -3272},
+{18126, -3316},
+{18118, -3359},
+{18109, -3403},
+{18101, -3446},
+{18094, -3489},
+{18085, -3533},
+{18076, -3576},
+{18068, -3619},
+{18059, -3663},
+{18050, -3706},
+{18041, -3749},
+{18032, -3792},
+{18023, -3836},
+{18014, -3879},
+{18005, -3922},
+{17995, -3965},
+{17986, -4008},
+{17975, -4051},
+{17966, -4094},
+{17956, -4138},
+{17946, -4180},
+{17936, -4224},
+{17926, -4266},
+{17916, -4309},
+{17905, -4353},
+{17895, -4395},
+{17884, -4438},
+{17874, -4481},
+{17863, -4524},
+{17852, -4567},
+{17841, -4609},
+{17830, -4652},
+{17819, -4695},
+{17807, -4738},
+{17796, -4780},
+{17784, -4823},
+{17772, -4865},
+{17761, -4908},
+{17749, -4951},
+{17738, -4993},
+{17725, -5036},
+{17713, -5078},
+{17701, -5121},
+{17689, -5163},
+{17676, -5205},
+{17664, -5248},
+{17651, -5290},
+{17638, -5333},
+{17626, -5375},
+{17613, -5417},
+{17599, -5459},
+{17586, -5501},
+{17573, -5544},
+{17560, -5586},
+{17546, -5627},
+{17533, -5670},
+{17519, -5712},
+{17505, -5753},
+{17492, -5795},
+{17478, -5837},
+{17464, -5879},
+{17450, -5921},
+{17435, -5963},
+{17421, -6005},
+{17406, -6046},
+{17392, -6088},
+{17377, -6130},
+{17363, -6172},
+{17348, -6213},
+{17333, -6254},
+{17318, -6296},
+{17303, -6338},
+{17288, -6379},
+{17272, -6420},
+{17257, -6462},
+{17241, -6503},
+{17225, -6545},
+{17210, -6586},
+{17194, -6627},
+{17178, -6668},
+{17162, -6709},
+{17145, -6750},
+{17130, -6791},
+{17113, -6832},
+{17097, -6874},
+{17080, -6915},
+{17064, -6956},
+{17047, -6996},
+{17030, -7037},
+{17013, -7078},
+{16996, -7119},
+{16979, -7159},
+{16962, -7200},
+{16945, -7241},
+{16927, -7281},
+{16910, -7322},
+{16892, -7362},
+{16874, -7403},
+{16856, -7444},
+{16838, -7484},
+{16821, -7524},
+{16802, -7564},
+{16784, -7605},
+{16766, -7645},
+{16748, -7685},
+{16729, -7725},
+{16711, -7765},
+{16692, -7805},
+{16674, -7845},
+{16654, -7885},
+{16635, -7925},
+{16616, -7964},
+{16597, -8004},
+{16578, -8044},
+{16559, -8084},
+{16539, -8124},
+{16520, -8164},
+{16500, -8203},
+{16480, -8242},
+{16461, -8282},
+{16441, -8322},
+{16421, -8361},
+{16401, -8400},
+{16380, -8440},
+{16360, -8479},
+{16340, -8518},
+{16319, -8557},
+{16299, -8597},
+{16278, -8635},
+{16257, -8674},
+{16237, -8713},
+{16215, -8752},
+{16195, -8791},
+{16173, -8829},
+{16152, -8868},
+{16131, -8907},
+{16110, -8946},
+{16088, -8985},
+{16067, -9023},
+{16045, -9061},
+{16023, -9100},
+{16001, -9138},
+{15979, -9176},
+{15957, -9215},
+{15935, -9253},
+{15913, -9291},
+{15891, -9329},
+{15868, -9367},
+{15846, -9405},
+{15823, -9443},
+{15800, -9481},
+{15778, -9519},
+{15755, -9557},
+{15732, -9595},
+{15709, -9632},
+{15686, -9670},
+{15662, -9708},
+{15639, -9745},
+{15615, -9782},
+{15592, -9820},
+{15569, -9857},
+{15544, -9894},
+{15521, -9932},
+{15497, -9969},
+{15473, -10006},
+{15449, -10043},
+{15425, -10080},
+{15401, -10117},
+{15377, -10154},
+{15352, -10191},
+{15327, -10227},
+{15303, -10264},
+{15278, -10301},
+{15254, -10337},
+{15229, -10374},
+{15204, -10411},
+{15180, -10447},
+{15154, -10483},
+{15129, -10519},
+{15104, -10556},
+{15078, -10592},
+{15053, -10628},
+{15027, -10664},
+{15002, -10700},
+{14976, -10736},
+{14950, -10772},
+{14924, -10808},
+{14898, -10844},
+{14872, -10879},
+{14846, -10915},
+{14820, -10950},
+{14794, -10985},
+{14767, -11021},
+{14741, -11056},
+{14714, -11092},
+{14687, -11127},
+{14661, -11162},
+{14635, -11197},
+{14607, -11232},
+{14581, -11267},
+{14554, -11302},
+{14526, -11337},
+{14499, -11372},
+{14472, -11407},
+{14444, -11441},
+{14417, -11476},
+{14389, -11511},
+{14362, -11545},
+{14334, -11579},
+{14306, -11614},
+{14278, -11648},
+{14251, -11682},
+{14222, -11716},
+{14194, -11750},
+{14166, -11784},
+{14137, -11818},
+{14109, -11852},
+{14081, -11886},
+{14053, -11919},
+{14023, -11953},
+{13995, -11987},
+{13966, -12020},
+{13937, -12054},
+{13909, -12087},
+{13879, -12120},
+{13851, -12153},
+{13821, -12187},
+{13792, -12220},
+{13763, -12253},
+{13733, -12286},
+{13704, -12319},
+{13674, -12351},
+{13645, -12385},
+{13615, -12417},
+{13585, -12450},
+{13555, -12482},
+{13525, -12514},
+{13495, -12546},
+{13465, -12579},
+{13435, -12611},
+{13405, -12644},
+{13374, -12676},
+{13345, -12708},
+{13314, -12739},
+{13283, -12772}
+};
+
+
+
+cos_msin_t *s_cos_msin_table[] = {s_cos_msin_2, s_cos_msin_4,
+ s_cos_msin_8, s_cos_msin_16,
+ s_cos_msin_32, s_cos_msin_64
+ };
+
diff --git a/jni/pjproject-android/.svn/pristine/26/26ed7be6a579fd650294ea13c65e4b32418bba15.svn-base b/jni/pjproject-android/.svn/pristine/26/26ed7be6a579fd650294ea13c65e4b32418bba15.svn-base
new file mode 100644
index 0000000..f8c68be
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/26/26ed7be6a579fd650294ea13c65e4b32418bba15.svn-base
@@ -0,0 +1,74 @@
+/* $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
+ */
+#ifndef __PJLIB_UTIL_MD5_H__
+#define __PJLIB_UTIL_MD5_H__
+
+/**
+ * @file md5.h
+ * @brief MD5 Functions
+ */
+
+#include <pj/types.h>
+
+PJ_BEGIN_DECL
+
+/**
+ * @defgroup PJLIB_UTIL_MD5 MD5
+ * @ingroup PJLIB_UTIL_ENCRYPTION
+ * @{
+ */
+
+
+/** MD5 context. */
+typedef struct pj_md5_context
+{
+ pj_uint32_t buf[4]; /**< buf */
+ pj_uint32_t bits[2]; /**< bits */
+ pj_uint8_t in[64]; /**< in */
+} pj_md5_context;
+
+/** Initialize the algorithm.
+ * @param pms MD5 context.
+ */
+PJ_DECL(void) pj_md5_init(pj_md5_context *pms);
+
+/** Append a string to the message.
+ * @param pms MD5 context.
+ * @param data Data.
+ * @param nbytes Length of data.
+ */
+PJ_DECL(void) pj_md5_update( pj_md5_context *pms,
+ const pj_uint8_t *data, unsigned nbytes);
+
+/** Finish the message and return the digest.
+ * @param pms MD5 context.
+ * @param digest 16 byte digest.
+ */
+PJ_DECL(void) pj_md5_final(pj_md5_context *pms, pj_uint8_t digest[16]);
+
+
+/**
+ * @}
+ */
+
+PJ_END_DECL
+
+
+#endif /* __PJLIB_UTIL_MD5_H__ */