📄 targetposition.cc
字号:
//// 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//------------------------------------------------------------------------------#include "TargetPosition.h"#include "SPRM.h"#include "State.h"#include "util/Log.h"//------------------------------------------------------------------------------using dvd::vm::TargetPosition;//------------------------------------------------------------------------------bool TargetPosition::enterPGC(unsigned pgcNo, unsigned programNo){ if (isInVideoManager() && !isInMenu()) { Log::error("dvd::vm::TargetPosition::enterPGC: cannot enter into PGC in the first play PGC!\n"); return false; } PGCTable pgcTable = getPGCTable(); if (!pgcTable) { Log::fatal("dvd::vm::TargetPosition::enterPGC: no PGC table found in VTS %u\n", getVTSNumber()); return false; } if (pgcNo>=1 && pgcNo<=pgcTable.getNumberOfPGCs()) { setPGCNumber(pgcNo); return enterProgram(programNo); } else { Log::error("dvd::vm::TargetPosition::enterPGC: invalid PGC number: %u!\n", pgcNo); return false; }}//------------------------------------------------------------------------------void TargetPosition::enterFirstPlayPGC(){ setVTSNumber(Position::VTS_VMG); clearInMenu(); setPGCNumber(0);}//------------------------------------------------------------------------------bool TargetPosition::enterMenu(unsigned menuID){ setInMenu(); PGCTable pgcTable = getPGCTable(); if (!pgcTable) { Log::fatal("dvd::vm::TargetPosition::enterMenu: cannot enter menu %u because no PGC table found\n", menuID); return false; } for(unsigned pgcNo = 1; pgcNo<=pgcTable.getNumberOfPGCs(); ++pgcNo) { unsigned entryID = pgcTable.getPGCInfo(pgcNo).getEntryID(); if ( (entryID&0x80)==0x80 && (entryID&0x7f)==menuID) { return enterPGC(pgcNo); } } Log::error("dvd::vm::TargetPosition::enterMenu: menu not found for ID %u\n", menuID); return false;}//------------------------------------------------------------------------------bool TargetPosition::enterMenu(unsigned menuID, bool forced){ bool entered = enterMenu(menuID); if (forced && !entered) { Log::debug("dvd::vm::TargetPosition::enterMenu: trying to find menu elsewhere\n"); unsigned currentVTSNumber = getVTSNumber(); if (currentVTSNumber!=Position::VTS_VMG) { setVTSNumber(Position::VTS_VMG); entered = enterMenu(menuID); } size_t numVTSs = state.getDVD()->getVMG()->getNumberOfTitleSets(); for(size_t i = 1; i<=numVTSs && !entered; ++i) { if (currentVTSNumber!=i) { setVTSNumber(i); entered = enterMenu(menuID); } } } return entered;}//------------------------------------------------------------------------------bool TargetPosition::enterVMGMenu(unsigned menuID){ setVTSNumber(Position::VTS_VMG); return enterMenu(menuID);}//------------------------------------------------------------------------------bool TargetPosition::enterVMGPGC(unsigned pgcNo){ setVTSNumber(Position::VTS_VMG); setInMenu(); return enterPGC(pgcNo);}//------------------------------------------------------------------------------bool TargetPosition::enterNextPGC(){ PGC pgc = getPGC(); if (!pgc) { Log::fatal("dvd::vm::TargetPosition::enterNextPGC: cannot enter PGC following invalid PGC\n"); return false; } return enterPGC(pgc.getNextPGCNumber());}//------------------------------------------------------------------------------bool TargetPosition::enterPreviousPGC(){ PGC pgc = getPGC(); if (!pgc) { Log::fatal("dvd::vm::TargetPosition::enterPreviousPGC: cannot enter PGC preceding invalid PGC\n"); return false; } return enterPGC(pgc.getPreviousPGCNumber());}//------------------------------------------------------------------------------bool TargetPosition::enterGoUpPGC(){ PGC pgc = getPGC(); if (!pgc) { Log::fatal("dvd::vm::TargetPosition::enterGoUpPGC: cannot enter GoUp PGC of invalid PGC\n"); return false; } return enterPGC(pgc.getGoUpPGCNumber());}//------------------------------------------------------------------------------bool TargetPosition::enterProgram(unsigned programNo){ PGC pgc = getPGC(); if (!pgc) { Log::fatal("dvd::vm::TargetPosition::enterProgram: cannot enter program %u of invalid PGC\n", programNo); return false; } else if (pgc.isEmpty()) { return enterCell(0); } else if (programNo<1 || programNo>pgc.getNumberOfPrograms()) { Log::error("dvd::vm::TargetPosition::enterProgram: Invalid program number: %u\n", programNo); return false; } else { return enterCell(pgc.getEntryCellNumber(programNo)); }}//------------------------------------------------------------------------------bool TargetPosition::repeatProgram(){ PGC pgc = getPGC(); if (!pgc) { Log::fatal("dvd::vm::TargetPosition::repeatProgram: cannot repeat program in invalid PGC\n"); return false; } else if (pgc.isEmpty()) { Log::fatal("dvd::vm::TargetPosition::repeatProgram: cannot repeat program in empty PGC\n"); return false; } else { return enterProgram(pgc.getProgramNumber(getCellNumber())); }}//------------------------------------------------------------------------------bool TargetPosition::enterNextProgram(){ PGC pgc = getPGC(); if (!pgc) { Log::fatal("dvd::vm::TargetPosition::enterNextProgram: cannot enter next program in invalid PGC\n"); return false; } else if (pgc.isEmpty()) { Log::fatal("dvd::vm::TargetPosition::enterNextProgram: cannot enter next program in empty PGC\n"); return false; } else { return enterProgram(pgc.getProgramNumber(getCellNumber())+1); }}//------------------------------------------------------------------------------bool TargetPosition::enterPreviousProgram(){ PGC pgc = getPGC(); if (!pgc) { Log::fatal("dvd::vm::TargetPosition::enterPreviousProgram: cannot enter previous program in invalid PGC\n"); return false; } else if (pgc.isEmpty()) { Log::fatal("dvd::vm::TargetPosition::enterPreviousProgram: cannot enter previous program in empty PGC\n"); return false; } else { return enterProgram(pgc.getProgramNumber(getCellNumber())-1); }}//------------------------------------------------------------------------------bool TargetPosition::enterLastProgram()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -