Added some convenience macros for creating format/querytype and eventmask functions

Original commit message from CVS:
Added some convenience macros for creating format/querytype and eventmask
functions
This commit is contained in:
Wim Taymans 2002-07-25 18:12:12 +00:00
parent 6bd5ed021c
commit 12fddba0bd
3 changed files with 35 additions and 0 deletions

View 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)),

View 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__ */

View 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)