- major API breakage (one of the last, I promise...)

Original commit message from CVS:
- major API breakage (one of the last, I promise...)
- GST_PAD_QUERY -> GST_QUERY
- GstPadQuery -> GstQuery
- Move query definitions to gstquery.h to allow for future dynamic
query types.
- remove _pad_handles_* in favour of extra format/event functions to
make the same checks.
- fix elements
- Implemented missing query/event/formats functions in gstelement
This commit is contained in:
Wim Taymans 2002-12-30 17:42:11 +00:00
parent 8854eac118
commit 347505bcb9
19 changed files with 390 additions and 209 deletions

View file

@ -131,6 +131,7 @@ gst_headers = \
gstprobe.h \ gstprobe.h \
gstprops.h \ gstprops.h \
gstqueue.h \ gstqueue.h \
gstquery.h \
gstscheduler.h \ gstscheduler.h \
gstsystemclock.h \ gstsystemclock.h \
gstthread.h \ gstthread.h \

View file

@ -319,34 +319,34 @@ gst_fakesrc_request_new_pad (GstElement *element, GstPadTemplate *templ)
return srcpad; return srcpad;
} }
GST_FORMATS_FUNCTION (gst_fakesrc_get_formats, GST_PAD_FORMATS_FUNCTION (gst_fakesrc_get_formats,
GST_FORMAT_DEFAULT GST_FORMAT_DEFAULT
) )
GST_PAD_QUERY_TYPE_FUNCTION (gst_fakesrc_get_query_types, GST_PAD_QUERY_TYPE_FUNCTION (gst_fakesrc_get_query_types,
GST_PAD_QUERY_TOTAL, GST_QUERY_TOTAL,
GST_PAD_QUERY_POSITION, GST_QUERY_POSITION,
GST_PAD_QUERY_START, GST_QUERY_START,
GST_PAD_QUERY_SEGMENT_END GST_QUERY_SEGMENT_END
) )
static gboolean static gboolean
gst_fakesrc_query (GstPad *pad, GstPadQueryType type, gst_fakesrc_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value) GstFormat *format, gint64 *value)
{ {
GstFakeSrc *src = GST_FAKESRC (GST_PAD_PARENT (pad)); GstFakeSrc *src = GST_FAKESRC (GST_PAD_PARENT (pad));
switch (type) { switch (type) {
case GST_PAD_QUERY_TOTAL: case GST_QUERY_TOTAL:
*value = src->num_buffers; *value = src->num_buffers;
break; break;
case GST_PAD_QUERY_POSITION: case GST_QUERY_POSITION:
*value = src->buffer_count; *value = src->buffer_count;
break; break;
case GST_PAD_QUERY_START: case GST_QUERY_START:
*value = src->segment_start; *value = src->segment_start;
break; break;
case GST_PAD_QUERY_SEGMENT_END: case GST_QUERY_SEGMENT_END:
*value = src->segment_end; *value = src->segment_end;
break; break;
default: default:
@ -355,7 +355,7 @@ gst_fakesrc_query (GstPad *pad, GstPadQueryType type,
return TRUE; 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, GST_SEEK_FLAG_FLUSH },
{ GST_EVENT_SEEK_SEGMENT, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT_LOOP }, { GST_EVENT_SEEK_SEGMENT, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT_LOOP },
{ GST_EVENT_FLUSH, 0 } { GST_EVENT_FLUSH, 0 }

View file

@ -50,7 +50,7 @@ enum {
ARG_MAXFILESIZE, 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_EVENT_SEEK, GST_SEEK_METHOD_CUR |
GST_SEEK_METHOD_SET | GST_SEEK_METHOD_SET |
GST_SEEK_METHOD_END | GST_SEEK_METHOD_END |

View file

@ -109,7 +109,7 @@ enum {
ARG_TOUCH, 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_EVENT_SEEK, GST_SEEK_METHOD_CUR |
GST_SEEK_METHOD_SET | GST_SEEK_METHOD_SET |
GST_SEEK_METHOD_END | GST_SEEK_METHOD_END |
@ -119,11 +119,11 @@ GST_EVENT_MASK_FUNCTION (gst_filesrc_get_event_mask,
) )
GST_PAD_QUERY_TYPE_FUNCTION (gst_filesrc_get_query_types, GST_PAD_QUERY_TYPE_FUNCTION (gst_filesrc_get_query_types,
GST_PAD_QUERY_TOTAL, GST_QUERY_TOTAL,
GST_PAD_QUERY_POSITION GST_QUERY_POSITION
) )
GST_FORMATS_FUNCTION (gst_filesrc_get_formats, GST_PAD_FORMATS_FUNCTION (gst_filesrc_get_formats,
GST_FORMAT_BYTES GST_FORMAT_BYTES
) )
@ -138,7 +138,7 @@ static void gst_filesrc_get_property (GObject *object, guint prop_id,
static GstBuffer * gst_filesrc_get (GstPad *pad); static GstBuffer * gst_filesrc_get (GstPad *pad);
static gboolean gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event); 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); GstFormat *format, gint64 *value);
static GstElementStateReturn gst_filesrc_change_state (GstElement *element); static GstElementStateReturn gst_filesrc_change_state (GstElement *element);
@ -732,19 +732,19 @@ gst_filesrc_change_state (GstElement *element)
} }
static gboolean static gboolean
gst_filesrc_srcpad_query (GstPad *pad, GstPadQueryType type, gst_filesrc_srcpad_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value) GstFormat *format, gint64 *value)
{ {
GstFileSrc *src = GST_FILESRC (GST_PAD_PARENT (pad)); GstFileSrc *src = GST_FILESRC (GST_PAD_PARENT (pad));
switch (type) { switch (type) {
case GST_PAD_QUERY_TOTAL: case GST_QUERY_TOTAL:
if (*format != GST_FORMAT_BYTES) { if (*format != GST_FORMAT_BYTES) {
return FALSE; return FALSE;
} }
*value = src->filelen; *value = src->filelen;
break; break;
case GST_PAD_QUERY_POSITION: case GST_QUERY_POSITION:
switch (*format) { switch (*format) {
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
*value = src->curoffset; *value = src->curoffset;

View file

@ -60,10 +60,6 @@ static void gst_element_real_get_property (GObject *object, guint prop_id, GVa
static void gst_element_dispose (GObject *object); 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 GstElementStateReturn gst_element_change_state (GstElement *element);
static void gst_element_error_func (GstElement* element, GstElement *source, gchar *errormsg); static void gst_element_error_func (GstElement* element, GstElement *source, gchar *errormsg);
@ -149,8 +145,8 @@ gst_element_class_init (GstElementClass *klass)
klass->elementfactory = NULL; klass->elementfactory = NULL;
klass->padtemplates = NULL; klass->padtemplates = NULL;
klass->numpadtemplates = 0; klass->numpadtemplates = 0;
klass->send_event = GST_DEBUG_FUNCPTR (gst_element_send_event_default); klass->send_event = NULL;
klass->query = GST_DEBUG_FUNCPTR (gst_element_query_default); klass->query = NULL;
} }
static void static void
@ -1762,24 +1758,52 @@ gst_element_error_func (GstElement* element, GstElement *source,
} }
} }
static gboolean static GstPad*
gst_element_send_event_default (GstElement *element, GstEvent *event) gst_element_get_random_pad (GstElement *element, GstPadDirection dir)
{ {
GList *pads = element->pads; GList *pads = element->pads;
gboolean res = FALSE;
while (pads) { while (pads) {
GstPad *pad = GST_PAD_CAST (pads->data); 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)) { if (GST_PAD_IS_USABLE (pad)) {
res = gst_pad_send_event (GST_PAD_PEER (pad), event); return pad;
break;
} }
} }
pads = g_list_next (pads); 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;
} }
/** /**
@ -1805,35 +1829,50 @@ gst_element_send_event (GstElement *element, GstEvent *event)
if (oclass->send_event) if (oclass->send_event)
return oclass->send_event (element, 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; return FALSE;
} }
static gboolean /**
gst_element_query_default (GstElement *element, GstPadQueryType type, * gst_element_get_query_types:
GstFormat *format, gint64 *value) * @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; GstElementClass *oclass;
gboolean res = FALSE;
while (pads) { g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
GstPad *pad = GST_PAD_CAST (pads->data);
oclass = GST_ELEMENT_GET_CLASS (element);
if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK) {
if (GST_PAD_IS_USABLE (pad)) { if (oclass->get_query_types)
res = gst_pad_query (GST_PAD_PEER (pad), type, format, value); return oclass->get_query_types (element);
break; else {
} GstPad *pad = gst_element_get_random_pad (element, GST_PAD_SINK);
} if (pad)
pads = g_list_next (pads); return gst_pad_get_query_types (GST_PAD_PEER (pad));
} }
return res;
return FALSE;
} }
/** /**
* gst_element_query: * gst_element_query:
* @element: a #GstElement to perform the query on. * @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. * @format: the #GstFormat pointer to hold the format of the result.
* @value: the pointer to the value of the result. * @value: the pointer to the value of the result.
* *
@ -1841,12 +1880,12 @@ gst_element_query_default (GstElement *element, GstPadQueryType type,
* to GST_FORMAT_DEFAULT and this function returns TRUE, the * to GST_FORMAT_DEFAULT and this function returns TRUE, the
* format pointer will hold the default format. * format pointer will hold the default format.
* For element that don't implement a query handler, this function * 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. * Returns: TRUE if the query could be performed.
*/ */
gboolean gboolean
gst_element_query (GstElement *element, GstPadQueryType type, gst_element_query (GstElement *element, GstQueryType type,
GstFormat *format, gint64 *value) GstFormat *format, gint64 *value)
{ {
GstElementClass *oclass; GstElementClass *oclass;
@ -1859,6 +1898,90 @@ gst_element_query (GstElement *element, GstPadQueryType type,
if (oclass->query) if (oclass->query)
return oclass->query (element, type, format, value); 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; return FALSE;
} }

View file

@ -69,6 +69,23 @@ extern GType _gst_element_type;
# define GST_ELEMENT_CLASS GST_ELEMENT_CLASS_CAST # define GST_ELEMENT_CLASS GST_ELEMENT_CLASS_CAST
#endif #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 { typedef enum {
/* element is complex (for some def.) and generally require a cothread */ /* element is complex (for some def.) and generally require a cothread */
GST_ELEMENT_COMPLEX = GST_OBJECT_FLAG_LAST, GST_ELEMENT_COMPLEX = GST_OBJECT_FLAG_LAST,
@ -168,21 +185,34 @@ struct _GstElementClass {
/* vtable*/ /* vtable*/
gboolean (*release_locks) (GstElement *element); gboolean (*release_locks) (GstElement *element);
/* query/convert/events functions */
const GstEventMask* (*get_event_masks) (GstElement *element);
gboolean (*send_event) (GstElement *element, GstEvent *event); 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); GstFormat *format, gint64 *value);
/* change the element state */ /* change the element state */
GstElementStateReturn (*change_state) (GstElement *element); GstElementStateReturn (*change_state) (GstElement *element);
/* request a new pad */
/* request/release pads */
GstPad* (*request_new_pad) (GstElement *element, GstPadTemplate *templ, const gchar* name); GstPad* (*request_new_pad) (GstElement *element, GstPadTemplate *templ, const gchar* name);
void (*release_pad) (GstElement *element, GstPad *pad); void (*release_pad) (GstElement *element, GstPad *pad);
/* set/get clocks */ /* set/get clocks */
GstClock* (*get_clock) (GstElement *element); GstClock* (*get_clock) (GstElement *element);
void (*set_clock) (GstElement *element, GstClock *clock); void (*set_clock) (GstElement *element, GstClock *clock);
/* index */ /* index */
GstIndex* (*get_index) (GstElement *element); GstIndex* (*get_index) (GstElement *element);
void (*set_index) (GstElement *element, GstIndex *index); void (*set_index) (GstElement *element, GstIndex *index);
/* padding */
gpointer dummy[8]; gpointer dummy[8];
}; };
@ -255,10 +285,6 @@ const GList* gst_element_get_pad_list (GstElement *element);
GstPad* gst_element_get_compatible_pad (GstElement *element, GstPad *pad); GstPad* gst_element_get_compatible_pad (GstElement *element, GstPad *pad);
GstPad* gst_element_get_compatible_pad_filtered (GstElement *element, GstPad *pad, GstPad* gst_element_get_compatible_pad_filtered (GstElement *element, GstPad *pad,
GstCaps *filtercaps); 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); GstPadTemplate* gst_element_get_pad_template (GstElement *element, const gchar *name);
GList* gst_element_get_pad_template_list (GstElement *element); GList* gst_element_get_pad_template_list (GstElement *element);
@ -279,9 +305,15 @@ gboolean gst_element_connect_pads_filtered (GstElement *src, const gchar *srcpa
void gst_element_disconnect_pads (GstElement *src, const gchar *srcpadname, void gst_element_disconnect_pads (GstElement *src, const gchar *srcpadname,
GstElement *dest, const gchar *destpadname); 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_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); 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); void gst_element_set_eos (GstElement *element);

