VideoClipWorkflow.h 3.22 KB
Newer Older
1 2 3
/*****************************************************************************
 * VideoClipWorkflow.h : Clip workflow. Will extract a single frame from a VLCMedia
 *****************************************************************************
Ludovic Fauvet's avatar
Ludovic Fauvet committed
4
 * Copyright (C) 2008-2010 VideoLAN
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
 *
 * Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
 *
 * 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 VIDEOCLIPWORKFLOW_H
#define VIDEOCLIPWORKFLOW_H

#include "ClipWorkflow.h"
27
#include "EffectsEngine.h"
28

29
#include <QQueue>
30

31 32
class   Clip;

33 34
class   VideoClipWorkflow : public ClipWorkflow
{
35 36
    Q_OBJECT

37
    public:
38
        VideoClipWorkflow( ClipHelper* ch );
39
        ~VideoClipWorkflow();
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
40 41
        void                    *getLockCallback() const;
        void                    *getUnlockCallback() const;
42
        virtual Workflow::OutputBuffer  *getOutput( ClipWorkflow::GetMode mode );
43
        virtual bool            appendEffect( Effect *effect, qint64 start = 0, qint64 end = -1 );
44
        virtual void            setTime( qint64 time, qint64 frame );
45
        virtual void            saveEffects( QXmlStreamWriter &project ) const;
46

47
        static const quint32    nbBuffers = 3 * 30; //3 seconds with an average fps of 30
48

49 50
    protected:
        virtual void            initVlcOutput();
51 52
        virtual quint32         getNbComputedBuffers() const;
        virtual quint32         getMaxComputedBuffers() const;
53
        virtual void            flushComputedBuffers();
54 55 56 57
        /**
         *  \brief              Pre-allocate some image buffers.
         */
        void                    preallocate();
58
        virtual void            releasePrealocated();
59

60
    private:
61 62
        QQueue<Workflow::Frame*>    m_computedBuffers;
        QQueue<Workflow::Frame*>    m_availableBuffers;
63
        static void                 lock( VideoClipWorkflow* clipWorkflow, void** pp_ret,
64
                                      int size );
65
        static void                 unlock( VideoClipWorkflow* clipWorkflow, void* buffer,
66 67
                                        int width, int height, int bpp, int size,
                                        qint64 pts );
68 69
        quint32                     m_width;
        quint32                     m_height;
70 71 72
        QReadWriteLock              *m_effectsLock;
        QMutex                      *m_renderedFrameMutex;
        qint64                      m_renderedFrame;
73
        Workflow::Frame             *m_lastReturnedBuffer;
74
        QList<EffectsEngine::FilterHelper*>     m_filters;
75 76 77
};

#endif // VIDEOCLIPWORKFLOW_H