gstreamer/docs/design/draft-query.txt
Andy Wingo 8970bda4ba gst/gstquery.h
Original commit message from CVS:
2005-05-06  Andy Wingo  <wingo@pobox.com>

* gst/gstquery.h
* gst/gstquery.c (_gst_query_initialize): Extend GstQuery from
GstData, init a memchunk.
(standard_definitions): Add a few query types, deprecate a few.
(gst_query_get_type): New proc.
(_gst_query_copy, _gst_query_free, gst_query_new): GstData
implementation.
(gst_query_new_application, gst_query_get_structure): New public
procs.

* docs/design/draft-query.txt: Removed LINKS from the query types,
because all the rest can be dispatched to other pads -- seemed
ugly to have a query that couldn't be dispatched. internal_links
is fine as a pad method.

* gst/gstpad.h: Add query2 as a pad method, add the new functions
in gstpad.c, but maintain binary compatibility for the moment.
Will fix before 0.9 is out.

* gst/gstqueryutils.c:
* gst/gstqueryutils.h: New files, implement 3 methods for each
query type: parse_query, parse_response, and set. Probably need an
allocator as well.

* gst/gst.h: Add gstquery.h and gstqueryutils.h to the list.

* gst/elements/gstfilesink.c (gst_filesink_query2):
* gst/base/gstbasesrc.c (gst_basesrc_query2): Replace old query,
query_types, and formats methods.

* gst/gstpad.c (gst_pad_query2, gst_pad_query2_default)
(gst_pad_set_query2_function): New functions.
(gst_real_pad_init): Set query2_default as the default query2
function. Basically just dispatches to internally linked pads.

Needs review!

* gst/gstdata_private.h (_GST_DATA_INIT): Set data->refcount to 1
without using the atomic operations. Only one thread can possibly
be accessing the data at this point. Changed so as to avoid
gst_atomic operations.
2005-05-06 21:41:22 +00:00

90 lines
2.6 KiB
Plaintext

DRAFT Query
-----------
Purpose
Queries are used to get information about the stream.
A query is started on a specific pad and travels up or downstream.
Types of queries
- get length of stream
- get position in stream
- get seeking capabilities
- get latency
- convert one value to another
- query supported formats
- query internal links.
Current implementation
The current implementation of query requires pads to implement the
following functions:
gboolean (*GstPadConvertFunction) (GstPad *pad,
GstFormat src_format, gint64 src_value,
GstFormat *dest_format, gint64 *dest_value);
gboolean (*GstPadQueryFunction) (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value);
GList* (*GstPadIntLinkFunction) (GstPad *pad);
const GstFormat* (*GstPadFormatsFunction) (GstPad *pad);
const GstEventMask* (*GstPadEventMaskFunction) (GstPad *pad);
const GstQueryType* (*GstPadQueryTypeFunction) (GstPad *pad);
Most of these functions are not very extensible in particular,
the queryfunction can only return one value.
Requirements
- multiple return values, grouped together when they make sense.
- one pad function to perform the query
- extensible queries.
Proposition
- define GstQuery extending GstData and containing a GstStructure (see GstMessage)
- define standard query types (see proposed types)
- define methods to create a parse the results in the GstQuery.
- define pad method:
gboolean (*GstPadQueryFunction) (GstPad *pad, GstQuery *query);
pad returns result in query structure and TRUE as result or FALSE when
query is not supported.
Proposed types
- GST_QUERY_SEEKING:
- get info on how seeking can be done
- getrange, with/without offset/size
- ranges where seeking is efficient (for caching network sources)
- flags describing seeking behaviour (forward, backward, segments,
play backwards, ...)
- GST_QUERY_POSITION:
- get info on current position of the stream
- start position
- current position
- end position
- length
- GST_QUERY_LATENCY:
- get amount of buffering
- GST_QUERY_CONVERT:
- convert format/value to another format/value pair.
- GST_QUERY_FORMATS:
- return list of supported formats.
Also????
- GST_QUERY_CAPS: