?? commandbasedosdhandler.cc
字號:
//// Copyright (c) 2005 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//------------------------------------------------------------------------------#include "CommandBasedOSDHandler.h"#include "UpdateDVDPositionCommand.h"#include "UpdateDVDLanguagesCommand.h"#include "UpdateVolumeCommand.h"#include "sched/Scheduler.h"//------------------------------------------------------------------------------using output::osd::CommandBasedOSDHandler;using sched::Scheduler;//------------------------------------------------------------------------------CommandBasedOSDHandler::CommandBasedOSDHandler(const char* name) : Schedulable(name), commandAvailable(name, "commandAvailable"){}//------------------------------------------------------------------------------void CommandBasedOSDHandler::run(){ millis_t timeout = INVALID_MILLIS; while(!shouldQuit()) { clearInterrupt(); bool timeoutOccured = false; while(commands.size()==0 && !timeoutOccured && !isInterrupted()) { timeoutOccured = !Scheduler::waitInterruptible(commandAvailable, timeout); } if (!isInterrupted()) { if (timeoutOccured) timeout = handleTimeout(); if (commands.size()>0) { commands_t currentCommands; commands.swap(currentCommands); for(commands_t::iterator i = currentCommands.begin(); i!=currentCommands.end(); ++i) { Command* command = *i; if (!isInterrupted()) { command->executeOn(this); } delete command; } if (!isInterrupted()) { timeout = finalizeUpdates(); } } } }}//------------------------------------------------------------------------------void CommandBasedOSDHandler::updateDVDPosition(const DVDPosition& dvdPosition){ OSDHandler::updateDVDPosition(dvdPosition); addCommand(new UpdateDVDPositionCommand(dvdPosition));}//------------------------------------------------------------------------------void CommandBasedOSDHandler::updateDVDLanguages(unsigned audioLanguageCode, unsigned spuLanguageCode){ addCommand(new UpdateDVDLanguagesCommand(audioLanguageCode, spuLanguageCode));}//------------------------------------------------------------------------------void CommandBasedOSDHandler::updateVolume(unsigned volume){ addCommand(new UpdateVolumeCommand(volume));}//------------------------------------------------------------------------------void CommandBasedOSDHandler::show(){ addCommand(new SimpleCommand(SimpleCommand::SHOW));}//------------------------------------------------------------------------------void CommandBasedOSDHandler::setPlayMode(playMode_t playMode){ SimpleCommand::type_t type = SimpleCommand::PLAYMODE_PLAY; switch(playMode) { case FORWARD: type = SimpleCommand::PLAYMODE_PLAY; break; case FAST_FORWARD_1: type = SimpleCommand::PLAYMODE_FAST_FORWARD_1; break; case FAST_FORWARD_2: type = SimpleCommand::PLAYMODE_FAST_FORWARD_2; break; case FAST_FORWARD_3: type = SimpleCommand::PLAYMODE_FAST_FORWARD_3; break; case FAST_BACKWARD_1: type = SimpleCommand::PLAYMODE_FAST_BACKWARD_1; break; case FAST_BACKWARD_2: type = SimpleCommand::PLAYMODE_FAST_BACKWARD_2; break; case FAST_BACKWARD_3: type = SimpleCommand::PLAYMODE_FAST_BACKWARD_3; break; case PAUSED: type = SimpleCommand::PLAYMODE_PAUSE; } addCommand(new SimpleCommand(type));}//------------------------------------------------------------------------------void CommandBasedOSDHandler::addCommand(Command* command){ commands.push_back(command); commandAvailable.set();}//------------------------------------------------------------------------------millis_t CommandBasedOSDHandler::finalizeUpdates(){ return INVALID_MILLIS;}//------------------------------------------------------------------------------millis_t CommandBasedOSDHandler::handleTimeout(){ return INVALID_MILLIS;}//------------------------------------------------------------------------------
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -