summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-05-28 04:26:02 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-05-28 04:26:02 +0000
commit5a13c2785b4abae476a4205fe3272ee263c06d2d (patch)
treebdcd31038c97112d4d4ac4ba4256fdcf55e8ad8d
parent44d41e6675d9b0f47e4f447c473a78b50467927b (diff)
downloadxine-lib-5a13c2785b4abae476a4205fe3272ee263c06d2d.tar.gz
xine-lib-5a13c2785b4abae476a4205fe3272ee263c06d2d.tar.bz2
adding parameters api
CVS patchset: 4966 CVS date: 2003/05/28 04:26:02
-rw-r--r--include/xine.h.in53
-rw-r--r--src/xine-engine/post.h21
2 files changed, 72 insertions, 2 deletions
diff --git a/include/xine.h.in b/include/xine.h.in
index 51aa2cf95..9a0cefcac 100644
--- a/include/xine.h.in
+++ b/include/xine.h.in
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine.h.in,v 1.86 2003/05/26 01:45:04 miguelfreitas Exp $
+ * $Id: xine.h.in,v 1.87 2003/05/28 04:26:02 miguelfreitas Exp $
*
* public xine-lib (libxine) interface and documentation
*
@@ -644,6 +644,57 @@ void xine_post_dispose(xine_t *xine, xine_post_t *self);
*/
#define XINE_POST_DATA_DOUBLE 4
+/* parameters api (used by frontends)
+ * input->data is xine_post_api_t* (see below)
+ */
+#define XINE_POST_DATA_PARAMETERS 5
+
+/* defines a single parameter entry. */
+typedef struct {
+ int type; /* POST_PARAM_TYPE_xxx */
+ char *name; /* name of this parameter */
+ int size; /* sizeof(parameter) */
+ int offset; /* offset in bytes from struct ptr */
+ char **enum_values; /* enumeration (first=0) or NULL */
+ double range_min; /* minimum value */
+ double range_max; /* maximum value */
+ int readonly; /* 0 = read/write, 1=read-only */
+ char *description; /* user-friendly description */
+} xine_post_api_parameter_t;
+
+/* description of parameters struct (params). */
+typedef struct {
+ int struct_size; /* sizeof(params) */
+ xine_post_api_parameter_t *parameter; /* list of parameters */
+} xine_post_api_descr_t;
+
+typedef struct {
+ /*
+ * method to set all the read/write parameters.
+ * params is a struct * defined by xine_post_api_descr_t
+ */
+ int (*set_parameters) (xine_post_t *self, void *params);
+
+ /*
+ * method to get all parameters.
+ */
+ int (*get_parameters) (xine_post_t *self, void *params);
+
+ /*
+ * method to get params struct definition
+ */
+ xine_post_api_descr_t * (*get_param_descr) (void);
+} xine_post_api_t;
+
+/* post parameter types */
+#define POST_PARAM_TYPE_LAST 0 /* terminator of parameter list */
+#define POST_PARAM_TYPE_INT 1 /* integer (or vector of integers) */
+#define POST_PARAM_TYPE_DOUBLE 2 /* double (or vector of doubles) */
+#define POST_PARAM_TYPE_CHAR 3 /* char (or vector of chars = string) */
+#define POST_PARAM_TYPE_STRING 4 /* (char *), ASCIIZ */
+#define POST_PARAM_TYPE_STRINGLIST 5 /* (char **) list, NULL terminated */
+#define POST_PARAM_TYPE_BOOL 6 /* integer (0 or 1) */
+
/*********************************************************************
* information retrieval *
diff --git a/src/xine-engine/post.h b/src/xine-engine/post.h
index ebdb74288..71339584c 100644
--- a/src/xine-engine/post.h
+++ b/src/xine-engine/post.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: post.h,v 1.6 2003/05/20 13:50:57 mroi Exp $
+ * $Id: post.h,v 1.7 2003/05/28 04:26:36 miguelfreitas Exp $
*
* post plugin definitions
*
@@ -157,4 +157,23 @@ struct post_audio_port_s {
* port functions can be replaced with own implementations */
post_audio_port_t *post_intercept_audio_port(post_plugin_t *post, xine_audio_port_t *port);
+
+/* macros to create parameter descriptors */
+
+#define START_PARAM_DESCR( param_t ) \
+static param_t __temp_s; \
+static xine_post_api_parameter_t __temp_p[] = {
+
+#define PARAM_ITEM( param_type, var, enumv, min, max, readonly, descr ) \
+{ param_type, "##var", sizeof(__temp_s.var), \
+ (char *)&__temp_s.var-(char *)&__temp_s, enumv, min, max, readonly, descr },
+
+#define END_PARAM_DESCR( name ) \
+ { POST_PARAM_TYPE_LAST, NULL, 0, 0, NULL, 0, 0, 1, NULL } \
+}; \
+static xine_post_api_descr_t name = { \
+ sizeof( __temp_s ), \
+ __temp_p \
+};
+
#endif