⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pidbuffer.java

📁 优秀的MPEG2-TS流分析软件
💻 JAVA
字号:
/*
 * @(#)PidBuffer.java - 
 *
 * Copyright (c) 2005 by dvb.matt, All Rights Reserved.
 * 
 * This file is part of X, a free Java based demux utility.
 * X is intended for educational purposes only, as a non-commercial test project.
 * It may not be used otherwise. Most parts are only experimental.
 *  
 *
 * This program is free software; you can redistribute it free of charge
 * and/or modify it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

package net.sourceforge.dvb.projectx.parser;

import java.io.ByteArrayOutputStream;


/**
 * stuff for pre-buffering of PID data
 */
public class PidBuffer {

	private boolean pidstart = false;
	private boolean pidscram = false;
	private boolean need = true;

	private int ID = -1;
	private int PID = -1;
	private int demux = -1;
	private int counter = -1;

	private ByteArrayOutputStream buffer = new ByteArrayOutputStream();

	public void setStarted(boolean b)
	{
		pidstart = b;
	}

	public boolean isStarted()
	{
		return pidstart;
	}

	public void setScram(boolean b)
	{ 
		pidscram = b;
	}

	public boolean getScram()
	{ 
		return pidscram; 
	}

	public void setID(int val)
	{ 
		ID = val;
	}

	public int getID()
	{ 
		return ID;
	}

	public void setCounter(int val)
	{
		counter = val;
	}

	public int getCounter()
	{
		return counter;
	}

	public void count()
	{
		counter += (counter < 15) ? 1 : -15 ;
	}

	public void countPVA()
	{
		counter += (counter < 255) ? 1 : -255 ;
	}

	public void setPID(int val)
	{
		PID = val;
	}

	public int getPID()
	{
		return PID;
	}

	public void setDemux(int val)
	{
		demux = val;
	}

	public int getDemux()
	{
		return demux;
	}

	public void setneeded(boolean b)
	{
		need = b;
	}

	public boolean isneeded()
	{
		return need;
	}

	public void writeData(byte[] data, int off, int len)
	{
		buffer.write(data, off, len);
	}

	public ByteArrayOutputStream getData()
	{
		return buffer;
	}

	public int getDataSize()
	{
		return buffer.size();
	}

	public void reset()
	{
		buffer.reset();
	}
}

⌨️ 快捷键说明

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