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

📄 position.h

📁 Linux下比较早的基于命令行的DVD播放器
💻 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_VM_POSITION_H#define DXR3PLAYER_DVD_VM_POSITION_H//------------------------------------------------------------------------------#include "dvd/IFO.h"#include "dvd/PGC.h"#include "dvd/SectorPosition.h"#include <cstdio>//------------------------------------------------------------------------------namespace dvd {class DVD;class VTS;}//------------------------------------------------------------------------------namespace dvd { namespace vm {class State;//------------------------------------------------------------------------------/** * Class describing the position within the DVD. */class Position : public SectorPosition{protected:    /**     * The state the position belongs to.     */    const State& state;private:    /**     * The number of the PGC we play     */    unsigned pgcNumber;    /**     * The number of the cell we play.     */    unsigned cellNumber;public:    /**     * Construct the position object to be in the first play PGC.     */    explicit Position(const State& state);    /**     * Copy construct the object.     */    Position(const Position& from);    /**     * Reset the position.     */    void reset();    /**     * Determine of the position is valid.     */    bool isValid() const;    /**     * Copy this position from the given other one.     *     * @param cellNo cell number to use. If 0, the one from the source     * position is copied along with the sector number, otherwise this     * number is used with a sector number of 0.     */    void copy(const Position& from, unsigned cellNo = 0);    /**     * Assignment operator.     */    Position& operator=(const Position& from);    /**     * Determine if this position is equal to the other one.     */    bool equals(const Position& other) const;    /**     * Set the PGC number.     */    void setPGCNumber(unsigned pgcNo);    /**     * Get the PGC number.     */    unsigned getPGCNumber() const;    /**     * Set the cell number.     */    void setCellNumber(unsigned cellNo);    /**     * Get the cell number.     */    unsigned getCellNumber() const;    /**     * Find the IFO the position designates. It can return 0.     */    const IFO* findIFO() const;    /**     * Get the Video Manager.     */    const VMG* getVMG() const;    /**     * Find the VTS structure corresponding to the current position.     *     * @return the VTS structure or 0 if not found.     */    const VTS* findVTS() const;    /**     * Get the PGC the position points to.     */    PGC getPGC() const;    /**     * Get the PGC table for the position. Cannot be     * called while in the first play PGC.     */    PGCTable getPGCTable() const;    /**     * Get the playback info for the current cell.     */    CellPlaybackInfo getCellPlaybackInfo() const;    /**     * Get the "user position" for this position. This includes the     * DVD title and chapter (part) numbers and the time offset within     * the current PGC. The time offset returned is the time offset of     * the beginning of the current cell, cell elapsed time from PCIs     * or DSIs must be added to it.     */    unsigned long long getUserPosition(unsigned& titleNo, unsigned& partNo,                                       unsigned long long& playbackTime,                                       unsigned& fps) const;    /**     * Check if the given play mode is allowed in this position.     */    bool isPlayModeAllowed(playMode_t playMode) const;    /**     * Save the position to the given file.     *     * @return if the saving has succeeded     */    bool save(FILE* f) const;    /**     * Load the position from the given file.     *     * @return if the loading has succeeded     */    bool load(FILE* f);};//------------------------------------------------------------------------------// Inline definitions//------------------------------------------------------------------------------inline Position::Position(const State& state) :     state(state),    pgcNumber(0),     cellNumber(0){}//------------------------------------------------------------------------------inline Position::Position(const Position& from) :    SectorPosition(),    state(from.state){    copy(from);}//------------------------------------------------------------------------------inline bool Position::isValid() const{    return pgcNumber!=0 && cellNumber!=0;}//------------------------------------------------------------------------------inline Position& Position::operator=(const Position& from){    copy(from);    return *this;}//------------------------------------------------------------------------------inline void Position::setPGCNumber(unsigned pgcNo){    pgcNumber = pgcNo;}//------------------------------------------------------------------------------inline unsigned Position::getPGCNumber() const{    return pgcNumber;}//------------------------------------------------------------------------------inline void Position::setCellNumber(unsigned cellNo){    cellNumber = cellNo;}//------------------------------------------------------------------------------inline unsigned Position::getCellNumber() const{    return cellNumber;}//------------------------------------------------------------------------------inline bool operator==(const Position& p1, const Position& p2){    return p1.equals(p2);}//------------------------------------------------------------------------------//------------------------------------------------------------------------------} /* namespace dvd::vm */ } /* namespace dvd *///------------------------------------------------------------------------------#endif // DXR3PLAYER_DVD_VM_POSITION_H// Local variables:// mode: c++// End:

⌨️ 快捷键说明

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