View file

@ -88,6 +88,34 @@ _gst_event_free (GstEvent* event)
g_free (event); g_free (event);
} }
/**
* 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: * gst_event_new:
* @type: The type of the new event * @type: The type of the new event

View file

@ -79,9 +79,9 @@ typedef struct
} GstEventMask; } GstEventMask;
#ifdef G_HAVE_ISO_VARARGS #ifdef G_HAVE_ISO_VARARGS
#define GST_EVENT_MASK_FUNCTION(functionname, ...) \ #define GST_EVENT_MASK_FUNCTION(type,functionname, ...) \
static const GstEventMask* \ static const GstEventMask* \
functionname (GstPad *pad) \ functionname (type pad) \
{ \ { \
static const GstEventMask masks[] = { \ static const GstEventMask masks[] = { \
__VA_ARGS__, \ __VA_ARGS__, \
@ -90,9 +90,9 @@ functionname (GstPad *pad) \
return masks; \ return masks; \
} }
#elif defined(G_HAVE_GNUC_VARARGS) #elif defined(G_HAVE_GNUC_VARARGS)
#define GST_EVENT_MASK_FUNCTION(functionname, a...) \ #define GST_EVENT_MASK_FUNCTION(type,functionname, a...) \
static const GstEventMask* \ static const GstEventMask* \
functionname (GstPad *pad) \ functionname (type pad) \
{ \ { \
static const GstEventMask masks[] = { \ static const GstEventMask masks[] = { \
a, \ a, \
@ -189,6 +189,8 @@ GstEvent* gst_event_new (GstEventType type);
/* copy buffer */ /* copy buffer */
#define gst_event_copy(ev) GST_EVENT (gst_data_copy (GST_DATA (ev))) #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 */ /* seek event */
GstEvent* gst_event_new_seek (GstSeekType type, gint64 offset); GstEvent* gst_event_new_seek (GstSeekType type, gint64 offset);

