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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? bitstream.java

?? Java編寫的一個(gè)mp3播放器源代碼,對于想做這方面工作的網(wǎng)友來說還是有很大的參考價(jià)值的
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * 11/19/04  1.0 moved to LGPL.
 * 
 * 11/17/04	 Uncomplete frames discarded. E.B, javalayer@javazoom.net 
 *
 * 12/05/03	 ID3v2 tag returned. E.B, javalayer@javazoom.net 
 *
 * 12/12/99	 Based on Ibitstream. Exceptions thrown on errors,
 *			 Temporary removed seek functionality. mdm@techie.com
 *
 * 02/12/99 : Java Conversion by E.B , javalayer@javazoom.net
 *
 * 04/14/97 : Added function prototypes for new syncing and seeking
 * mechanisms. Also made this file portable. Changes made by Jeff Tsay
 *
 *  @(#) ibitstream.h 1.5, last edit: 6/15/94 16:55:34
 *  @(#) 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;

import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PushbackInputStream;


/**
 * The <code>Bistream</code> class is responsible for parsing
 * an MPEG audio bitstream.
 *
 * <b>REVIEW:</b> much of the parsing currently occurs in the
 * various decoders. This should be moved into this class and associated
 * inner classes.
 */
public final class Bitstream implements BitstreamErrors
{
	/**
	 * Synchronization control constant for the initial
	 * synchronization to the start of a frame.
	 */
	static byte		INITIAL_SYNC = 0;

	/**
	 * Synchronization control constant for non-initial frame
	 * synchronizations.
	 */
	static byte		STRICT_SYNC = 1;

	// max. 1730 bytes per frame: 144 * 384kbit/s / 32000 Hz + 2 Bytes CRC
	/**
	 * Maximum size of the frame buffer.
	 */
	private static final int	BUFFER_INT_SIZE = 433;

	/**
	 * The frame buffer that holds the data for the current frame.
	 */
	private final int[]		framebuffer = new int[BUFFER_INT_SIZE];

	/**
	 * Number of valid bytes in the frame buffer.
	 */
	private int				framesize;

	/**
	 * The bytes read from the stream.
	 */
	private byte[]			frame_bytes = new byte[BUFFER_INT_SIZE*4];

	/**
	 * Index into <code>framebuffer</code> where the next bits are
	 * retrieved.
	 */
	private int				wordpointer;

	/**
	 * Number (0-31, from MSB to LSB) of next bit for get_bits()
	 */
	private int				bitindex;

	/**
	 * The current specified syncword
	 */
	private int				syncword;
	
	/**
	 * Audio header position in stream.
	 */
	private int				header_pos = 0;

	/**
	 *
	 */
	private boolean			single_ch_mode;
  //private int 			current_frame_number;
  //private int				last_frame_number;

	private final int		bitmask[] = {0,	// dummy
	 0x00000001, 0x00000003, 0x00000007, 0x0000000F,
	 0x0000001F, 0x0000003F, 0x0000007F, 0x000000FF,
	 0x000001FF, 0x000003FF, 0x000007FF, 0x00000FFF,
	 0x00001FFF, 0x00003FFF, 0x00007FFF, 0x0000FFFF,
     0x0001FFFF };

	private final PushbackInputStream	source;

	private final Header			header = new Header();

	private final byte				syncbuf[] = new byte[4];

	private Crc16[]					crc = new Crc16[1];

	private byte[]					rawid3v2 = null;

	private boolean					firstframe = true;


	/**
	 * Construct a IBitstream that reads data from a
	 * given InputStream.
	 *
	 * @param in	The InputStream to read from.
	 */
	public Bitstream(InputStream in)
	{
		if (in==null) throw new NullPointerException("in");
		in = new BufferedInputStream(in);		
		loadID3v2(in);
		firstframe = true;
		//source = new PushbackInputStream(in, 1024);
		source = new PushbackInputStream(in, BUFFER_INT_SIZE*4);
		
		closeFrame();
		//current_frame_number = -1;
		//last_frame_number = -1;
	}

	/**
	 * Return position of the first audio header.
	 * @return size of ID3v2 tag frames.
	 */
	public int header_pos()
	{
		return header_pos;
	}
	
	/**
	 * Load ID3v2 frames.
	 * @param in MP3 InputStream.
	 * @author JavaZOOM
	 */
	private void loadID3v2(InputStream in)
	{		
		int size = -1;
		try
		{
			// Read ID3v2 header (10 bytes).
			in.mark(10);			
			size = readID3v2Header(in);
			header_pos = size;			
		}
		catch (IOException e)
		{}
		finally
		{
			try
			{
				// Unread ID3v2 header (10 bytes).
				in.reset();
			}
			catch (IOException e)
			{}
		}
		// Load ID3v2 tags.
		try
		{
			if (size > 0)
			{
				rawid3v2 = new byte[size];
				in.read(rawid3v2,0,rawid3v2.length);
			}			
		}
		catch (IOException e)
		{}
	}
	
	/**
	 * Parse ID3v2 tag header to find out size of ID3v2 frames. 
	 * @param in MP3 InputStream
	 * @return size of ID3v2 frames + header
	 * @throws IOException
	 * @author JavaZOOM
	 */
	private int readID3v2Header(InputStream in) throws IOException
	{		
		byte[] id3header = new byte[4];
		int size = -10;
		in.read(id3header,0,3);
		// Look for ID3v2
		if ( (id3header[0]=='I') && (id3header[1]=='D') && (id3header[2]=='3'))
		{
			in.read(id3header,0,3);
			int majorVersion = id3header[0];
			int revision = id3header[1];
			in.read(id3header,0,4);
			size = (int) (id3header[0] << 21) + (id3header[1] << 14) + (id3header[2] << 7) + (id3header[3]);
		}
		return (size+10);
	}
	
	/**
	 * Return raw ID3v2 frames + header.
	 * @return ID3v2 InputStream or null if ID3v2 frames are not available.
	 */
	public InputStream getRawID3v2()
	{
		if (rawid3v2 == null) return null;
		else
		{
			ByteArrayInputStream bain = new ByteArrayInputStream(rawid3v2);		
			return bain;
		}
	}

	/**
	 * Close the Bitstream.
	 * @throws BitstreamException
	 */
	public void close() throws BitstreamException
	{
		try
		{
			source.close();
		}
		catch (IOException ex)
		{
			throw newBitstreamException(STREAM_ERROR, ex);
		}
	}

	/**
	 * Reads and parses the next frame from the input source.
	 * @return the Header describing details of the frame read,
	 *	or null if the end of the stream has been reached.
	 */
	public Header readFrame() throws BitstreamException
	{
		Header result = null;
		try
		{
			result = readNextFrame();
			// E.B, Parse VBR (if any) first frame.
			if (firstframe == true)
			{
				result.parseVBR(frame_bytes);
				firstframe = false;
			}			
		}
		catch (BitstreamException ex)
		{
			if ((ex.getErrorCode()==INVALIDFRAME))
			{
				// Try to skip this frame.
				//System.out.println("INVALIDFRAME");
				try
				{
					closeFrame();
					result = readNextFrame();
				}
				catch (BitstreamException e)
				{
					if ((e.getErrorCode()!=STREAM_EOF))
					{
						// wrap original exception so stack trace is maintained.
						throw newBitstreamException(e.getErrorCode(), e);
					}
				}
			}
			else if ((ex.getErrorCode()!=STREAM_EOF))
			{
				// wrap original exception so stack trace is maintained.
				throw newBitstreamException(ex.getErrorCode(), ex);
			}
		}
		return result;
	}

	/**
	 * Read next MP3 frame.
	 * @return MP3 frame header.
	 * @throws BitstreamException
	 */
	private Header readNextFrame() throws BitstreamException
	{
		if (framesize == -1)
		{
			nextFrame();
		}
		return header;
	}


	/**
	 * Read next MP3 frame.
	 * @throws BitstreamException
	 */
	private void nextFrame() throws BitstreamException
	{
		// entire frame is read by the header class.
		header.read_header(this, crc);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产精品一区二区www在线 | eeuss影院一区二区三区| 欧美一区二区高清| 国产又粗又猛又爽又黄91精品| 亚洲天堂2016| 欧美精品一区二区三区蜜臀| 日本韩国一区二区三区| 国产一区二区福利视频| 亚洲成人一区在线| 中文字幕不卡的av| 精品国产自在久精品国产| 日本韩国精品在线| 成人听书哪个软件好| 精东粉嫩av免费一区二区三区| 亚洲福利视频一区二区| 18成人在线观看| 亚洲国产精品精华液ab| 精品国产一区二区在线观看| 欧美日高清视频| 色先锋资源久久综合| 高清免费成人av| 国模一区二区三区白浆| 日本不卡视频在线| 亚洲午夜在线观看视频在线| 《视频一区视频二区| 欧美激情在线观看视频免费| 久久免费看少妇高潮| 日韩欧美高清在线| 91精品国产综合久久久久久| 欧美综合亚洲图片综合区| 99久久99久久综合| 99综合电影在线视频| 成人一区二区三区| 丰满岳乱妇一区二区三区| 国产精品综合网| 精品亚洲免费视频| 国内外成人在线| 国产一区二区三区视频在线播放| 美腿丝袜亚洲综合| 紧缚奴在线一区二区三区| 麻豆专区一区二区三区四区五区| 日本不卡免费在线视频| 午夜一区二区三区视频| 日韩黄色免费电影| 奇米影视7777精品一区二区| 美女国产一区二区三区| 极品尤物av久久免费看| 国产v日产∨综合v精品视频| 成人动漫av在线| 91豆麻精品91久久久久久| 欧美色视频在线| 欧美一二三区在线| 精品福利一二区| 国产欧美日本一区二区三区| 国产精品久久久久婷婷二区次| 亚洲欧美福利一区二区| 午夜视频在线观看一区二区三区| 免费一级片91| 国产不卡视频在线播放| 欧洲国内综合视频| 欧美一级电影网站| 亚洲国产高清aⅴ视频| 亚洲精品久久7777| 日韩电影在线一区| 国产资源在线一区| 99久久精品国产麻豆演员表| 欧美三区在线观看| 日韩一级二级三级精品视频| 国产午夜久久久久| 一区二区三区四区不卡视频| 免费看欧美美女黄的网站| 国产精品一区2区| 色一区在线观看| 日韩一区二区中文字幕| 国产精品免费久久久久| 亚洲成精国产精品女| 狠狠色丁香久久婷婷综| 色呦呦国产精品| 精品国产精品网麻豆系列 | 精品福利在线导航| 最新成人av在线| 日本视频在线一区| av在线综合网| 日韩欧美在线123| 亚洲人成7777| 国产一区二区免费在线| 在线看国产一区| 国产亚洲福利社区一区| 亚洲二区在线视频| 成人一区二区三区在线观看| 欧美一区二区三区日韩| 中文字幕亚洲精品在线观看| 日本va欧美va欧美va精品| 91麻豆产精品久久久久久| 日韩精品一区二| 亚洲一区二区三区四区在线| 国产很黄免费观看久久| 欧美日韩视频在线一区二区| 国产精品午夜春色av| 美女免费视频一区二区| 91国模大尺度私拍在线视频| 久久久久国产精品麻豆| 免费成人av在线| 91成人免费在线| 欧美韩国日本不卡| 黄页网站大全一区二区| 欧美年轻男男videosbes| 亚洲人成人一区二区在线观看 | 国产精品午夜春色av| 蜜臀a∨国产成人精品| 91成人免费网站| 成人免费一区二区三区在线观看| 国内精品伊人久久久久av一坑| 欧美日韩高清一区二区三区| 亚洲日本丝袜连裤袜办公室| 国产91精品一区二区麻豆网站| 日韩视频国产视频| 污片在线观看一区二区| 国产片一区二区| 亚洲国产精品激情在线观看| 麻豆国产精品视频| 欧美一区二区三区色| 日日夜夜免费精品视频| 欧美色图12p| 亚洲国产精品久久人人爱蜜臀 | 色伊人久久综合中文字幕| 国产精品福利一区二区三区| 成人高清视频在线| 中文字幕精品一区二区三区精品| 国产美女一区二区| 亚洲精品一区在线观看| 久久99国产精品免费网站| 欧美一级片在线观看| 日本麻豆一区二区三区视频| 欧美精品亚洲二区| 午夜电影一区二区三区| 欧美综合欧美视频| 性做久久久久久久久| 正在播放一区二区| 久久成人麻豆午夜电影| 精品国产伦一区二区三区观看方式| 麻豆91在线观看| 久久综合久久鬼色| 国产福利91精品一区| 中文av一区二区| 91丨九色丨蝌蚪丨老版| 亚洲狠狠爱一区二区三区| 欧美日韩国产高清一区| 久久精品国产澳门| 久久蜜桃av一区二区天堂| 国产成人一区二区精品非洲| 中文无字幕一区二区三区 | 狠狠狠色丁香婷婷综合激情| 久久伊人蜜桃av一区二区| 国产成人午夜99999| 国产精品短视频| 91国在线观看| 免费在线欧美视频| 欧美激情在线看| 欧美伊人久久久久久久久影院| 亚洲成人av免费| 精品国产sm最大网站| 丁香网亚洲国际| 亚洲最快最全在线视频| 91精品国产欧美日韩| 国产精品亚洲一区二区三区在线 | 天天射综合影视| 精品欧美黑人一区二区三区| 成人激情免费网站| 亚洲电影你懂得| 精品国产成人系列| 91老师国产黑色丝袜在线| 午夜精品一区二区三区电影天堂 | 色88888久久久久久影院按摩 | 天涯成人国产亚洲精品一区av| 欧美精品一区二区三区视频| 91麻豆自制传媒国产之光| 日韩高清中文字幕一区| 国产精品久久久久久久浪潮网站 | 制服丝袜成人动漫| 成人午夜又粗又硬又大| 日韩和欧美一区二区三区| 国产午夜精品久久| 欧美性大战久久久久久久| 国产乱码精品一区二区三 | 青青草原综合久久大伊人精品| 国产欧美日韩卡一| 欧美一区二区三区在| 99久久婷婷国产| 韩国成人精品a∨在线观看| 一区二区三区色| 久久综合九色欧美综合狠狠| 91黄色小视频| 成人免费毛片高清视频| 免费精品视频在线| 亚洲美女视频在线观看| 2020国产精品自拍| 欧美区在线观看| 一本一道综合狠狠老| 国产精品综合一区二区三区|