Added some convenience macros for creating format/querytype and eventmask functions
authorWim Taymans <wim.taymans@gmail.com>
Thu, 25 Jul 2002 18:12:12 +0000 (18:12 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Thu, 25 Jul 2002 18:12:12 +0000 (18:12 +0000)
Original commit message from CVS:
Added some convenience macros for creating format/querytype and eventmask
functions

gst/gstevent.h
gst/gstformat.h
gst/gstpad.h

index d3ff018..0d260ce 100644 (file)
@@ -74,6 +74,17 @@ typedef struct
   GstEventFlag         flags;
 } GstEventMask;
 
+#define GST_EVENT_MASK_FUNCTION(functionname, a...)     \
+static const GstEventMask*                              \
+functionname (GstPad *pad)                             \
+{                                                      \
+  static const GstEventMask masks[] = {                 \
+    a,                                                 \
+    { 0, }                                             \
+  };                                                   \
+  return masks;                                        \
+}
+
 /* seek events, extends GstEventFlag */
 typedef enum {
   GST_SEEK_METHOD_CUR          = (1 << (GST_SEEK_METHOD_SHIFT + 0)),
index e8f8b93..2c4f01d 100644 (file)
@@ -39,6 +39,18 @@ typedef enum {
   GST_FORMAT_UNITS     = 6,
 } GstFormat;
 
+#define GST_FORMATS_FUNCTION(functionname, a...)     \
+static const GstFormat*                              \
+functionname (GstPad *pad)                           \
+{                                                    \
+  static const GstFormat formats[] = {               \
+    a,                                               \
+    0                                                \
+  };                                                 \
+  return formats;                                    \
+}
+
+
 G_END_DECLS
 
 #endif /* __GST_FORMAT_H__ */
index 3c9af2f..c51289b 100644 (file)
@@ -124,6 +124,18 @@ typedef enum {
   GST_PAD_QUERY_JITTER,
   GST_PAD_QUERY_SEGMENT_END
 } GstPadQueryType;
+
+#define GST_PAD_QUERY_TYPE_FUNCTION(functionname, a...) \
+static const GstPadQueryType*                           \
+functionname (GstPad *pad)                              \
+{                                                       \
+  static const GstPadQueryType types[] = {              \
+    a,                                                  \
+    0                                                  \
+  };                                                    \
+  return types;                                         \
+}
+
  
 /* this defines the functions used to chain buffers
  * pad is the sink pad (so the same chain function can be used for N pads)