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

plugin.hh

00001 /*
00002  * PIAVE - PIAVE Is A Video Editor
00003  *
00004  * Copyright (C) 2002 Rolf Dubitzky, rolf@dubitzky.de
00005  */
00006 
00007 /*
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software Foundation,
00020  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00021  */
00022 
00023 
00028 #if ! defined( PLUGIN_HH )
00029 #define PLUGIN_HH
00030 
00031 // STD C++
00032 #include <iostream>
00033 #include <string>
00034 
00035 // PIAVE
00036 #include "piave_base.hh"
00037 
00038 #define PLUGIN_IFACE_VERSION 1
00039 
00040 namespace PIAVE { 
00041 
00042     class PropertyNode;
00043 
00044     class Plugin;
00045     
00046     typedef Plugin * (*PluginMaker)();
00047 
00051     struct PluginInfo {
00052         const char * name;
00053         int iface_version;
00054         PluginMaker maker;
00055     };
00056 
00062 #define PIAVE_PLUGIN( N )  \
00063         Plugin * new_ ## N () { return new  N (); }; \
00064         PluginInfo pluginInfo[] = { { #N , PLUGIN_IFACE_VERSION , &new_ ##N } , \
00065                                     { 0  , 0                    , 0 } \
00066                                   };;
00067 
00075     enum PluginType_e {
00076         /* meta types for queries */
00077         PLUGIN_NO_TYPE = 0, 
00078         PLUGIN_ANY_TYPE, 
00079         /* effect plugins */
00080         PLUGIN_VIDEO_OP,
00081         PLUGIN_AUDIO_OP,
00082         /* iostreams and container */
00083         PLUGIN_INSTREAM,
00084         PLUGIN_OUTSTREAM,
00085         /* codecs */
00086         PLUGIN_VIDEO_CODEC,
00087         PLUGIN_AUDIO_CODEC,
00088         /* media elements */
00089         PLUGIN_MEDIA_ELEMENT
00090     };
00091 
00092 
00097     class PluginBase
00098     {
00099       public:
00100         PluginBase() {};
00101         virtual ~PluginBase() {}
00102         virtual PropertyNode * getProperties( PropertyNode *p  = 0 ) const = 0;
00103 
00104     };
00105 
00111     class Plugin 
00112     {
00113       public:
00114         Plugin( const std::string & name, PluginType_e t );
00115         virtual ~Plugin();
00116 
00117         std::string     getName() const { return _name; }
00118         int             getPriority()const { return _priority; }
00119         PluginType_e    getType() const { return _type; }
00120         PropertyNode *  getCapabilities() const;
00121         bool            isEnabled() const { return _enabled; }
00122 
00123         void setName( const std::string & n ) { _name = n; }
00124         void setPriority( int p ) { _priority = p; }
00125         void setCapabilities( PropertyNode * caps ) { _caps = caps; };
00126         void setEnabled( bool enabled = true ) { _enabled = enabled; }
00127 
00129         virtual PluginBase    * newElement( const PropertyNode * p = 0 ) = 0;
00130         
00131 
00132       private:
00136         std::string _name;
00137 
00141         int _priority; 
00142 
00148         PluginType_e _type;
00149 
00158         PropertyNode * _caps; 
00159 
00164         bool _enabled;
00165 
00166     };
00167 
00168 }
00169 
00170 #endif

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