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

📄 dvddump.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_DVDDUMP_H#define DXR3PLAYER_DVD_DVDDUMP_H//------------------------------------------------------------------------------#include "Device.h"#include "DVD.h"#include "util/DefaultAllocator.h"#include <map>#include <functional>#include <libmpdvdkit/nav_types.h>#include <cstdio>//------------------------------------------------------------------------------namespace ifodump {class IFOReader;class NAVReader;}//------------------------------------------------------------------------------namespace dvd {//------------------------------------------------------------------------------/** * DVD device which works from a DVD dump. */class DVDDump : public Device{public:    /**     * The magic number for dumps.     */    static const char magic[4];    /**     * The current version. It can be:     *     * - 1: from dxr3Player 0.9.4     *     * Version 0 means and unversioned dump. It is treated as dump     * version 1.     */    static const unsigned currentVersion = 1;    /**     * Function to check if the given dump file is versioned or not.     */    static bool isVersioned(FILE* f);    private:    /**     * Structure for the navigation structures.     */    struct NAVInfo {        /**         * The PCI.         */        pci_t pci;        /**         * The DSI         */        dsi_t dsi;    };    /**     * Type for mapping VOBU start sectors to NAV infos.     */    typedef std::map<size_t, NAVInfo, std::greater<size_t>, DefaultAllocator > navMap_t;    /**     * IFO information structure.     */    struct IFOInfo {        /**         * The IFO handle.         */        ifo_handle_t ifoHandle;        /**         * NAV mapping for the menu VOBUs.         */        navMap_t menuNAVs;                /**         * NAV mapping for the title VOBUs.         */        navMap_t titleNAVs;    };    /**     * Our own file handler.     */    class FileHandler : public dvd::FileHandler     {    private:        /**         * Copy the given PCI with endianness conversion         */        static void copy(pci_t& dest, const pci_t& src);        /**         * Copy the given DSI with endianness conversion         */        static void copy(dsi_t& dest, const dsi_t& src);        /**         * The NAV map to use to generate bogus sectors.         */        const navMap_t& navs;    public:        /**         * Construct the file handler with the given map.         */        FileHandler(const navMap_t& navs);        /**         * @see dvd::FileHandler::getLength         */        virtual size_t getLength();        /**         * @see dvd::FileHandler::readSectors         */        virtual void readSectors(void* dest, size_t offset, size_t numSectors);    private:        /**         * Read a single sector into the given destination.         */        void readSector(void* dest, size_t offset) const;    };public:    /**     * Check if the given file is a dump file.     */    static bool isDumpFile(const char* path);private:    /**     * The open indicator.     */    bool opened;    /**     * The IFO information     */    IFOInfo ifoInfos[DVD::maxNumberOfVTSs+1];    public:    /**     * Construct the DVD dump device from the given dump file.     */    DVDDump(const char* dumpFile);    /**     * @see Device::hasDisk     */    virtual bool hasDisk();    /**     * @see Device::isOpen     */    virtual bool isOpen() const;        /**     * @see Device::open     */    virtual bool open();    /**     * @see Device::getID     */    virtual void getID(unsigned char* dest) const;    /**     * @see Device::getIFOHandle     */    virtual const ifo_handle_t* getIFOHandle(unsigned titleNo) const;        /**     * @see Device::openFile     */    virtual dvd::FileHandler* openFile(unsigned titleNo, bool isMenu) const;    /**     * @see Device::close     */    virtual void close();    /**     * @see Device::eject     */    virtual void eject();private:    /**     * Read the IFO data for the IFO with the given index.     */    void readIFO(ifodump::IFOReader& reader, size_t ifoIndex);    /**     * Read the NAV data for the IFO with the given index.     */    void readNAV(ifodump::NAVReader& reader, size_t ifoIndex);    /**     * Read the NAV data for the VOBU address map into the giveb map.     */    void readNAV(ifodump::NAVReader& reader, navMap_t& dest,                  vobu_admap_t* vobuAddresses);}; //------------------------------------------------------------------------------} /* namespace dvd *///------------------------------------------------------------------------------#endif // DXR3PLAYER_DVD_DVDDUMP_H// Local variables:// mode: c++// End:

⌨️ 快捷键说明

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