亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? decoder.java

?? Java編寫的一個mp3播放器源代碼,對于想做這方面工作的網友來說還是有很大的參考價值的
?? JAVA
字號:
/*
 * 11/19/04		1.0 moved to LGPL.
 * 01/12/99		Initial version.	mdm@techie.com
 *-----------------------------------------------------------------------
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Library 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 Library General Public License for more details.
 *
 *   You should have received a copy of the GNU Library General Public
 *   License along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *----------------------------------------------------------------------
 */
 
package javazoom.jl.decoder;

/**
 * The <code>Decoder</code> class encapsulates the details of
 * decoding an MPEG audio frame. 
 * 
 * @author	MDM	
 * @version 0.0.7 12/12/99
 * @since	0.0.5
 */
public class Decoder implements DecoderErrors
{
	static private final Params DEFAULT_PARAMS = new Params();
	
	/**
	 * The Bistream from which the MPEG audio frames are read.
	 */
	//private Bitstream				stream;
	
	/**
	 * The Obuffer instance that will receive the decoded
	 * PCM samples.
	 */
	private Obuffer			output;
		
	/**
	 * Synthesis filter for the left channel.
	 */
	private SynthesisFilter			filter1;
	
	/**
	 * Sythesis filter for the right channel.
	 */
	private SynthesisFilter			filter2;	
			
	/**
	 * The decoder used to decode layer III frames.
	 */
	private LayerIIIDecoder			l3decoder;
	private LayerIIDecoder			l2decoder;
	private LayerIDecoder			l1decoder;
	
	private int						outputFrequency;
	private int						outputChannels;
	
	private Equalizer				equalizer = new Equalizer();
	
	private Params					params;
	
	private boolean					initialized;
		
	
	/**
	 * Creates a new <code>Decoder</code> instance with default 
	 * parameters.
	 */
	
	public Decoder()
	{
		this(null);
	}

	/**
	 * Creates a new <code>Decoder</code> instance with default 
	 * parameters.
	 * 
	 * @param params	The <code>Params</code> instance that describes
	 *					the customizable aspects of the decoder.  
	 */
	public Decoder(Params params0)
	{
		if (params0==null)
			params0 = DEFAULT_PARAMS;
	
		params = params0;
		
		Equalizer eq = params.getInitialEqualizerSettings();
		if (eq!=null)
		{
			equalizer.setFrom(eq);
		}
	}
	
	static public Params getDefaultParams()
	{
		return (Params)DEFAULT_PARAMS.clone();
	}
	
	public void setEqualizer(Equalizer eq)
	{
		if (eq==null)
			eq = Equalizer.PASS_THRU_EQ;
		
		equalizer.setFrom(eq);
		
		float[] factors = equalizer.getBandFactors();

		if (filter1!=null)
			filter1.setEQ(factors);
		
		if (filter2!=null)
			filter2.setEQ(factors);			
	}
	
	/**
	 * Decodes one frame from an MPEG audio bitstream.
	 * 
	 * @param header		The header describing the frame to decode.
	 * @param bitstream		The bistream that provides the bits for te body of the frame. 
	 * 
	 * @return A SampleBuffer containing the decoded samples.
	 */
	public Obuffer decodeFrame(Header header, Bitstream stream)
		throws DecoderException
	{
		if (!initialized)
		{
			initialize(header);
		}
		
		int layer = header.layer();
		
		output.clear_buffer();
		
		FrameDecoder decoder = retrieveDecoder(header, stream, layer);
		
		decoder.decodeFrame();
				
		output.write_buffer(1);
		
		return output;	
	}
	
	/**
	 * Changes the output buffer. This will take effect the next time
	 * decodeFrame() is called. 
	 */
	public void setOutputBuffer(Obuffer out)
	{
		output = out;
	}
	
