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

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

?? header.java

?? Java編寫的一個mp3播放器源代碼,對于想做這方面工作的網友來說還是有很大的參考價值的
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * 11/19/04 : 1.0 moved to LGPL.
 *            VBRI header support added, E.B javalayer@javazoom.net
 * 
 * 12/04/03 : VBR (XING) header support added, E.B javalayer@javazoom.net
 *
 * 02/13/99 : Java Conversion by JavaZOOM , E.B javalayer@javazoom.net
 *
 * Declarations for MPEG header class
 * A few layer III, MPEG-2 LSF, and seeking modifications made by Jeff Tsay.
 * Last modified : 04/19/97
 *
 *  @(#) header.h 1.7, last edit: 6/15/94 16:55:33
 *  @(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de)
 *  @(#) Berlin University of Technology
 *-----------------------------------------------------------------------
 *   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;

/**
 * Class for extracting information from a frame header.
 */
public final class Header
{
	public  static final int[][]	frequencies =
						{{22050, 24000, 16000, 1},
						{44100, 48000, 32000, 1},
						{11025, 12000, 8000, 1}};	// SZD: MPEG25

	/**
	 * Constant for MPEG-2 LSF version
	 */
	public static final int		MPEG2_LSF = 0;
	public static final int		MPEG25_LSF = 2;	// SZD

	/**
	 * Constant for MPEG-1 version
	 */
	public static final int		MPEG1 = 1;

	public static final int		STEREO = 0;
	public static final int		JOINT_STEREO = 1;
	public static final int		DUAL_CHANNEL = 2;
	public static final int		SINGLE_CHANNEL = 3;
	public static final int		FOURTYFOUR_POINT_ONE = 0;
	public static final int		FOURTYEIGHT=1;
	public static final int		THIRTYTWO=2;

	private int				h_layer, h_protection_bit, h_bitrate_index,
	  						h_padding_bit, h_mode_extension;
	private int				h_version;
	private int				h_mode;
	private int				h_sample_frequency;
	private int				h_number_of_subbands, h_intensity_stereo_bound;
	private boolean			h_copyright, h_original;
	// VBR support added by E.B
	private double[] 		h_vbr_time_per_frame = {-1, 384, 1152, 1152};
	private boolean			h_vbr;
	private int				h_vbr_frames;
	private int				h_vbr_scale;
	private int				h_vbr_bytes;
	private byte[]			h_vbr_toc;
	
	private byte			syncmode = Bitstream.INITIAL_SYNC;
	private Crc16			crc;

	public short			checksum;
	public int				framesize;
	public int				nSlots;

	private int				_headerstring = -1; // E.B

	Header()
	{
	}
	public String toString()
	{
		StringBuffer buffer = new StringBuffer(200);
		buffer.append("Layer ");
		buffer.append(layer_string());
		buffer.append(" frame ");
		buffer.append(mode_string());
		buffer.append(' ');
		buffer.append(version_string());
		if (!checksums())
			buffer.append(" no");
		buffer.append(" checksums");
		buffer.append(' ');
		buffer.append(sample_frequency_string());
		buffer.append(',');
		buffer.append(' ');
		buffer.append(bitrate_string());

		String s =  buffer.toString();
		return s;
	}

	/**
	 * Read a 32-bit header from the bitstream.
	 */
	void read_header(Bitstream stream, Crc16[] crcp) throws BitstreamException
	{
		int headerstring;
		int channel_bitrate;
		boolean sync = false;
		do
		{
			headerstring = stream.syncHeader(syncmode);
			_headerstring = headerstring; // E.B
			if (syncmode == Bitstream.INITIAL_SYNC)
			{
				h_version = ((headerstring >>> 19) & 1);
				if (((headerstring >>> 20) & 1) == 0) // SZD: MPEG2.5 detection
					if (h_version == MPEG2_LSF)
						h_version = MPEG25_LSF;
					else
						throw stream.newBitstreamException(Bitstream.UNKNOWN_ERROR);
				if ((h_sample_frequency = ((headerstring >>> 10) & 3)) == 3)
				{
					throw stream.newBitstreamException(Bitstream.UNKNOWN_ERROR);
				}
			}
			h_layer = 4 - (headerstring >>> 17) & 3;
			h_protection_bit = (headerstring >>> 16) & 1;
			h_bitrate_index = (headerstring >>> 12) & 0xF;
			h_padding_bit = (headerstring >>> 9) & 1;
			h_mode = ((headerstring >>> 6) & 3);
			h_mode_extension = (headerstring >>> 4) & 3;
			if (h_mode == JOINT_STEREO)
				h_intensity_stereo_bound = (h_mode_extension << 2) + 4;
			else
				h_intensity_stereo_bound = 0; // should never be used
			if (((headerstring >>> 3) & 1) == 1)
				h_copyright = true;
			if (((headerstring >>> 2) & 1) == 1)
				h_original = true;
			// calculate number of subbands:
			if (h_layer == 1)
				h_number_of_subbands = 32;
			else
			{
				channel_bitrate = h_bitrate_index;
				// calculate bitrate per channel:
				if (h_mode != SINGLE_CHANNEL)
					if (channel_bitrate == 4)
						channel_bitrate = 1;
					else
						channel_bitrate -= 4;
				if ((channel_bitrate == 1) || (channel_bitrate == 2))
					if (h_sample_frequency == THIRTYTWO)
						h_number_of_subbands = 12;
					else
						h_number_of_subbands = 8;
				else if ((h_sample_frequency == FOURTYEIGHT) || ((channel_bitrate >= 3) && (channel_bitrate <= 5)))
					h_number_of_subbands = 27;
				else
					h_number_of_subbands = 30;
			}
			if (h_intensity_stereo_bound > h_number_of_subbands)
				h_intensity_stereo_bound = h_number_of_subbands;
			// calculate framesize and nSlots
			calculate_framesize();
			// read framedata:
			int framesizeloaded = stream.read_frame_data(framesize);
			if ((framesize >=0) && (framesizeloaded != framesize))
			{
				// Data loaded does not match to expected framesize,
				// it might be an ID3v1 TAG. (Fix 11/17/04).
				throw stream.newBitstreamException(Bitstream.INVALIDFRAME);
			}
			if (stream.isSyncCurrentPosition(syncmode))
			{
				if (syncmode == Bitstream.INITIAL_SYNC)
				{
					syncmode = Bitstream.STRICT_SYNC;
					stream.set_syncword(headerstring & 0xFFF80CC0);
				}
				sync = true;
			}
			else
			{
				stream.unreadFrame();
			}
		}
		while (!sync);
		stream.parse_frame();
		if (h_protection_bit == 0)
		{
			// frame contains a crc checksum
			checksum = (short) stream.get_bits(16);
			if (crc == null)
				crc = new Crc16();
			crc.add_bits(headerstring, 16);
			crcp[0] = crc;
		}
		else
			crcp[0] = null;
		if (h_sample_frequency == FOURTYFOUR_POINT_ONE)
		{
			/*
				if (offset == null)
			  {
				  int max = max_number_of_frames(stream);
				  offset = new int[max];
			     for(int i=0; i<max; i++) offset[i] = 0;
			  }
			  // E.B : Investigate more
			  int cf = stream.current_frame();
			  int lf = stream.last_frame();
			  if ((cf > 0) && (cf == lf))
			  {
				   offset[cf] = offset[cf-1] + h_padding_bit;
			  }
			  else
			  {
				       offset[0] = h_padding_bit;
			  }
			*/
		}
	}

	/**
	 * Parse frame to extract optionnal VBR frame.
	 * @param firstframe
	 * @author E.B (javalayer@javazoom.net)
	 */
	void parseVBR(byte[] firstframe) throws BitstreamException
	{
		// Trying Xing header.
		String xing = "Xing";
		byte tmp[] = new byte[4];
		int offset = 0;
		// Compute "Xing" offset depending on MPEG version and channels.
		if (h_version == MPEG1) 
		{
		  if (h_mode == SINGLE_CHANNEL)  offset=21-4;
		  else offset=36-4;
		} 
		else 
		{
		  if (h_mode == SINGLE_CHANNEL) offset=13-4;
		  else offset = 21-4;		  
		}
		try
		{
			System.arraycopy(firstframe, offset, tmp, 0, 4);
			// Is "Xing" ?
			if (xing.equals(new String(tmp)))
			{
				//Yes.
				h_vbr = true;
				h_vbr_frames = -1;
				h_vbr_bytes = -1;
				h_vbr_scale = -1;
				h_vbr_toc = new byte[100];
								
				int length = 4;
				// Read flags.
				byte flags[] = new byte[4];
				System.arraycopy(firstframe, offset + length, flags, 0, flags.length);
				length += flags.length;
				// Read number of frames (if available).
				if ((flags[3] & (byte) (1 << 0)) != 0)
				{
					System.arraycopy(firstframe, offset + length, tmp, 0, tmp.length);
					h_vbr_frames = (tmp[0] << 24)&0xFF000000 | (tmp[1] << 16)&0x00FF0000 | (tmp[2] << 8)&0x0000FF00 | tmp[3]&0x000000FF;
					length += 4;	
				}
				// Read size (if available).
				if ((flags[3] & (byte) (1 << 1)) != 0)
				{
					System.arraycopy(firstframe, offset + length, tmp, 0, tmp.length);
					h_vbr_bytes = (tmp[0] << 24)&0xFF000000 | (tmp[1] << 16)&0x00FF0000 | (tmp[2] << 8)&0x0000FF00 | tmp[3]&0x000000FF;
					length += 4;	
				}
				// Read TOC (if available).
				if ((flags[3] & (byte) (1 << 2)) != 0)
				{
					System.arraycopy(firstframe, offset + length, h_vbr_toc, 0, h_vbr_toc.length);
					length += h_vbr_toc.length;	
				}
				// Read scale (if available).
				if ((flags[3] & (byte) (1 << 3)) != 0)
				{
					System.arraycopy(firstframe, offset + length, tmp, 0, tmp.length);
					h_vbr_scale = (tmp[0] << 24)&0xFF000000 | (tmp[1] << 16)&0x00FF0000 | (tmp[2] << 8)&0x0000FF00 | tmp[3]&0x000000FF;
					length += 4;	
				}
				//System.out.println("VBR:"+xing+" Frames:"+ h_vbr_frames +" Size:"+h_vbr_bytes);			
			}				
		}
		catch (ArrayIndexOutOfBoundsException e)
		{
			throw new BitstreamException("XingVBRHeader Corrupted",e);
		}
		
		// Trying VBRI header.			
		String vbri = "VBRI";
		offset = 36-4;
		try
		{
			System.arraycopy(firstframe, offset, tmp, 0, 4);
			// Is "VBRI" ?
			if (vbri.equals(new String(tmp)))
			{
				//Yes.
				h_vbr = true;
				h_vbr_frames = -1;
				h_vbr_bytes = -1;
				h_vbr_scale = -1;
				h_vbr_toc = new byte[100];
				// Bytes.				
				int length = 4 + 6;
				System.arraycopy(firstframe, offset + length, tmp, 0, tmp.length);
				h_vbr_bytes = (tmp[0] << 24)&0xFF000000 | (tmp[1] << 16)&0x00FF0000 | (tmp[2] << 8)&0x0000FF00 | tmp[3]&0x000000FF;
				length += 4;	
				// Frames.	
				System.arraycopy(firstframe, offset + length, tmp, 0, tmp.length);
				h_vbr_frames = (tmp[0] << 24)&0xFF000000 | (tmp[1] << 16)&0x00FF0000 | (tmp[2] << 8)&0x0000FF00 | tmp[3]&0x000000FF;
				length += 4;	
				//System.out.println("VBR:"+vbri+" Frames:"+ h_vbr_frames +" Size:"+h_vbr_bytes);
				// TOC
				// TODO				
			}
		}
		catch (ArrayIndexOutOfBoundsException e)
		{
			throw new BitstreamException("VBRIVBRHeader Corrupted",e);
		}
	}
	
	// Functions to query header contents:
	/**
	 * Returns version.
	 */
	public int version() { return h_version; }

	/**
	 * Returns Layer ID.
	 */
	public int layer() { return h_layer; }

	/**
	 * Returns bitrate index.
	 */
	public int bitrate_index() { return h_bitrate_index; }

	/**
	 * Returns Sample Frequency.
	 */
	public int sample_frequency() { return h_sample_frequency; }

	/**
	 * Returns Frequency.
	 */
	public int frequency() {return frequencies[h_version][h_sample_frequency];}

	/**
	 * Returns Mode.
	 */
	public int mode() { return h_mode; }

	/**
	 * Returns Protection bit.
	 */
	public boolean checksums()
	{
		if (h_protection_bit == 0) return true;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
老汉av免费一区二区三区| 精品视频1区2区3区| 色婷婷国产精品| 精品剧情v国产在线观看在线| 最新热久久免费视频| 国产在线乱码一区二区三区| 欧美亚洲一区二区在线观看| 久久久国产综合精品女国产盗摄| 午夜久久久影院| 91在线观看高清| 国产欧美一区二区在线| 久久国产乱子精品免费女| 欧美日韩精品电影| 亚洲欧美日韩人成在线播放| 福利视频网站一区二区三区| 日韩欧美不卡在线观看视频| 日韩影院精彩在线| 色丁香久综合在线久综合在线观看| 国产偷国产偷亚洲高清人白洁| 免费观看日韩av| 在线不卡免费欧美| 亚洲午夜羞羞片| 欧美日韩精品三区| 亚洲国产视频在线| 欧美三级欧美一级| 亚洲成人自拍偷拍| 欧美人与性动xxxx| 日韩高清不卡在线| 日韩欧美久久久| 久久91精品国产91久久小草| 欧美不卡视频一区| 紧缚捆绑精品一区二区| 日韩免费看的电影| 国产高清成人在线| 中文字幕av不卡| 91香蕉视频mp4| 亚洲国产视频一区| 日韩亚洲欧美综合| 国产精品一级片在线观看| 国产调教视频一区| 成人精品鲁一区一区二区| 亚洲免费观看在线观看| 欧美在线free| 美女在线观看视频一区二区| 精品久久久久久久久久久院品网 | 2021久久国产精品不只是精品| 日韩高清一区二区| 亚洲精品一线二线三线无人区| 国产一区二区三区日韩| 欧美极品aⅴ影院| 色综合久久精品| 蜜桃一区二区三区四区| 欧美激情一区在线| 91激情五月电影| 麻豆成人久久精品二区三区小说| 精品久久久久香蕉网| 99re热视频这里只精品| 喷白浆一区二区| 国产精品久线观看视频| 欧美群妇大交群的观看方式| 极品尤物av久久免费看| 亚洲精品国久久99热| 日韩亚洲欧美综合| 一本色道久久综合亚洲aⅴ蜜桃 | 一区二区三区四区精品在线视频 | 91久久精品一区二区三| 日本欧美一区二区在线观看| 久久久久久久综合狠狠综合| 在线中文字幕一区二区| 国产综合久久久久久鬼色| 中文字幕中文字幕在线一区 | 国产精品综合在线视频| 亚洲免费观看在线观看| 精品国产一区二区三区忘忧草| 成人高清视频在线观看| 丝袜诱惑亚洲看片| 国产精品灌醉下药二区| 欧美一级夜夜爽| 91美女在线视频| 国产成人综合在线观看| 日韩在线观看一区二区| 亚洲免费av观看| 国产网红主播福利一区二区| 91精品国产一区二区三区蜜臀 | 日韩欧美亚洲国产精品字幕久久久 | 99re8在线精品视频免费播放| 蜜臀精品一区二区三区在线观看 | 国产传媒欧美日韩成人| 日韩精品91亚洲二区在线观看| 国产精品色哟哟网站| 精品国产露脸精彩对白 | 欧美亚男人的天堂| 成人丝袜18视频在线观看| 麻豆freexxxx性91精品| 亚洲一区二区五区| 亚洲日穴在线视频| 国产精品午夜春色av| 精品国产三级a在线观看| 777奇米成人网| 91国偷自产一区二区三区观看 | 亚洲精选视频在线| 国产精品蜜臀在线观看| 久久久久88色偷偷免费| 欧美一级片在线看| 3d动漫精品啪啪| 91精品国产色综合久久ai换脸| 精品视频在线看| 欧美日韩综合色| 欧美日韩视频在线第一区| 欧美在线免费观看亚洲| 欧美午夜免费电影| 欧美午夜不卡视频| 欧美日韩国产乱码电影| 欧美日韩精品一区视频| 51精品秘密在线观看| 911精品国产一区二区在线| 91精品国产免费| 日韩一区二区三区精品视频 | 欧美亚洲一区三区| 欧美情侣在线播放| 91精品国产综合久久精品性色| 欧美一区二区在线视频| 精品国产乱子伦一区| 国产亚洲一区二区三区四区 | 91国产成人在线| 在线观看日产精品| 欧美一区永久视频免费观看| 日韩欧美一级在线播放| 国产视频在线观看一区二区三区| 国产午夜精品福利| 一区二区视频在线| 亚洲福利国产精品| 裸体健美xxxx欧美裸体表演| 国产一区二区三区美女| 成人污视频在线观看| 欧美熟乱第一页| 精品日产卡一卡二卡麻豆| 欧美国产精品中文字幕| 亚洲自拍偷拍av| 久久精品噜噜噜成人av农村| 国产精品资源站在线| 91黄色小视频| 亚洲精品一线二线三线| 日韩美女精品在线| 日本不卡在线视频| 成人在线视频首页| 精品视频1区2区3区| 久久精品亚洲国产奇米99| 亚洲精品久久久蜜桃| 久99久精品视频免费观看| 99re视频这里只有精品| 日韩视频免费观看高清完整版| 国产精品久久久久一区二区三区 | 91麻豆文化传媒在线观看| 91精品欧美久久久久久动漫 | 久久综合丝袜日本网| 亚洲精品成人a在线观看| 欧美96一区二区免费视频| 99久久99久久综合| 精品国产乱码久久久久久免费| 亚洲少妇最新在线视频| 美日韩一区二区| 色琪琪一区二区三区亚洲区| 久久影院视频免费| 爽好久久久欧美精品| 91同城在线观看| 欧美高清一级片在线观看| 日韩精品成人一区二区三区| 91免费在线视频观看| 久久久久国产免费免费| 日本在线不卡视频一二三区| 在线一区二区观看| 国产精品网站导航| 激情伊人五月天久久综合| 欧美日韩一区国产| 亚洲欧美另类小说视频| 成人听书哪个软件好| 久久免费的精品国产v∧| 欧美aaa在线| 欧美精品乱码久久久久久 | 中文字幕在线一区二区三区| 久久99久国产精品黄毛片色诱| 欧美在线免费观看视频| 亚洲精品免费视频| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 欧美视频在线观看一区| 国产精品美女久久久久av爽李琼| 国产专区综合网| 欧美精品一区二区在线播放 | 亚洲成人av一区二区三区| 91在线国内视频| 国产精品久久久久影院色老大| 国产不卡在线一区| 国产欧美一区视频| 成人av在线电影| 亚洲欧美日韩国产一区二区三区 | 香蕉久久夜色精品国产使用方法| 91碰在线视频| 亚洲一区在线观看视频| 在线免费观看一区|