📄 pci.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 "PCI.h"#include "Sector.h"#include "util/Log.h"#include <libmpdvdkit/nav_read.h>#include <libmpdvdkit/nav_print.h>#include <cassert>//------------------------------------------------------------------------------using dvd::demux::PCI;using dvd::demux::ButtonInformation;using dvd::demux::HighlightInformation;//------------------------------------------------------------------------------void PCI::set(const unsigned char* d){ assert(d!=0); navRead_PCI(&pci, const_cast<unsigned char*>(d));// if (pci.hli.hl_gi.btngr_ns>1) {// navPrint_PCI(&pci);// }}//------------------------------------------------------------------------------void PCI::set(const Sector& sector){ static const unsigned char header[] = { 0x00, 0x00, 0x01, 0xbf, 0x03, 0xd4, 0x00 }; size_t index = sector.findPESHeader<sizeof(header)>(header); assert(index>0); set(sector.getData() + index);}//------------------------------------------------------------------------------bool HighlightInformation::doesFormatMatch(unsigned displayType, displayFormat_t displayFormat){ return (displayType==0 && displayFormat==DF_SMALLSCREEN) || ( (displayType&0x01)==0x01 && displayFormat==DF_WIDESCREEN) || ( (displayType&0x02)==0x02 && displayFormat==DF_LETTERBOX) || ( (displayType&0x04)==0x04 && displayFormat==DF_PANSCAN);}//------------------------------------------------------------------------------ButtonInformation HighlightInformation::getButtonInformation(size_t buttonNumber, displayFormat_t displayFormat) const{ assert(getGeneral().isValidButton(buttonNumber)); size_t groupNumber = (size_t)-1; size_t numberOfButtonGroups = hli->hl_gi.btngr_ns; size_t buttonGroupSize = (numberOfButtonGroups>=1) ? (maxNumberOfButtons / numberOfButtonGroups) : maxNumberOfButtons; if (numberOfButtonGroups==1 || doesFormatMatch(hli->hl_gi.btngr1_dsp_ty, displayFormat)) { groupNumber = 0; } else if (numberOfButtonGroups>=2 && doesFormatMatch(hli->hl_gi.btngr2_dsp_ty, displayFormat)) { groupNumber = 1; } else if (numberOfButtonGroups>=3 && doesFormatMatch(hli->hl_gi.btngr3_dsp_ty, displayFormat)) { groupNumber = 2; } else { groupNumber = 0; } return ButtonInformation(hli->btnit + groupNumber * buttonGroupSize + buttonNumber - 1);}//------------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -