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

📄 title.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_TITLE_H#define DXR3PLAYER_DVD_TITLE_H//------------------------------------------------------------------------------#include <cassert>#include <libmpdvdkit/ifo_types.h>//------------------------------------------------------------------------------namespace dvd {//------------------------------------------------------------------------------/** * Video Manager title information. */class TitleInfo{private:    /**     * The low-level structure     */    const title_info_t* title_info;public:    /**     * Construct a title information object.     */    explicit TitleInfo(const title_info_t* title_info);    /**     * Get the number of angles.     */    unsigned getNumberOfAngles() const;    /**     * Get the VTS number.     */    unsigned getVTSNumber() const;    /**     * Get the VTS title number.     */    unsigned getVTSTitleNumber() const;};//------------------------------------------------------------------------------/** * Video Manager title info table. */class TitleInfoTable{private:    /**     * The low-level structure     */    const tt_srpt_t* tt_srpt;public:    /**     * Construct a title table.     */    explicit TitleInfoTable(const tt_srpt_t* tt_srpt);    /**     * Check if the title table is valid.     */    operator bool() const;    /**     * Get the number of titles.     */    unsigned getNumberOfTitles() const;    /**     * Get the title information with the given number.     */    TitleInfo getTitleInfo(unsigned titleNo) const;    /**     * Get the title number for the given VTS and VTS title numbers.     */    unsigned getTitleNumber(unsigned vtsNo, unsigned vtsTitleNo) const;};//------------------------------------------------------------------------------/** * A part of VTS title. */class Part{private:    /**     * The low-level structure.     */    const ptt_info_t* ptt_info;public:    /**     * Construct the object.     */    Part(const ptt_info_t* ptt_info);    /**     * Get the PGC number.     */    unsigned getPGCNumber() const;    /**     * Get the program number.     */    unsigned getProgramNumber() const;};//------------------------------------------------------------------------------/** * A VTS title. */class Title{private:    /**     * The low-level structure.     */    const ttu_t* ttu;public:    /**     * Construct the title.     */    Title(const ttu_t* ttu);    /**     * Get the number of parts.     */    unsigned getNumberOfParts() const;    /**     * Get the part with the given number.     */    Part getPart(unsigned partNo) const;    /**     * Find the part number with the given PGC/PG numbers.     *     * @return the number of part found, or 0 if not found.     */    unsigned findPart(unsigned pgcNo, unsigned programNo);};//------------------------------------------------------------------------------/** * VTS title table. */class TitleTable{private:    /**     * The low-level structure     */    const vts_ptt_srpt_t* vts_ptt_srpt;public:    /**     * Construct the table.     */    explicit TitleTable(const vts_ptt_srpt_t* vts_ptt_srpt);    /**     * Determine if the table is valid.     */    operator bool() const;    /**     * Get the number of titles.     */    unsigned getNumberOfTitles() const;    /**     * Get the title with the given, 1-based number.     */    Title getTitle(unsigned vtsTitleNumber) const;    /**     * Find the title and part numbers for the given PGC/PG number     * pair.     *     * @return the title number, or 0 if not found.     */    unsigned findTitleAndPart(unsigned pgcNo, unsigned programNo,                               unsigned& partNo)        const;};//------------------------------------------------------------------------------// Inline definitions//------------------------------------------------------------------------------inline TitleInfo::TitleInfo(const title_info_t* title_info) :    title_info(title_info){}//------------------------------------------------------------------------------inline unsigned TitleInfo::getNumberOfAngles() const{    return title_info->nr_of_angles;}//------------------------------------------------------------------------------inline unsigned TitleInfo::getVTSNumber() const{    return title_info->title_set_nr;}//------------------------------------------------------------------------------inline unsigned TitleInfo::getVTSTitleNumber() const{    return title_info->vts_ttn;}//------------------------------------------------------------------------------//------------------------------------------------------------------------------inline TitleInfoTable::TitleInfoTable(const tt_srpt_t* tt_srpt) :    tt_srpt(tt_srpt){}//------------------------------------------------------------------------------inline TitleInfoTable::operator bool() const{    return tt_srpt != 0;}//------------------------------------------------------------------------------inline unsigned TitleInfoTable::getNumberOfTitles() const{    return tt_srpt->nr_of_srpts;}//------------------------------------------------------------------------------inline TitleInfo TitleInfoTable::getTitleInfo(unsigned titleNo) const{    assert(titleNo>=1 && titleNo<=getNumberOfTitles());    return TitleInfo(tt_srpt->title + titleNo - 1);}//------------------------------------------------------------------------------//------------------------------------------------------------------------------inline Part::Part(const ptt_info_t* ptt_info) : ptt_info(ptt_info){}//------------------------------------------------------------------------------inline unsigned Part::getPGCNumber() const{    return ptt_info->pgcn;}//------------------------------------------------------------------------------inline unsigned Part::getProgramNumber() const{    return ptt_info->pgn;}//------------------------------------------------------------------------------//------------------------------------------------------------------------------inline Title::Title(const ttu_t* ttu) : ttu(ttu){}//------------------------------------------------------------------------------inline unsigned Title::getNumberOfParts() const{    return ttu->nr_of_ptts;}//------------------------------------------------------------------------------inline Part Title::getPart(unsigned partNo) const{    assert(partNo>=1 && partNo<=getNumberOfParts());    return Part(ttu->ptt + partNo - 1);}//------------------------------------------------------------------------------//------------------------------------------------------------------------------inline TitleTable::TitleTable(const vts_ptt_srpt_t* vts_ptt_srpt) :    vts_ptt_srpt(vts_ptt_srpt){}//------------------------------------------------------------------------------inline TitleTable::operator bool() const{    return vts_ptt_srpt != 0;}//------------------------------------------------------------------------------inline unsigned TitleTable::getNumberOfTitles() const{    return vts_ptt_srpt->nr_of_srpts;}//------------------------------------------------------------------------------inline Title TitleTable::getTitle(unsigned vtsTitleNo) const{    assert(vtsTitleNo>=1 && vtsTitleNo<=getNumberOfTitles());    return Title(vts_ptt_srpt->title + vtsTitleNo - 1);}//------------------------------------------------------------------------------} /* namespace dvd *///------------------------------------------------------------------------------#endif // DXR3PLAYER_DVD_TITLE_H// Local variables:// mode: c++// End:

⌨️ 快捷键说明

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