📄 videohandler.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 "VideoHandler.h"#include "output/VideoAttributes.h"#include "dxr3/Video.h"#include "util/Config.h"//------------------------------------------------------------------------------using output::dxr3::VideoHandler;using dvd::packet::PacketQueue;using dxr3::Video;//------------------------------------------------------------------------------VideoHandler::VideoHandler(Timer& timer, PacketQueue& inputQueue, Video& videoDevice) : TimedStreamHandler("output::dxr3::VideoHandler", timer, inputQueue, videoDevice.getStream(), 16), videoDevice(videoDevice){ const Config& config = Config::get(); videoDevice.setBCS(config.defaultBrightness, config.defaultContrast, config.defaultSaturation);}//------------------------------------------------------------------------------void VideoHandler::printStatus() const{ int brightness, contrast, saturation; videoDevice.getBCS(brightness, contrast, saturation); Log::debug(" brightness: %d, contrast: %d, saturation: %d\n", brightness, contrast, saturation);}//------------------------------------------------------------------------------void VideoHandler::setAttributes(const VideoAttributes& attributes){ const Config& config = Config::get(); if (!config.keepStandard && videoDevice.getStandard()!=attributes.standard) { videoDevice.setStandard(attributes.standard); } if (!config.keepAspectRatio && videoDevice.getAspectRatio()!=attributes.aspectRatio) { videoDevice.setAspectRatio(attributes.aspectRatio); }}//------------------------------------------------------------------------------bool VideoHandler::isDifferent(const VideoAttributes& attributes) const{ const Config& config = Config::get(); return (!config.keepStandard && videoDevice.getStandard()!=attributes.standard) || (!config.keepAspectRatio && videoDevice.getAspectRatio()!=attributes.aspectRatio);}//------------------------------------------------------------------------------unsigned VideoHandler::increaseBrightness(){ int brightness; int contrast; int saturation; videoDevice.getBCS(brightness, contrast, saturation); if (brightness<=95) { brightness += 5; videoDevice.setBCS(brightness, contrast, saturation); } return brightness;}//------------------------------------------------------------------------------unsigned VideoHandler::decreaseBrightness(){ int brightness; int contrast; int saturation; videoDevice.getBCS(brightness, contrast, saturation); if (brightness>=5) { brightness -= 5; videoDevice.setBCS(brightness, contrast, saturation); } return brightness;}//------------------------------------------------------------------------------unsigned VideoHandler::increaseContrast(){ int brightness; int contrast; int saturation; videoDevice.getBCS(brightness, contrast, saturation); if (contrast<=95) { contrast += 5; videoDevice.setBCS(brightness, contrast, saturation); } return contrast;}//------------------------------------------------------------------------------unsigned VideoHandler::decreaseContrast(){ int brightness; int contrast; int saturation; videoDevice.getBCS(brightness, contrast, saturation); if (contrast>=5) { contrast -= 5; videoDevice.setBCS(brightness, contrast, saturation); } return contrast;}//------------------------------------------------------------------------------unsigned VideoHandler::increaseSaturation(){ int brightness; int contrast; int saturation; videoDevice.getBCS(brightness, contrast, saturation); if (saturation<=95) { saturation += 5; videoDevice.setBCS(brightness, contrast, saturation); } return saturation;}//------------------------------------------------------------------------------unsigned VideoHandler::decreaseSaturation(){ int brightness; int contrast; int saturation; videoDevice.getBCS(brightness, contrast, saturation); if (saturation>=5) { saturation -= 5; videoDevice.setBCS(brightness, contrast, saturation); } return saturation;}//------------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -