gstprobe.h \
gstprops.h \
gstqueue.h \
+ gstquery.h \
gstscheduler.h \
gstsystemclock.h \
gstthread.h \
return srcpad;
}
-GST_FORMATS_FUNCTION (gst_fakesrc_get_formats,
+GST_PAD_FORMATS_FUNCTION (gst_fakesrc_get_formats,
GST_FORMAT_DEFAULT
)
GST_PAD_QUERY_TYPE_FUNCTION (gst_fakesrc_get_query_types,
- GST_PAD_QUERY_TOTAL,
- GST_PAD_QUERY_POSITION,
- GST_PAD_QUERY_START,
- GST_PAD_QUERY_SEGMENT_END
+ GST_QUERY_TOTAL,
+ GST_QUERY_POSITION,
+ GST_QUERY_START,
+ GST_QUERY_SEGMENT_END
)
static gboolean
-gst_fakesrc_query (GstPad *pad, GstPadQueryType type,
+gst_fakesrc_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value)
{
GstFakeSrc *src = GST_FAKESRC (GST_PAD_PARENT (pad));
switch (type) {
- case GST_PAD_QUERY_TOTAL:
+ case GST_QUERY_TOTAL:
*value = src->num_buffers;
break;
- case GST_PAD_QUERY_POSITION:
+ case GST_QUERY_POSITION:
*value = src->buffer_count;
break;
- case GST_PAD_QUERY_START:
+ case GST_QUERY_START:
*value = src->segment_start;
break;
- case GST_PAD_QUERY_SEGMENT_END:
+ case GST_QUERY_SEGMENT_END:
*value = src->segment_end;
break;
default:
return TRUE;
}
-GST_EVENT_MASK_FUNCTION (gst_fakesrc_get_event_mask,
+GST_PAD_EVENT_MASK_FUNCTION (gst_fakesrc_get_event_mask,
{ GST_EVENT_SEEK, GST_SEEK_FLAG_FLUSH },
{ GST_EVENT_SEEK_SEGMENT, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT_LOOP },
{ GST_EVENT_FLUSH, 0 }
ARG_MAXFILESIZE,
};
-GST_EVENT_MASK_FUNCTION (gst_filesink_get_event_mask,
+GST_PAD_EVENT_MASK_FUNCTION (gst_filesink_get_event_mask,
{ GST_EVENT_SEEK, GST_SEEK_METHOD_CUR |
GST_SEEK_METHOD_SET |
GST_SEEK_METHOD_END |
ARG_TOUCH,
};
-GST_EVENT_MASK_FUNCTION (gst_filesrc_get_event_mask,
+GST_PAD_EVENT_MASK_FUNCTION (gst_filesrc_get_event_mask,
{ GST_EVENT_SEEK, GST_SEEK_METHOD_CUR |
GST_SEEK_METHOD_SET |
GST_SEEK_METHOD_END |
)
GST_PAD_QUERY_TYPE_FUNCTION (gst_filesrc_get_query_types,
- GST_PAD_QUERY_TOTAL,
- GST_PAD_QUERY_POSITION
+ GST_QUERY_TOTAL,
+ GST_QUERY_POSITION
)
-GST_FORMATS_FUNCTION (gst_filesrc_get_formats,
+GST_PAD_FORMATS_FUNCTION (gst_filesrc_get_formats,
GST_FORMAT_BYTES
)
static GstBuffer * gst_filesrc_get (GstPad *pad);
static gboolean gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event);
-static gboolean gst_filesrc_srcpad_query (GstPad *pad, GstPadQueryType type,
+static gboolean gst_filesrc_srcpad_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value);
static GstElementStateReturn gst_filesrc_change_state (GstElement *element);
}
static gboolean
-gst_filesrc_srcpad_query (GstPad *pad, GstPadQueryType type,
+gst_filesrc_srcpad_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value)
{
GstFileSrc *src = GST_FILESRC (GST_PAD_PARENT (pad));
switch (type) {
- case GST_PAD_QUERY_TOTAL:
+ case GST_QUERY_TOTAL:
if (*format != GST_FORMAT_BYTES) {
return FALSE;
}
*value = src->filelen;
break;
- case GST_PAD_QUERY_POSITION:
+ case GST_QUERY_POSITION:
switch (*format) {
case GST_FORMAT_BYTES:
*value = src->curoffset;
static void gst_element_dispose (GObject *object);
-static gboolean gst_element_send_event_default (GstElement *element, GstEvent *event);
-static gboolean gst_element_query_default (GstElement *element, GstPadQueryType type,
- GstFormat *format, gint64 *value);
-
static GstElementStateReturn gst_element_change_state (GstElement *element);
static void gst_element_error_func (GstElement* element, GstElement *source, gchar *errormsg);
klass->elementfactory = NULL;
klass->padtemplates = NULL;
klass->numpadtemplates = 0;
- klass->send_event = GST_DEBUG_FUNCPTR (gst_element_send_event_default);
- klass->query = GST_DEBUG_FUNCPTR (gst_element_query_default);
+ klass->send_event = NULL;
+ klass->query = NULL;
}
static void
}
}
-static gboolean
-gst_element_send_event_default (GstElement *element, GstEvent *event)
+static GstPad*
+gst_element_get_random_pad (GstElement *element, GstPadDirection dir)
{
GList *pads = element->pads;
- gboolean res = FALSE;
-
while (pads) {
GstPad *pad = GST_PAD_CAST (pads->data);
- if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK) {
+ if (GST_PAD_DIRECTION (pad) == dir) {
if (GST_PAD_IS_USABLE (pad)) {
- res = gst_pad_send_event (GST_PAD_PEER (pad), event);
- break;
+ return pad;
}
}
pads = g_list_next (pads);
}
- return res;
+ return NULL;
+}
+
+/**
+ * gst_element_get_event_masks:
+ * @element: a #GstElement to query
+ *
+ * Get an array of event masks from the element.
+ * If the element doesn't
+ * implement an event masks function, the query will be forwarded
+ * to a random sink pad.
+ *
+ * Returns: An array of #GstEventMask elements.
+ */
+const GstEventMask*
+gst_element_get_event_masks (GstElement *element)
+{
+ GstElementClass *oclass;
+
+ g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
+
+ oclass = GST_ELEMENT_GET_CLASS (element);
+
+ if (oclass->get_event_masks)
+ return oclass->get_event_masks (element);
+ else {
+ GstPad *pad = gst_element_get_random_pad (element, GST_PAD_SINK);
+ if (pad)
+ return gst_pad_get_event_masks (GST_PAD_PEER (pad));
+ }
+
+ return FALSE;
}
/**
if (oclass->send_event)
return oclass->send_event (element, event);
+ else {
+ GstPad *pad = gst_element_get_random_pad (element, GST_PAD_SINK);
+ if (pad)
+ return gst_pad_send_event (GST_PAD_PEER (pad), event);
+ }
return FALSE;
}
-static gboolean
-gst_element_query_default (GstElement *element, GstPadQueryType type,
- GstFormat *format, gint64 *value)
+/**
+ * gst_element_get_query_types:
+ * @element: a #GstElement to query
+ *
+ * Get an array of query types from the element.
+ * If the element doesn't
+ * implement a query types function, the query will be forwarded
+ * to a random sink pad.
+ *
+ * Returns: An array of #GstQueryType elements.
+ */
+const GstQueryType*
+gst_element_get_query_types (GstElement *element)
{
- GList *pads = element->pads;
- gboolean res = FALSE;
+ GstElementClass *oclass;
- while (pads) {
- GstPad *pad = GST_PAD_CAST (pads->data);
-
- if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK) {
- if (GST_PAD_IS_USABLE (pad)) {
- res = gst_pad_query (GST_PAD_PEER (pad), type, format, value);
- break;
- }
- }
- pads = g_list_next (pads);
+ g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
+
+ oclass = GST_ELEMENT_GET_CLASS (element);
+
+ if (oclass->get_query_types)
+ return oclass->get_query_types (element);
+ else {
+ GstPad *pad = gst_element_get_random_pad (element, GST_PAD_SINK);
+ if (pad)
+ return gst_pad_get_query_types (GST_PAD_PEER (pad));
}
- return res;
+
+ return FALSE;
}
/**
* gst_element_query:
* @element: a #GstElement to perform the query on.
- * @type: the #GstPadQueryType.
+ * @type: the #GstQueryType.
* @format: the #GstFormat pointer to hold the format of the result.
* @value: the pointer to the value of the result.
*
* to GST_FORMAT_DEFAULT and this function returns TRUE, the
* format pointer will hold the default format.
* For element that don't implement a query handler, this function
- * forwards the query to a random connected sinkpad of this element.
+ * forwards the query to a random usable sinkpad of this element.
*
* Returns: TRUE if the query could be performed.
*/
gboolean
-gst_element_query (GstElement *element, GstPadQueryType type,
+gst_element_query (GstElement *element, GstQueryType type,
GstFormat *format, gint64 *value)
{
GstElementClass *oclass;
if (oclass->query)
return oclass->query (element, type, format, value);
+ else {
+ GstPad *pad = gst_element_get_random_pad (element, GST_PAD_SINK);
+ if (pad)
+ return gst_pad_query (GST_PAD_PEER (pad), type, format, value);
+ }
+
+ return FALSE;
+}
+
+/**
+ * gst_element_get_formats:
+ * @element: a #GstElement to query
+ *
+ * Get an array of formst from the element.
+ * If the element doesn't
+ * implement a formats function, the query will be forwarded
+ * to a random sink pad.
+ *
+ * Returns: An array of #GstFormat elements.
+ */
+const GstFormat*
+gst_element_get_formats (GstElement *element)
+{
+ GstElementClass *oclass;
+
+ g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
+
+ oclass = GST_ELEMENT_GET_CLASS (element);
+
+ if (oclass->get_formats)
+ return oclass->get_formats (element);
+ else {
+ GstPad *pad = gst_element_get_random_pad (element, GST_PAD_SINK);
+ if (pad)
+ return gst_pad_get_formats (GST_PAD_PEER (pad));
+ }
+
+ return FALSE;
+}
+
+/**
+ * gst_element_convert:
+ * @element: a #GstElement to invoke the converter on.
+ * @src_format: the source #GstFormat.
+ * @src_value: the source value.
+ * @dest_format: a pointer to the destination #GstFormat.
+ * @dest_value: a pointer to the destination value.
+ *
+ * Invokes a conversion on the element.
+ * If the element doesn't
+ * implement a convert function, the query will be forwarded
+ * to a random sink pad.
+ *
+ * Returns: TRUE if the conversion could be performed.
+ */
+gboolean
+gst_element_convert (GstElement *element,
+ GstFormat src_format, gint64 src_value,
+ GstFormat *dest_format, gint64 *dest_value)
+{
+ GstElementClass *oclass;
+
+ g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
+ g_return_val_if_fail (dest_format != NULL, FALSE);
+ g_return_val_if_fail (dest_value != NULL, FALSE);
+
+ if (src_format == *dest_format) {
+ *dest_value = src_value;
+ return TRUE;
+ }
+
+ oclass = GST_ELEMENT_GET_CLASS (element);
+
+ if (oclass->convert)
+ return oclass->convert (element,
+ src_format, src_value,
+ dest_format, dest_value);
+ else {
+ GstPad *pad = gst_element_get_random_pad (element, GST_PAD_SINK);
+ if (pad)
+ return gst_pad_convert (GST_PAD_PEER (pad),
+ src_format, src_value,
+ dest_format, dest_value);
+ }
return FALSE;
}
# define GST_ELEMENT_CLASS GST_ELEMENT_CLASS_CAST
#endif
+/* convenience functions */
+#ifdef G_HAVE_ISO_VARARGS
+#define GST_ELEMENT_QUERY_TYPE_FUNCTION(functionname, ...) \
+ GST_QUERY_TYPE_FUNCTION (GstElement*, functionname, __VA_ARGS__);
+#define GST_ELEMENT_FORMATS_FUNCTION(functionname, ...) \
+ GST_FORMATS_FUNCTION (GstElement*, functionname, __VA_ARGS__);
+#define GST_ELEMENT_EVENT_MASK_FUNCTION(functionname, ...) \
+ GST_EVENT_MASK_FUNCTION (GstElement*, functionname, __VA_ARGS__);
+#elif defined(G_HAVE_GNUC_VARARGS)
+#define GST_ELEMENT_QUERY_TYPE_FUNCTION(functionname, a...) \
+ GST_QUERY_TYPE_FUNCTION (GstElement*, functionname, a);
+#define GST_ELEMENT_FORMATS_FUNCTION(functionname, a...) \
+ GST_FORMATS_FUNCTION (GstElement*, functionname, a);
+#define GST_ELEMENT_EVENT_MASK_FUNCTION(functionname, a...) \
+ GST_EVENT_MASK_FUNCTION (GstElement*, functionname, a);
+#endif
+
typedef enum {
/* element is complex (for some def.) and generally require a cothread */
GST_ELEMENT_COMPLEX = GST_OBJECT_FLAG_LAST,
/* vtable*/
gboolean (*release_locks) (GstElement *element);
+
+ /* query/convert/events functions */
+ const GstEventMask* (*get_event_masks) (GstElement *element);
gboolean (*send_event) (GstElement *element, GstEvent *event);
- gboolean (*query) (GstElement *element, GstPadQueryType type,
+ const GstFormat* (*get_formats) (GstElement *element);
+ gboolean (*convert) (GstElement *element,
+ GstFormat src_format, gint64 src_value,
+ GstFormat *dest_format, gint64 *dest_value);
+ const GstQueryType* (*get_query_types) (GstElement *element);
+ gboolean (*query) (GstElement *element, GstQueryType type,
GstFormat *format, gint64 *value);
+
/* change the element state */
GstElementStateReturn (*change_state) (GstElement *element);
- /* request a new pad */
+
+ /* request/release pads */
GstPad* (*request_new_pad) (GstElement *element, GstPadTemplate *templ, const gchar* name);
void (*release_pad) (GstElement *element, GstPad *pad);
+
/* set/get clocks */
GstClock* (*get_clock) (GstElement *element);
void (*set_clock) (GstElement *element, GstClock *clock);
+
/* index */
GstIndex* (*get_index) (GstElement *element);
void (*set_index) (GstElement *element, GstIndex *index);
+ /* padding */
gpointer dummy[8];
};
GstPad* gst_element_get_compatible_pad (GstElement *element, GstPad *pad);
GstPad* gst_element_get_compatible_pad_filtered (GstElement *element, GstPad *pad,
GstCaps *filtercaps);
-/* unimplemented
-GstPad* gst_element_get_compatible_request_pad (GstElement *element, GstPadTemplate *templ);
-GstPad* gst_element_get_compatible_static_pad (GstElement *element, GstPadTemplate *templ);
-*/
GstPadTemplate* gst_element_get_pad_template (GstElement *element, const gchar *name);
GList* gst_element_get_pad_template_list (GstElement *element);
void gst_element_disconnect_pads (GstElement *src, const gchar *srcpadname,
GstElement *dest, const gchar *destpadname);
+const GstEventMask* gst_element_get_event_masks (GstElement *element);
gboolean gst_element_send_event (GstElement *element, GstEvent *event);
-gboolean gst_element_query (GstElement *element, GstPadQueryType type,
+const GstQueryType* gst_element_get_query_types (GstElement *element);
+gboolean gst_element_query (GstElement *element, GstQueryType type,
GstFormat *format, gint64 *value);
+const GstFormat* gst_element_get_formats (GstElement *element);
+gboolean gst_element_convert (GstElement *element,
+ GstFormat src_format, gint64 src_value,
+ GstFormat *dest_format, gint64 *dest_value);
void gst_element_set_eos (GstElement *element);
}
/**
+ * gst_event_masks_contains:
+ * @masks: The eventmask array to search
+ * @mask: the event mask to find
+ *
+ * See if the given eventmask is inside the eventmask array.
+ *
+ * Returns: TRUE if the eventmask is found inside the array
+ */
+gboolean
+gst_event_masks_contains (const GstEventMask *masks, GstEventMask *mask)
+{
+ g_return_val_if_fail (mask != NULL, FALSE);
+
+ if (!masks)
+ return FALSE;
+
+ while (masks->type) {
+ if (masks->type == mask->type &&
+ (masks->flags & mask->flags) == mask->flags)
+ return TRUE;
+
+ masks++;
+ }
+
+ return FALSE;
+}
+
+/**
* gst_event_new:
* @type: The type of the new event
*
} GstEventMask;
#ifdef G_HAVE_ISO_VARARGS
-#define GST_EVENT_MASK_FUNCTION(functionname, ...) \
+#define GST_EVENT_MASK_FUNCTION(type,functionname, ...) \
static const GstEventMask* \
-functionname (GstPad *pad) \
+functionname (type pad) \
{ \
static const GstEventMask masks[] = { \
__VA_ARGS__, \
return masks; \
}
#elif defined(G_HAVE_GNUC_VARARGS)
-#define GST_EVENT_MASK_FUNCTION(functionname, a...) \
+#define GST_EVENT_MASK_FUNCTION(type,functionname, a...) \
static const GstEventMask* \
-functionname (GstPad *pad) \
+functionname (type pad) \
{ \
static const GstEventMask masks[] = { \
a, \
/* copy buffer */
#define gst_event_copy(ev) GST_EVENT (gst_data_copy (GST_DATA (ev)))
+gboolean gst_event_masks_contains (const GstEventMask *masks, GstEventMask *mask);
+
/* seek event */
GstEvent* gst_event_new_seek (GstSeekType type, gint64 offset);
};
#ifdef G_HAVE_ISO_VARARGS
-#define GST_FORMATS_FUNCTION(functionname, ...) \
-static const GstFormat* \
-functionname (GstPad *pad) \
-{ \
- static const GstFormat formats[] = { \
- __VA_ARGS__, \
- 0 \
- }; \
- return formats; \
+#define GST_FORMATS_FUNCTION(type, functionname, ...) \
+static const GstFormat* \
+functionname (type object) \
+{ \
+ static const GstFormat formats[] = { \
+ __VA_ARGS__, \
+ 0 \
+ }; \
+ return formats; \
}
#elif defined(G_HAVE_GNUC_VARARGS)
-#define GST_FORMATS_FUNCTION(functionname, a...) \
-static const GstFormat* \
-functionname (GstPad *pad) \
-{ \
- static const GstFormat formats[] = { \
- a, \
- 0 \
- }; \
- return formats; \
+#define GST_FORMATS_FUNCTION(type, functionname, a...) \
+static const GstFormat* \
+functionname (type object) \
+{ \
+ static const GstFormat formats[] = { \
+ a, \
+ 0 \
+ }; \
+ return formats; \
}
#endif
* @index: the index to search
* @id: the id of the index writer
* @method: The lookup method to use
+ * @flags: Flags for the entry
* @format: the format of the value
* @value: the value to find
*
* @index: the index to search
* @id: the id of the index writer
* @method: The lookup method to use
+ * @flags: Flags for the entry
* @format: the format of the value
* @value: the value to find
* @func: the function used to compare entries
}
/**
- * gst_pad_handles_event:
- * @pad: a #GstPad to check
- * @mask: the mask to check
- *
- * Checks if the pad can handle the given eventmask.
- *
- * Returns: TRUE if the pad can handle the given eventmask
- */
-gboolean
-gst_pad_handles_event (GstPad *pad, GstEventMask *mask)
-{
- const GstEventMask *masks;
-
- g_return_val_if_fail (pad != NULL, FALSE);
- g_return_val_if_fail (mask != NULL, FALSE);
-
- masks = gst_pad_get_event_masks (pad);
- if (!masks)
- return FALSE;
-
- while (masks->type) {
- if (masks->type == mask->type &&
- (masks->flags & mask->flags) == mask->flags)
- return TRUE;
-
- masks++;
- }
-
- return FALSE;
-}
-
-/**
* gst_pad_set_convert_function:
* @pad: a #GstPad to set the convert function for.
* @convert: the #GstPadConvertFunction to set.
*
* Returns: an array of querytypes anded with 0.
*/
-const GstPadQueryType*
+const GstQueryType*
gst_pad_get_query_types (GstPad *pad)
{
GstRealPad *rpad;
}
static gboolean
-gst_pad_get_query_types_dispatcher (GstPad *pad, const GstPadQueryType **data)
+gst_pad_get_query_types_dispatcher (GstPad *pad, const GstQueryType **data)
{
*data = gst_pad_get_query_types (pad);
*
* Returns: an array of querytypes anded with 0.
*/
-const GstPadQueryType*
+const GstQueryType*
gst_pad_get_query_types_default (GstPad *pad)
{
- GstPadQueryType *result = NULL;
+ GstQueryType *result = NULL;
gst_pad_dispatcher (pad, (GstPadDispatcherFunction)
gst_pad_get_query_types_dispatcher, &result);
typedef struct
{
- GstPadQueryType type;
+ GstQueryType type;
GstFormat *format;
gint64 *value;
} GstPadQueryData;
/**
* gst_pad_query_default:
* @pad: a #GstPad to invoke the default query on.
- * @type: the #GstPadQueryType of the query to perform.
+ * @type: the #GstQueryType of the query to perform.
* @format: a pointer to the #GstFormat of the result.
* @value: a pointer to the result.
*
* Returns: TRUE if the query could be performed.
*/
gboolean
-gst_pad_query_default (GstPad *pad, GstPadQueryType type,
+gst_pad_query_default (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value)
{
GstPadQueryData data;
/**
* gst_pad_query:
* @pad: a #GstPad to invoke the default query on.
- * @type: the #GstPadQueryType of the query to perform.
+ * @type: the #GstQueryType of the query to perform.
* @format: a pointer to the #GstFormat of the result.
* @value: a pointer to the result.
*
* Returns: TRUE if the query could be performed.
*/
gboolean
-gst_pad_query (GstPad *pad, GstPadQueryType type,
+gst_pad_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value)
{
GstRealPad *rpad;
return FALSE;
}
-/**
- * gst_pad_handles_format:
- * @pad: a #GstPad to check
- * @format: the format to check
- *
- * Checks if the pad can handle the given format.
- *
- * Returns: TRUE if the pad can handle the given format
- */
-gboolean
-gst_pad_handles_format (GstPad *pad, GstFormat format)
-{
- const GstFormat *formats;
-
- formats = gst_pad_get_formats (pad);
-
- return gst_formats_contains (formats, format);
-}
-
static gboolean
gst_pad_get_formats_dispatcher (GstPad *pad, const GstFormat **data)
{
#include <gst/gstcaps.h>
#include <gst/gstevent.h>
#include <gst/gstprobe.h>
+#include <gst/gstquery.h>
G_BEGIN_DECLS
GST_PAD_CONNECT_DONE = 2
} GstPadConnectReturn;
-typedef enum {
- GST_PAD_QUERY_NONE = 0,
- GST_PAD_QUERY_TOTAL,
- GST_PAD_QUERY_POSITION,
- GST_PAD_QUERY_LATENCY,
- GST_PAD_QUERY_JITTER,
- GST_PAD_QUERY_START,
- GST_PAD_QUERY_SEGMENT_END,
- GST_PAD_QUERY_RATE
-} GstPadQueryType;
-
+/* convenience functions */
#ifdef G_HAVE_ISO_VARARGS
-#define GST_PAD_QUERY_TYPE_FUNCTION(functionname, ...) \
-static const GstPadQueryType* \
-functionname (GstPad *pad) \
-{ \
- static const GstPadQueryType types[] = { \
- __VA_ARGS__, \
- 0 \
- }; \
- return types; \
-}
+#define GST_PAD_QUERY_TYPE_FUNCTION(functionname, ...) GST_QUERY_TYPE_FUNCTION (GstPad *, functionname, __VA_ARGS__);
+#define GST_PAD_FORMATS_FUNCTION(functionname, ...) GST_FORMATS_FUNCTION (GstPad *, functionname, __VA_ARGS__);
+#define GST_PAD_EVENT_MASK_FUNCTION(functionname, ...) GST_EVENT_MASK_FUNCTION (GstPad *, functionname, __VA_ARGS__);
#elif defined(G_HAVE_GNUC_VARARGS)
-#define GST_PAD_QUERY_TYPE_FUNCTION(functionname, a...) \
-static const GstPadQueryType* \
-functionname (GstPad *pad) \
-{ \
- static const GstPadQueryType types[] = { \
- a, \
- 0 \
- }; \
- return types; \
-}
+#define GST_PAD_QUERY_TYPE_FUNCTION(functionname, a...) GST_QUERY_TYPE_FUNCTION (GstPad *, functionname, a);
+#define GST_PAD_FORMATS_FUNCTION(functionname, a...) GST_FORMATS_FUNCTION (GstPad *, functionname, a);
+#define GST_PAD_EVENT_MASK_FUNCTION(functionname, a...) GST_EVENT_MASK_FUNCTION (GstPad *, functionname, a);
#endif
typedef gboolean (*GstPadConvertFunction) (GstPad *pad,
GstFormat src_format, gint64 src_value,
GstFormat *dest_format, gint64 *dest_value);
-typedef gboolean (*GstPadQueryFunction) (GstPad *pad, GstPadQueryType type,
+typedef gboolean (*GstPadQueryFunction) (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value);
typedef GList* (*GstPadIntConnFunction) (GstPad *pad);
typedef const GstFormat* (*GstPadFormatsFunction) (GstPad *pad);
typedef const GstEventMask* (*GstPadEventMaskFunction) (GstPad *pad);
-typedef const GstPadQueryType* (*GstPadQueryTypeFunction) (GstPad *pad);
+typedef const GstQueryType* (*GstPadQueryTypeFunction) (GstPad *pad);
typedef GstPadConnectReturn (*GstPadConnectFunction) (GstPad *pad, GstCaps *caps);
typedef GstCaps* (*GstPadGetCapsFunction) (GstPad *pad, GstCaps *caps);
void gst_pad_set_event_mask_function (GstPad *pad, GstPadEventMaskFunction mask_func);
const GstEventMask* gst_pad_get_event_masks (GstPad *pad);
const GstEventMask* gst_pad_get_event_masks_default (GstPad *pad);
-gboolean gst_pad_handles_event (GstPad *pad, GstEventMask *mask);
/* pad connections */
void gst_pad_set_connect_function (GstPad *pad, GstPadConnectFunction connect);
/* convert/query/format functions */
void gst_pad_set_formats_function (GstPad *pad,
GstPadFormatsFunction formats);
-gboolean gst_pad_handles_format (GstPad *pad, GstFormat format);
const GstFormat* gst_pad_get_formats (GstPad *pad);
const GstFormat* gst_pad_get_formats_default (GstPad *pad);
void gst_pad_set_query_function (GstPad *pad, GstPadQueryFunction query);
void gst_pad_set_query_type_function (GstPad *pad, GstPadQueryTypeFunction type_func);
-const GstPadQueryType* gst_pad_get_query_types (GstPad *pad);
-const GstPadQueryType* gst_pad_get_query_types_default (GstPad *pad);
-gboolean gst_pad_query (GstPad *pad, GstPadQueryType type,
+const GstQueryType* gst_pad_get_query_types (GstPad *pad);
+const GstQueryType* gst_pad_get_query_types_default (GstPad *pad);
+gboolean gst_pad_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value);
-gboolean gst_pad_query_default (GstPad *pad, GstPadQueryType type,
+gboolean gst_pad_query_default (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value);
void gst_pad_set_internal_connection_function(GstPad *pad, GstPadIntConnFunction intconn);
--- /dev/null
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wim.taymans@chello.be>
+ *
+ * gstpad.h: Header for GstPad object
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __GST_QUERY_H__
+#define __GST_QUERY_H__
+
+#include <gst/gstconfig.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+ GST_QUERY_NONE = 0,
+ GST_QUERY_TOTAL,
+ GST_QUERY_POSITION,
+ GST_QUERY_LATENCY,
+ GST_QUERY_JITTER,
+ GST_QUERY_START,
+ GST_QUERY_SEGMENT_END,
+ GST_QUERY_RATE
+} GstQueryType;
+
+#ifdef G_HAVE_ISO_VARARGS
+#define GST_QUERY_TYPE_FUNCTION(type, functionname, ...) \
+static const GstQueryType* \
+functionname (type object) \
+{ \
+ static const GstQueryType types[] = { \
+ __VA_ARGS__, \
+ 0 \
+ }; \
+ return types; \
+}
+#elif defined(G_HAVE_GNUC_VARARGS)
+#define GST_QUERY_TYPE_FUNCTION(type, functionname, a...) \
+static const GstQueryType* \
+functionname (type object) \
+{ \
+ static const GstQueryType types[] = { \
+ a, \
+ 0 \
+ }; \
+ return types; \
+}
+#endif
+
+G_END_DECLS
+
+#endif /* __GST_QUERY_H__ */
+
format = GST_FORMAT_BYTES;
- if (gst_pad_query (GST_PAD_PEER (bs->pad), GST_PAD_QUERY_POSITION, &format, &value))
+ if (gst_pad_query (GST_PAD_PEER (bs->pad), GST_QUERY_POSITION, &format, &value))
return value;
return -1;
format = GST_FORMAT_BYTES;
- if (gst_pad_query (GST_PAD_PEER (bs->pad), GST_PAD_QUERY_TOTAL, &format, &value))
+ if (gst_pad_query (GST_PAD_PEER (bs->pad), GST_QUERY_TOTAL, &format, &value))
return value;
return -1;
return srcpad;
}
-GST_FORMATS_FUNCTION (gst_fakesrc_get_formats,
+GST_PAD_FORMATS_FUNCTION (gst_fakesrc_get_formats,
GST_FORMAT_DEFAULT
)
GST_PAD_QUERY_TYPE_FUNCTION (gst_fakesrc_get_query_types,
- GST_PAD_QUERY_TOTAL,
- GST_PAD_QUERY_POSITION,
- GST_PAD_QUERY_START,
- GST_PAD_QUERY_SEGMENT_END
+ GST_QUERY_TOTAL,
+ GST_QUERY_POSITION,
+ GST_QUERY_START,
+ GST_QUERY_SEGMENT_END
)
static gboolean
-gst_fakesrc_query (GstPad *pad, GstPadQueryType type,
+gst_fakesrc_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value)
{
GstFakeSrc *src = GST_FAKESRC (GST_PAD_PARENT (pad));
switch (type) {
- case GST_PAD_QUERY_TOTAL:
+ case GST_QUERY_TOTAL:
*value = src->num_buffers;
break;
- case GST_PAD_QUERY_POSITION:
+ case GST_QUERY_POSITION:
*value = src->buffer_count;
break;
- case GST_PAD_QUERY_START:
+ case GST_QUERY_START:
*value = src->segment_start;
break;
- case GST_PAD_QUERY_SEGMENT_END:
+ case GST_QUERY_SEGMENT_END:
*value = src->segment_end;
break;
default:
return TRUE;
}
-GST_EVENT_MASK_FUNCTION (gst_fakesrc_get_event_mask,
+GST_PAD_EVENT_MASK_FUNCTION (gst_fakesrc_get_event_mask,
{ GST_EVENT_SEEK, GST_SEEK_FLAG_FLUSH },
{ GST_EVENT_SEEK_SEGMENT, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT_LOOP },
{ GST_EVENT_FLUSH, 0 }
ARG_MAXFILESIZE,
};
-GST_EVENT_MASK_FUNCTION (gst_filesink_get_event_mask,
+GST_PAD_EVENT_MASK_FUNCTION (gst_filesink_get_event_mask,
{ GST_EVENT_SEEK, GST_SEEK_METHOD_CUR |
GST_SEEK_METHOD_SET |
GST_SEEK_METHOD_END |
ARG_TOUCH,
};
-GST_EVENT_MASK_FUNCTION (gst_filesrc_get_event_mask,
+GST_PAD_EVENT_MASK_FUNCTION (gst_filesrc_get_event_mask,
{ GST_EVENT_SEEK, GST_SEEK_METHOD_CUR |
GST_SEEK_METHOD_SET |
GST_SEEK_METHOD_END |
)
GST_PAD_QUERY_TYPE_FUNCTION (gst_filesrc_get_query_types,
- GST_PAD_QUERY_TOTAL,
- GST_PAD_QUERY_POSITION
+ GST_QUERY_TOTAL,
+ GST_QUERY_POSITION
)
-GST_FORMATS_FUNCTION (gst_filesrc_get_formats,
+GST_PAD_FORMATS_FUNCTION (gst_filesrc_get_formats,
GST_FORMAT_BYTES
)
static GstBuffer * gst_filesrc_get (GstPad *pad);
static gboolean gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event);
-static gboolean gst_filesrc_srcpad_query (GstPad *pad, GstPadQueryType type,
+static gboolean gst_filesrc_srcpad_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value);
static GstElementStateReturn gst_filesrc_change_state (GstElement *element);
}
static gboolean
-gst_filesrc_srcpad_query (GstPad *pad, GstPadQueryType type,
+gst_filesrc_srcpad_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value)
{
GstFileSrc *src = GST_FILESRC (GST_PAD_PARENT (pad));
switch (type) {
- case GST_PAD_QUERY_TOTAL:
+ case GST_QUERY_TOTAL:
if (*format != GST_FORMAT_BYTES) {
return FALSE;
}
*value = src->filelen;
break;
- case GST_PAD_QUERY_POSITION:
+ case GST_QUERY_POSITION:
switch (*format) {
case GST_FORMAT_BYTES:
*value = src->curoffset;
format = GST_FORMAT_DEFAULT;
- gst_pad_query (pad, GST_PAD_QUERY_START, &format, &value);
+ gst_pad_query (pad, GST_QUERY_START, &format, &value);
g_print ("configured for start %lld\n", value);
- gst_pad_query (pad, GST_PAD_QUERY_SEGMENT_END, &format, &value);
+ gst_pad_query (pad, GST_QUERY_SEGMENT_END, &format, &value);
g_print ("configured segment end %lld\n", value);
g_signal_connect (G_OBJECT (gst_element_get_pad (fakesink, "sink")), "event_received", G_CALLBACK (event_received), event);
- gst_pad_query (pad, GST_PAD_QUERY_START, &format, &value);
+ gst_pad_query (pad, GST_QUERY_START, &format, &value);
g_print ("configured for start %lld\n", value);
- gst_pad_query (pad, GST_PAD_QUERY_SEGMENT_END, &format, &value);
+ gst_pad_query (pad, GST_QUERY_SEGMENT_END, &format, &value);
g_print ("configured segment end %lld\n", value);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
}
static void
-print_query_types (const GstPadQueryType *types)
+print_query_types (const GstQueryType *types)
{
GType query_type;
GEnumClass *klass;
- query_type = gst_pad_query_type_get_type();
+ query_type = gst_query_type_get_type();
klass = (GEnumClass *) g_type_class_ref (query_type);
while (types && *types) {