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

📄 controlsequence.h

📁 Linux下比较早的基于命令行的DVD播放器
💻 H
字号:
//// 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#ifndef DXR3PLAYER_DVD_SPU_CONTROLSEQUENCE_H#define DXR3PLAYER_DVD_SPU_CONTROLSEQUENCE_H//------------------------------------------------------------------------------#include "dvd/spu/Picture.h"#include "util/Reference.h"#include "types.h"#include <cstdlib>//------------------------------------------------------------------------------namespace dvd { namespace spu {//------------------------------------------------------------------------------class SPUBufferBitReader;//------------------------------------------------------------------------------/** * Class representing a control sequence. It is nothing, but a series * of setting commands, which are here expressed as the parameters * they set. */class ControlSequence{public:    /**     * The display commands.     */    typedef enum displayCommand_t {        /// None        NONE,        /// Forced start displaying        FORCED_START,        /// Start displaying        START,        /// Stop displaying        STOP    };private:    /**     * Command: Forced Start Display     */    static const unsigned char CMD_FORCED_START_DISPLAY = 0x00;    /**     * Command: Start Display     */    static const unsigned char CMD_START_DISPLAY = 0x01;    /**     * Command: Stop Display     */    static const unsigned char CMD_STOP_DISPLAY = 0x02;    /**     * Command: Set Color     */    static const unsigned char CMD_SET_COLOR = 0x03;    /**     * Command: Set Contrast     */    static const unsigned char CMD_SET_CONTRAST = 0x04;    /**     * Command: Set Display Area     */    static const unsigned char CMD_SET_DISPLAY_AREA = 0x05;    /**     * Command: Set Pixel Offsets     */    static const unsigned char CMD_SET_PIXEL_OFFSETS = 0x06;    /**     * Command: Change Color and Contrast     */    static const unsigned char CMD_CHANGE_COLOR_AND_CONTRAST = 0x07;    /**     * Command: End     */    static const unsigned char CMD_END = 0xff;    /**     * The delay before executing these commands     */    size_t delay;    /**     * The PTS at which the command should be executed.     */    pts_t pts;    /**     * The display command.     */    displayCommand_t displayCommand;    /**     * The color value. -1 means no color set.     */    int color;    /**     * The contrast value. -1 means no contrast set.     */    int contrast;    /**     * The picture.     */    Reference<Picture> picture;    /**     * Color and contrast changing information.     */    struct {        /**         * The length of the data.         */        size_t length;        /**         * The data.         */        unsigned char* data;    } colorAndContrastChange;public:    /**     * Construct an empty control sequence.     */    ControlSequence();    /**     * Destroy the control sequence     */    ~ControlSequence();    /**     * Get the delay of this control sequence.     */    size_t getDelay() const;    /**     * Set the PTS based on the given base PTS.     *     * @return the PTS set     */    pts_t setPTS(pts_t basePTS);    /**     * Get the PTS based on the given base PTS.     */    pts_t getPTS() const;    /**     * Get the display command.     */    displayCommand_t getDisplayCommand() const;    /**     * Get the color index.     */    int getColorIndex() const;    /**     * Get the contrast (alpha) values.     */    int getContrast() const;    /**     * Decode the control sequence in the given buffer starting at the     * given offset.     *     * @return the offset of the next control sequence     */    size_t decode(SPUBufferBitReader& reader);    /**     * Get the picture data for reading.     */    Reference<Picture> getPicture() const;    /**     * Encode the pixel data into the given stream     */    size_t encodePixelData(DynamicBufferBitWriter& writer,                           size_t& topFieldLength) const;    /**     * Encode the commands into the given writer. When calculating the     * offset to the next control sequence, it assumes that that comes     * immediately after this one.     */    void encodeCommands(DynamicBufferBitWriter& writer,                        size_t topFieldOffset, size_t bottomFieldOffset,                        bool isLast) const;private:    /**     * Read a color and contrast chaning command from the given reader.     */    void changeColorAndContrast(SPUBufferBitReader& reader);};//------------------------------------------------------------------------------// Inline definitions//------------------------------------------------------------------------------inline size_t ControlSequence::getDelay() const{    return delay;}//------------------------------------------------------------------------------inline pts_t ControlSequence::setPTS(pts_t basePTS){    pts = basePTS + delay * 1024;    return pts;}//------------------------------------------------------------------------------inline pts_t ControlSequence::getPTS() const{    return pts;}//------------------------------------------------------------------------------inline ControlSequence::displayCommand_t ControlSequence::getDisplayCommand() const{    return displayCommand;}//------------------------------------------------------------------------------inline int ControlSequence::getColorIndex() const{    return color;}//------------------------------------------------------------------------------inline int ControlSequence::getContrast() const{    return contrast;}//------------------------------------------------------------------------------inline Reference<Picture> ControlSequence::getPicture() const{    return picture;}//------------------------------------------------------------------------------} /* namespace dvd::spu */ } /* namespace dvd *///------------------------------------------------------------------------------#endif // DXR3PLAYER_DVD_SPU_CONTROLSEQUENCE_H// Local variables:// mode: c++// End:

⌨️ 快捷键说明

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