	/**
	 * Retrieves the sample frequency of the PCM samples output
	 * by this decoder. This typically corresponds to the sample
	 * rate encoded in the MPEG audio stream.
	 * 
	 * @param the sample rate (in Hz) of the samples written to the
	 *		output buffer when decoding. 
	 */
	public int getOutputFrequency()
	{
		return outputFrequency;
	}
	
	/**
	 * Retrieves the number of channels of PCM samples output by
	 * this decoder. This usually corresponds to the number of
	 * channels in the MPEG audio stream, although it may differ.
	 * 
	 * @return The number of output channels in the decoded samples: 1 
	 *		for mono, or 2 for stereo.
	 *		
	 */
	public int getOutputChannels()
	{
		return outputChannels;	
	}
	
	/**
	 * Retrieves the maximum number of samples that will be written to
	 * the output buffer when one frame is decoded. This can be used to
	 * help calculate the size of other buffers whose size is based upon 
	 * the number of samples written to the output buffer. NB: this is
	 * an upper bound and fewer samples may actually be written, depending
	 * upon the sample rate and number of channels.
	 * 
	 * @return The maximum number of samples that are written to the 
	 *		output buffer when decoding a single frame of MPEG audio.
	 */
	public int getOutputBlockSize()
	{
		return Obuffer.OBUFFERSIZE;
	}
	
	
	protected DecoderException newDecoderException(int errorcode)
	{
		return new DecoderException(errorcode, null);
	}
	
	protected DecoderException newDecoderException(int errorcode, Throwable throwable)
	{
		return new DecoderException(errorcode, throwable);
	}
	
	protected FrameDecoder retrieveDecoder(Header header, Bitstream stream, int layer)
		throws DecoderException
	{
		FrameDecoder decoder = null;
		
		// REVIEW: allow channel output selection type
		// (LEFT, RIGHT, BOTH, DOWNMIX)
		switch (layer)
		{
		case 3:
			if (l3decoder==null)
			{
				l3decoder = new LayerIIIDecoder(stream, 
					header, filter1, filter2, 
					output, OutputChannels.BOTH_CHANNELS);
			}						
			
			decoder = l3decoder;
			break;
		case 2:
			if (l2decoder==null)
			{
				l2decoder = new LayerIIDecoder();
				l2decoder.create(stream, 
					header, filter1, filter2, 
					output, OutputChannels.BOTH_CHANNELS);				
			}
			decoder = l2decoder;
			break;
		case 1:
			if (l1decoder==null)
			{
				l1decoder = new LayerIDecoder();
				l1decoder.create(stream, 
					header, filter1, filter2, 
					output, OutputChannels.BOTH_CHANNELS);				
			}
			decoder = l1decoder;
			break;
		}
						
		if (decoder==null)
		{
			throw newDecoderException(UNSUPPORTED_LAYER, null);
		}
		
		return decoder;
	}
	
	private void initialize(Header header)
		throws DecoderException
	{
		
		// REVIEW: allow customizable scale factor
		float scalefactor = 32700.0f;
		
		int mode = header.mode();
		int layer = header.layer();
		int channels = mode==Header.SINGLE_CHANNEL ? 1 : 2;

					
		// set up output buffer if not set up by client.
		if (output==null)
			output = new SampleBuffer(header.frequency(), channels);
		
		float[] factors = equalizer.getBandFactors();
		filter1 = new SynthesisFilter(0, scalefactor, factors);
   		
		// REVIEW: allow mono output for stereo
		if (channels==2) 
			filter2 = new SynthesisFilter(1, scalefactor, factors);

		outputChannels = channels;
		outputFrequency = header.frequency();
		
		initialized = true;
	}
	
	/**
	 * The <code>Params</code> class presents the customizable
	 * aspects of the decoder. 
	 * <p>
	 * Instances of this class are not thread safe. 
	 */
	public static class Params implements Cloneable
	{
		private OutputChannels	outputChannels = OutputChannels.BOTH;
		
		private Equalizer		equalizer = new Equalizer();
		
		public Params()
		{			
		}
		
