你好,游客 登录 注册 搜索
背景:
阅读新闻

Speex编解码在Android上实现

[日期:2012-09-25] 来源:Linux社区  作者:xyz_lmn [字体:大 中 小]

8.在Java层创建Speex工具类,内容如下:

  1. package com.trunkbow.speextest;  
  2.   
  3. public class Speex {  
  4.      /* quality  
  5.      * 1 : 4kbps (very noticeable artifacts, usually intelligible)  
  6.      * 2 : 6kbps (very noticeable artifacts, good intelligibility)  
  7.      * 4 : 8kbps (noticeable artifacts sometimes)  
  8.      * 6 : 11kpbs (artifacts usually only noticeable with headphones)  
  9.      * 8 : 15kbps (artifacts not usually noticeable)  
  10.      */    
  11.     private static final int DEFAULT_COMPRESSION = 8;     
  12.         
  13.     Speex() {    
  14.     }    
  15.     
  16.     public void init() {    
  17.         load();     
  18.         open(DEFAULT_COMPRESSION);     
  19.     }    
  20.         
  21.     private void load() {    
  22.         try {    
  23.             System.loadLibrary("speex");    
  24.         } catch (Throwable e) {    
  25.             e.printStackTrace();    
  26.         }    
  27.     
  28.     }    
  29.     
  30.     public native int open(int compression);    
  31.     public native int getFrameSize();    
  32.     public native int decode(byte encoded[], short lin[], int size);    
  33.     public native int encode(short lin[], int offset, byte encoded[], int size);    
  34.     public native void close();    
  35. }  

9、使用cygwin编译,生成so文件。

参考:

点击这里这个是一个Android recorder ,使用speex编码。

linux
相关资讯       Android开发入门教程  Speex 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款