View file

@ -54,26 +54,26 @@ struct _GstFormatDefinition
}; };
#ifdef G_HAVE_ISO_VARARGS #ifdef G_HAVE_ISO_VARARGS
#define GST_FORMATS_FUNCTION(functionname, ...) \ #define GST_FORMATS_FUNCTION(type, functionname, ...) \
static const GstFormat* \ static const GstFormat* \
functionname (GstPad *pad) \ functionname (type object) \
{ \ { \
static const GstFormat formats[] = { \ static const GstFormat formats[] = { \
__VA_ARGS__, \ __VA_ARGS__, \
0 \ 0 \
}; \ }; \
return formats; \ return formats; \
} }
#elif defined(G_HAVE_GNUC_VARARGS) #elif defined(G_HAVE_GNUC_VARARGS)
#define GST_FORMATS_FUNCTION(functionname, a...) \ #define GST_FORMATS_FUNCTION(type, functionname, a...) \
static const GstFormat* \ static const GstFormat* \
functionname (GstPad *pad) \ functionname (type object) \
{ \ { \
static const GstFormat formats[] = { \ static const GstFormat formats[] = { \
a, \ a, \
0 \ 0 \
}; \ }; \
return formats; \ return formats; \
} }
#endif #endif

View file

@ -547,6 +547,7 @@ gst_index_compare_func (gconstpointer a,
* @index: the index to search * @index: the index to search
* @id: the id of the index writer * @id: the id of the index writer
* @method: The lookup method to use * @method: The lookup method to use
* @flags: Flags for the entry
* @format: the format of the value * @format: the format of the value
* @value: the value to find * @value: the value to find
* *
@ -571,6 +572,7 @@ gst_index_get_assoc_entry (GstIndex *index, gint id,
* @index: the index to search * @index: the index to search
* @id: the id of the index writer * @id: the id of the index writer
* @method: The lookup method to use * @method: The lookup method to use
* @flags: Flags for the entry
* @format: the format of the value * @format: the format of the value
* @value: the value to find * @value: the value to find
* @func: the function used to compare entries * @func: the function used to compare entries

View file

@ -580,38 +580,6 @@ gst_pad_get_event_masks_default (GstPad *pad)
return result; return result;
} }
/**
* 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: * gst_pad_set_convert_function:
* @pad: a #GstPad to set the convert function for. * @pad: a #GstPad to set the convert function for.
@ -679,7 +647,7 @@ gst_pad_set_query_type_function (GstPad *pad, GstPadQueryTypeFunction type_func)
* *
* Returns: an array of querytypes anded with 0. * Returns: an array of querytypes anded with 0.
*/ */
const GstPadQueryType* const GstQueryType*
gst_pad_get_query_types (GstPad *pad) gst_pad_get_query_types (GstPad *pad)
{ {
GstRealPad *rpad; GstRealPad *rpad;
@ -698,7 +666,7 @@ gst_pad_get_query_types (GstPad *pad)
} }
static gboolean 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); *data = gst_pad_get_query_types (pad);
@ -714,10 +682,10 @@ gst_pad_get_query_types_dispatcher (GstPad *pad, const GstPadQueryType **data)
* *
* Returns: an array of querytypes anded with 0. * Returns: an array of querytypes anded with 0.
*/ */
const GstPadQueryType* const GstQueryType*
gst_pad_get_query_types_default (GstPad *pad) gst_pad_get_query_types_default (GstPad *pad)
{ {
GstPadQueryType *result = NULL; GstQueryType *result = NULL;
gst_pad_dispatcher (pad, (GstPadDispatcherFunction) gst_pad_dispatcher (pad, (GstPadDispatcherFunction)
gst_pad_get_query_types_dispatcher, &result); gst_pad_get_query_types_dispatcher, &result);
@ -2908,7 +2876,7 @@ gst_pad_convert (GstPad *pad,
typedef struct typedef struct
{ {
GstPadQueryType type; GstQueryType type;
GstFormat *format; GstFormat *format;
gint64 *value; gint64 *value;
} GstPadQueryData; } GstPadQueryData;
@ -2922,7 +2890,7 @@ gst_pad_query_dispatcher (GstPad *pad, GstPadQueryData *data)
/** /**
* gst_pad_query_default: * gst_pad_query_default:
* @pad: a #GstPad to invoke the default query on. * @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. * @format: a pointer to the #GstFormat of the result.
* @value: a pointer to the result. * @value: a pointer to the result.
* *
@ -2931,7 +2899,7 @@ gst_pad_query_dispatcher (GstPad *pad, GstPadQueryData *data)
* Returns: TRUE if the query could be performed. * Returns: TRUE if the query could be performed.
*/ */
gboolean gboolean
gst_pad_query_default (GstPad *pad, GstPadQueryType type, gst_pad_query_default (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value) GstFormat *format, gint64 *value)
{ {
GstPadQueryData data; GstPadQueryData data;
@ -2951,7 +2919,7 @@ gst_pad_query_default (GstPad *pad, GstPadQueryType type,
/** /**
* gst_pad_query: * gst_pad_query:
* @pad: a #GstPad to invoke the default query on. * @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. * @format: a pointer to the #GstFormat of the result.
* @value: a pointer to the result. * @value: a pointer to the result.
* *
@ -2960,7 +2928,7 @@ gst_pad_query_default (GstPad *pad, GstPadQueryType type,
* Returns: TRUE if the query could be performed. * Returns: TRUE if the query could be performed.
*/ */
gboolean gboolean
gst_pad_query (GstPad *pad, GstPadQueryType type, gst_pad_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value) GstFormat *format, gint64 *value)
{ {
GstRealPad *rpad; GstRealPad *rpad;
@ -2979,25 +2947,6 @@ gst_pad_query (GstPad *pad, GstPadQueryType type,
return FALSE; 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 static gboolean
gst_pad_get_formats_dispatcher (GstPad *pad, const GstFormat **data) gst_pad_get_formats_dispatcher (GstPad *pad, const GstFormat **data)
{ {

View file

@ -31,6 +31,7 @@
#include <gst/gstcaps.h> #include <gst/gstcaps.h>
#include <gst/gstevent.h> #include <gst/gstevent.h>
#include <gst/gstprobe.h> #include <gst/gstprobe.h>
#include <gst/gstquery.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -117,39 +118,15 @@ typedef enum {
GST_PAD_CONNECT_DONE = 2 GST_PAD_CONNECT_DONE = 2
} GstPadConnectReturn; } GstPadConnectReturn;
typedef enum { /* convenience functions */
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;
#ifdef G_HAVE_ISO_VARARGS #ifdef G_HAVE_ISO_VARARGS
#define GST_PAD_QUERY_TYPE_FUNCTION(functionname, ...) \ #define GST_PAD_QUERY_TYPE_FUNCTION(functionname, ...) GST_QUERY_TYPE_FUNCTION (GstPad *, functionname, __VA_ARGS__);
static const GstPadQueryType* \ #define GST_PAD_FORMATS_FUNCTION(functionname, ...) GST_FORMATS_FUNCTION (GstPad *, functionname, __VA_ARGS__);
functionname (GstPad *pad) \ #define GST_PAD_EVENT_MASK_FUNCTION(functionname, ...) GST_EVENT_MASK_FUNCTION (GstPad *, functionname, __VA_ARGS__);
{ \
static const GstPadQueryType types[] = { \
__VA_ARGS__, \
0 \
}; \
return types; \
}
#elif defined(G_HAVE_GNUC_VARARGS) #elif defined(G_HAVE_GNUC_VARARGS)
#define GST_PAD_QUERY_TYPE_FUNCTION(functionname, a...) \ #define GST_PAD_QUERY_TYPE_FUNCTION(functionname, a...) GST_QUERY_TYPE_FUNCTION (GstPad *, functionname, a);
static const GstPadQueryType* \ #define GST_PAD_FORMATS_FUNCTION(functionname, a...) GST_FORMATS_FUNCTION (GstPad *, functionname, a);
functionname (GstPad *pad) \ #define GST_PAD_EVENT_MASK_FUNCTION(functionname, a...) GST_EVENT_MASK_FUNCTION (GstPad *, functionname, a);
{ \
static const GstPadQueryType types[] = { \
a, \
0 \
}; \
return types; \
}
#endif #endif
@ -162,12 +139,12 @@ typedef gboolean (*GstPadEventFunction) (GstPad *pad, GstEvent *event);
typedef gboolean (*GstPadConvertFunction) (GstPad *pad, typedef gboolean (*GstPadConvertFunction) (GstPad *pad,
GstFormat src_format, gint64 src_value, GstFormat src_format, gint64 src_value,
GstFormat *dest_format, gint64 *dest_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); GstFormat *format, gint64 *value);
typedef GList* (*GstPadIntConnFunction) (GstPad *pad); typedef GList* (*GstPadIntConnFunction) (GstPad *pad);
typedef const GstFormat* (*GstPadFormatsFunction) (GstPad *pad); typedef const GstFormat* (*GstPadFormatsFunction) (GstPad *pad);
typedef const GstEventMask* (*GstPadEventMaskFunction) (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 GstPadConnectReturn (*GstPadConnectFunction) (GstPad *pad, GstCaps *caps);
typedef GstCaps* (*GstPadGetCapsFunction) (GstPad *pad, GstCaps *caps); typedef GstCaps* (*GstPadGetCapsFunction) (GstPad *pad, GstCaps *caps);
@ -440,7 +417,6 @@ void gst_pad_set_event_function (GstPad *pad, GstPadEventFunction event);
void gst_pad_set_event_mask_function (GstPad *pad, GstPadEventMaskFunction mask_func); 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 (GstPad *pad);
const GstEventMask* gst_pad_get_event_masks_default (GstPad *pad); const GstEventMask* gst_pad_get_event_masks_default (GstPad *pad);
gboolean gst_pad_handles_event (GstPad *pad, GstEventMask *mask);
/* pad connections */ /* pad connections */
void gst_pad_set_connect_function (GstPad *pad, GstPadConnectFunction connect); void gst_pad_set_connect_function (GstPad *pad, GstPadConnectFunction connect);
@ -479,7 +455,6 @@ GstPad* gst_pad_selectv (GstPad *pad, ...);
/* convert/query/format functions */ /* convert/query/format functions */
void gst_pad_set_formats_function (GstPad *pad, void gst_pad_set_formats_function (GstPad *pad,
GstPadFormatsFunction formats); 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 (GstPad *pad);
const GstFormat* gst_pad_get_formats_default (GstPad *pad); const GstFormat* gst_pad_get_formats_default (GstPad *pad);
@ -493,11 +468,11 @@ gboolean gst_pad_convert_default (GstPad *pad,
void gst_pad_set_query_function (GstPad *pad, GstPadQueryFunction query); void gst_pad_set_query_function (GstPad *pad, GstPadQueryFunction query);
void gst_pad_set_query_type_function (GstPad *pad, GstPadQueryTypeFunction type_func); void gst_pad_set_query_type_function (GstPad *pad, GstPadQueryTypeFunction type_func);
const GstPadQueryType* gst_pad_get_query_types (GstPad *pad); const GstQueryType* gst_pad_get_query_types (GstPad *pad);
const GstPadQueryType* gst_pad_get_query_types_default (GstPad *pad); const GstQueryType* gst_pad_get_query_types_default (GstPad *pad);
gboolean gst_pad_query (GstPad *pad, GstPadQueryType type, gboolean gst_pad_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value); 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); GstFormat *format, gint64 *value);
void gst_pad_set_internal_connection_function(GstPad *pad, GstPadIntConnFunction intconn); void gst_pad_set_internal_connection_function(GstPad *pad, GstPadIntConnFunction intconn);

69
gst/gstquery.h Normal file
View file

@ -0,0 +1,69 @@
/* 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__ */

View file

@ -489,7 +489,7 @@ gst_bytestream_tell (GstByteStream *bs)
format = GST_FORMAT_BYTES; 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 value;
return -1; return -1;
@ -505,7 +505,7 @@ gst_bytestream_length (GstByteStream *bs)
format = GST_FORMAT_BYTES; 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 value;
return -1; return -1;

View file

@ -319,34 +319,34 @@ gst_fakesrc_request_new_pad (GstElement *element, GstPadTemplate *templ)
return srcpad; return srcpad;
} }
GST_FORMATS_FUNCTION (gst_fakesrc_get_formats, GST_PAD_FORMATS_FUNCTION (gst_fakesrc_get_formats,
GST_FORMAT_DEFAULT GST_FORMAT_DEFAULT
) )
GST_PAD_QUERY_TYPE_FUNCTION (gst_fakesrc_get_query_types, GST_PAD_QUERY_TYPE_FUNCTION (gst_fakesrc_get_query_types,
GST_PAD_QUERY_TOTAL, GST_QUERY_TOTAL,
GST_PAD_QUERY_POSITION, GST_QUERY_POSITION,
GST_PAD_QUERY_START, GST_QUERY_START,
GST_PAD_QUERY_SEGMENT_END GST_QUERY_SEGMENT_END
) )
static gboolean static gboolean
gst_fakesrc_query (GstPad *pad, GstPadQueryType type, gst_fakesrc_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value) GstFormat *format, gint64 *value)
{ {
GstFakeSrc *src = GST_FAKESRC (GST_PAD_PARENT (pad)); GstFakeSrc *src = GST_FAKESRC (GST_PAD_PARENT (pad));
switch (type) { switch (type) {
case GST_PAD_QUERY_TOTAL: case GST_QUERY_TOTAL:
*value = src->num_buffers; *value = src->num_buffers;
break; break;
case GST_PAD_QUERY_POSITION: case GST_QUERY_POSITION:
*value = src->buffer_count; *value = src->buffer_count;
break; break;
case GST_PAD_QUERY_START: case GST_QUERY_START:
*value = src->segment_start; *value = src->segment_start;
break; break;
case GST_PAD_QUERY_SEGMENT_END: case GST_QUERY_SEGMENT_END:
*value = src->segment_end; *value = src->segment_end;
break; break;
default: default:
@ -355,7 +355,7 @@ gst_fakesrc_query (GstPad *pad, GstPadQueryType type,
return TRUE; 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, GST_SEEK_FLAG_FLUSH },
{ GST_EVENT_SEEK_SEGMENT, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT_LOOP }, { GST_EVENT_SEEK_SEGMENT, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT_LOOP },
{ GST_EVENT_FLUSH, 0 } { GST_EVENT_FLUSH, 0 }

View file

@ -50,7 +50,7 @@ enum {
ARG_MAXFILESIZE, 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_EVENT_SEEK, GST_SEEK_METHOD_CUR |
GST_SEEK_METHOD_SET | GST_SEEK_METHOD_SET |
GST_SEEK_METHOD_END | GST_SEEK_METHOD_END |

View file

@ -109,7 +109,7 @@ enum {
ARG_TOUCH, 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_EVENT_SEEK, GST_SEEK_METHOD_CUR |
GST_SEEK_METHOD_SET | GST_SEEK_METHOD_SET |
GST_SEEK_METHOD_END | GST_SEEK_METHOD_END |
@ -119,11 +119,11 @@ GST_EVENT_MASK_FUNCTION (gst_filesrc_get_event_mask,
) )
GST_PAD_QUERY_TYPE_FUNCTION (gst_filesrc_get_query_types, GST_PAD_QUERY_TYPE_FUNCTION (gst_filesrc_get_query_types,
GST_PAD_QUERY_TOTAL, GST_QUERY_TOTAL,
GST_PAD_QUERY_POSITION GST_QUERY_POSITION
) )
GST_FORMATS_FUNCTION (gst_filesrc_get_formats, GST_PAD_FORMATS_FUNCTION (gst_filesrc_get_formats,
GST_FORMAT_BYTES GST_FORMAT_BYTES
) )
@ -138,7 +138,7 @@ static void gst_filesrc_get_property (GObject *object, guint prop_id,
static GstBuffer * gst_filesrc_get (GstPad *pad); static GstBuffer * gst_filesrc_get (GstPad *pad);
static gboolean gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event); 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); GstFormat *format, gint64 *value);
static GstElementStateReturn gst_filesrc_change_state (GstElement *element); static GstElementStateReturn gst_filesrc_change_state (GstElement *element);
@ -732,19 +732,19 @@ gst_filesrc_change_state (GstElement *element)
} }
static gboolean static gboolean
gst_filesrc_srcpad_query (GstPad *pad, GstPadQueryType type, gst_filesrc_srcpad_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value) GstFormat *format, gint64 *value)
{ {
GstFileSrc *src = GST_FILESRC (GST_PAD_PARENT (pad)); GstFileSrc *src = GST_FILESRC (GST_PAD_PARENT (pad));
switch (type) { switch (type) {
case GST_PAD_QUERY_TOTAL: case GST_QUERY_TOTAL:
if (*format != GST_FORMAT_BYTES) { if (*format != GST_FORMAT_BYTES) {
return FALSE; return FALSE;
} }
*value = src->filelen; *value = src->filelen;
break; break;
case GST_PAD_QUERY_POSITION: case GST_QUERY_POSITION:
switch (*format) { switch (*format) {
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
*value = src->curoffset; *value = src->curoffset;

View file

@ -59,9 +59,9 @@ main (gint argc, gchar *argv[])
format = GST_FORMAT_DEFAULT; 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); 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_print ("configured segment end %lld\n", value);
@ -82,9 +82,9 @@ main (gint argc, gchar *argv[])
g_signal_connect (G_OBJECT (gst_element_get_pad (fakesink, "sink")), "event_received", G_CALLBACK (event_received), event); 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); 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_print ("configured segment end %lld\n", value);
gst_element_set_state (pipeline, GST_STATE_PLAYING); gst_element_set_state (pipeline, GST_STATE_PLAYING);

View file

@ -199,12 +199,12 @@ print_event_masks (const GstEventMask *masks)
} }
static void static void
print_query_types (const GstPadQueryType *types) print_query_types (const GstQueryType *types)
{ {
GType query_type; GType query_type;
GEnumClass *klass; 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); klass = (GEnumClass *) g_type_class_ref (query_type);
while (types && *types) { while (types && *types) {