📄 dvd.h
字号:
//// Copyright (c) 2002 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_H#define DXR3PLAYER_DVD_H//------------------------------------------------------------------------------#include "Device.h"#include "IFO.h"#include <libmpdvdkit/ifo_types.h>#include <cstdlib>//------------------------------------------------------------------------------namespace dvd {class Device;class VMG;class VTS;//------------------------------------------------------------------------------/** * Class describing a DVD. */class DVD{public: /** * The maximum number of VTSs. */ static const size_t maxNumberOfVTSs = 99;private: /** * The size of a disc ID in bytes. */ static const size_t discIDLength = 16; /** * The DVD device we are using. */ Device& device; /** * The ID of the disc currently opened in printable (hexadecimal) format. */ char discID[2*discIDLength + 1]; /** * The VMG of the DVD. */ VMG vmg; /** * The VTSs on the DVD. */ VTS vtss[maxNumberOfVTSs];public: /** * Construct an instance of this class representing the given DVD * device. */ DVD(Device& device); /** * Determine if there is a disk in the DVD or not. */ bool hasDisk() const; /** * Determine if the DVD is open or not. */ bool isOpen() const; /** * Try to open the DVD device. If succeeds, read in all IFO data. * * @return if the opening has succeeded. */ bool open(); /** * Get the DVD's ID into the given buffer. It shall be a * 0-terminated string. */ void getID(char* dest, size_t length) const; /** * Get the VMG. */ const VMG* getVMG() const; /** * Get the VTS with the given number (1..99) */ const VTS* getVTS(unsigned vtsNumber) const; /** * Open the menu file for the given IFO. * * @return the file opened. */ File openMenuFile(const IFO* ifo) const; /** * Open the title file for the given IFO. * * @return the file opened */ File openTitleFile(const IFO* ifo) const; /** * Close the DVD device. */ void close(); /** * Eject the DVD device. */ void eject();private: /** * Get the title numebr for the given IFO. */ unsigned getTitleNumber(const IFO* ifo) const;};//------------------------------------------------------------------------------// Inline definitions//------------------------------------------------------------------------------inline bool DVD::hasDisk() const{ return device.hasDisk();}//------------------------------------------------------------------------------inline bool DVD::isOpen() const{ return device.isOpen();}//------------------------------------------------------------------------------inline const VMG* DVD::getVMG() const{ return &vmg;}//------------------------------------------------------------------------------inline const VTS* DVD::getVTS(unsigned vtsNumber) const{ if (vtsNumber<1 || vtsNumber>maxNumberOfVTSs) return 0; else return (vtss[vtsNumber-1]) ? (vtss + vtsNumber -1) : 0;}//------------------------------------------------------------------------------inline unsigned DVD::getTitleNumber(const IFO* ifo) const{ if (ifo==&vmg) { return 0; } else { return (ifo - static_cast<const IFO*>(vtss)) + 1; }}//------------------------------------------------------------------------------inline File DVD::openMenuFile(const IFO* ifo) const{ return device.openFile(getTitleNumber(ifo), true);}//------------------------------------------------------------------------------inline File DVD::openTitleFile(const IFO* ifo) const{ return device.openFile(getTitleNumber(ifo), false);}//------------------------------------------------------------------------------//------------------------------------------------------------------------------} /* namespace dvd *///------------------------------------------------------------------------------#endif // DXR3PLAYER_DVD_H// Local variables:// mode: c++// End:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -