parameter.h

00001 /*****************************************************************
00002  * gmerlin - a general purpose multimedia framework and applications
00003  *
00004  * Copyright (c) 2001 - 2008 Members of the Gmerlin project
00005  * gmerlin-general@lists.sourceforge.net
00006  * http://gmerlin.sourceforge.net
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, see <http://www.gnu.org/licenses/>.
00020  * *****************************************************************/
00021 
00022 #ifndef __BG_PARAMETER_H_
00023 #define __BG_PARAMETER_H_
00024 
00025 #include <libxml/tree.h>
00026 #include <libxml/parser.h>
00027 
00028 #include <gavl/gavl.h>
00029 
00044 /* Universal Parameter setting mechanism */
00045 
00053 typedef enum
00054   {
00055     BG_PARAMETER_SECTION, 
00056     BG_PARAMETER_CHECKBUTTON, 
00057     BG_PARAMETER_INT,         
00058     BG_PARAMETER_FLOAT,       
00059     BG_PARAMETER_SLIDER_INT,  
00060     BG_PARAMETER_SLIDER_FLOAT, 
00061     BG_PARAMETER_STRING,      
00062     BG_PARAMETER_STRING_HIDDEN, 
00063     BG_PARAMETER_STRINGLIST,  
00064     BG_PARAMETER_COLOR_RGB,   
00065     BG_PARAMETER_COLOR_RGBA,  
00066     BG_PARAMETER_FONT,        
00067     BG_PARAMETER_DEVICE,      
00068     BG_PARAMETER_FILE,        
00069     BG_PARAMETER_DIRECTORY,   
00070     BG_PARAMETER_MULTI_MENU,  
00071     BG_PARAMETER_MULTI_LIST,  
00072     BG_PARAMETER_MULTI_CHAIN, 
00073     BG_PARAMETER_TIME         
00074   } bg_parameter_type_t;
00075 
00080 typedef union
00081   {
00082   double  val_f; 
00083   int     val_i; 
00084   char *  val_str; 
00085   float val_color[4];  
00086   gavl_time_t val_time; 
00087   } bg_parameter_value_t;
00088 
00089 /* Flags */
00090 
00094 #define BG_PARAMETER_SYNC         (1<<0) 
00095 
00096 
00099 #define BG_PARAMETER_HIDE_DIALOG  (1<<1) 
00100 
00101 
00107 typedef struct bg_parameter_info_s
00108   {
00109   char * name; 
00110   char * long_name; 
00111   char * opt; 
00112 
00113   char * gettext_domain; 
00114   char * gettext_directory; 
00115   
00116   bg_parameter_type_t type; 
00117 
00118   int flags; 
00119   
00120   bg_parameter_value_t val_default; 
00121   bg_parameter_value_t val_min; 
00122   bg_parameter_value_t val_max; 
00123   
00124   /* Names which can be passed to set_parameter (NULL terminated) */
00125 
00126   char ** multi_names; 
00127 
00128   /* Long names are optional, if they are NULL,
00129      the short names are used */
00130 
00131   char ** multi_labels; 
00132   char ** multi_descriptions; 
00133     
00134   /*
00135    *  These are parameters for each codec.
00136    *  The name members of these MUST be unique with respect to the rest
00137    *  of the parameters passed to the same set_parameter func
00138    */
00139 
00140   struct bg_parameter_info_s ** multi_parameters; 
00141   
00142   int num_digits; 
00143   
00144   char * help_string; 
00145   } bg_parameter_info_t;
00146 
00147 /* Prototype for setting/getting parameters */
00148 
00149 /*
00150  *  NOTE: All applications MUST call a bg_set_parameter_func with
00151  *  a NULL name argument to signal, that all parameters are set now
00152  */
00153 
00167 typedef void (*bg_set_parameter_func_t)(void * data, const char * name,
00168                                         const bg_parameter_value_t * v);
00169 
00183 typedef int (*bg_get_parameter_func_t)(void * data, const char * name,
00184                                        bg_parameter_value_t * v);
00185 
00195 bg_parameter_info_t *
00196 bg_parameter_info_copy_array(const bg_parameter_info_t * src);
00197 
00206 void bg_parameter_info_copy(bg_parameter_info_t * dst,
00207                             const bg_parameter_info_t * src);
00208 
00214 void bg_parameter_info_destroy_array(bg_parameter_info_t * info);
00215 
00226 void bg_parameter_value_copy(bg_parameter_value_t * dst,
00227                              const bg_parameter_value_t * src,
00228                              const bg_parameter_info_t * info);
00229 
00236 void bg_parameter_value_free(bg_parameter_value_t * val,
00237                              bg_parameter_type_t type);
00238 
00239 
00247 bg_parameter_info_t *
00248 bg_parameter_info_concat_arrays(bg_parameter_info_t ** srcs);
00249 
00260 int bg_parameter_get_selected(const bg_parameter_info_t * info,
00261                               const char * val);
00262 
00263 
00275 const bg_parameter_info_t *
00276 bg_parameter_find(const bg_parameter_info_t * info,
00277                   const char * name);
00278 
00279 
00290 bg_parameter_info_t * bg_xml_2_parameters(xmlDocPtr xml_doc,
00291                                           xmlNodePtr xml_parameters);
00292 
00302 void
00303 bg_parameters_2_xml(bg_parameter_info_t * info, xmlNodePtr xml_parameters);
00304 
00305 
00306 
00307 #endif /* __BG_PARAMETER_H_ */
00308 

Generated on Wed Jan 9 19:32:52 2008 for gmerlin by  doxygen 1.5.3