Types.h 3.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
/*****************************************************************************
 * Types.h: Workflow related types.
 *****************************************************************************
 * Copyright (C) 2008-2010 VideoLAN
 *
 * Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
 *
 * 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#ifndef TYPES_H
#define TYPES_H

#include <qglobal.h>

namespace   Workflow
{
30
    const quint32   Depth = 4;
31

32 33 34 35 36 37 38 39 40 41
    /**
     *  \enum   Represents the potential Track types.
     */
    enum    TrackType
    {
        VideoTrack, ///< Represents a video track
        AudioTrack, ///< Represents an audio track
        NbTrackType, ///< Used to know how many types we have
    };

42 43 44 45 46 47 48 49
    struct  OutputBuffer
    {
        TrackType   type;
        protected:
            OutputBuffer( TrackType _type ) : type( _type ) {}
    };

    class   Frame : public OutputBuffer
50 51
    {
        public:
52
            explicit Frame();
53 54 55 56
            Frame( quint32 width, quint32 height );
            ~Frame();
            quint32         width() const;
            quint32         height() const;
57 58 59
            quint32         *buffer();
            const quint32   *buffer() const;
            void            setBuffer( quint32 *buff );
60
            Frame           *clone() const;
61 62 63 64 65 66
            /**
             *  \brief      Resize the buffer.
             *
             *  \warning    This will not resize what's in the frame !
             */
            void            resize( quint32 width, quint32 height );
67
            /**
68
             *  \returns    The frame size in octets
69 70 71
             *
             *  This is equal to width * height * Depth
             */
72 73 74 75 76
            /**
             *  \returns    The frame size in pixels
             *
             *  This is equal to width * height
             */
77
            quint32         size() const;
78
            quint32         nbPixels() const;
79 80 81 82 83 84 85 86 87 88
            /**
             *  \warning    Terrible hack !
             *
             *  Remove this ASAP !!
             */
            //FIXME
            qint64      ptsDiff;
        private:
            quint32     m_width;
            quint32     m_height;
89
            quint32     *m_buffer;
90
            quint32     m_size;
91
            quint32     m_nbPixels;
92
    };
93
    struct  AudioSample : public OutputBuffer
94
    {
95
        AudioSample() : OutputBuffer( AudioTrack ){}
96 97 98 99 100 101 102
        unsigned char*  buff;
        size_t          size;
        quint32         nbSample;
        quint32         nbChannels;
        qint64          ptsDiff;
        qint64          pts;
    };
103 104 105
}

#endif // TYPES_H