📄 extension.cc
字号:
//// Copyright (c) 2003 by Istv醤 V醨adi//// This file is part of dxr3Player, a DVD player written specifically // for the DXR3 (aka Hollywood+) decoder card.// This program is free software; you can redistribute it 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//------------------------------------------------------------------------------#include "Extension.h"#include "Sector.h"#include <cstdio>//------------------------------------------------------------------------------using dvd::demux::Extension;//------------------------------------------------------------------------------Extension::Header::Header() : orig_or_copy(0), copyright(0), data_alignment(0), pes_priority(0), pes_scrambling(0), res1(2), pes_ext(0), pes_crc(0), add_copy(0), dsm_mode(0), es_rate(0), escr(0), pts_dts(0), length(0){}//------------------------------------------------------------------------------//------------------------------------------------------------------------------pts_t Extension::TS::getValue() const{ pts_t value = ts_32_30; value <<=8; value |= ts_29_22; value <<=7; value |= ts_21_15; value <<=8; value |= ts_14_07; value <<=7; value |= ts_06_00; return value;}//------------------------------------------------------------------------------//------------------------------------------------------------------------------Extension::Extension() : rest(0){}//------------------------------------------------------------------------------Extension::Extension(SectorBitReader& reader) : rest(0){ reader.read(&header, sizeof(header)); if (header.length>0) { rest = new unsigned char[header.length]; reader.read(rest, header.length); }}//------------------------------------------------------------------------------Extension::Extension(const Extension& other) : header(other.header), rest(new unsigned char[other.header.length]){ memcpy(rest, other.rest, other.header.length);}//------------------------------------------------------------------------------Extension& Extension::operator=(const Extension& other){ header = other.header; delete[] rest; rest = new unsigned char[other.header.length]; memcpy(rest, other.rest, other.header.length); return *this;}//------------------------------------------------------------------------------pts_t Extension::getPTS() const{ if ( (header.pts_dts&0x02)==0 ) return INVALID_PTS; else return reinterpret_cast<const TS*>(rest)->getValue();}//------------------------------------------------------------------------------pts_t Extension::getDTS() const{ if (header.pts_dts!=0x03) return INVALID_PTS; else return reinterpret_cast<const TS*>(rest + 5)->getValue(); }//------------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -