📄 extension.h
字号:
//// 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#ifndef DXR3PLAYER_DVD_DEMUX_EXTENSION_H#define DXR3PLAYER_DVD_DEMUX_EXTENSION_H//------------------------------------------------------------------------------#include "types.h"#include <cstdlib>//------------------------------------------------------------------------------namespace dvd { namespace demux {//------------------------------------------------------------------------------class SectorBitReader;//------------------------------------------------------------------------------/** * Extension for PES packets. */class Extension{public: struct Header { unsigned char orig_or_copy : 1; unsigned char copyright : 1; unsigned char data_alignment : 1; unsigned char pes_priority : 1; unsigned char pes_scrambling : 2; unsigned char res1 : 2; unsigned char pes_ext : 1; unsigned char pes_crc : 1; unsigned char add_copy : 1; unsigned char dsm_mode : 1; unsigned char es_rate : 1; unsigned char escr : 1; unsigned char pts_dts : 2; unsigned char length; /** * Construct a default header. */ Header(); };private: /** * Time stamp structure. */ struct TS { unsigned char res1 : 1; unsigned char ts_32_30 : 3; unsigned char res2 : 4; unsigned char ts_29_22; unsigned char res3 : 1; unsigned char ts_21_15 : 7; unsigned char ts_14_07; unsigned char res4 : 1; unsigned char ts_06_00 : 7; /** * Get the value. */ pts_t getValue() const; }; /** * The header of the extension. */ Header header; /** * The rest of the extension */ unsigned char* rest;public: /** * Default constructor. */ Extension(); /** * Construct the extension from the given reader */ explicit Extension(SectorBitReader& reader); /** * Copy the extension. */ Extension(const Extension& other); /** * Destroy the extension */ ~Extension(); /** * Assignment operator. */ Extension& operator=(const Extension& other); /** * Get the header of the extension */ const Header& getHeader() const; /** * Get the total length of the extension */ size_t getLength() const; /** * Get the PTS data in the extension, if present, INVALID_PTS * otherwise. */ pts_t getPTS() const; /** * Get the DTS data in the extension, if present, INVALID_PTS * otherwise. */ pts_t getDTS() const; /** * Get the rest of the data. */ const unsigned char* getRest() const;};//------------------------------------------------------------------------------// Inline definitions//------------------------------------------------------------------------------inline Extension::~Extension(){ delete[] rest;}//------------------------------------------------------------------------------inline const Extension::Header& Extension::getHeader() const{ return header;}//------------------------------------------------------------------------------inline size_t Extension::getLength() const{ return sizeof(header) + header.length;}//------------------------------------------------------------------------------inline const unsigned char* Extension::getRest() const{ return rest;}//------------------------------------------------------------------------------} /* namespace dvd::demux */ } /* namespace dvd *///------------------------------------------------------------------------------#endif // DXR3PLAYER_DVD_DEMUX_EXTENSION_H// Local variables:// mode: c++// End:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -