📄 videohandler.h
字号:
//// Copyright (c) 2004 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#ifndef DXR3PLAYER_OUTPUT_UNICHROME_VIDEOHANDLER_H#define DXR3PLAYER_OUTPUT_UNICHROME_VIDEOHANDLER_H//------------------------------------------------------------------------------#include "dvd/packet/PacketQueue.h"#include "output/VideoAttributes.h"#include "sched/Schedulable.h"#include "mpeg/MPEGListener.h"#include "mpeg/MPEGParser.h"//------------------------------------------------------------------------------namespace unichrome {class Unichrome;}//------------------------------------------------------------------------------namespace output {class SystemTimer;} /* namespace output *///------------------------------------------------------------------------------namespace output { namespace unichrome {//------------------------------------------------------------------------------class SPUHandler;//------------------------------------------------------------------------------/** * Handler for the video strams. */class VideoHandler : public mpeg::MPEGParser, public mpeg::MPEGListener{private: /** * The input queue for video packets. */ dvd::packet::PacketQueue& inputQueue; /** * The Unichrome device. */ ::unichrome::Unichrome& videoDevice; /** * The timer to use. */ output::SystemTimer& timer; /** * The SPU handler to use. */ SPUHandler& spuHandler; /** * The base PTS value. This is the PTS value corresponding to * field 0 when we take into account the number of fields. */ pts_t basePTS; /** * The number of fields since basePTS. */ size_t numFields; /** * The field compensation. */ ssize_t fieldCompensation; /** * Indicate if only intra frames should be played. */ bool playIntra; /** * Indicate if only the first I-frame should be accepted. */ bool nextOnlyIFrame; /** * Our current video attributes. */ VideoAttributes videoAttributes; public: /** * Construct the video handler. */ VideoHandler(dvd::packet::PacketQueue& inputQueue, output::SystemTimer& timer, SPUHandler& spuHandler, ::unichrome::Unichrome& videoDevice); /** * Process the video packets. */ virtual void run(); /** * Get the next packet. */ virtual Reference<dvd::packet::DataBlockPacket> getNextPacket(); /** * @see sched::Schedulable::printStatus */ virtual void printStatus() const; /** * Set the flag wether only intra frames should be played. */ void setPlayIntra(bool x); /** * Reset the video handler. */ void reset(); /** * Flush the video handler. */ void flush(); /** * Determine of the given video attributes are different from the * current ones. */ bool isDifferent(const VideoAttributes& attributes) const; /** * Set the given video attributes. */ void setAttributes(const VideoAttributes& attributes); /** * Increase the brightness and return the new value. */ unsigned increaseBrightness(); /** * Decrease the brightness and return the new value. */ unsigned decreaseBrightness(); /** * Increase the contrast and return the new value. */ unsigned increaseContrast(); /** * Decrease the contrast and return the new value. */ unsigned decreaseContrast(); /** * Increase the saturation and return the new value. */ unsigned increaseSaturation(); /** * Decrease the saturation and return the new value. */ unsigned decreaseSaturation();private: /** * Get the frame length in PTS. */ ptsdiff_t getFrameLength() const; /** * Get the timing tolerance. */ ptsdiff_t getTolerance() const; /** * Clear the OSD buffer. */ void clearOSD(); /** * Draw the current frame into the given buffer. */ void drawCurrentFrame(bool updateFieldCompensation = true); /** * Get the PTS for the current frame having the given PTS value. */ pts_t getFramePTS(pts_t pts); /** * Time the frame with the given PTS value. */ void timeFrame(pts_t pts); /** * If HW flipping is used, wait until the currently pending * flipping has been finished and update the field compensation * accordingly. Otherwise simply return; */ void waitHWFlipFinished(bool updateFieldCompensation = true); /** * Process the given PTS information. */ virtual void ptsReceived(pts_t pts); /** * Process a sequence header (it contains the extension too). */ virtual void sequence(const mpeg::SequenceHeader& header); /** * Process a quantization matrix. */ virtual void quantMatrix(const mpeg::QuantMatrix& quantMatrix); /** * Process a group of pictures header.. */ virtual void groupOfPictures(const mpeg::GOPHeader& header); /** * Process a picture header (it contains the extension too). */ virtual void picture(const mpeg::PictureHeader& header); /** * Process a slice data. */ virtual void slice(const unsigned char* data, size_t length); /** * Process the end of a picture. */ virtual void endPicture(); /** * Process the end of a sequence. */ virtual void endSequence();};//------------------------------------------------------------------------------} /* namespace output::unichrome */ } /* namespace output *///------------------------------------------------------------------------------#endif // DXR3PLAYER_OUTPUT_UNICHROME_VIDEOHANDLER_H// Local variables:// mode: c++// End:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -