Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

aflibFile.h

Go to the documentation of this file.
00001 /*
00002  * Copyright: (C) 1999-2001 Bruce W. Forsberg
00003  *
00004  *   This library is free software; you can redistribute it and/or
00005  *   modify it under the terms of the GNU Lesser General Public
00006  *   License as published by the Free Software Foundation; either
00007  *   version 2.1 of the License, or any later version.
00008  *
00009  *   This library is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  *   Lesser General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU Lesser General Public
00015  *   License along with this library; if not, write to the Free Software
00016  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00017  *
00018  *   Bruce Forsberg  forsberg@tns.net
00019  *
00020  */
00021 
00022 #ifndef _AFLIBFILE_H
00023 #define _AFLIBFILE_H
00024 
00025 #ifdef HAVE_CONFIG_H
00026 #include <config.h>
00027 #endif
00028 
00029 #include "aflib.h"
00030 #include "aflibConfig.h"
00031 
00032 //#define TEST_OPTIONS
00033 //#ifdef TEST_OPTIONS
00034 //#include "aflibOptions.h"
00035 //#endif
00036 
00037 #include <string>
00038 #include <list>
00039 #include <map>
00040 #if __GNUC__ >= 3
00041 using std::string;
00042 using std::list;
00043 using std::map;
00044 #endif
00045 
00046 
00075 class aflibData;
00076 class aflibFileItem;
00077 
00078 class aflibFile {
00079 
00080 public:
00081 
00082    virtual ~aflibFile();
00083 
00084    static void
00085    returnSupportedFormats(
00086       list <string>& formats,
00087       list <string>& descriptions);
00088 
00089    static aflibFile *
00090    open(
00091       aflibFileType type_enum,
00092       const string& file,
00093       aflibConfig* cfg = NULL,
00094       aflibStatus* status = NULL);
00095 
00096    static aflibFile *
00097    open(
00098       const string& format,
00099       const string& file,
00100       aflibConfig* cfg = NULL,
00101       aflibStatus* status = NULL);
00102 
00103    static aflibFile *
00104    create(
00105       aflibFileType type_enum,
00106       const string& file,
00107       const aflibConfig& cfg,
00108       aflibStatus* status = NULL);
00109 
00110    static aflibFile *
00111    create(
00112       const string& format,
00113       const string& file,
00114       const aflibConfig& cfg,
00115       aflibStatus* status = NULL);
00116 
00117    virtual aflibStatus
00118    afopen(
00119       const char * file,
00120       aflibConfig* cfg);
00121 
00122    virtual aflibStatus
00123    afcreate(
00124       const char * file,
00125       const aflibConfig& cfg);
00126 
00127    virtual aflibStatus
00128    afread(
00129       aflibData& data,
00130       long long position = -1);
00131 
00132    virtual aflibStatus
00133    afwrite(
00134       aflibData& data,
00135       long long position = -1);
00136 
00137    virtual bool
00138    setItem(
00139       const char * item,
00140       const void * value);
00141 
00142    virtual bool
00143    getItem(
00144       const char * item,
00145       void * value);
00146 
00147    const string&
00148    getFormat() const;
00149 
00150    virtual void
00151    setInputConfig(const aflibConfig& cfg);
00152  
00153    const aflibConfig&
00154    getInputConfig() const;
00155  
00156    void
00157    setOutputConfig(const aflibConfig& cfg);
00158  
00159    const aflibConfig&
00160    getOutputConfig() const;
00161 
00162    void
00163    setValue1(const string& value);
00164 
00165    void
00166    setValue2(const string& value);
00167 
00168    void
00169    setValue3(const string& value);
00170 
00171    virtual bool
00172    isDataSizeSupported(aflib_data_size size);
00173  
00174    virtual bool
00175    isEndianSupported(aflib_data_endian end);
00176  
00177    virtual bool
00178    isSampleRateSupported(int& rate);
00179 
00180    virtual bool
00181    isChannelsSupported(int& channels);
00182 
00183 protected:
00184 
00185    aflibFile();
00186 
00187    long       _total_size;
00188    long       _one_second_size;
00189    long       _current_place_size;
00190    string     _value1;
00191    string     _value2;
00192    string     _value3;
00193 
00194 
00195 private:
00196 
00197     //void (*_isChannelsSupported)(int&);
00198    aflibConfig _cfg_input;
00199    aflibConfig _cfg_output;
00200    void *     _lib1;
00201    aflibFile * _file_object;
00202    string     _format;
00203    static list<aflibFileItem *>  _support_list;
00204 //#ifdef TEST_OPTIONS
00205 //  static map< string,aflibOptions * >  _options_map;
00206 //#endif
00207     
00208    static bool _list_created;
00209 
00210 
00211    aflibFile(const char * module_name);
00212 
00213    aflibFile(const aflibFile& file);
00214 
00215    const aflibFile&
00216    operator== (const aflibFile& file);
00217 
00218    static aflibFile *
00219    allocateModuleFile(
00220       aflibFileType type_enum,
00221       const char *  module_format);
00222 
00223    static const char *
00224    findModuleFile(const string& file_name);
00225 
00226    static void
00227    parseModuleFile();
00228 
00229    static char *
00230    stripStuff(char * ptr);
00231 
00232    bool
00233    initialized();
00234 
00235 };
00236 
00237 #endif

Generated at Tue Aug 7 22:18:06 2001 for Open Source Audio Library Project by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001