		public Object clone()
		{
			try
			{
				return super.clone();
			}
			catch (CloneNotSupportedException ex)
			{				
				throw new InternalError(this+": "+ex);
			}
		}
				
		public void setOutputChannels(OutputChannels out)
		{
			if (out==null)
				throw new NullPointerException("out");
			
			outputChannels = out;
		}
		
		public OutputChannels getOutputChannels()
		{
			return outputChannels;
		}
		
		/**
		 * Retrieves the equalizer settings that the decoder's equalizer
		 * will be initialized from.
		 * <p>
		 * The <code>Equalizer</code> instance returned 
		 * cannot be changed in real time to affect the 
		 * decoder output as it is used only to initialize the decoders
		 * EQ settings. To affect the decoder's output in realtime,
		 * use the Equalizer returned from the getEqualizer() method on
		 * the decoder. 
		 * 
		 * @return	The <code>Equalizer</code> used to initialize the
		 *			EQ settings of the decoder. 
		 */
		public Equalizer getInitialEqualizerSettings()
		{
			return equalizer;	
		}
				
	};
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久女同精品一区二区| 国产一区二区三区四区五区美女 | 91在线看国产| 精品国内二区三区| 136国产福利精品导航| 日韩黄色片在线观看| 99re6这里只有精品视频在线观看| 91精品国产一区二区| 亚洲欧美日韩国产成人精品影院| 久久99深爱久久99精品| 欧美亚洲综合在线| 综合久久国产九一剧情麻豆| 国产一区91精品张津瑜| 欧美日韩中文国产| 亚洲精品成人少妇| 亚洲3atv精品一区二区三区| 国产一区二区精品在线观看| 欧美一区二区三区免费在线看 | 欧美丰满一区二区免费视频| 亚洲欧美日韩一区二区三区在线观看| 精品一区二区影视| 欧美一区二区网站| 午夜精品在线视频一区| 91久久久免费一区二区| 亚洲欧洲av在线| 成人av在线播放网址| 日本一区二区三区高清不卡| 国产精品一区二区视频| 2021国产精品久久精品| 精品无人码麻豆乱码1区2区 | 久久久电影一区二区三区| 美日韩一区二区| 日韩精品一区二区三区在线| 免费人成在线不卡| 欧美一区二区免费| 九色综合国产一区二区三区| 精品av久久707| 国产在线日韩欧美| 亚洲精品一区二区三区四区高清| 老司机精品视频导航| 日韩限制级电影在线观看| 蜜臀精品久久久久久蜜臀| 日韩区在线观看| 国产精品亚洲人在线观看| 国产亚洲午夜高清国产拍精品| 国产精品一区二区久久精品爱涩| 亚洲国产成人一区二区三区| 91玉足脚交白嫩脚丫在线播放| 亚洲日本va午夜在线电影| 欧洲色大大久久| 首页国产欧美久久| 久久亚区不卡日本| 99国产精品久久久久久久久久| 亚洲另类春色国产| 4438x亚洲最大成人网| 九色porny丨国产精品| 欧美国产成人精品| 欧美三级韩国三级日本三斤| 日本欧美一区二区三区| 久久综合色播五月| 91麻豆高清视频| 亚洲午夜影视影院在线观看| 久久国内精品视频| 久久久精品国产免费观看同学| 国产69精品久久99不卡| 一个色妞综合视频在线观看| 欧美一区二区三区视频免费| 国产高清成人在线| 亚洲五月六月丁香激情| 久久一留热品黄| 色成人在线视频| 韩日精品视频一区| 亚洲综合色自拍一区| 久久综合久久综合亚洲| 在线观看91视频| 国产精品白丝jk白祙喷水网站| 亚洲人成影院在线观看| 欧美一区午夜精品| 97精品久久久午夜一区二区三区 | 欧美精品第1页| 成人免费毛片a| 日韩国产一二三区| 国产精品热久久久久夜色精品三区| 欧美日韩第一区日日骚| 高清beeg欧美| 蜜桃视频第一区免费观看| 最好看的中文字幕久久| 久久久综合激的五月天| 91精品国产91热久久久做人人| 成人91在线观看| 精品一区二区在线观看| 亚洲国产精品视频| 中文字幕一区二区三区乱码在线| 精品卡一卡二卡三卡四在线| 欧美午夜视频网站| 91在线观看地址| 成人丝袜18视频在线观看| 精品制服美女丁香| 麻豆精品视频在线观看免费| 亚洲激情成人在线| 国产精品进线69影院| 国产拍欧美日韩视频二区| 欧美成人精精品一区二区频| 91精品久久久久久久91蜜桃| 欧美午夜在线一二页| 91女神在线视频| 91蝌蚪porny九色| a美女胸又www黄视频久久| 国产大陆a不卡| 国产成人精品综合在线观看| 国内精品国产成人| 久久99国产乱子伦精品免费| 久久99久久久欧美国产| 蜜臀精品久久久久久蜜臀| 日本强好片久久久久久aaa| 亚洲v中文字幕| 日韩精品1区2区3区| 婷婷亚洲久悠悠色悠在线播放| 午夜国产精品一区| 日本亚洲视频在线| 日本欧美一区二区| 裸体健美xxxx欧美裸体表演| 极品少妇一区二区| 国产美女av一区二区三区| 国产成人在线免费| 成人黄色免费短视频| 99精品久久99久久久久| 91免费看`日韩一区二区| 色天天综合色天天久久| 在线免费观看一区| 欧美剧情片在线观看| 日韩欧美久久一区| 精品裸体舞一区二区三区| 久久亚洲春色中文字幕久久久| 欧美国产日韩a欧美在线观看 | 91精品国产一区二区三区| 日韩精品一区二区三区视频在线观看| 日韩一区二区三区av| 日韩一级视频免费观看在线| wwwwxxxxx欧美| 亚洲欧美日韩国产另类专区| 亚洲成av人片在线观看无码| 蜜臀av一区二区| av一本久道久久综合久久鬼色| 色悠悠久久综合| 欧美一级日韩免费不卡| 久久久久久久综合狠狠综合| 亚洲欧美日韩精品久久久久| 日韩福利电影在线观看| 国产成人在线观看| 欧美性受极品xxxx喷水| 久久五月婷婷丁香社区| 亚洲最色的网站| 加勒比av一区二区| 欧美性受xxxx黑人xyx性爽| 精品国产欧美一区二区| 中文字幕五月欧美| 久久精品国产澳门| 97精品超碰一区二区三区| 51精品国自产在线| 综合色天天鬼久久鬼色| 青青草视频一区| 一本久久综合亚洲鲁鲁五月天| 欧美一区二区在线免费观看| 亚洲国产精品99久久久久久久久| 丝袜诱惑亚洲看片| 97久久精品人人做人人爽50路| 91精品国产综合久久久蜜臀粉嫩| 国产精品免费久久久久| 美女任你摸久久| 91久久精品一区二区三| 国产亚洲欧美日韩日本| 三级不卡在线观看| 一本久久a久久精品亚洲| 久久精品亚洲国产奇米99| 亚洲成人一区在线| 一本大道久久精品懂色aⅴ| 久久一日本道色综合| 毛片不卡一区二区| 欧美日韩国产免费| 亚洲日本中文字幕区| 成人免费av资源| 国产欧美久久久精品影院| 另类综合日韩欧美亚洲| 欧美性受极品xxxx喷水| 亚洲人123区| 96av麻豆蜜桃一区二区| 国产偷国产偷精品高清尤物| 国产在线不卡视频| 日韩片之四级片| 久久99国产精品久久99| 5566中文字幕一区二区电影| 亚洲第一搞黄网站| 欧美三级电影网| 午夜久久久久久| 91精品国产全国免费观看| 日韩激情一二三区| 日韩欧美在线网站| 狂野欧美性猛交blacked| 精品久久一区二区三区|