Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

sndfile.hh

00001 /*
00002  * PIAVE - PIAVE Is A Video Editor
00003  *
00004  * Copyright (C) 2002 Rolf Dubitzky, rolf@dubitzky.de
00005  *
00006  */
00007 
00008 /*
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software Foundation,
00021  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00022  */
00023 
00024 
00034 #if ! defined( SNDFILE_HH )
00035 #define SNDFILE_HH
00036 
00037 // stdc
00038 #include <signal.h>
00039 #include <stdio.h>
00040 #include <unistd.h>
00041 #include <fcntl.h>
00042 #include <sys/stat.h>
00043 
00044 // stdc++
00045 #include <string>
00046 
00047 // sndfile
00048 //#include "libsndfile/codec.h"
00049 //#include "libsndfile/sndfilefile.h"
00050 
00051 // PIAVE
00052 #include "libpiave/piave_base.hh"
00053 #include "libpiave/avstream.hh"
00054 #include "libpiave/exception.hh"
00055 #include "libpiave/ringbuffer.hh"
00056 
00057 
00058 namespace PIAVE {
00059 
00060     class Frame;
00061 
00062     class SndfilePlugin : public Plugin
00063     {
00064       public:
00065         SndfilePlugin();
00066         virtual PluginBase * newElement( const PropertyNode * p = 0 );
00067     };
00068 
00069 
00073     class InSndfile : public InAVFStream
00074     {
00075 
00076       public:
00077         InSndfile( const std::string& fileName ) throw(exception);
00078 
00079         ~InSndfile();
00080         virtual Frame getFrame( Time t );
00081 
00082         virtual PropertyNode * getProperties( PropertyNode * p ) const;
00083 
00084         virtual void decodeMetaData( Frame & f );
00085         virtual void decodeVideo( Frame & f, uint8_t * dest = 0 );
00086         virtual void decodeAudio( Frame & f, uint8_t * dest = 0 );
00087 
00088       private:
00089         void refillBuffer();
00090 
00091         std::string getTypeStr() const;
00092         std::string getSubFormatStr() const;
00093         std::string getEndiannessStr() const;
00094 
00095       private:
00096         SNDFILE        * _sndfile;
00097         SF_INFO          _sfinfo;
00098 
00099         int              _nChannels;
00100         int              _frequency;
00101 
00106         ValRingBuffer<int16_t> * _readBuffer;
00107         double                   _minSec;
00108         double                   _maxSec;
00109 
00110         
00111 
00112     };
00113 
00114 };
00115 
00116 #endif

Generated on Tue Oct 14 20:45:37 2003 for piave by doxygen1.2.18