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

📄 statetracker.h

📁 Linux下比较早的基于命令行的DVD播放器
💻 H
字号:
// Copyright (c) 2004 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_OUTPUT_STATETRACKER#define DXR3PLAYER_OUTPUT_STATETRACKER//------------------------------------------------------------------------------#include "OutputProcessor.h"#include "dvd/packet/CommandExecutor.h"#include "dvd/vm/Processor.h"#include "sched/Schedulable.h"//------------------------------------------------------------------------------namespace dvd { namespace packet {class PacketQueue;} /* namespace dvd::packet */ namespace vm {class ProcessorCommandQueue;} /* namespace dvd::vm */} /* namespace dvd *///------------------------------------------------------------------------------namespace output {//------------------------------------------------------------------------------class Timer;class OSDHandler;//------------------------------------------------------------------------------/** * This class keeps track of the output VM state for the DVD. It * handles various events that should occur at a certain time * instance. It assumes, that packets arrive in the queue in the * correct order. */class StateTracker : public sched::Schedulable,                     public dvd::packet::CommandExecutor                     {public:    /**     * Interface for the actual button handlers     */    class ButtonHandler    {    public:        /**         * Virtual destructor         */        virtual ~ButtonHandler() {}        /**         * Highlight a certain button.         */        virtual void highlightButton(int color, int contrast,                                     size_t top, size_t bottom,                                     size_t left, size_t right) = 0;        /**         * Clear the button currently displayed.         */        virtual void clearButton() = 0;    };private:    /**     * The timer.     */    Timer& timer;    /**     * The input queue.     */    dvd::packet::PacketQueue& inputQueue;    /**     * The button handler.     */    ButtonHandler& buttonHandler;    /**     * The OSD handler.     */    OSDHandler& osdHandler;    /**     * The processor command queue     */    dvd::vm::ProcessorCommandQueue& processorCommandQueue;        /**     * Our own processor.     */    dvd::vm::Processor processor;    /**     * The previous PCI.     */    Reference<dvd::demux::PCI> previousPCI;        /**     * The current PCI.     */    Reference<dvd::demux::PCI> currentPCI;    /**     * The next display format (the packet comes before a PCI becomes     * valid).     */    displayFormat_t nextDisplayFormat;    /**     * The current display format (the packet comes before a PCI becomes     * valid).     */    displayFormat_t currentDisplayFormat;    /**     * The audio stream number. It is always valid after a processor     * update.     */    unsigned audioStreamNumber;    /**     * The SPU stream number. It is always valid after a processor     * update.     */    unsigned spuStreamNumber;    /**     * Indicate if the buttons should be hidden.     */    bool hideButtons;    public:    /**     * Construct the state tracker.     */    StateTracker(Timer& timer,                 dvd::packet::PacketQueue& inputQueue,                 ButtonHandler& buttonHandler,                 OSDHandler& osdHandler,                 dvd::vm::ProcessorCommandQueue& processorCommandQueue,                 dvd::DVD& dvd);    /**     * @see sched::Schedulable::run     */    virtual void run();    /**     * @see sched::Schedulable::printStatus     */    virtual void printStatus() const;    /**     * Reset the state tracker.     */    void reset();    /**     * Handle the given user action. It handles only actions that     * may require modifying the processor state.     */    OutputProcessor::processorChange_t     handleOperation(input::InputListener::operation_t operation,                    dvd::vm::State& processorState);    /**     * Process the "Up" button.     */    bool buttonUp();    /**     * Process the "Down" button.     */    bool buttonDown();    /**     * Process the "Left" button.     */    bool buttonLeft();    /**     * Process the "Right" button.     */    bool buttonRight();    /**     * Activate the current button.     */    bool activateButton();    /**     * Enter the menu with the given ID.     */    bool enterMenu();    /**     * Get the VM state.     */    const dvd::vm::State& getVMState() const;    /**     * @see dvd::packet::CommandExecutor::setPCI     */    virtual void setPCI(Reference<dvd::demux::PCI> pci);    /**     * @see dvd::packet::CommandExecutor::updateProcessor     */    virtual void updateProcessor(size_t commandID);private:    /**     * Update the highlight on screen.     */    bool updateHighlight();    /**     * Update the highlight according to the given button info.     */    void highlightButton(dvd::demux::HighlightInformation highlightInfo,                         unsigned buttonNo);    /**     * Handle the given button operation.     */    OutputProcessor::processorChange_t    StateTracker::handleButton(input::InputListener::operation_t operation);    /**     * Handle the given menu operation.     */    OutputProcessor::processorChange_t    StateTracker::handleMenu(input::InputListener::operation_t operation);    /**     * Update the user position.     */    void updateUserPosition() const;    /**     * Update the languages.     */    void updateLanguages() const;    /**     * Determine if at least the given number of seconds elapsed from     * the current cell.     */    bool hasCellElapsed(size_t numSeconds) const;};//------------------------------------------------------------------------------// Inline definitions//------------------------------------------------------------------------------inline StateTracker::StateTracker(Timer& timer,                                  dvd::packet::PacketQueue& inputQueue,                                  ButtonHandler& buttonHandler,                                  OSDHandler& osdHandler,                                  dvd::vm::ProcessorCommandQueue& processorCommandQueue,                                  dvd::DVD& dvd) :    sched::Schedulable("output::StateTracker"),    timer(timer),    inputQueue(inputQueue),    buttonHandler(buttonHandler),    osdHandler(osdHandler),    processorCommandQueue(processorCommandQueue),    processor(&dvd),    nextDisplayFormat(DF_SMALLSCREEN),    currentDisplayFormat(DF_SMALLSCREEN),    audioStreamNumber(0),    spuStreamNumber(0),    hideButtons(false){}//------------------------------------------------------------------------------//------------------------------------------------------------------------------} /* namespace output *///------------------------------------------------------------------------------#endif // DXR3PLAYER_OUTPUT_STATETRACKER// Local Variables:// mode: C++// c-basic-offset: 4// indent-tabs-mode: nil// End:

⌨️ 快捷键说明

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