src/org/sipdroid/pjlib/Codec.java
changeset 836 2f2f5e24ac6a
equal deleted inserted replaced
835:4e40f3481f23 836:2f2f5e24ac6a
       
     1 /*
       
     2  * Copyright (C) 2009 The Sipdroid Open Source Project
       
     3  * 
       
     4  * This file is part of Sipdroid (http://www.sipdroid.org)
       
     5  * 
       
     6  * Sipdroid is free software; you can redistribute it and/or modify
       
     7  * it under the terms of the GNU General Public License as published by
       
     8  * the Free Software Foundation; either version 3 of the License, or
       
     9  * (at your option) any later version.
       
    10  * 
       
    11  * This source code is distributed in the hope that it will be useful,
       
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    14  * GNU General Public License for more details.
       
    15  * 
       
    16  * You should have received a copy of the GNU General Public License
       
    17  * along with this source code; if not, write to the Free Software
       
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    19  */
       
    20 package org.sipdroid.pjlib;
       
    21 
       
    22 import java.lang.String;
       
    23 
       
    24 public class Codec {
       
    25     public static native int open(String codec_id);
       
    26     public static native int decode(byte alaw[], short lin[], int frames);
       
    27     public static native int encode(short lin[], int offset, byte alaw[], int frames);
       
    28     public static native int close();
       
    29 
       
    30     public static void init() {
       
    31     }
       
    32 
       
    33     public static boolean loaded;
       
    34 
       
    35     static {
       
    36 	try {
       
    37 	    System.loadLibrary("pjlib_linker_jni");
       
    38 	    open("gsm");
       
    39 	    loaded = true;
       
    40 	} catch (Throwable e) {
       
    41 	    e.printStackTrace();
       
    42 	}
       
    43     }
       
    44 }