AudioClipWorkflow.h 2.68 KB
Newer Older
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
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
/*****************************************************************************
 * AudioClipWorkflow.h : Clip workflow. Will extract a single frame from a VLCMedia
 *****************************************************************************
 * Copyright (C) 2008-2009 the VLMC team
 *
 * 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 AUDIOCLIPWORKFLOW_H
#define AUDIOCLIPWORKFLOW_H

#include "ClipWorkflow.h"
27
#include "Pool.hpp"
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
28 29 30 31

class   AudioClipWorkflow : public ClipWorkflow
{
    public:
32 33 34 35
        struct  AudioSample
        {
            unsigned char*  buff;
            size_t          size;
36 37
            unsigned int    nbSample;
            unsigned int    nbChannels;
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
38
            qint64          ptsDiff;
39
        };
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
40 41 42 43
        AudioClipWorkflow( Clip* clip );
        ~AudioClipWorkflow();
        void*                   getLockCallback();
        void*                   getUnlockCallback();
44
        virtual void*           getOutput( ClipWorkflow::GetMode mode );
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
45 46

    private:
47 48 49 50
        QReadWriteLock*             m_computedBuffersLock;
        Pool<AudioSample*>          m_computedBuffers;
        QReadWriteLock*             m_availableBuffersLock;
        Pool<AudioSample*>          m_availableBuffers;
51 52 53 54 55 56
        void                        initVlcOutput();
        static void                 lock( AudioClipWorkflow* clipWorkflow, uint8_t** pcm_buffer , unsigned int size );
        static void                 unlock( AudioClipWorkflow* clipWorkflow, uint8_t* pcm_buffer,
                                            unsigned int channels, unsigned int rate,
                                            unsigned int nb_samples, unsigned int bits_per_sample,
                                            unsigned int size, qint64 pts );
57 58 59

        //FIXME: this is totally random powered ! Please adjust with a value that does make sense...
        static const uint32_t   nbBuffers = 128;
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
60 61 62
};

#endif // AUDIOCLIPWORKFLOW_H