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

📄 pgc.cc

📁 Linux下比较早的基于命令行的DVD播放器
💻 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 "PGC.h"#include "util/Log.h"#include "util/Util.h"//------------------------------------------------------------------------------using dvd::PGC;//------------------------------------------------------------------------------unsigned long long dvd::dvdTime2Frames(const dvd_time_t& dvd_time,                                       unsigned& fps){    unsigned long long frames = 0;    frames += Util::bcd2Unsigned(dvd_time.hour);    frames *= 60;    frames += Util::bcd2Unsigned(dvd_time.minute);    frames *= 60;    frames += Util::bcd2Unsigned(dvd_time.second);    unsigned f = ((dvd_time.frame_u&0xc0)==0xc0) ? 30 : 25;    assert(fps==0 || f==fps);    fps = f;    frames *= fps;    frames += Util::bcd2Unsigned(dvd_time.frame_u&0x3f);    return frames;}//------------------------------------------------------------------------------unsigned PGC::findBaseCell(unsigned cellNo, bool ascending) const{    int diff = ascending ? 1 : -1;        for(; cellNo>=1 && cellNo<=getNumberOfCells(); cellNo += diff) {        CellPlaybackInfo cellPlaybackInfo = getCellPlaybackInfo(cellNo);        if (!cellPlaybackInfo.isInAngleBlock() ||            cellPlaybackInfo.isFirstInAngleBlock()) break;    }    return cellNo;}//------------------------------------------------------------------------------unsigned PGC::getProgramNumber(unsigned cellNo) const{    unsigned numPrograms = getNumberOfPrograms();    for(unsigned programNumber = numPrograms; programNumber>=1; --programNumber) {        if (cellNo>=getEntryCellNumber(programNumber)) return programNumber;    }    return 0;}//------------------------------------------------------------------------------unsigned PGC::getAudioStreamNumber(unsigned streamNo) const{    if (streamNo>=8) return INVALID_STREAM_NUMBER;        unsigned ctrl = pgc->audio_control[streamNo];    if ( (ctrl&0x8000)!=0x8000) return INVALID_STREAM_NUMBER;    else return (ctrl>>8)&0x07;}//------------------------------------------------------------------------------unsigned PGC::getLogicalAudioStreamNumber(unsigned streamNo) const{    for(unsigned i = 0; i<8; ++i) {        unsigned ctrl = pgc->audio_control[i];        if ( (ctrl&0x8000)==0x8000 && ((ctrl>>8)&0x07)==streamNo) {            return i;        }    }    return INVALID_STREAM_NUMBER;}//------------------------------------------------------------------------------unsigned PGC::getSPUStreamNumber(unsigned streamNo,                                  aspectRatio_t /*aspectRatio*/,                                 displayFormat_t displayFormat) const{    unsigned ctrl = pgc->subp_control[streamNo];        if ( (ctrl&0x80000000)!=0x80000000) return PGC::INVALID_STREAM_NUMBER;    switch(displayFormat) {      case DF_SMALLSCREEN:        return (ctrl>>24)&0x1f;      case DF_WIDESCREEN:      default:        return (ctrl>>16)&0x1f;      case DF_LETTERBOX:        return (ctrl>>8)&0x1f;      case DF_PANSCAN:        return (ctrl>>0)&0x1f;    }}//------------------------------------------------------------------------------unsigned PGC::getLogicalSPUStreamNumber(unsigned streamNo,                                        aspectRatio_t /*aspectRatio*/,                                        displayFormat_t displayFormat) const{    for(unsigned i = 0; i<32; ++i) {        unsigned ctrl = pgc->subp_control[i];                    if ( (ctrl&0x80000000)!=0x80000000) continue;        switch(displayFormat) {          case DF_SMALLSCREEN:            if ( ((ctrl>>24)&0x1f)==streamNo ) return i;          case DF_WIDESCREEN:          default:            if ( ((ctrl>>16)&0x1f)==streamNo ) return i;          case DF_LETTERBOX:            if ( ((ctrl>>8)&0x1f)==streamNo ) return i;          case DF_PANSCAN:            if ( ((ctrl>>0)&0x1f)==streamNo ) return i;       }    }    return INVALID_STREAM_NUMBER;}//------------------------------------------------------------------------------unsigned long long PGC::getCellStartingTime(unsigned cellNo,                                            unsigned& fps) const{    unsigned long long startingTime = 0;    for(unsigned i = 1; i<cellNo; ++i) {        startingTime += getCellPlaybackInfo(i).getPlaybackTime(fps);    }    return startingTime;}//------------------------------------------------------------------------------//------------------------------------------------------------------------------

⌨️ 快捷键说明

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