decoder.java

来自「用jxse开发的一个p2p通讯软件 有聊天 文件共享 视频3大功能」· Java 代码 · 共 63 行

JAVA
63
字号
/* * Created on Oct 18, 2004 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */package net.jxta.myjxta.plugins.vojxta;import org.xiph.speex.SpeexDecoder;import java.io.StreamCorruptedException;/** * @author Ravi * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */public final class Decoder{    private final SpeexDecoder decoder;    	public static void main(String[] args) {	}	/**	 * 	 */	public Decoder() {        		super();        		decoder = new SpeexDecoder();        		decoder.init(AudioResource.MODE, AudioResource.SAMPLE_RATE, AudioResource.CHANNELS, false);	// boolean enhanced = false	}		/**	 * 	 * @param buf	 * @return speex decoded byte array	 */	public byte[] decode(byte[] buf){        		try {            			decoder.processData(buf, 0, buf.length);            		} catch (StreamCorruptedException e) {            			e.printStackTrace();            		}		byte[] decoded = new byte[decoder.getProcessedDataByteSize()];        		decoder.getProcessedData(decoded, 0);				return decoded;	}		}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?