2003-01-01 03:09:39 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wim.taymans@chello.be>
|
2005-03-07 18:27:42 +00:00
|
|
|
* 2005 Wim Taymans <wim@fluendo.com>
|
2003-01-01 03:09:39 +00:00
|
|
|
*
|
2005-11-10 10:17:01 +00:00
|
|
|
* gstquery.c: GstQueryType registration and Query parsing/creation
|
2003-01-01 03:09:39 +00:00
|
|
|
*
|
|
|
|
* 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
|
2012-11-03 20:44:48 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2003-01-01 03:09:39 +00:00
|
|
|
*/
|
2005-10-15 16:01:57 +00:00
|
|
|
|
2005-08-29 21:41:02 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstquery
|
2012-03-29 11:34:50 +00:00
|
|
|
* @short_description: Provide functions to create queries, and to set and parse
|
|
|
|
* values in them.
|
2005-08-29 21:41:02 +00:00
|
|
|
* @see_also: #GstPad, #GstElement
|
|
|
|
*
|
2010-11-19 13:06:05 +00:00
|
|
|
* Queries can be performed on pads (gst_pad_query()) and elements
|
|
|
|
* (gst_element_query()). Please note that some queries might need a running
|
|
|
|
* pipeline to work.
|
2005-08-29 21:41:02 +00:00
|
|
|
*
|
2009-11-25 16:24:16 +00:00
|
|
|
* Queries can be created using the gst_query_new_*() functions.
|
|
|
|
* Query values can be set using gst_query_set_*(), and parsed using
|
|
|
|
* gst_query_parse_*() helpers.
|
2006-02-14 13:07:10 +00:00
|
|
|
*
|
|
|
|
* The following example shows how to query the duration of a pipeline:
|
2009-11-23 10:34:07 +00:00
|
|
|
*
|
2006-02-14 13:07:10 +00:00
|
|
|
* <example>
|
|
|
|
* <title>Query duration on a pipeline</title>
|
|
|
|
* <programlisting>
|
|
|
|
* GstQuery *query;
|
|
|
|
* gboolean res;
|
|
|
|
* query = gst_query_new_duration (GST_FORMAT_TIME);
|
|
|
|
* res = gst_element_query (pipeline, query);
|
|
|
|
* if (res) {
|
|
|
|
* gint64 duration;
|
|
|
|
* gst_query_parse_duration (query, NULL, &duration);
|
|
|
|
* g_print ("duration = %"GST_TIME_FORMAT, GST_TIME_ARGS (duration));
|
|
|
|
* }
|
|
|
|
* else {
|
|
|
|
* g_print ("duration query failed...");
|
|
|
|
* }
|
|
|
|
* gst_query_unref (query);
|
|
|
|
* </programlisting>
|
|
|
|
* </example>
|
|
|
|
*
|
2012-03-29 11:34:50 +00:00
|
|
|
* Last reviewed on 2012-03-29 (0.11.3)
|
2005-08-29 21:41:02 +00:00
|
|
|
*/
|
2003-01-01 03:09:39 +00:00
|
|
|
|
2012-02-27 12:35:10 +00:00
|
|
|
|
2006-10-02 10:06:17 +00:00
|
|
|
#include "gst_private.h"
|
|
|
|
#include "gstinfo.h"
|
2004-05-07 02:36:28 +00:00
|
|
|
#include "gstquery.h"
|
2005-09-26 15:03:43 +00:00
|
|
|
#include "gstvalue.h"
|
2005-05-09 10:53:13 +00:00
|
|
|
#include "gstenumtypes.h"
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
#include "gstquark.h"
|
2008-12-20 17:33:44 +00:00
|
|
|
#include "gsturi.h"
|
2011-04-28 13:31:48 +00:00
|
|
|
#include "gstbufferpool.h"
|
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
|
|
|
|
2005-05-09 10:53:13 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_query_debug);
|
|
|
|
#define GST_CAT_DEFAULT gst_query_debug
|
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
|
|
|
|
2009-12-04 22:52:32 +00:00
|
|
|
static GType _gst_query_type = 0;
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GstQuery query;
|
|
|
|
|
|
|
|
GstStructure *structure;
|
|
|
|
} GstQueryImpl;
|
|
|
|
|
|
|
|
#define GST_QUERY_STRUCTURE(q) (((GstQueryImpl *)(q))->structure)
|
|
|
|
|
2012-01-25 15:14:17 +00:00
|
|
|
|
2012-03-14 13:51:16 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const gint type;
|
|
|
|
const gchar *name;
|
|
|
|
GQuark quark;
|
|
|
|
} GstQueryQuarks;
|
|
|
|
|
|
|
|
static GstQueryQuarks query_quarks[] = {
|
|
|
|
{GST_QUERY_UNKNOWN, "unknown", 0},
|
|
|
|
{GST_QUERY_POSITION, "position", 0},
|
|
|
|
{GST_QUERY_DURATION, "duration", 0},
|
|
|
|
{GST_QUERY_LATENCY, "latency", 0},
|
|
|
|
{GST_QUERY_JITTER, "jitter", 0},
|
|
|
|
{GST_QUERY_RATE, "rate", 0},
|
|
|
|
{GST_QUERY_SEEKING, "seeking", 0},
|
|
|
|
{GST_QUERY_SEGMENT, "segment", 0},
|
|
|
|
{GST_QUERY_CONVERT, "convert", 0},
|
|
|
|
{GST_QUERY_FORMATS, "formats", 0},
|
|
|
|
{GST_QUERY_BUFFERING, "buffering", 0},
|
|
|
|
{GST_QUERY_CUSTOM, "custom", 0},
|
|
|
|
{GST_QUERY_URI, "uri", 0},
|
|
|
|
{GST_QUERY_ALLOCATION, "allocation", 0},
|
|
|
|
{GST_QUERY_SCHEDULING, "scheduling", 0},
|
|
|
|
{GST_QUERY_ACCEPT_CAPS, "accept-caps", 0},
|
|
|
|
{GST_QUERY_CAPS, "caps", 0},
|
2012-03-14 15:14:12 +00:00
|
|
|
{GST_QUERY_DRAIN, "drain", 0},
|
2013-03-28 14:35:13 +00:00
|
|
|
{GST_QUERY_CONTEXT, "context", 0},
|
2012-03-14 13:51:16 +00:00
|
|
|
|
|
|
|
{0, NULL, 0}
|
2003-01-01 03:09:39 +00:00
|
|
|
};
|
|
|
|
|
2011-08-29 15:06:18 +00:00
|
|
|
GST_DEFINE_MINI_OBJECT_TYPE (GstQuery, gst_query);
|
2011-08-29 13:34:30 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
void
|
2011-08-29 11:27:26 +00:00
|
|
|
_priv_gst_query_initialize (void)
|
2003-01-01 03:09:39 +00:00
|
|
|
{
|
2012-03-14 13:51:16 +00:00
|
|
|
gint i;
|
2003-01-01 03:09:39 +00:00
|
|
|
|
2012-03-14 13:51:16 +00:00
|
|
|
_gst_query_type = gst_query_get_type ();
|
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
|
|
|
|
2005-05-09 10:53:13 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_query_debug, "query", 0, "query system");
|
|
|
|
|
2012-03-14 13:51:16 +00:00
|
|
|
for (i = 0; query_quarks[i].name; i++) {
|
|
|
|
query_quarks[i].quark = g_quark_from_static_string (query_quarks[i].name);
|
2003-01-01 03:09:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-20 14:50:43 +00:00
|
|
|
/**
|
|
|
|
* gst_query_type_get_name:
|
2012-03-14 13:51:16 +00:00
|
|
|
* @type: the query type
|
2005-11-20 14:50:43 +00:00
|
|
|
*
|
|
|
|
* Get a printable name for the given query type. Do not modify or free.
|
|
|
|
*
|
|
|
|
* Returns: a reference to the static name of the query.
|
|
|
|
*/
|
2005-11-19 18:57:00 +00:00
|
|
|
const gchar *
|
2012-03-14 13:51:16 +00:00
|
|
|
gst_query_type_get_name (GstQueryType type)
|
2005-11-19 18:57:00 +00:00
|
|
|
{
|
2012-03-14 13:51:16 +00:00
|
|
|
gint i;
|
2005-11-19 18:57:00 +00:00
|
|
|
|
2012-03-14 13:51:16 +00:00
|
|
|
for (i = 0; query_quarks[i].name; i++) {
|
|
|
|
if (type == query_quarks[i].type)
|
|
|
|
return query_quarks[i].name;
|
|
|
|
}
|
|
|
|
return "unknown";
|
2005-11-19 18:57:00 +00:00
|
|
|
}
|
|
|
|
|
2005-11-20 14:50:43 +00:00
|
|
|
/**
|
|
|
|
* gst_query_type_to_quark:
|
2012-03-14 13:51:16 +00:00
|
|
|
* @type: the query type
|
2005-11-20 14:50:43 +00:00
|
|
|
*
|
|
|
|
* Get the unique quark for the given query type.
|
|
|
|
*
|
|
|
|
* Returns: the quark associated with the query type
|
|
|
|
*/
|
2005-11-19 18:57:00 +00:00
|
|
|
GQuark
|
2012-03-14 13:51:16 +00:00
|
|
|
gst_query_type_to_quark (GstQueryType type)
|
2003-01-01 03:09:39 +00:00
|
|
|
{
|
2012-03-14 13:51:16 +00:00
|
|
|
gint i;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2012-03-14 13:51:16 +00:00
|
|
|
for (i = 0; query_quarks[i].name; i++) {
|
|
|
|
if (type == query_quarks[i].type)
|
|
|
|
return query_quarks[i].quark;
|
2003-01-01 03:09:39 +00:00
|
|
|
}
|
2012-03-14 13:51:16 +00:00
|
|
|
return 0;
|
2003-01-01 03:09:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-03-14 13:51:16 +00:00
|
|
|
* gst_query_type_get_flags:
|
2005-11-09 19:32:32 +00:00
|
|
|
* @type: a #GstQueryType
|
2003-01-01 03:09:39 +00:00
|
|
|
*
|
2012-03-14 13:51:16 +00:00
|
|
|
* Gets the #GstQueryTypeFlags associated with @type.
|
2010-12-07 18:35:04 +00:00
|
|
|
*
|
2012-03-14 13:51:16 +00:00
|
|
|
* Returns: a #GstQueryTypeFlags.
|
2003-01-01 03:09:39 +00:00
|
|
|
*/
|
2012-03-14 13:51:16 +00:00
|
|
|
GstQueryTypeFlags
|
|
|
|
gst_query_type_get_flags (GstQueryType type)
|
2003-01-01 03:09:39 +00:00
|
|
|
{
|
2012-03-14 13:51:16 +00:00
|
|
|
GstQueryTypeFlags ret;
|
2005-03-07 18:27:42 +00:00
|
|
|
|
2012-03-26 15:35:18 +00:00
|
|
|
ret = type & ((1 << GST_QUERY_NUM_SHIFT) - 1);
|
2005-03-07 18:27:42 +00:00
|
|
|
|
2012-03-14 13:51:16 +00:00
|
|
|
return ret;
|
2003-01-01 03:09:39 +00:00
|
|
|
}
|
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
|
|
|
|
2009-12-04 22:52:32 +00:00
|
|
|
static void
|
|
|
|
_gst_query_free (GstQuery * query)
|
|
|
|
{
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *s;
|
|
|
|
|
2009-12-04 22:52:32 +00:00
|
|
|
g_return_if_fail (query != NULL);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
s = GST_QUERY_STRUCTURE (query);
|
|
|
|
if (s) {
|
|
|
|
gst_structure_set_parent_refcount (s, NULL);
|
|
|
|
gst_structure_free (s);
|
2009-12-04 22:52:32 +00:00
|
|
|
}
|
|
|
|
|
2012-06-14 22:54:22 +00:00
|
|
|
g_slice_free1 (sizeof (GstQueryImpl), query);
|
2009-12-04 22:52:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstQuery *
|
|
|
|
_gst_query_copy (GstQuery * query)
|
|
|
|
{
|
|
|
|
GstQuery *copy;
|
2012-03-14 23:24:40 +00:00
|
|
|
GstStructure *s;
|
2009-12-04 22:52:32 +00:00
|
|
|
|
2012-03-14 23:24:40 +00:00
|
|
|
s = GST_QUERY_STRUCTURE (query);
|
|
|
|
if (s) {
|
|
|
|
s = gst_structure_copy (s);
|
|
|
|
}
|
|
|
|
copy = gst_query_new_custom (query->type, s);
|
2009-12-04 22:52:32 +00:00
|
|
|
|
|
|
|
return copy;
|
|
|
|
}
|
|
|
|
|
2005-08-29 21:41:02 +00:00
|
|
|
/**
|
|
|
|
* gst_query_new_position:
|
|
|
|
* @format: the default #GstFormat for the new query
|
|
|
|
*
|
|
|
|
* Constructs a new query stream position query object. Use gst_query_unref()
|
2005-11-10 10:17:01 +00:00
|
|
|
* when done with it. A position query is used to query the current position
|
|
|
|
* of playback in the streams, in some format.
|
2005-08-29 21:41:02 +00:00
|
|
|
*
|
2010-12-07 18:35:04 +00:00
|
|
|
* Free-function: gst_query_unref
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new #GstQuery
|
2005-08-29 21:41:02 +00:00
|
|
|
*/
|
2005-05-09 10:53:13 +00:00
|
|
|
GstQuery *
|
|
|
|
gst_query_new_position (GstFormat format)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2011-10-29 07:02:00 +00:00
|
|
|
structure = gst_structure_new_id (GST_QUARK (QUERY_POSITION),
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
|
2008-04-16 18:48:03 +00:00
|
|
|
GST_QUARK (CURRENT), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
|
2012-02-10 13:58:13 +00:00
|
|
|
query = gst_query_new_custom (GST_QUERY_POSITION, structure);
|
2005-05-09 10:53:13 +00:00
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
2005-08-29 21:41:02 +00:00
|
|
|
/**
|
|
|
|
* gst_query_set_position:
|
2005-11-09 19:32:32 +00:00
|
|
|
* @query: a #GstQuery with query type GST_QUERY_POSITION
|
2005-08-29 21:41:02 +00:00
|
|
|
* @format: the requested #GstFormat
|
2005-11-09 19:32:32 +00:00
|
|
|
* @cur: the position to set
|
2005-08-29 21:41:02 +00:00
|
|
|
*
|
2005-11-09 19:32:32 +00:00
|
|
|
* Answer a position query by setting the requested value in the given format.
|
2005-08-29 21:41:02 +00:00
|
|
|
*/
|
2005-05-09 10:53:13 +00:00
|
|
|
void
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
gst_query_set_position (GstQuery * query, GstFormat format, gint64 cur)
|
2005-05-09 10:53:13 +00:00
|
|
|
{
|
2011-07-26 23:17:02 +00:00
|
|
|
GstStructure *s;
|
2011-05-10 13:33:53 +00:00
|
|
|
|
2005-05-09 10:53:13 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_POSITION);
|
|
|
|
|
2011-07-26 23:17:02 +00:00
|
|
|
s = GST_QUERY_STRUCTURE (query);
|
|
|
|
g_return_if_fail (format == g_value_get_enum (gst_structure_id_get_value (s,
|
|
|
|
GST_QUARK (FORMAT))));
|
|
|
|
|
|
|
|
gst_structure_id_set (s,
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
|
|
|
|
GST_QUARK (CURRENT), G_TYPE_INT64, cur, NULL);
|
2005-05-09 10:53:13 +00:00
|
|
|
}
|
|
|
|
|
2005-08-29 21:41:02 +00:00
|
|
|
/**
|
|
|
|
* gst_query_parse_position:
|
2005-11-09 19:32:32 +00:00
|
|
|
* @query: a #GstQuery
|
2010-12-07 18:35:04 +00:00
|
|
|
* @format: (out) (allow-none): the storage for the #GstFormat of the
|
|
|
|
* position values (may be NULL)
|
|
|
|
* @cur: (out) (allow-none): the storage for the current position (may be NULL)
|
2005-08-29 21:41:02 +00:00
|
|
|
*
|
2005-11-09 19:32:32 +00:00
|
|
|
* Parse a position query, writing the format into @format, and the position
|
|
|
|
* into @cur, if the respective parameters are non-NULL.
|
2005-08-29 21:41:02 +00:00
|
|
|
*/
|
2005-05-09 10:53:13 +00:00
|
|
|
void
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
gst_query_parse_position (GstQuery * query, GstFormat * format, gint64 * cur)
|
2005-05-09 10:53:13 +00:00
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_POSITION);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2005-05-09 10:53:13 +00:00
|
|
|
if (format)
|
2011-08-25 19:18:15 +00:00
|
|
|
*format =
|
|
|
|
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
GST_QUARK (FORMAT)));
|
2005-05-09 10:53:13 +00:00
|
|
|
if (cur)
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
*cur = g_value_get_int64 (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (CURRENT)));
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_new_duration:
|
2005-11-09 19:32:32 +00:00
|
|
|
* @format: the #GstFormat for this duration query
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
*
|
2009-11-23 10:34:07 +00:00
|
|
|
* Constructs a new stream duration query object to query in the given format.
|
2005-11-10 10:17:01 +00:00
|
|
|
* Use gst_query_unref() when done with it. A duration query will give the
|
|
|
|
* total length of the stream.
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
*
|
2010-12-07 18:35:04 +00:00
|
|
|
* Free-function: gst_query_unref
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new #GstQuery
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
*/
|
|
|
|
GstQuery *
|
|
|
|
gst_query_new_duration (GstFormat format)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2011-10-29 07:02:00 +00:00
|
|
|
structure = gst_structure_new_id (GST_QUARK (QUERY_DURATION),
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
|
2008-04-16 18:48:03 +00:00
|
|
|
GST_QUARK (DURATION), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
|
2012-02-10 13:58:13 +00:00
|
|
|
query = gst_query_new_custom (GST_QUERY_DURATION, structure);
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_set_duration:
|
2005-11-09 19:32:32 +00:00
|
|
|
* @query: a #GstQuery
|
|
|
|
* @format: the #GstFormat for the duration
|
|
|
|
* @duration: the duration of the stream
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
*
|
2005-11-09 19:32:32 +00:00
|
|
|
* Answer a duration query by setting the requested value in the given format.
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_set_duration (GstQuery * query, GstFormat format, gint64 duration)
|
|
|
|
{
|
2011-07-26 23:17:02 +00:00
|
|
|
GstStructure *s;
|
2011-05-10 13:33:53 +00:00
|
|
|
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_DURATION);
|
|
|
|
|
2011-07-26 23:17:02 +00:00
|
|
|
s = GST_QUERY_STRUCTURE (query);
|
|
|
|
g_return_if_fail (format == g_value_get_enum (gst_structure_id_get_value (s,
|
|
|
|
GST_QUARK (FORMAT))));
|
|
|
|
gst_structure_id_set (s, GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
GST_QUARK (DURATION), G_TYPE_INT64, duration, NULL);
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_parse_duration:
|
2005-11-09 19:32:32 +00:00
|
|
|
* @query: a #GstQuery
|
2010-12-07 18:35:04 +00:00
|
|
|
* @format: (out) (allow-none): the storage for the #GstFormat of the duration
|
|
|
|
* value, or NULL.
|
|
|
|
* @duration: (out) (allow-none): the storage for the total duration, or NULL.
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
*
|
2005-11-09 19:32:32 +00:00
|
|
|
* Parse a duration query answer. Write the format of the duration into @format,
|
|
|
|
* and the value into @duration, if the respective variables are non-NULL.
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_parse_duration (GstQuery * query, GstFormat * format,
|
|
|
|
gint64 * duration)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_DURATION);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
if (format)
|
2011-08-25 19:18:15 +00:00
|
|
|
*format =
|
|
|
|
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
GST_QUARK (FORMAT)));
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
if (duration)
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
*duration = g_value_get_int64 (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (DURATION)));
|
2005-05-09 10:53:13 +00:00
|
|
|
}
|
|
|
|
|
2007-02-02 11:48:48 +00:00
|
|
|
/**
|
|
|
|
* gst_query_new_latency:
|
|
|
|
*
|
2009-11-23 10:34:07 +00:00
|
|
|
* Constructs a new latency query object.
|
2007-02-02 11:48:48 +00:00
|
|
|
* Use gst_query_unref() when done with it. A latency query is usually performed
|
|
|
|
* by sinks to compensate for additional latency introduced by elements in the
|
|
|
|
* pipeline.
|
|
|
|
*
|
2010-12-07 18:35:04 +00:00
|
|
|
* Free-function: gst_query_unref
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a #GstQuery
|
2007-02-02 11:48:48 +00:00
|
|
|
*/
|
|
|
|
GstQuery *
|
|
|
|
gst_query_new_latency (void)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2011-10-29 07:02:00 +00:00
|
|
|
structure = gst_structure_new_id (GST_QUARK (QUERY_LATENCY),
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
GST_QUARK (LIVE), G_TYPE_BOOLEAN, FALSE,
|
2008-04-16 18:48:03 +00:00
|
|
|
GST_QUARK (MIN_LATENCY), G_TYPE_UINT64, G_GUINT64_CONSTANT (0),
|
|
|
|
GST_QUARK (MAX_LATENCY), G_TYPE_UINT64, G_GUINT64_CONSTANT (-1), NULL);
|
2007-02-02 11:48:48 +00:00
|
|
|
|
2012-02-10 13:58:13 +00:00
|
|
|
query = gst_query_new_custom (GST_QUERY_LATENCY, structure);
|
2007-02-02 11:48:48 +00:00
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_set_latency:
|
|
|
|
* @query: a #GstQuery
|
|
|
|
* @live: if there is a live element upstream
|
2012-01-14 18:16:01 +00:00
|
|
|
* @min_latency: the minimal latency of the upstream elements
|
|
|
|
* @max_latency: the maximal latency of the upstream elements
|
2007-02-02 11:48:48 +00:00
|
|
|
*
|
|
|
|
* Answer a latency query by setting the requested values in the given format.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_set_latency (GstQuery * query, gboolean live,
|
|
|
|
GstClockTime min_latency, GstClockTime max_latency)
|
|
|
|
{
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
2007-02-02 11:48:48 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
gst_structure_id_set (structure,
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
GST_QUARK (LIVE), G_TYPE_BOOLEAN, live,
|
|
|
|
GST_QUARK (MIN_LATENCY), G_TYPE_UINT64, min_latency,
|
|
|
|
GST_QUARK (MAX_LATENCY), G_TYPE_UINT64, max_latency, NULL);
|
2007-02-02 11:48:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_parse_latency:
|
|
|
|
* @query: a #GstQuery
|
2010-12-07 18:35:04 +00:00
|
|
|
* @live: (out) (allow-none): storage for live or NULL
|
|
|
|
* @min_latency: (out) (allow-none): the storage for the min latency or NULL
|
|
|
|
* @max_latency: (out) (allow-none): the storage for the max latency or NULL
|
2007-02-02 11:48:48 +00:00
|
|
|
*
|
2009-11-23 10:34:07 +00:00
|
|
|
* Parse a latency query answer.
|
2007-02-02 11:48:48 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_parse_latency (GstQuery * query, gboolean * live,
|
|
|
|
GstClockTime * min_latency, GstClockTime * max_latency)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2007-02-02 11:48:48 +00:00
|
|
|
if (live)
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
*live =
|
|
|
|
g_value_get_boolean (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (LIVE)));
|
2007-02-02 11:48:48 +00:00
|
|
|
if (min_latency)
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
*min_latency = g_value_get_uint64 (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (MIN_LATENCY)));
|
2007-02-02 11:48:48 +00:00
|
|
|
if (max_latency)
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
*max_latency = g_value_get_uint64 (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (MAX_LATENCY)));
|
2007-02-02 11:48:48 +00:00
|
|
|
}
|
|
|
|
|
2005-09-22 17:40:42 +00:00
|
|
|
/**
|
|
|
|
* gst_query_new_convert:
|
2005-10-20 19:47:07 +00:00
|
|
|
* @src_format: the source #GstFormat for the new query
|
2005-09-22 17:40:42 +00:00
|
|
|
* @value: the value to convert
|
2005-10-20 19:47:07 +00:00
|
|
|
* @dest_format: the target #GstFormat
|
2005-09-22 17:40:42 +00:00
|
|
|
*
|
2005-11-09 19:32:32 +00:00
|
|
|
* Constructs a new convert query object. Use gst_query_unref()
|
2005-11-10 10:17:01 +00:00
|
|
|
* when done with it. A convert query is used to ask for a conversion between
|
|
|
|
* one format and another.
|
2005-09-22 17:40:42 +00:00
|
|
|
*
|
2010-12-07 18:35:04 +00:00
|
|
|
* Free-function: gst_query_unref
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a #GstQuery
|
2005-09-22 17:40:42 +00:00
|
|
|
*/
|
2005-05-09 10:53:13 +00:00
|
|
|
GstQuery *
|
2005-10-20 19:47:07 +00:00
|
|
|
gst_query_new_convert (GstFormat src_format, gint64 value,
|
|
|
|
GstFormat dest_format)
|
2005-05-09 10:53:13 +00:00
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2011-10-29 07:02:00 +00:00
|
|
|
structure = gst_structure_new_id (GST_QUARK (QUERY_CONVERT),
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
GST_QUARK (SRC_FORMAT), GST_TYPE_FORMAT, src_format,
|
|
|
|
GST_QUARK (SRC_VALUE), G_TYPE_INT64, value,
|
|
|
|
GST_QUARK (DEST_FORMAT), GST_TYPE_FORMAT, dest_format,
|
2008-04-16 18:48:03 +00:00
|
|
|
GST_QUARK (DEST_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
|
2012-02-10 13:58:13 +00:00
|
|
|
query = gst_query_new_custom (GST_QUERY_CONVERT, structure);
|
2005-05-09 10:53:13 +00:00
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
2005-09-22 17:40:42 +00:00
|
|
|
/**
|
|
|
|
* gst_query_set_convert:
|
2005-11-09 19:32:32 +00:00
|
|
|
* @query: a #GstQuery
|
2005-09-22 17:40:42 +00:00
|
|
|
* @src_format: the source #GstFormat
|
|
|
|
* @src_value: the source value
|
|
|
|
* @dest_format: the destination #GstFormat
|
|
|
|
* @dest_value: the destination value
|
|
|
|
*
|
|
|
|
* Answer a convert query by setting the requested values.
|
|
|
|
*/
|
2005-05-09 10:53:13 +00:00
|
|
|
void
|
|
|
|
gst_query_set_convert (GstQuery * query, GstFormat src_format, gint64 src_value,
|
|
|
|
GstFormat dest_format, gint64 dest_value)
|
|
|
|
{
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
2005-05-09 10:53:13 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONVERT);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
gst_structure_id_set (structure,
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
GST_QUARK (SRC_FORMAT), GST_TYPE_FORMAT, src_format,
|
|
|
|
GST_QUARK (SRC_VALUE), G_TYPE_INT64, src_value,
|
|
|
|
GST_QUARK (DEST_FORMAT), GST_TYPE_FORMAT, dest_format,
|
2008-04-16 18:48:03 +00:00
|
|
|
GST_QUARK (DEST_VALUE), G_TYPE_INT64, dest_value, NULL);
|
2005-05-09 10:53:13 +00:00
|
|
|
}
|
|
|
|
|
2005-09-22 17:40:42 +00:00
|
|
|
/**
|
|
|
|
* gst_query_parse_convert:
|
2005-11-09 19:32:32 +00:00
|
|
|
* @query: a #GstQuery
|
2010-12-07 18:35:04 +00:00
|
|
|
* @src_format: (out) (allow-none): the storage for the #GstFormat of the
|
|
|
|
* source value, or NULL
|
|
|
|
* @src_value: (out) (allow-none): the storage for the source value, or NULL
|
|
|
|
* @dest_format: (out) (allow-none): the storage for the #GstFormat of the
|
|
|
|
* destination value, or NULL
|
|
|
|
* @dest_value: (out) (allow-none): the storage for the destination value,
|
|
|
|
* or NULL
|
2005-11-09 19:32:32 +00:00
|
|
|
*
|
|
|
|
* Parse a convert query answer. Any of @src_format, @src_value, @dest_format,
|
|
|
|
* and @dest_value may be NULL, in which case that value is omitted.
|
2005-09-22 17:40:42 +00:00
|
|
|
*/
|
2005-05-09 10:53:13 +00:00
|
|
|
void
|
|
|
|
gst_query_parse_convert (GstQuery * query, GstFormat * src_format,
|
|
|
|
gint64 * src_value, GstFormat * dest_format, gint64 * dest_value)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONVERT);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2005-05-09 10:53:13 +00:00
|
|
|
if (src_format)
|
2011-08-25 19:18:15 +00:00
|
|
|
*src_format =
|
|
|
|
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
GST_QUARK (SRC_FORMAT)));
|
2005-05-09 10:53:13 +00:00
|
|
|
if (src_value)
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
*src_value = g_value_get_int64 (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (SRC_VALUE)));
|
2005-05-09 10:53:13 +00:00
|
|
|
if (dest_format)
|
2011-08-25 19:18:15 +00:00
|
|
|
*dest_format =
|
|
|
|
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
GST_QUARK (DEST_FORMAT)));
|
2005-05-09 10:53:13 +00:00
|
|
|
if (dest_value)
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
*dest_value = g_value_get_int64 (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (DEST_VALUE)));
|
2005-05-09 10:53:13 +00:00
|
|
|
}
|
|
|
|
|
2005-09-22 17:40:42 +00:00
|
|
|
/**
|
|
|
|
* gst_query_new_segment:
|
|
|
|
* @format: the #GstFormat for the new query
|
|
|
|
*
|
2005-11-09 19:32:32 +00:00
|
|
|
* Constructs a new segment query object. Use gst_query_unref()
|
2005-11-10 10:17:01 +00:00
|
|
|
* when done with it. A segment query is used to discover information about the
|
|
|
|
* currently configured segment for playback.
|
2005-09-22 17:40:42 +00:00
|
|
|
*
|
2010-12-07 18:35:04 +00:00
|
|
|
* Free-function: gst_query_unref
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new #GstQuery
|
2005-09-22 17:40:42 +00:00
|
|
|
*/
|
|
|
|
GstQuery *
|
|
|
|
gst_query_new_segment (GstFormat format)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2011-10-29 07:02:00 +00:00
|
|
|
structure = gst_structure_new_id (GST_QUARK (QUERY_SEGMENT),
|
2006-08-28 08:44:29 +00:00
|
|
|
GST_QUARK (RATE), G_TYPE_DOUBLE, (gdouble) 0.0,
|
|
|
|
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
|
2008-04-16 18:48:03 +00:00
|
|
|
GST_QUARK (START_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1),
|
|
|
|
GST_QUARK (STOP_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
|
2012-02-10 13:58:13 +00:00
|
|
|
query = gst_query_new_custom (GST_QUERY_SEGMENT, structure);
|
2005-05-09 10:53:13 +00:00
|
|
|
|
2005-09-22 17:40:42 +00:00
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_set_segment:
|
2005-11-09 19:32:32 +00:00
|
|
|
* @query: a #GstQuery
|
2005-09-22 17:40:42 +00:00
|
|
|
* @rate: the rate of the segment
|
2005-11-09 19:32:32 +00:00
|
|
|
* @format: the #GstFormat of the segment values (@start_value and @stop_value)
|
2005-09-22 17:40:42 +00:00
|
|
|
* @start_value: the start value
|
|
|
|
* @stop_value: the stop value
|
|
|
|
*
|
2006-05-08 17:12:08 +00:00
|
|
|
* Answer a segment query by setting the requested values. The normal
|
|
|
|
* playback segment of a pipeline is 0 to duration at the default rate of
|
|
|
|
* 1.0. If a seek was performed on the pipeline to play a different
|
|
|
|
* segment, this query will return the range specified in the last seek.
|
|
|
|
*
|
2009-11-23 10:34:07 +00:00
|
|
|
* @start_value and @stop_value will respectively contain the configured
|
|
|
|
* playback range start and stop values expressed in @format.
|
|
|
|
* The values are always between 0 and the duration of the media and
|
2006-05-08 17:12:08 +00:00
|
|
|
* @start_value <= @stop_value. @rate will contain the playback rate. For
|
|
|
|
* negative rates, playback will actually happen from @stop_value to
|
|
|
|
* @start_value.
|
2005-09-22 17:40:42 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_set_segment (GstQuery * query, gdouble rate, GstFormat format,
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
gint64 start_value, gint64 stop_value)
|
2005-09-22 17:40:42 +00:00
|
|
|
{
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
2005-09-22 17:40:42 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEGMENT);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
gst_structure_id_set (structure,
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
GST_QUARK (RATE), G_TYPE_DOUBLE, rate,
|
|
|
|
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
|
|
|
|
GST_QUARK (START_VALUE), G_TYPE_INT64, start_value,
|
|
|
|
GST_QUARK (STOP_VALUE), G_TYPE_INT64, stop_value, NULL);
|
2005-09-22 17:40:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_parse_segment:
|
2005-11-09 19:32:32 +00:00
|
|
|
* @query: a #GstQuery
|
2010-12-07 18:35:04 +00:00
|
|
|
* @rate: (out) (allow-none): the storage for the rate of the segment, or NULL
|
|
|
|
* @format: (out) (allow-none): the storage for the #GstFormat of the values,
|
|
|
|
* or NULL
|
|
|
|
* @start_value: (out) (allow-none): the storage for the start value, or NULL
|
|
|
|
* @stop_value: (out) (allow-none): the storage for the stop value, or NULL
|
2005-11-09 19:32:32 +00:00
|
|
|
*
|
2009-11-23 10:34:07 +00:00
|
|
|
* Parse a segment query answer. Any of @rate, @format, @start_value, and
|
2005-11-09 19:32:32 +00:00
|
|
|
* @stop_value may be NULL, which will cause this value to be omitted.
|
2006-05-08 17:12:08 +00:00
|
|
|
*
|
|
|
|
* See gst_query_set_segment() for an explanation of the function arguments.
|
2005-09-22 17:40:42 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_parse_segment (GstQuery * query, gdouble * rate, GstFormat * format,
|
gst/: API change fix.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_query), (do_playing):
* gst/base/gstbasesrc.c: (gst_base_src_query):
* gst/elements/gstfilesink.c: (gst_file_sink_query):
* gst/elements/gsttypefindelement.c:
(gst_type_find_handle_src_query), (find_element_get_length),
(gst_type_find_element_activate):
API change fix.
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_set_segment),
(gst_query_parse_segment):
* gst/gstquery.h:
Bundling query position/duration is not a good idea since duration
does not change much and we don't want to recalculate it for every
position query, so they are separated again..
Base value in segment query is not needed.
* gst/gstqueue.c: (gst_queue_handle_src_query):
* gst/gstutils.c: (gst_element_query_position),
(gst_element_query_duration), (gst_pad_query_position),
(gst_pad_query_duration):
* gst/gstutils.h:
Updates for query API change.
Added some docs here and there.
2005-10-19 15:50:10 +00:00
|
|
|
gint64 * start_value, gint64 * stop_value)
|
2005-09-22 17:40:42 +00:00
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEGMENT);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2005-09-22 17:40:42 +00:00
|
|
|
if (rate)
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
*rate = g_value_get_double (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (RATE)));
|
2005-09-22 17:40:42 +00:00
|
|
|
if (format)
|
2011-08-25 19:18:15 +00:00
|
|
|
*format =
|
|
|
|
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
GST_QUARK (FORMAT)));
|
2005-09-22 17:40:42 +00:00
|
|
|
if (start_value)
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
*start_value = g_value_get_int64 (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (START_VALUE)));
|
2005-09-22 17:40:42 +00:00
|
|
|
if (stop_value)
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
*stop_value = g_value_get_int64 (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (STOP_VALUE)));
|
2005-09-22 17:40:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-05-10 13:33:53 +00:00
|
|
|
* gst_query_new_custom:
|
2005-09-22 17:40:42 +00:00
|
|
|
* @type: the query type
|
|
|
|
* @structure: a structure for the query
|
|
|
|
*
|
2011-05-10 13:33:53 +00:00
|
|
|
* Constructs a new custom query object. Use gst_query_unref()
|
2005-09-22 17:40:42 +00:00
|
|
|
* when done with it.
|
|
|
|
*
|
2010-12-07 18:35:04 +00:00
|
|
|
* Free-function: gst_query_unref
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new #GstQuery
|
2005-09-22 17:40:42 +00:00
|
|
|
*/
|
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
|
|
|
GstQuery *
|
2011-05-10 13:33:53 +00:00
|
|
|
gst_query_new_custom (GstQueryType type, GstStructure * structure)
|
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
|
|
|
{
|
2012-02-10 13:58:13 +00:00
|
|
|
GstQueryImpl *query;
|
|
|
|
|
|
|
|
query = g_slice_new0 (GstQueryImpl);
|
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
|
|
|
|
2012-02-10 13:58:13 +00:00
|
|
|
GST_DEBUG ("creating new query %p %s", query, gst_query_type_get_name (type));
|
|
|
|
|
|
|
|
if (structure) {
|
|
|
|
/* structure must not have a parent */
|
|
|
|
if (!gst_structure_set_parent_refcount (structure,
|
|
|
|
&query->query.mini_object.refcount))
|
|
|
|
goto had_parent;
|
|
|
|
}
|
|
|
|
|
2012-07-04 14:38:15 +00:00
|
|
|
gst_mini_object_init (GST_MINI_OBJECT_CAST (query), 0, _gst_query_type,
|
2012-06-23 18:56:12 +00:00
|
|
|
(GstMiniObjectCopyFunction) _gst_query_copy, NULL,
|
|
|
|
(GstMiniObjectFreeFunction) _gst_query_free);
|
|
|
|
|
|
|
|
GST_QUERY_TYPE (query) = type;
|
2012-02-10 13:58:13 +00:00
|
|
|
GST_QUERY_STRUCTURE (query) = structure;
|
|
|
|
|
|
|
|
return GST_QUERY_CAST (query);
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
had_parent:
|
|
|
|
{
|
2012-06-14 22:54:22 +00:00
|
|
|
g_slice_free1 (sizeof (GstQueryImpl), query);
|
2012-02-10 13:58:13 +00:00
|
|
|
g_warning ("structure is already owned by another object");
|
|
|
|
return NULL;
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2005-09-22 17:40:42 +00:00
|
|
|
/**
|
|
|
|
* gst_query_get_structure:
|
2005-11-09 19:32:32 +00:00
|
|
|
* @query: a #GstQuery
|
2005-09-22 17:40:42 +00:00
|
|
|
*
|
|
|
|
* Get the structure of a query.
|
|
|
|
*
|
2010-12-07 18:35:04 +00:00
|
|
|
* Returns: (transfer none): the #GstStructure of the query. The structure is
|
|
|
|
* still owned by the query and will therefore be freed when the query
|
|
|
|
* is unreffed.
|
2005-09-22 17:40:42 +00:00
|
|
|
*/
|
2011-05-10 13:33:53 +00:00
|
|
|
const GstStructure *
|
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
|
|
|
gst_query_get_structure (GstQuery * query)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GST_IS_QUERY (query), NULL);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
return GST_QUERY_STRUCTURE (query);
|
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
|
|
|
}
|
2005-09-26 15:03:43 +00:00
|
|
|
|
2011-05-10 13:41:54 +00:00
|
|
|
/**
|
|
|
|
* gst_query_writable_structure:
|
|
|
|
* @query: a #GstQuery
|
|
|
|
*
|
2012-03-12 10:38:37 +00:00
|
|
|
* Get the structure of a query. This method should be called with a writable
|
|
|
|
* @query so that the returned structure is guranteed to be writable.
|
2011-05-10 13:41:54 +00:00
|
|
|
*
|
|
|
|
* Returns: (transfer none): the #GstStructure of the query. The structure is
|
|
|
|
* still owned by the query and will therefore be freed when the query
|
|
|
|
* is unreffed.
|
|
|
|
*/
|
|
|
|
GstStructure *
|
|
|
|
gst_query_writable_structure (GstQuery * query)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GST_IS_QUERY (query), NULL);
|
|
|
|
g_return_val_if_fail (gst_query_is_writable (query), NULL);
|
|
|
|
|
|
|
|
return GST_QUERY_STRUCTURE (query);
|
|
|
|
}
|
|
|
|
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
/**
|
2009-05-22 09:24:22 +00:00
|
|
|
* gst_query_new_seeking:
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
* @format: the default #GstFormat for the new query
|
|
|
|
*
|
|
|
|
* Constructs a new query object for querying seeking properties of
|
2009-11-23 10:34:07 +00:00
|
|
|
* the stream.
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
*
|
2010-12-07 18:35:04 +00:00
|
|
|
* Free-function: gst_query_unref
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new #GstQuery
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
*/
|
|
|
|
GstQuery *
|
|
|
|
gst_query_new_seeking (GstFormat format)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2011-10-29 07:02:00 +00:00
|
|
|
structure = gst_structure_new_id (GST_QUARK (QUERY_SEEKING),
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
|
|
|
|
GST_QUARK (SEEKABLE), G_TYPE_BOOLEAN, FALSE,
|
2008-04-16 18:48:03 +00:00
|
|
|
GST_QUARK (SEGMENT_START), G_TYPE_INT64, G_GINT64_CONSTANT (-1),
|
|
|
|
GST_QUARK (SEGMENT_END), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
|
2012-02-10 13:58:13 +00:00
|
|
|
query = gst_query_new_custom (GST_QUERY_SEEKING, structure);
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
2005-10-20 20:25:55 +00:00
|
|
|
/**
|
|
|
|
* gst_query_set_seeking:
|
2005-11-09 19:32:32 +00:00
|
|
|
* @query: a #GstQuery
|
|
|
|
* @format: the format to set for the @segment_start and @segment_end values
|
2005-10-20 20:25:55 +00:00
|
|
|
* @seekable: the seekable flag to set
|
|
|
|
* @segment_start: the segment_start to set
|
|
|
|
* @segment_end: the segment_end to set
|
|
|
|
*
|
|
|
|
* Set the seeking query result fields in @query.
|
|
|
|
*/
|
2005-09-26 15:03:43 +00:00
|
|
|
void
|
|
|
|
gst_query_set_seeking (GstQuery * query, GstFormat format,
|
|
|
|
gboolean seekable, gint64 segment_start, gint64 segment_end)
|
|
|
|
{
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
2005-09-26 15:03:43 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEEKING);
|
2011-05-10 13:41:54 +00:00
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
2005-09-26 15:03:43 +00:00
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
gst_structure_id_set (structure,
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
|
|
|
|
GST_QUARK (SEEKABLE), G_TYPE_BOOLEAN, seekable,
|
|
|
|
GST_QUARK (SEGMENT_START), G_TYPE_INT64, segment_start,
|
|
|
|
GST_QUARK (SEGMENT_END), G_TYPE_INT64, segment_end, NULL);
|
2005-09-26 15:03:43 +00:00
|
|
|
}
|
|
|
|
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
/**
|
|
|
|
* gst_query_parse_seeking:
|
|
|
|
* @query: a GST_QUERY_SEEKING type query #GstQuery
|
2010-12-07 18:35:04 +00:00
|
|
|
* @format: (out) (allow-none): the format to set for the @segment_start
|
|
|
|
* and @segment_end values, or NULL
|
|
|
|
* @seekable: (out) (allow-none): the seekable flag to set, or NULL
|
|
|
|
* @segment_start: (out) (allow-none): the segment_start to set, or NULL
|
|
|
|
* @segment_end: (out) (allow-none): the segment_end to set, or NULL
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
*
|
2009-11-23 10:34:07 +00:00
|
|
|
* Parse a seeking query, writing the format into @format, and
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
* other results into the passed parameters, if the respective parameters
|
|
|
|
* are non-NULL
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_parse_seeking (GstQuery * query, GstFormat * format,
|
|
|
|
gboolean * seekable, gint64 * segment_start, gint64 * segment_end)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEEKING);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
if (format)
|
2011-08-25 19:18:15 +00:00
|
|
|
*format =
|
|
|
|
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
GST_QUARK (FORMAT)));
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
if (seekable)
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
*seekable = g_value_get_boolean (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (SEEKABLE)));
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
if (segment_start)
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
*segment_start = g_value_get_int64 (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (SEGMENT_START)));
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
if (segment_end)
|
Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of lo...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c: (init_post):
* gst/gst_private.h:
* gst/gstquark.c: (_priv_gst_quarks_initialize):
* gst/gstquark.h:
* gst/gstquery.c: (gst_query_new_position),
(gst_query_set_position), (gst_query_parse_position),
(gst_query_new_duration), (gst_query_set_duration),
(gst_query_parse_duration), (gst_query_new_convert),
(gst_query_set_convert), (gst_query_parse_convert),
(gst_query_new_segment), (gst_query_set_segment),
(gst_query_parse_segment), (gst_query_new_seeking),
(gst_query_set_seeking), (gst_query_parse_seeking):
Add internal helpers for pre-registering quarks from static strings
and using the quark values directly instead of looking them up when
creating and parsing queries. Can be used for event construction too.
Closes #350432.
2006-08-16 11:47:54 +00:00
|
|
|
*segment_end = g_value_get_int64 (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (SEGMENT_END)));
|
check/: Add tests for fdsrc seekability
Original commit message from CVS:
* check/Makefile.am:
* check/elements/fdsrc.c: (event_func), (setup_fdsrc),
(cleanup_fdsrc), (GST_START_TEST), (fdsrc_suite), (main):
Add tests for fdsrc seekability
* gst/elements/gstfdsrc.c: (gst_fdsrc_class_init),
(gst_fdsrc_init), (gst_fdsrc_update_fd), (gst_fdsrc_start),
(gst_fdsrc_set_property), (gst_fdsrc_is_seekable),
(gst_fdsrc_get_size), (gst_fdsrc_uri_set_uri):
* gst/elements/gstfdsrc.h:
fdsrc should not be a 'live' source.
Implement seeking on seekable fd's.
* gst/gstquery.c: (gst_query_new_seeking),
(gst_query_parse_seeking):
* gst/gstquery.h:
Implement SEEKING query functions:
*_new_seeking and *_parse_seeking
2005-11-27 22:50:09 +00:00
|
|
|
}
|
|
|
|
|
2012-01-25 15:14:17 +00:00
|
|
|
static GArray *
|
2012-01-30 14:59:02 +00:00
|
|
|
ensure_array (GstStructure * s, GQuark quark, gsize element_size,
|
|
|
|
GDestroyNotify clear_func)
|
2011-11-18 16:27:16 +00:00
|
|
|
{
|
2012-01-25 15:14:17 +00:00
|
|
|
GArray *array;
|
2011-11-18 16:27:16 +00:00
|
|
|
const GValue *value;
|
|
|
|
|
|
|
|
value = gst_structure_id_get_value (s, quark);
|
|
|
|
if (value) {
|
2012-01-25 15:14:17 +00:00
|
|
|
array = (GArray *) g_value_get_boxed (value);
|
2011-11-18 16:27:16 +00:00
|
|
|
} else {
|
|
|
|
GValue new_array_val = { 0, };
|
|
|
|
|
2012-01-25 15:14:17 +00:00
|
|
|
array = g_array_new (FALSE, TRUE, element_size);
|
2012-01-30 14:59:02 +00:00
|
|
|
if (clear_func)
|
|
|
|
g_array_set_clear_func (array, clear_func);
|
2011-11-18 16:27:16 +00:00
|
|
|
|
2012-01-25 15:14:17 +00:00
|
|
|
g_value_init (&new_array_val, G_TYPE_ARRAY);
|
2011-11-18 16:27:16 +00:00
|
|
|
g_value_take_boxed (&new_array_val, array);
|
|
|
|
|
|
|
|
gst_structure_id_take_value (s, quark, &new_array_val);
|
|
|
|
}
|
|
|
|
return array;
|
|
|
|
}
|
|
|
|
|
2006-02-14 12:07:16 +00:00
|
|
|
/**
|
|
|
|
* gst_query_new_formats:
|
|
|
|
*
|
|
|
|
* Constructs a new query object for querying formats of
|
2009-11-23 10:34:07 +00:00
|
|
|
* the stream.
|
2006-02-14 12:07:16 +00:00
|
|
|
*
|
2010-12-07 18:35:04 +00:00
|
|
|
* Free-function: gst_query_unref
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new #GstQuery
|
2006-02-14 12:07:16 +00:00
|
|
|
*/
|
|
|
|
GstQuery *
|
|
|
|
gst_query_new_formats (void)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2011-10-29 07:02:00 +00:00
|
|
|
structure = gst_structure_new_id_empty (GST_QUARK (QUERY_FORMATS));
|
2012-02-10 13:58:13 +00:00
|
|
|
query = gst_query_new_custom (GST_QUERY_FORMATS, structure);
|
2006-02-14 12:07:16 +00:00
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_query_list_add_format (GValue * list, GstFormat format)
|
|
|
|
{
|
|
|
|
GValue item = { 0, };
|
|
|
|
|
|
|
|
g_value_init (&item, GST_TYPE_FORMAT);
|
|
|
|
g_value_set_enum (&item, format);
|
|
|
|
gst_value_list_append_value (list, &item);
|
|
|
|
g_value_unset (&item);
|
|
|
|
}
|
|
|
|
|
2005-10-20 20:25:55 +00:00
|
|
|
/**
|
|
|
|
* gst_query_set_formats:
|
2005-11-09 19:32:32 +00:00
|
|
|
* @query: a #GstQuery
|
|
|
|
* @n_formats: the number of formats to set.
|
|
|
|
* @...: A number of @GstFormats equal to @n_formats.
|
2005-10-20 20:25:55 +00:00
|
|
|
*
|
2005-11-09 19:32:32 +00:00
|
|
|
* Set the formats query result fields in @query. The number of formats passed
|
|
|
|
* must be equal to @n_formats.
|
2005-10-20 20:25:55 +00:00
|
|
|
*/
|
2005-09-26 15:03:43 +00:00
|
|
|
void
|
|
|
|
gst_query_set_formats (GstQuery * query, gint n_formats, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
GValue list = { 0, };
|
|
|
|
gint i;
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
2005-09-26 15:03:43 +00:00
|
|
|
|
2006-02-14 12:07:16 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
|
2011-05-10 13:41:54 +00:00
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
2006-02-14 12:07:16 +00:00
|
|
|
|
2005-09-26 15:03:43 +00:00
|
|
|
g_value_init (&list, GST_TYPE_LIST);
|
|
|
|
|
|
|
|
va_start (ap, n_formats);
|
|
|
|
for (i = 0; i < n_formats; i++) {
|
2006-02-14 12:07:16 +00:00
|
|
|
gst_query_list_add_format (&list, va_arg (ap, GstFormat));
|
2005-09-26 15:03:43 +00:00
|
|
|
}
|
|
|
|
va_end (ap);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
gst_structure_set_value (structure, "formats", &list);
|
2006-04-05 13:18:29 +00:00
|
|
|
|
|
|
|
g_value_unset (&list);
|
|
|
|
|
2005-09-26 15:03:43 +00:00
|
|
|
}
|
2006-02-14 12:07:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_set_formatsv:
|
|
|
|
* @query: a #GstQuery
|
|
|
|
* @n_formats: the number of formats to set.
|
2010-12-07 18:35:04 +00:00
|
|
|
* @formats: (in) (array length=n_formats): an array containing @n_formats
|
|
|
|
* @GstFormat values.
|
2006-02-14 12:07:16 +00:00
|
|
|
*
|
|
|
|
* Set the formats query result fields in @query. The number of formats passed
|
|
|
|
* in the @formats array must be equal to @n_formats.
|
|
|
|
*/
|
|
|
|
void
|
2011-04-19 10:48:05 +00:00
|
|
|
gst_query_set_formatsv (GstQuery * query, gint n_formats,
|
|
|
|
const GstFormat * formats)
|
2006-02-14 12:07:16 +00:00
|
|
|
{
|
|
|
|
GValue list = { 0, };
|
|
|
|
gint i;
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
2006-02-14 12:07:16 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
|
2011-05-10 13:41:54 +00:00
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
2006-02-14 12:07:16 +00:00
|
|
|
|
|
|
|
g_value_init (&list, GST_TYPE_LIST);
|
|
|
|
for (i = 0; i < n_formats; i++) {
|
|
|
|
gst_query_list_add_format (&list, formats[i]);
|
|
|
|
}
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
gst_structure_set_value (structure, "formats", &list);
|
2006-04-05 13:18:29 +00:00
|
|
|
|
|
|
|
g_value_unset (&list);
|
2006-02-14 12:07:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-05-10 13:33:53 +00:00
|
|
|
* gst_query_parse_n_formats:
|
2006-02-14 12:07:16 +00:00
|
|
|
* @query: a #GstQuery
|
2012-01-30 14:59:02 +00:00
|
|
|
* @n_formats: (out) (allow-none): the number of formats in this query.
|
2006-02-14 12:07:16 +00:00
|
|
|
*
|
2009-11-23 10:34:07 +00:00
|
|
|
* Parse the number of formats in the formats @query.
|
2006-02-14 12:07:16 +00:00
|
|
|
*/
|
|
|
|
void
|
2011-05-10 13:33:53 +00:00
|
|
|
gst_query_parse_n_formats (GstQuery * query, guint * n_formats)
|
2006-02-14 12:07:16 +00:00
|
|
|
{
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
2006-02-14 12:07:16 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
|
|
|
|
|
|
|
|
if (n_formats) {
|
|
|
|
const GValue *list;
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
list = gst_structure_get_value (structure, "formats");
|
2006-02-14 12:07:16 +00:00
|
|
|
if (list == NULL)
|
|
|
|
*n_formats = 0;
|
|
|
|
else
|
|
|
|
*n_formats = gst_value_list_get_size (list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-05-10 13:33:53 +00:00
|
|
|
* gst_query_parse_nth_format:
|
2006-02-14 12:07:16 +00:00
|
|
|
* @query: a #GstQuery
|
2010-06-16 16:10:06 +00:00
|
|
|
* @nth: (out): the nth format to retrieve.
|
2012-01-30 14:59:02 +00:00
|
|
|
* @format: (out) (allow-none): a pointer to store the nth format
|
2006-02-14 12:07:16 +00:00
|
|
|
*
|
2009-11-23 10:34:07 +00:00
|
|
|
* Parse the format query and retrieve the @nth format from it into
|
2006-02-14 12:07:16 +00:00
|
|
|
* @format. If the list contains less elements than @nth, @format will be
|
|
|
|
* set to GST_FORMAT_UNDEFINED.
|
|
|
|
*/
|
|
|
|
void
|
2011-05-10 13:33:53 +00:00
|
|
|
gst_query_parse_nth_format (GstQuery * query, guint nth, GstFormat * format)
|
2006-02-14 12:07:16 +00:00
|
|
|
{
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
2006-02-14 12:07:16 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
|
|
|
|
|
|
|
|
if (format) {
|
|
|
|
const GValue *list;
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
list = gst_structure_get_value (structure, "formats");
|
2006-02-14 12:07:16 +00:00
|
|
|
if (list == NULL) {
|
|
|
|
*format = GST_FORMAT_UNDEFINED;
|
|
|
|
} else {
|
|
|
|
if (nth < gst_value_list_get_size (list)) {
|
2011-08-25 19:18:15 +00:00
|
|
|
*format =
|
|
|
|
(GstFormat) g_value_get_enum (gst_value_list_get_value (list, nth));
|
2006-02-14 12:07:16 +00:00
|
|
|
} else
|
|
|
|
*format = GST_FORMAT_UNDEFINED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
|
|
|
|
/**
|
2011-12-01 18:05:59 +00:00
|
|
|
* gst_query_new_buffering:
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
* @format: the default #GstFormat for the new query
|
|
|
|
*
|
|
|
|
* Constructs a new query object for querying the buffering status of
|
|
|
|
* a stream.
|
|
|
|
*
|
2011-04-28 14:20:22 +00:00
|
|
|
* Free-function: gst_query_unref
|
2010-12-07 18:35:04 +00:00
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new #GstQuery
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
*/
|
|
|
|
GstQuery *
|
|
|
|
gst_query_new_buffering (GstFormat format)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2008-04-08 20:17:49 +00:00
|
|
|
/* by default, we configure the answer as no buffering with a 100% buffering
|
|
|
|
* progress */
|
2011-10-29 07:02:00 +00:00
|
|
|
structure = gst_structure_new_id (GST_QUARK (QUERY_BUFFERING),
|
2008-04-08 20:17:49 +00:00
|
|
|
GST_QUARK (BUSY), G_TYPE_BOOLEAN, FALSE,
|
|
|
|
GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, 100,
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, GST_BUFFERING_STREAM,
|
|
|
|
GST_QUARK (AVG_IN_RATE), G_TYPE_INT, -1,
|
|
|
|
GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, -1,
|
2008-04-16 18:48:03 +00:00
|
|
|
GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, G_GINT64_CONSTANT (0),
|
|
|
|
GST_QUARK (ESTIMATED_TOTAL), G_TYPE_INT64, G_GINT64_CONSTANT (-1),
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
|
2008-04-16 18:48:03 +00:00
|
|
|
GST_QUARK (START_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1),
|
|
|
|
GST_QUARK (STOP_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
|
2012-02-10 13:58:13 +00:00
|
|
|
query = gst_query_new_custom (GST_QUERY_BUFFERING, structure);
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-12-01 18:05:59 +00:00
|
|
|
* gst_query_set_buffering_percent:
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
* @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
|
2008-04-08 20:17:49 +00:00
|
|
|
* @busy: if buffering is busy
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
* @percent: a buffering percent
|
|
|
|
*
|
|
|
|
* Set the percentage of buffered data. This is a value between 0 and 100.
|
2008-04-08 20:17:49 +00:00
|
|
|
* The @busy indicator is %TRUE when the buffering is in progress.
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
*/
|
|
|
|
void
|
2008-04-08 20:17:49 +00:00
|
|
|
gst_query_set_buffering_percent (GstQuery * query, gboolean busy, gint percent)
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
{
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
|
2011-05-10 13:41:54 +00:00
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
g_return_if_fail (percent >= 0 && percent <= 100);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
gst_structure_id_set (structure,
|
2008-04-08 20:17:49 +00:00
|
|
|
GST_QUARK (BUSY), G_TYPE_BOOLEAN, busy,
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, percent, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-12-01 18:05:59 +00:00
|
|
|
* gst_query_parse_buffering_percent:
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
* @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
|
2010-12-07 18:35:04 +00:00
|
|
|
* @busy: (out) (allow-none): if buffering is busy, or NULL
|
|
|
|
* @percent: (out) (allow-none): a buffering percent, or NULL
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
*
|
|
|
|
* Get the percentage of buffered data. This is a value between 0 and 100.
|
2008-04-08 20:17:49 +00:00
|
|
|
* The @busy indicator is %TRUE when the buffering is in progress.
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
*/
|
|
|
|
void
|
2008-04-08 20:17:49 +00:00
|
|
|
gst_query_parse_buffering_percent (GstQuery * query, gboolean * busy,
|
|
|
|
gint * percent)
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
{
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2008-04-08 20:17:49 +00:00
|
|
|
if (busy)
|
2011-05-10 13:33:53 +00:00
|
|
|
*busy = g_value_get_boolean (gst_structure_id_get_value (structure,
|
2008-04-08 20:17:49 +00:00
|
|
|
GST_QUARK (BUSY)));
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
if (percent)
|
2011-05-10 13:33:53 +00:00
|
|
|
*percent = g_value_get_int (gst_structure_id_get_value (structure,
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
GST_QUARK (BUFFER_PERCENT)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_set_buffering_stats:
|
|
|
|
* @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
|
2009-11-23 10:34:07 +00:00
|
|
|
* @mode: a buffering mode
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
* @avg_in: the average input rate
|
|
|
|
* @avg_out: the average output rate
|
2012-10-11 15:09:29 +00:00
|
|
|
* @buffering_left: amount of buffering time left in milliseconds
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
*
|
|
|
|
* Configures the buffering stats values in @query.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_set_buffering_stats (GstQuery * query, GstBufferingMode mode,
|
|
|
|
gint avg_in, gint avg_out, gint64 buffering_left)
|
|
|
|
{
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
|
2011-05-10 13:41:54 +00:00
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
gst_structure_id_set (structure,
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, mode,
|
|
|
|
GST_QUARK (AVG_IN_RATE), G_TYPE_INT, avg_in,
|
|
|
|
GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, avg_out,
|
|
|
|
GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, buffering_left, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_parse_buffering_stats:
|
|
|
|
* @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
|
2010-12-07 18:35:04 +00:00
|
|
|
* @mode: (out) (allow-none): a buffering mode, or NULL
|
|
|
|
* @avg_in: (out) (allow-none): the average input rate, or NULL
|
|
|
|
* @avg_out: (out) (allow-none): the average output rat, or NULLe
|
2012-10-11 15:09:29 +00:00
|
|
|
* @buffering_left: (out) (allow-none): amount of buffering time left in
|
|
|
|
* milliseconds, or NULL
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
*
|
|
|
|
* Extracts the buffering stats values from @query.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_parse_buffering_stats (GstQuery * query,
|
|
|
|
GstBufferingMode * mode, gint * avg_in, gint * avg_out,
|
|
|
|
gint64 * buffering_left)
|
|
|
|
{
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
if (mode)
|
2011-08-25 19:18:15 +00:00
|
|
|
*mode = (GstBufferingMode)
|
2011-08-26 12:37:54 +00:00
|
|
|
g_value_get_enum (gst_structure_id_get_value (structure,
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
GST_QUARK (BUFFERING_MODE)));
|
|
|
|
if (avg_in)
|
2011-05-10 13:33:53 +00:00
|
|
|
*avg_in = g_value_get_int (gst_structure_id_get_value (structure,
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
GST_QUARK (AVG_IN_RATE)));
|
|
|
|
if (avg_out)
|
2011-05-10 13:33:53 +00:00
|
|
|
*avg_out = g_value_get_int (gst_structure_id_get_value (structure,
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
GST_QUARK (AVG_OUT_RATE)));
|
|
|
|
if (buffering_left)
|
|
|
|
*buffering_left =
|
2011-05-10 13:33:53 +00:00
|
|
|
g_value_get_int64 (gst_structure_id_get_value (structure,
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
GST_QUARK (BUFFERING_LEFT)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2008-04-08 20:28:21 +00:00
|
|
|
* gst_query_set_buffering_range:
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
* @query: a #GstQuery
|
|
|
|
* @format: the format to set for the @start and @stop values
|
|
|
|
* @start: the start to set
|
|
|
|
* @stop: the stop to set
|
2013-07-26 14:15:24 +00:00
|
|
|
* @estimated_total: estimated total amount of download time remaining in
|
|
|
|
* miliseconds
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
*
|
2009-11-23 10:34:07 +00:00
|
|
|
* Set the available query result fields in @query.
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
*/
|
|
|
|
void
|
2008-04-08 20:28:21 +00:00
|
|
|
gst_query_set_buffering_range (GstQuery * query, GstFormat format,
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
gint64 start, gint64 stop, gint64 estimated_total)
|
|
|
|
{
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
|
2011-05-10 13:41:54 +00:00
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
gst_structure_id_set (structure,
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
|
|
|
|
GST_QUARK (START_VALUE), G_TYPE_INT64, start,
|
|
|
|
GST_QUARK (STOP_VALUE), G_TYPE_INT64, stop,
|
|
|
|
GST_QUARK (ESTIMATED_TOTAL), G_TYPE_INT64, estimated_total, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2008-04-08 20:28:21 +00:00
|
|
|
* gst_query_parse_buffering_range:
|
2010-08-31 09:35:12 +00:00
|
|
|
* @query: a GST_QUERY_BUFFERING type query #GstQuery
|
2010-12-07 18:35:04 +00:00
|
|
|
* @format: (out) (allow-none): the format to set for the @segment_start
|
|
|
|
* and @segment_end values, or NULL
|
|
|
|
* @start: (out) (allow-none): the start to set, or NULL
|
|
|
|
* @stop: (out) (allow-none): the stop to set, or NULL
|
|
|
|
* @estimated_total: (out) (allow-none): estimated total amount of download
|
2013-07-26 14:15:24 +00:00
|
|
|
* time remaining in miliseconds, or NULL
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
*
|
2009-11-23 10:34:07 +00:00
|
|
|
* Parse an available query, writing the format into @format, and
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
* other results into the passed parameters, if the respective parameters
|
|
|
|
* are non-NULL
|
|
|
|
*/
|
|
|
|
void
|
2008-04-08 20:28:21 +00:00
|
|
|
gst_query_parse_buffering_range (GstQuery * query, GstFormat * format,
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
gint64 * start, gint64 * stop, gint64 * estimated_total)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
if (format)
|
2011-08-25 19:18:15 +00:00
|
|
|
*format =
|
|
|
|
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
|
Reorder the message docs and headers for clarity.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstmessage.c: (gst_message_set_buffering_stats),
(gst_message_parse_buffering_stats):
* gst/gstmessage.h:
* gst/gstquery.c: (gst_query_new_latency), (gst_query_set_latency),
(gst_query_parse_latency), (gst_query_new_buffering),
(gst_query_set_buffering_percent),
(gst_query_parse_buffering_percent),
(gst_query_set_buffering_stats), (gst_query_parse_buffering_stats),
(gst_query_set_buffering_avail), (gst_query_parse_buffering_avail):
* gst/gstquery.h:
Reorder the message docs and headers for clarity.
Add aditional buffering stats API for messages.
Add buffering query.
Convert some leftover queries to use GstQuark.
API: gst_message_set_buffering_stats
API: gst_message_parse_buffering_stats
API: GST_QUERY_BUFFERING
API: GstBufferingMode
API: gst_query_new_buffering
API: gst_query_set_buffering_percent
API: gst_query_parse_buffering_percent
API: gst_query_set_buffering_stats
API: gst_query_parse_buffering_stats
API: gst_query_set_buffering_avail
API: gst_query_parse_buffering_avail
2008-04-08 19:59:06 +00:00
|
|
|
GST_QUARK (FORMAT)));
|
|
|
|
if (start)
|
|
|
|
*start = g_value_get_int64 (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (START_VALUE)));
|
|
|
|
if (stop)
|
|
|
|
*stop = g_value_get_int64 (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (STOP_VALUE)));
|
|
|
|
if (estimated_total)
|
|
|
|
*estimated_total =
|
|
|
|
g_value_get_int64 (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (ESTIMATED_TOTAL)));
|
|
|
|
}
|
2008-12-20 17:33:44 +00:00
|
|
|
|
2012-03-15 19:23:59 +00:00
|
|
|
/* GstQueryBufferingRange: internal struct for GArray */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gint64 start;
|
|
|
|
gint64 stop;
|
|
|
|
} GstQueryBufferingRange;
|
|
|
|
|
2010-08-31 09:35:12 +00:00
|
|
|
/**
|
2011-12-01 18:05:59 +00:00
|
|
|
* gst_query_add_buffering_range:
|
2010-08-31 09:35:12 +00:00
|
|
|
* @query: a GST_QUERY_BUFFERING type query #GstQuery
|
|
|
|
* @start: start position of the range
|
|
|
|
* @stop: stop position of the range
|
|
|
|
*
|
|
|
|
* Set the buffering-ranges array field in @query. The current last
|
|
|
|
* start position of the array should be inferior to @start.
|
|
|
|
*
|
|
|
|
* Returns: a #gboolean indicating if the range was added or not.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_query_add_buffering_range (GstQuery * query, gint64 start, gint64 stop)
|
|
|
|
{
|
2012-01-25 15:14:17 +00:00
|
|
|
GstQueryBufferingRange range;
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
2012-01-25 15:14:17 +00:00
|
|
|
GArray *array;
|
2010-08-31 09:35:12 +00:00
|
|
|
|
2010-09-15 23:37:59 +00:00
|
|
|
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING, FALSE);
|
2011-05-10 13:41:54 +00:00
|
|
|
g_return_val_if_fail (gst_query_is_writable (query), FALSE);
|
2010-08-31 09:35:12 +00:00
|
|
|
|
2010-09-15 23:37:59 +00:00
|
|
|
if (G_UNLIKELY (start >= stop))
|
|
|
|
return FALSE;
|
2010-08-31 09:35:12 +00:00
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2012-01-25 15:14:17 +00:00
|
|
|
array = ensure_array (structure, GST_QUARK (BUFFERING_RANGES),
|
2012-01-30 14:59:02 +00:00
|
|
|
sizeof (GstQueryBufferingRange), NULL);
|
2012-01-25 15:14:17 +00:00
|
|
|
|
|
|
|
if (array->len > 1) {
|
|
|
|
GstQueryBufferingRange *last;
|
2011-11-18 16:27:16 +00:00
|
|
|
|
2012-01-25 15:14:17 +00:00
|
|
|
last = &g_array_index (array, GstQueryBufferingRange, array->len - 1);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (start <= last->start))
|
2010-09-15 23:37:59 +00:00
|
|
|
return FALSE;
|
2010-08-31 09:35:12 +00:00
|
|
|
}
|
|
|
|
|
2012-01-25 15:14:17 +00:00
|
|
|
range.start = start;
|
|
|
|
range.stop = stop;
|
|
|
|
g_array_append_val (array, range);
|
2010-08-31 09:35:12 +00:00
|
|
|
|
2010-09-15 23:37:59 +00:00
|
|
|
return TRUE;
|
2010-08-31 09:35:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-12-01 18:05:59 +00:00
|
|
|
* gst_query_get_n_buffering_ranges:
|
2010-08-31 09:35:12 +00:00
|
|
|
* @query: a GST_QUERY_BUFFERING type query #GstQuery
|
|
|
|
*
|
|
|
|
* Retrieve the number of values currently stored in the
|
|
|
|
* buffered-ranges array of the query's structure.
|
|
|
|
*
|
|
|
|
* Returns: the range array size as a #guint.
|
|
|
|
*/
|
|
|
|
guint
|
|
|
|
gst_query_get_n_buffering_ranges (GstQuery * query)
|
|
|
|
{
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
2012-01-25 15:14:17 +00:00
|
|
|
GArray *array;
|
2010-08-31 09:35:12 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING, 0);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2012-01-25 15:14:17 +00:00
|
|
|
array = ensure_array (structure, GST_QUARK (BUFFERING_RANGES),
|
2012-01-30 14:59:02 +00:00
|
|
|
sizeof (GstQueryBufferingRange), NULL);
|
2011-11-18 16:27:16 +00:00
|
|
|
|
2012-01-25 15:14:17 +00:00
|
|
|
return array->len;
|
2010-08-31 09:35:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2011-12-01 18:05:59 +00:00
|
|
|
* gst_query_parse_nth_buffering_range:
|
2010-08-31 09:35:12 +00:00
|
|
|
* @query: a GST_QUERY_BUFFERING type query #GstQuery
|
|
|
|
* @index: position in the buffered-ranges array to read
|
2010-12-07 18:35:04 +00:00
|
|
|
* @start: (out) (allow-none): the start position to set, or NULL
|
|
|
|
* @stop: (out) (allow-none): the stop position to set, or NULL
|
2010-08-31 09:35:12 +00:00
|
|
|
*
|
|
|
|
* Parse an available query and get the start and stop values stored
|
|
|
|
* at the @index of the buffered ranges array.
|
|
|
|
*
|
|
|
|
* Returns: a #gboolean indicating if the parsing succeeded.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_query_parse_nth_buffering_range (GstQuery * query, guint index,
|
|
|
|
gint64 * start, gint64 * stop)
|
|
|
|
{
|
2012-01-25 15:14:17 +00:00
|
|
|
GstQueryBufferingRange *range;
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
2012-01-25 15:14:17 +00:00
|
|
|
GArray *array;
|
2010-08-31 09:35:12 +00:00
|
|
|
|
2012-01-25 15:14:17 +00:00
|
|
|
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING, FALSE);
|
2010-08-31 09:35:12 +00:00
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2010-08-31 09:35:12 +00:00
|
|
|
|
2012-01-25 15:14:17 +00:00
|
|
|
array = ensure_array (structure, GST_QUARK (BUFFERING_RANGES),
|
2012-01-30 14:59:02 +00:00
|
|
|
sizeof (GstQueryBufferingRange), NULL);
|
2012-03-01 13:49:38 +00:00
|
|
|
g_return_val_if_fail (index < array->len, FALSE);
|
2012-01-25 15:14:17 +00:00
|
|
|
|
|
|
|
range = &g_array_index (array, GstQueryBufferingRange, index);
|
|
|
|
|
|
|
|
if (start)
|
|
|
|
*start = range->start;
|
|
|
|
if (stop)
|
|
|
|
*stop = range->stop;
|
|
|
|
|
|
|
|
return TRUE;
|
2010-08-31 09:35:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-20 17:33:44 +00:00
|
|
|
/**
|
|
|
|
* gst_query_new_uri:
|
|
|
|
*
|
|
|
|
* Constructs a new query URI query object. Use gst_query_unref()
|
|
|
|
* when done with it. An URI query is used to query the current URI
|
|
|
|
* that is used by the source or sink.
|
|
|
|
*
|
2010-12-07 18:35:04 +00:00
|
|
|
* Free-function: gst_query_unref
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new #GstQuery
|
2008-12-20 17:33:44 +00:00
|
|
|
*/
|
|
|
|
GstQuery *
|
|
|
|
gst_query_new_uri (void)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2011-10-29 07:02:00 +00:00
|
|
|
structure = gst_structure_new_id (GST_QUARK (QUERY_URI),
|
2009-05-29 17:22:42 +00:00
|
|
|
GST_QUARK (URI), G_TYPE_STRING, NULL, NULL);
|
2008-12-20 17:33:44 +00:00
|
|
|
|
2012-02-10 13:58:13 +00:00
|
|
|
query = gst_query_new_custom (GST_QUERY_URI, structure);
|
2008-12-20 17:33:44 +00:00
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_set_uri:
|
|
|
|
* @query: a #GstQuery with query type GST_QUERY_URI
|
|
|
|
* @uri: the URI to set
|
|
|
|
*
|
|
|
|
* Answer a URI query by setting the requested URI.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_set_uri (GstQuery * query, const gchar * uri)
|
|
|
|
{
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
2008-12-20 17:33:44 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI);
|
2011-05-10 13:41:54 +00:00
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
2008-12-20 17:33:44 +00:00
|
|
|
g_return_if_fail (gst_uri_is_valid (uri));
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
gst_structure_id_set (structure, GST_QUARK (URI), G_TYPE_STRING, uri, NULL);
|
2008-12-20 17:33:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_parse_uri:
|
|
|
|
* @query: a #GstQuery
|
2013-07-23 14:25:27 +00:00
|
|
|
* @uri: (out) (transfer full) (allow-none): the storage for the current URI
|
2010-12-07 18:35:04 +00:00
|
|
|
* (may be NULL)
|
2008-12-20 17:33:44 +00:00
|
|
|
*
|
|
|
|
* Parse an URI query, writing the URI into @uri as a newly
|
|
|
|
* allocated string, if the respective parameters are non-NULL.
|
|
|
|
* Free the string with g_free() after usage.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_parse_uri (GstQuery * query, gchar ** uri)
|
|
|
|
{
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
2008-12-20 17:33:44 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2008-12-20 17:33:44 +00:00
|
|
|
if (uri)
|
2011-05-10 13:33:53 +00:00
|
|
|
*uri = g_value_dup_string (gst_structure_id_get_value (structure,
|
2008-12-20 17:33:44 +00:00
|
|
|
GST_QUARK (URI)));
|
|
|
|
}
|
2011-04-28 13:31:48 +00:00
|
|
|
|
2013-04-19 10:14:54 +00:00
|
|
|
/**
|
|
|
|
* gst_query_set_uri_redirection:
|
|
|
|
* @query: a #GstQuery with query type GST_QUERY_URI
|
|
|
|
* @uri: the URI to set
|
|
|
|
*
|
|
|
|
* Answer a URI query by setting the requested URI redirection.
|
2013-08-13 11:11:19 +00:00
|
|
|
*
|
|
|
|
* Since: 1.2
|
2013-04-19 10:14:54 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_set_uri_redirection (GstQuery * query, const gchar * uri)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI);
|
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
|
|
|
g_return_if_fail (gst_uri_is_valid (uri));
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
gst_structure_id_set (structure, GST_QUARK (URI_REDIRECTION),
|
|
|
|
G_TYPE_STRING, uri, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_parse_uri_redirection:
|
|
|
|
* @query: a #GstQuery
|
|
|
|
* @uri: (out) (transfer full) (allow-none): the storage for the redirect URI
|
|
|
|
* (may be NULL)
|
|
|
|
*
|
|
|
|
* Parse an URI query, writing the URI into @uri as a newly
|
|
|
|
* allocated string, if the respective parameters are non-NULL.
|
|
|
|
* Free the string with g_free() after usage.
|
2013-08-13 11:11:19 +00:00
|
|
|
*
|
|
|
|
* Since: 1.2
|
2013-04-19 10:14:54 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_parse_uri_redirection (GstQuery * query, gchar ** uri)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI);
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2013-08-16 18:36:53 +00:00
|
|
|
if (uri) {
|
|
|
|
if (!gst_structure_id_get (structure, GST_QUARK (URI_REDIRECTION),
|
|
|
|
G_TYPE_STRING, uri, NULL))
|
|
|
|
*uri = NULL;
|
|
|
|
}
|
2013-04-19 10:14:54 +00:00
|
|
|
}
|
|
|
|
|
2011-04-28 14:20:22 +00:00
|
|
|
/**
|
2011-12-01 18:05:59 +00:00
|
|
|
* gst_query_new_allocation:
|
2011-04-28 14:20:22 +00:00
|
|
|
* @caps: the negotiated caps
|
|
|
|
* @need_pool: return a pool
|
|
|
|
*
|
|
|
|
* Constructs a new query object for querying the allocation properties.
|
|
|
|
*
|
|
|
|
* Free-function: gst_query_unref
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new #GstQuery
|
|
|
|
*/
|
2011-04-28 13:31:48 +00:00
|
|
|
GstQuery *
|
2011-04-28 14:20:22 +00:00
|
|
|
gst_query_new_allocation (GstCaps * caps, gboolean need_pool)
|
2011-04-28 13:31:48 +00:00
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2011-10-29 07:02:00 +00:00
|
|
|
structure = gst_structure_new_id (GST_QUARK (QUERY_ALLOCATION),
|
2011-04-28 13:31:48 +00:00
|
|
|
GST_QUARK (CAPS), GST_TYPE_CAPS, caps,
|
2012-03-15 19:23:59 +00:00
|
|
|
GST_QUARK (NEED_POOL), G_TYPE_BOOLEAN, need_pool, NULL);
|
2011-04-28 13:31:48 +00:00
|
|
|
|
2012-02-10 13:58:13 +00:00
|
|
|
query = gst_query_new_custom (GST_QUERY_ALLOCATION, structure);
|
2011-04-28 13:31:48 +00:00
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
2011-12-01 18:05:59 +00:00
|
|
|
/**
|
|
|
|
* gst_query_parse_allocation:
|
|
|
|
* @query: a #GstQuery
|
2012-03-29 15:53:47 +00:00
|
|
|
* @caps: (out) (transfer none) (allow-none): The #GstCaps
|
2011-12-01 18:05:59 +00:00
|
|
|
* @need_pool: (out) (allow-none): Whether a #GstBufferPool is needed
|
|
|
|
*
|
|
|
|
* Parse an allocation query, writing the requested caps in @caps and
|
|
|
|
* whether a pool is needed in @need_pool, if the respective parameters
|
|
|
|
* are non-NULL.
|
|
|
|
*/
|
2011-04-29 08:50:17 +00:00
|
|
|
void
|
|
|
|
gst_query_parse_allocation (GstQuery * query, GstCaps ** caps,
|
|
|
|
gboolean * need_pool)
|
|
|
|
{
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
2011-04-29 08:50:17 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2012-03-29 15:08:49 +00:00
|
|
|
if (caps) {
|
|
|
|
*caps = g_value_get_boxed (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (CAPS)));
|
|
|
|
}
|
2011-05-10 13:33:53 +00:00
|
|
|
gst_structure_id_get (structure,
|
2011-04-29 08:50:17 +00:00
|
|
|
GST_QUARK (NEED_POOL), G_TYPE_BOOLEAN, need_pool, NULL);
|
|
|
|
}
|
|
|
|
|
2012-03-15 19:23:59 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GstBufferPool *pool;
|
|
|
|
guint size;
|
|
|
|
guint min_buffers;
|
|
|
|
guint max_buffers;
|
|
|
|
} AllocationPool;
|
|
|
|
|
|
|
|
static void
|
|
|
|
allocation_pool_free (AllocationPool * ap)
|
|
|
|
{
|
|
|
|
if (ap->pool)
|
|
|
|
gst_object_unref (ap->pool);
|
|
|
|
}
|
|
|
|
|
2011-04-28 14:20:22 +00:00
|
|
|
/**
|
2012-03-15 19:23:59 +00:00
|
|
|
* gst_query_add_allocation_pool:
|
2011-04-28 14:20:22 +00:00
|
|
|
* @query: A valid #GstQuery of type GST_QUERY_ALLOCATION.
|
2012-03-15 19:23:59 +00:00
|
|
|
* @pool: the #GstBufferPool
|
2011-04-28 14:20:22 +00:00
|
|
|
* @size: the size
|
2011-06-11 18:45:42 +00:00
|
|
|
* @min_buffers: the min buffers
|
|
|
|
* @max_buffers: the max buffers
|
2011-04-28 14:20:22 +00:00
|
|
|
*
|
2012-03-15 19:23:59 +00:00
|
|
|
* Set the pool parameters in @query.
|
2011-04-28 14:20:22 +00:00
|
|
|
*/
|
2011-04-28 13:31:48 +00:00
|
|
|
void
|
2012-03-15 19:23:59 +00:00
|
|
|
gst_query_add_allocation_pool (GstQuery * query, GstBufferPool * pool,
|
|
|
|
guint size, guint min_buffers, guint max_buffers)
|
2011-04-28 13:31:48 +00:00
|
|
|
{
|
2012-03-15 19:23:59 +00:00
|
|
|
GArray *array;
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
2012-03-15 19:23:59 +00:00
|
|
|
AllocationPool ap;
|
2011-05-10 13:33:53 +00:00
|
|
|
|
2011-04-28 13:31:48 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
|
2011-05-10 13:41:54 +00:00
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
2012-03-15 19:23:59 +00:00
|
|
|
g_return_if_fail (size != 0);
|
2011-04-28 13:31:48 +00:00
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2012-03-15 19:23:59 +00:00
|
|
|
array = ensure_array (structure, GST_QUARK (POOL),
|
|
|
|
sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free);
|
|
|
|
|
|
|
|
if ((ap.pool = pool))
|
|
|
|
gst_object_ref (pool);
|
|
|
|
ap.size = size;
|
|
|
|
ap.min_buffers = min_buffers;
|
|
|
|
ap.max_buffers = max_buffers;
|
|
|
|
|
|
|
|
g_array_append_val (array, ap);
|
2011-04-28 13:31:48 +00:00
|
|
|
}
|
|
|
|
|
2012-03-15 19:23:59 +00:00
|
|
|
|
2011-04-28 14:20:22 +00:00
|
|
|
/**
|
2012-03-15 19:23:59 +00:00
|
|
|
* gst_query_get_n_allocation_pools:
|
|
|
|
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
|
|
|
|
*
|
|
|
|
* Retrieve the number of values currently stored in the
|
|
|
|
* pool array of the query's structure.
|
|
|
|
*
|
|
|
|
* Returns: the pool array size as a #guint.
|
|
|
|
*/
|
|
|
|
guint
|
|
|
|
gst_query_get_n_allocation_pools (GstQuery * query)
|
|
|
|
{
|
|
|
|
GArray *array;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0);
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
array = ensure_array (structure, GST_QUARK (POOL),
|
|
|
|
sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free);
|
|
|
|
|
|
|
|
return array->len;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_parse_nth_allocation_pool:
|
2011-04-28 14:20:22 +00:00
|
|
|
* @query: A valid #GstQuery of type GST_QUERY_ALLOCATION.
|
2012-03-29 11:34:50 +00:00
|
|
|
* @index: index to parse
|
2012-07-18 11:30:59 +00:00
|
|
|
* @pool: (out) (allow-none) (transfer full): the #GstBufferPool
|
2012-01-30 14:59:02 +00:00
|
|
|
* @size: (out) (allow-none): the size
|
|
|
|
* @min_buffers: (out) (allow-none): the min buffers
|
|
|
|
* @max_buffers: (out) (allow-none): the max buffers
|
2011-04-28 14:20:22 +00:00
|
|
|
*
|
2012-03-15 19:23:59 +00:00
|
|
|
* Get the pool parameters in @query.
|
2012-07-18 11:30:59 +00:00
|
|
|
*
|
|
|
|
* Unref @pool with gst_object_unref() when it's not needed any more.
|
2011-04-28 14:20:22 +00:00
|
|
|
*/
|
2011-04-28 13:31:48 +00:00
|
|
|
void
|
2012-03-15 19:23:59 +00:00
|
|
|
gst_query_parse_nth_allocation_pool (GstQuery * query, guint index,
|
|
|
|
GstBufferPool ** pool, guint * size, guint * min_buffers,
|
|
|
|
guint * max_buffers)
|
2011-04-28 13:31:48 +00:00
|
|
|
{
|
2012-03-15 19:23:59 +00:00
|
|
|
GArray *array;
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
2012-03-15 19:23:59 +00:00
|
|
|
AllocationPool *ap;
|
2011-05-10 13:33:53 +00:00
|
|
|
|
2011-04-28 13:31:48 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2012-03-15 19:23:59 +00:00
|
|
|
array = ensure_array (structure, GST_QUARK (POOL),
|
|
|
|
sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free);
|
|
|
|
g_return_if_fail (index < array->len);
|
|
|
|
|
|
|
|
ap = &g_array_index (array, AllocationPool, index);
|
|
|
|
|
|
|
|
if (pool)
|
|
|
|
if ((*pool = ap->pool))
|
|
|
|
gst_object_ref (*pool);
|
|
|
|
if (size)
|
|
|
|
*size = ap->size;
|
|
|
|
if (min_buffers)
|
|
|
|
*min_buffers = ap->min_buffers;
|
|
|
|
if (max_buffers)
|
|
|
|
*max_buffers = ap->max_buffers;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_set_nth_allocation_pool:
|
|
|
|
* @index: index to modify
|
|
|
|
* @query: A valid #GstQuery of type GST_QUERY_ALLOCATION.
|
|
|
|
* @pool: the #GstBufferPool
|
|
|
|
* @size: the size
|
|
|
|
* @min_buffers: the min buffers
|
|
|
|
* @max_buffers: the max buffers
|
|
|
|
*
|
|
|
|
* Set the pool parameters in @query.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_set_nth_allocation_pool (GstQuery * query, guint index,
|
|
|
|
GstBufferPool * pool, guint size, guint min_buffers, guint max_buffers)
|
|
|
|
{
|
|
|
|
GArray *array;
|
|
|
|
GstStructure *structure;
|
|
|
|
AllocationPool *oldap, ap;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
array = ensure_array (structure, GST_QUARK (POOL),
|
|
|
|
sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free);
|
|
|
|
g_return_if_fail (index < array->len);
|
|
|
|
|
|
|
|
oldap = &g_array_index (array, AllocationPool, index);
|
|
|
|
allocation_pool_free (oldap);
|
|
|
|
|
|
|
|
if ((ap.pool = pool))
|
|
|
|
gst_object_ref (pool);
|
|
|
|
ap.size = size;
|
|
|
|
ap.min_buffers = min_buffers;
|
|
|
|
ap.max_buffers = max_buffers;
|
|
|
|
g_array_index (array, AllocationPool, index) = ap;
|
2011-04-28 13:31:48 +00:00
|
|
|
}
|
|
|
|
|
2013-02-25 12:57:43 +00:00
|
|
|
/**
|
|
|
|
* gst_query_remove_nth_allocation_pool:
|
|
|
|
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
|
|
|
|
* @index: position in the allocation pool array to remove
|
|
|
|
*
|
|
|
|
* Remove the allocation pool at @index of the allocation pool array.
|
2013-07-16 13:46:15 +00:00
|
|
|
*
|
|
|
|
* Since: 1.2
|
2013-02-25 12:57:43 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_remove_nth_allocation_pool (GstQuery * query, guint index)
|
|
|
|
{
|
|
|
|
GArray *array;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
|
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
array =
|
|
|
|
ensure_array (structure, GST_QUARK (POOL), sizeof (AllocationPool),
|
|
|
|
(GDestroyNotify) allocation_pool_free);
|
|
|
|
g_return_if_fail (index < array->len);
|
|
|
|
|
|
|
|
g_array_remove_index (array, index);
|
|
|
|
}
|
|
|
|
|
2012-07-06 09:00:38 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GType api;
|
2012-07-06 09:49:47 +00:00
|
|
|
GstStructure *params;
|
2012-07-06 09:00:38 +00:00
|
|
|
} AllocationMeta;
|
|
|
|
|
2012-07-06 09:49:47 +00:00
|
|
|
static void
|
|
|
|
allocation_meta_free (AllocationMeta * am)
|
|
|
|
{
|
|
|
|
if (am->params)
|
|
|
|
gst_structure_free (am->params);
|
|
|
|
}
|
|
|
|
|
2011-04-28 14:20:22 +00:00
|
|
|
/**
|
2011-12-01 18:05:59 +00:00
|
|
|
* gst_query_add_allocation_meta:
|
2011-04-28 14:20:22 +00:00
|
|
|
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
|
|
|
|
* @api: the metadata API
|
2012-07-10 08:31:00 +00:00
|
|
|
* @params: (transfer none) (allow-none): API specific parameters
|
2011-04-28 14:20:22 +00:00
|
|
|
*
|
2012-07-06 09:49:47 +00:00
|
|
|
* Add @api with @params as one of the supported metadata API to @query.
|
2011-04-28 14:20:22 +00:00
|
|
|
*/
|
2011-04-28 13:31:48 +00:00
|
|
|
void
|
2012-07-06 09:49:47 +00:00
|
|
|
gst_query_add_allocation_meta (GstQuery * query, GType api,
|
2012-07-10 08:31:00 +00:00
|
|
|
const GstStructure * params)
|
2011-04-28 13:31:48 +00:00
|
|
|
{
|
2012-01-25 15:14:17 +00:00
|
|
|
GArray *array;
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
2012-07-06 09:00:38 +00:00
|
|
|
AllocationMeta am;
|
2011-04-28 13:31:48 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
|
2012-02-29 16:20:23 +00:00
|
|
|
g_return_if_fail (api != 0);
|
2011-05-10 13:41:54 +00:00
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
2011-04-28 13:31:48 +00:00
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2012-07-06 09:00:38 +00:00
|
|
|
array =
|
2012-07-06 09:49:47 +00:00
|
|
|
ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta),
|
|
|
|
(GDestroyNotify) allocation_meta_free);
|
2011-04-28 13:31:48 +00:00
|
|
|
|
2012-07-06 09:00:38 +00:00
|
|
|
am.api = api;
|
2012-07-10 08:31:00 +00:00
|
|
|
am.params = (params ? gst_structure_copy (params) : NULL);
|
2012-07-06 09:00:38 +00:00
|
|
|
|
|
|
|
g_array_append_val (array, am);
|
2011-04-28 13:31:48 +00:00
|
|
|
}
|
|
|
|
|
2011-04-28 14:20:22 +00:00
|
|
|
/**
|
2011-05-10 13:33:53 +00:00
|
|
|
* gst_query_get_n_allocation_metas:
|
2011-04-28 14:20:22 +00:00
|
|
|
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
|
|
|
|
*
|
|
|
|
* Retrieve the number of values currently stored in the
|
|
|
|
* meta API array of the query's structure.
|
|
|
|
*
|
|
|
|
* Returns: the metadata API array size as a #guint.
|
|
|
|
*/
|
2011-04-28 13:31:48 +00:00
|
|
|
guint
|
2011-05-10 13:33:53 +00:00
|
|
|
gst_query_get_n_allocation_metas (GstQuery * query)
|
2011-04-28 13:31:48 +00:00
|
|
|
{
|
2012-01-25 15:14:17 +00:00
|
|
|
GArray *array;
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
2011-04-28 13:31:48 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0);
|
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2012-07-06 09:00:38 +00:00
|
|
|
array =
|
2012-07-06 09:49:47 +00:00
|
|
|
ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta),
|
|
|
|
(GDestroyNotify) allocation_meta_free);
|
2011-11-18 16:27:16 +00:00
|
|
|
|
2012-01-25 15:14:17 +00:00
|
|
|
return array->len;
|
2011-04-28 13:31:48 +00:00
|
|
|
}
|
|
|
|
|
2011-04-28 14:20:22 +00:00
|
|
|
/**
|
2011-12-01 18:05:59 +00:00
|
|
|
* gst_query_parse_nth_allocation_meta:
|
2011-04-28 14:20:22 +00:00
|
|
|
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
|
|
|
|
* @index: position in the metadata API array to read
|
2013-08-12 12:25:34 +00:00
|
|
|
* @params: (out) (transfer none) (allow-none): API specific flags
|
2011-04-28 14:20:22 +00:00
|
|
|
*
|
|
|
|
* Parse an available query and get the metadata API
|
|
|
|
* at @index of the metadata API array.
|
|
|
|
*
|
2012-02-29 16:20:23 +00:00
|
|
|
* Returns: a #GType of the metadata API at @index.
|
2011-04-28 14:20:22 +00:00
|
|
|
*/
|
2012-02-29 16:20:23 +00:00
|
|
|
GType
|
2012-07-06 09:00:38 +00:00
|
|
|
gst_query_parse_nth_allocation_meta (GstQuery * query, guint index,
|
2012-07-06 09:49:47 +00:00
|
|
|
const GstStructure ** params)
|
2011-04-28 13:31:48 +00:00
|
|
|
{
|
2012-01-25 15:14:17 +00:00
|
|
|
GArray *array;
|
2011-05-10 13:33:53 +00:00
|
|
|
GstStructure *structure;
|
2012-07-06 09:00:38 +00:00
|
|
|
AllocationMeta *am;
|
2011-04-28 13:31:48 +00:00
|
|
|
|
2012-02-29 16:20:23 +00:00
|
|
|
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0);
|
2011-04-28 13:31:48 +00:00
|
|
|
|
2011-05-10 13:33:53 +00:00
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2012-07-06 09:00:38 +00:00
|
|
|
array =
|
2012-07-06 09:49:47 +00:00
|
|
|
ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta),
|
|
|
|
(GDestroyNotify) allocation_meta_free);
|
2011-04-28 13:31:48 +00:00
|
|
|
|
2012-03-01 13:49:38 +00:00
|
|
|
g_return_val_if_fail (index < array->len, 0);
|
2011-04-28 13:31:48 +00:00
|
|
|
|
2012-07-06 09:00:38 +00:00
|
|
|
am = &g_array_index (array, AllocationMeta, index);
|
|
|
|
|
2012-07-06 09:49:47 +00:00
|
|
|
if (params)
|
|
|
|
*params = am->params;
|
2012-07-06 09:00:38 +00:00
|
|
|
|
|
|
|
return am->api;
|
2012-03-01 13:49:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_remove_nth_allocation_meta:
|
|
|
|
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
|
|
|
|
* @index: position in the metadata API array to remove
|
|
|
|
*
|
|
|
|
* Remove the metadata API at @index of the metadata API array.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_remove_nth_allocation_meta (GstQuery * query, guint index)
|
|
|
|
{
|
|
|
|
GArray *array;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
|
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2012-07-06 09:00:38 +00:00
|
|
|
array =
|
2012-07-06 09:49:47 +00:00
|
|
|
ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta),
|
|
|
|
(GDestroyNotify) allocation_meta_free);
|
2012-03-01 13:49:38 +00:00
|
|
|
g_return_if_fail (index < array->len);
|
|
|
|
|
|
|
|
g_array_remove_index (array, index);
|
2011-04-28 13:31:48 +00:00
|
|
|
}
|
2011-05-24 10:52:09 +00:00
|
|
|
|
2011-06-23 16:03:22 +00:00
|
|
|
/**
|
2012-07-06 09:22:43 +00:00
|
|
|
* gst_query_find_allocation_meta:
|
2011-06-23 16:03:22 +00:00
|
|
|
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
|
|
|
|
* @api: the metadata API
|
2013-08-12 12:25:34 +00:00
|
|
|
* @index: (out) (transfer none) (allow-none): the index
|
2011-06-23 16:03:22 +00:00
|
|
|
*
|
2012-07-06 09:22:43 +00:00
|
|
|
* Check if @query has metadata @api set. When this function returns TRUE,
|
|
|
|
* @index will contain the index where the requested API and the flags can be
|
|
|
|
* found.
|
2011-06-23 16:03:22 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE when @api is in the list of metadata.
|
|
|
|
*/
|
|
|
|
gboolean
|
2012-07-06 09:22:43 +00:00
|
|
|
gst_query_find_allocation_meta (GstQuery * query, GType api, guint * index)
|
2011-06-23 16:03:22 +00:00
|
|
|
{
|
2012-01-25 15:14:17 +00:00
|
|
|
GArray *array;
|
2011-06-23 16:03:22 +00:00
|
|
|
GstStructure *structure;
|
2012-01-25 15:14:17 +00:00
|
|
|
guint i, len;
|
2011-06-23 16:03:22 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, FALSE);
|
2012-02-29 16:20:23 +00:00
|
|
|
g_return_val_if_fail (api != 0, FALSE);
|
2011-06-23 16:03:22 +00:00
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2012-07-06 09:00:38 +00:00
|
|
|
array =
|
2012-07-06 09:49:47 +00:00
|
|
|
ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta),
|
|
|
|
(GDestroyNotify) allocation_meta_free);
|
2011-06-23 16:03:22 +00:00
|
|
|
|
2012-01-25 15:14:17 +00:00
|
|
|
len = array->len;
|
|
|
|
for (i = 0; i < len; i++) {
|
2012-07-06 09:00:38 +00:00
|
|
|
AllocationMeta *am = &g_array_index (array, AllocationMeta, i);
|
2012-07-06 09:22:43 +00:00
|
|
|
if (am->api == api) {
|
|
|
|
if (index)
|
|
|
|
*index = i;
|
2011-11-18 16:27:16 +00:00
|
|
|
return TRUE;
|
2012-07-06 09:22:43 +00:00
|
|
|
}
|
2011-06-23 16:03:22 +00:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2012-03-15 19:23:59 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GstAllocator *allocator;
|
|
|
|
GstAllocationParams params;
|
|
|
|
} AllocationParam;
|
|
|
|
|
|
|
|
static void
|
|
|
|
allocation_param_free (AllocationParam * ap)
|
|
|
|
{
|
|
|
|
if (ap->allocator)
|
2012-07-09 14:02:50 +00:00
|
|
|
gst_object_unref (ap->allocator);
|
2012-03-15 19:23:59 +00:00
|
|
|
}
|
|
|
|
|
2011-06-07 14:35:07 +00:00
|
|
|
/**
|
2012-03-15 19:23:59 +00:00
|
|
|
* gst_query_add_allocation_param:
|
2011-06-07 14:35:07 +00:00
|
|
|
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
|
2012-07-06 09:49:47 +00:00
|
|
|
* @allocator: (transfer none) (allow-none): the memory allocator
|
|
|
|
* @params: (transfer none) (allow-none): a #GstAllocationParams
|
2011-06-07 14:35:07 +00:00
|
|
|
*
|
2012-03-15 19:23:59 +00:00
|
|
|
* Add @allocator and its @params as a supported memory allocator.
|
2011-06-07 14:35:07 +00:00
|
|
|
*/
|
|
|
|
void
|
2012-03-15 19:23:59 +00:00
|
|
|
gst_query_add_allocation_param (GstQuery * query, GstAllocator * allocator,
|
|
|
|
const GstAllocationParams * params)
|
2011-06-07 14:35:07 +00:00
|
|
|
{
|
2012-01-25 15:14:17 +00:00
|
|
|
GArray *array;
|
2011-06-07 14:35:07 +00:00
|
|
|
GstStructure *structure;
|
2012-03-15 19:23:59 +00:00
|
|
|
AllocationParam ap;
|
2011-06-07 14:35:07 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
|
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
2012-03-15 19:23:59 +00:00
|
|
|
g_return_if_fail (allocator != NULL || params != NULL);
|
2011-06-07 14:35:07 +00:00
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2012-03-15 19:23:59 +00:00
|
|
|
array = ensure_array (structure, GST_QUARK (ALLOCATOR),
|
|
|
|
sizeof (AllocationParam), (GDestroyNotify) allocation_param_free);
|
2011-06-07 14:35:07 +00:00
|
|
|
|
2012-03-15 19:23:59 +00:00
|
|
|
if ((ap.allocator = allocator))
|
2012-07-09 14:02:50 +00:00
|
|
|
gst_object_ref (allocator);
|
2012-03-15 19:23:59 +00:00
|
|
|
if (params)
|
|
|
|
ap.params = *params;
|
|
|
|
else
|
|
|
|
gst_allocation_params_init (&ap.params);
|
|
|
|
|
|
|
|
g_array_append_val (array, ap);
|
2011-06-07 14:35:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-03-15 19:23:59 +00:00
|
|
|
* gst_query_get_n_allocation_params:
|
2011-06-07 14:35:07 +00:00
|
|
|
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
|
|
|
|
*
|
|
|
|
* Retrieve the number of values currently stored in the
|
2012-03-15 19:23:59 +00:00
|
|
|
* allocator params array of the query's structure.
|
2011-06-07 14:35:07 +00:00
|
|
|
*
|
2011-06-08 09:03:50 +00:00
|
|
|
* If no memory allocator is specified, the downstream element can handle
|
2013-02-25 12:24:33 +00:00
|
|
|
* the default memory allocator. The first memory allocator in the query
|
|
|
|
* should be generic and allow mapping to system memory, all following
|
|
|
|
* allocators should be ordered by preference with the preferred one first.
|
2011-06-08 09:03:50 +00:00
|
|
|
*
|
2011-06-07 14:35:07 +00:00
|
|
|
* Returns: the allocator array size as a #guint.
|
|
|
|
*/
|
|
|
|
guint
|
2012-03-15 19:23:59 +00:00
|
|
|
gst_query_get_n_allocation_params (GstQuery * query)
|
2011-06-07 14:35:07 +00:00
|
|
|
{
|
2012-01-25 15:14:17 +00:00
|
|
|
GArray *array;
|
2011-06-07 14:35:07 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0);
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2012-03-15 19:23:59 +00:00
|
|
|
array = ensure_array (structure, GST_QUARK (ALLOCATOR),
|
|
|
|
sizeof (AllocationParam), (GDestroyNotify) allocation_param_free);
|
2011-11-18 16:27:16 +00:00
|
|
|
|
2012-01-25 15:14:17 +00:00
|
|
|
return array->len;
|
2011-06-07 14:35:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-03-15 19:23:59 +00:00
|
|
|
* gst_query_parse_nth_allocation_param:
|
2011-06-07 14:35:07 +00:00
|
|
|
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
|
|
|
|
* @index: position in the allocator array to read
|
2013-03-07 10:46:33 +00:00
|
|
|
* @allocator: (out) (transfer full) (allow-none): variable to hold the result
|
2012-07-06 09:49:47 +00:00
|
|
|
* @params: (out) (allow-none): parameters for the allocator
|
2011-06-07 14:35:07 +00:00
|
|
|
*
|
2012-03-15 19:23:59 +00:00
|
|
|
* Parse an available query and get the alloctor and its params
|
2011-06-07 14:35:07 +00:00
|
|
|
* at @index of the allocator array.
|
2012-03-15 19:23:59 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_parse_nth_allocation_param (GstQuery * query, guint index,
|
|
|
|
GstAllocator ** allocator, GstAllocationParams * params)
|
|
|
|
{
|
|
|
|
GArray *array;
|
|
|
|
GstStructure *structure;
|
|
|
|
AllocationParam *ap;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
array = ensure_array (structure, GST_QUARK (ALLOCATOR),
|
|
|
|
sizeof (AllocationParam), (GDestroyNotify) allocation_param_free);
|
|
|
|
g_return_if_fail (index < array->len);
|
|
|
|
|
|
|
|
ap = &g_array_index (array, AllocationParam, index);
|
|
|
|
|
|
|
|
if (allocator)
|
|
|
|
if ((*allocator = ap->allocator))
|
2012-07-09 14:02:50 +00:00
|
|
|
gst_object_ref (*allocator);
|
2012-03-15 19:23:59 +00:00
|
|
|
if (params)
|
|
|
|
*params = ap->params;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_set_nth_allocation_param:
|
|
|
|
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
|
|
|
|
* @index: position in the allocator array to set
|
2012-07-06 09:49:47 +00:00
|
|
|
* @allocator: (transfer none) (allow-none): new allocator to set
|
|
|
|
* @params: (transfer none) (allow-none): parameters for the allocator
|
2011-06-07 14:35:07 +00:00
|
|
|
*
|
2012-03-15 19:23:59 +00:00
|
|
|
* Parse an available query and get the alloctor and its params
|
|
|
|
* at @index of the allocator array.
|
2011-06-07 14:35:07 +00:00
|
|
|
*/
|
2012-03-15 19:23:59 +00:00
|
|
|
void
|
|
|
|
gst_query_set_nth_allocation_param (GstQuery * query, guint index,
|
|
|
|
GstAllocator * allocator, const GstAllocationParams * params)
|
2011-06-07 14:35:07 +00:00
|
|
|
{
|
2012-01-25 15:14:17 +00:00
|
|
|
GArray *array;
|
2011-06-07 14:35:07 +00:00
|
|
|
GstStructure *structure;
|
2012-03-15 19:23:59 +00:00
|
|
|
AllocationParam *old, ap;
|
2011-06-07 14:35:07 +00:00
|
|
|
|
2012-03-15 19:23:59 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
|
2011-06-07 14:35:07 +00:00
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2012-03-15 19:23:59 +00:00
|
|
|
array = ensure_array (structure, GST_QUARK (ALLOCATOR),
|
|
|
|
sizeof (AllocationParam), (GDestroyNotify) allocation_param_free);
|
|
|
|
g_return_if_fail (index < array->len);
|
|
|
|
|
|
|
|
old = &g_array_index (array, AllocationParam, index);
|
|
|
|
allocation_param_free (old);
|
|
|
|
|
|
|
|
if ((ap.allocator = allocator))
|
2012-07-09 14:02:50 +00:00
|
|
|
gst_object_ref (allocator);
|
2012-03-15 19:23:59 +00:00
|
|
|
if (params)
|
|
|
|
ap.params = *params;
|
|
|
|
else
|
|
|
|
gst_allocation_params_init (&ap.params);
|
2011-06-07 14:35:07 +00:00
|
|
|
|
2012-03-15 19:23:59 +00:00
|
|
|
g_array_index (array, AllocationParam, index) = ap;
|
2011-06-07 14:35:07 +00:00
|
|
|
}
|
|
|
|
|
2013-02-25 12:57:43 +00:00
|
|
|
/**
|
|
|
|
* gst_query_remove_nth_allocation_param:
|
|
|
|
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
|
|
|
|
* @index: position in the allocation param array to remove
|
|
|
|
*
|
|
|
|
* Remove the allocation param at @index of the allocation param array.
|
2013-07-16 13:46:15 +00:00
|
|
|
*
|
|
|
|
* Since: 1.2
|
2013-02-25 12:57:43 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_remove_nth_allocation_param (GstQuery * query, guint index)
|
|
|
|
{
|
|
|
|
GArray *array;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
|
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
array =
|
|
|
|
ensure_array (structure, GST_QUARK (ALLOCATOR), sizeof (AllocationParam),
|
|
|
|
(GDestroyNotify) allocation_param_free);
|
|
|
|
g_return_if_fail (index < array->len);
|
|
|
|
|
|
|
|
g_array_remove_index (array, index);
|
|
|
|
}
|
|
|
|
|
2011-05-24 10:52:09 +00:00
|
|
|
/**
|
2011-12-01 18:05:59 +00:00
|
|
|
* gst_query_new_scheduling:
|
2011-05-24 10:52:09 +00:00
|
|
|
*
|
|
|
|
* Constructs a new query object for querying the scheduling properties.
|
|
|
|
*
|
|
|
|
* Free-function: gst_query_unref
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new #GstQuery
|
|
|
|
*/
|
|
|
|
GstQuery *
|
|
|
|
gst_query_new_scheduling (void)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2011-10-29 07:02:00 +00:00
|
|
|
structure = gst_structure_new_id (GST_QUARK (QUERY_SCHEDULING),
|
2011-11-18 16:27:16 +00:00
|
|
|
GST_QUARK (FLAGS), GST_TYPE_SCHEDULING_FLAGS, 0,
|
2011-05-24 10:52:09 +00:00
|
|
|
GST_QUARK (MINSIZE), G_TYPE_INT, 1,
|
|
|
|
GST_QUARK (MAXSIZE), G_TYPE_INT, -1,
|
2011-11-18 17:08:21 +00:00
|
|
|
GST_QUARK (ALIGN), G_TYPE_INT, 0, NULL);
|
2012-02-10 13:58:13 +00:00
|
|
|
query = gst_query_new_custom (GST_QUERY_SCHEDULING, structure);
|
2011-05-24 10:52:09 +00:00
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-12-01 18:05:59 +00:00
|
|
|
* gst_query_set_scheduling:
|
2011-05-24 10:52:09 +00:00
|
|
|
* @query: A valid #GstQuery of type GST_QUERY_SCHEDULING.
|
2011-11-18 16:27:16 +00:00
|
|
|
* @flags: #GstSchedulingFlags
|
2011-05-24 10:52:09 +00:00
|
|
|
* @minsize: the suggested minimum size of pull requests
|
2011-10-21 09:15:11 +00:00
|
|
|
* @maxsize: the suggested maximum size of pull requests
|
2011-05-24 10:52:09 +00:00
|
|
|
* @align: the suggested alignment of pull requests
|
|
|
|
*
|
|
|
|
* Set the scheduling properties.
|
|
|
|
*/
|
|
|
|
void
|
2011-11-18 16:27:16 +00:00
|
|
|
gst_query_set_scheduling (GstQuery * query, GstSchedulingFlags flags,
|
2011-05-24 10:52:09 +00:00
|
|
|
gint minsize, gint maxsize, gint align)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING);
|
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
gst_structure_id_set (structure,
|
2011-11-18 16:27:16 +00:00
|
|
|
GST_QUARK (FLAGS), GST_TYPE_SCHEDULING_FLAGS, flags,
|
2011-05-24 10:52:09 +00:00
|
|
|
GST_QUARK (MINSIZE), G_TYPE_INT, minsize,
|
|
|
|
GST_QUARK (MAXSIZE), G_TYPE_INT, maxsize,
|
|
|
|
GST_QUARK (ALIGN), G_TYPE_INT, align, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-12-01 18:05:59 +00:00
|
|
|
* gst_query_parse_scheduling:
|
2011-05-24 10:52:09 +00:00
|
|
|
* @query: A valid #GstQuery of type GST_QUERY_SCHEDULING.
|
2012-01-30 14:59:02 +00:00
|
|
|
* @flags: (out) (allow-none): #GstSchedulingFlags
|
|
|
|
* @minsize: (out) (allow-none): the suggested minimum size of pull requests
|
|
|
|
* @maxsize: (out) (allow-none): the suggested maximum size of pull requests:
|
|
|
|
* @align: (out) (allow-none): the suggested alignment of pull requests
|
2011-05-24 10:52:09 +00:00
|
|
|
*
|
|
|
|
* Set the scheduling properties.
|
|
|
|
*/
|
|
|
|
void
|
2011-11-18 16:27:16 +00:00
|
|
|
gst_query_parse_scheduling (GstQuery * query, GstSchedulingFlags * flags,
|
2011-05-24 10:52:09 +00:00
|
|
|
gint * minsize, gint * maxsize, gint * align)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING);
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
gst_structure_id_get (structure,
|
2011-11-18 16:27:16 +00:00
|
|
|
GST_QUARK (FLAGS), GST_TYPE_SCHEDULING_FLAGS, flags,
|
2011-05-24 10:52:09 +00:00
|
|
|
GST_QUARK (MINSIZE), G_TYPE_INT, minsize,
|
|
|
|
GST_QUARK (MAXSIZE), G_TYPE_INT, maxsize,
|
|
|
|
GST_QUARK (ALIGN), G_TYPE_INT, align, NULL);
|
|
|
|
}
|
2011-11-09 16:36:00 +00:00
|
|
|
|
2011-11-18 16:27:16 +00:00
|
|
|
/**
|
2011-12-01 18:05:59 +00:00
|
|
|
* gst_query_add_scheduling_mode:
|
2011-11-18 16:27:16 +00:00
|
|
|
* @query: a GST_QUERY_SCHEDULING type query #GstQuery
|
|
|
|
* @mode: a #GstPadMode
|
|
|
|
*
|
|
|
|
* Add @mode as aone of the supported scheduling modes to @query.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_add_scheduling_mode (GstQuery * query, GstPadMode mode)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
2012-01-25 15:14:17 +00:00
|
|
|
GArray *array;
|
2011-11-18 16:27:16 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING);
|
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2012-01-30 14:59:02 +00:00
|
|
|
array =
|
|
|
|
ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL);
|
2011-11-18 16:27:16 +00:00
|
|
|
|
2012-01-25 15:14:17 +00:00
|
|
|
g_array_append_val (array, mode);
|
2011-11-18 16:27:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_get_n_scheduling_modes:
|
|
|
|
* @query: a GST_QUERY_SCHEDULING type query #GstQuery
|
|
|
|
*
|
|
|
|
* Retrieve the number of values currently stored in the
|
|
|
|
* scheduling mode array of the query's structure.
|
|
|
|
*
|
|
|
|
* Returns: the scheduling mode array size as a #guint.
|
|
|
|
*/
|
|
|
|
guint
|
|
|
|
gst_query_get_n_scheduling_modes (GstQuery * query)
|
|
|
|
{
|
2012-01-25 15:14:17 +00:00
|
|
|
GArray *array;
|
2011-11-18 16:27:16 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING, 0);
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2012-01-30 14:59:02 +00:00
|
|
|
array =
|
|
|
|
ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL);
|
2011-11-18 16:27:16 +00:00
|
|
|
|
2012-01-25 15:14:17 +00:00
|
|
|
return array->len;
|
2011-11-18 16:27:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-12-01 18:05:59 +00:00
|
|
|
* gst_query_parse_nth_scheduling_mode:
|
2011-11-18 16:27:16 +00:00
|
|
|
* @query: a GST_QUERY_SCHEDULING type query #GstQuery
|
|
|
|
* @index: position in the scheduling modes array to read
|
|
|
|
*
|
|
|
|
* Parse an available query and get the scheduling mode
|
|
|
|
* at @index of the scheduling modes array.
|
|
|
|
*
|
|
|
|
* Returns: a #GstPadMode of the scheduling mode at @index.
|
|
|
|
*/
|
|
|
|
GstPadMode
|
|
|
|
gst_query_parse_nth_scheduling_mode (GstQuery * query, guint index)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
2012-01-25 15:14:17 +00:00
|
|
|
GArray *array;
|
2011-11-18 16:27:16 +00:00
|
|
|
|
2012-03-01 13:49:38 +00:00
|
|
|
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING,
|
|
|
|
GST_PAD_MODE_NONE);
|
2011-11-18 16:27:16 +00:00
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2012-01-30 14:59:02 +00:00
|
|
|
array =
|
|
|
|
ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL);
|
2012-03-01 13:49:38 +00:00
|
|
|
g_return_val_if_fail (index < array->len, GST_PAD_MODE_NONE);
|
2011-11-18 16:27:16 +00:00
|
|
|
|
2012-03-01 13:49:38 +00:00
|
|
|
return g_array_index (array, GstPadMode, index);
|
2011-11-18 16:27:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-12-01 18:05:59 +00:00
|
|
|
* gst_query_has_scheduling_mode:
|
2011-11-18 16:27:16 +00:00
|
|
|
* @query: a GST_QUERY_SCHEDULING type query #GstQuery
|
|
|
|
* @mode: the scheduling mode
|
|
|
|
*
|
|
|
|
* Check if @query has scheduling mode set.
|
|
|
|
*
|
2012-09-10 20:39:32 +00:00
|
|
|
* <note>
|
|
|
|
* <para>
|
|
|
|
* When checking if upstream supports pull mode, it is usually not
|
|
|
|
* enough to just check for GST_PAD_MODE_PULL with this function, you
|
|
|
|
* also want to check whether the scheduling flags returned by
|
|
|
|
* gst_query_parse_scheduling() have the seeking flag set (meaning
|
|
|
|
* random access is supported, not only sequential pulls).
|
|
|
|
* </para>
|
|
|
|
* </note>
|
|
|
|
*
|
2011-11-18 16:27:16 +00:00
|
|
|
* Returns: TRUE when @mode is in the list of scheduling modes.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_query_has_scheduling_mode (GstQuery * query, GstPadMode mode)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
2012-01-25 15:14:17 +00:00
|
|
|
GArray *array;
|
|
|
|
guint i, len;
|
2011-11-18 16:27:16 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING, FALSE);
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2012-01-30 14:59:02 +00:00
|
|
|
array =
|
|
|
|
ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL);
|
2011-11-18 16:27:16 +00:00
|
|
|
|
2012-01-25 15:14:17 +00:00
|
|
|
len = array->len;
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
if (mode == g_array_index (array, GstPadMode, i))
|
2011-11-18 16:27:16 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2012-09-11 14:39:34 +00:00
|
|
|
/**
|
|
|
|
* gst_query_has_scheduling_mode_with_flags:
|
|
|
|
* @query: a GST_QUERY_SCHEDULING type query #GstQuery
|
|
|
|
* @mode: the scheduling mode
|
|
|
|
* @flags: #GstSchedulingFlags
|
|
|
|
*
|
|
|
|
* Check if @query has scheduling mode set and @flags is set in
|
|
|
|
* query scheduling flags.
|
|
|
|
*
|
|
|
|
* Returns: TRUE when @mode is in the list of scheduling modes
|
|
|
|
* and @flags are compatible with query flags.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_query_has_scheduling_mode_with_flags (GstQuery * query, GstPadMode mode,
|
|
|
|
GstSchedulingFlags flags)
|
|
|
|
{
|
|
|
|
GstSchedulingFlags sched_flags;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING, FALSE);
|
|
|
|
|
|
|
|
gst_query_parse_scheduling (query, &sched_flags, NULL, NULL, NULL);
|
|
|
|
|
2012-09-11 15:27:03 +00:00
|
|
|
return ((flags & sched_flags) == flags) &&
|
2012-09-11 14:39:34 +00:00
|
|
|
gst_query_has_scheduling_mode (query, mode);
|
|
|
|
}
|
|
|
|
|
2011-11-09 16:36:00 +00:00
|
|
|
/**
|
2011-12-01 18:05:59 +00:00
|
|
|
* gst_query_new_accept_caps:
|
2012-03-21 08:00:45 +00:00
|
|
|
* @caps: a fixed #GstCaps
|
2011-11-09 16:36:00 +00:00
|
|
|
*
|
|
|
|
* Constructs a new query object for querying if @caps are accepted.
|
|
|
|
*
|
|
|
|
* Free-function: gst_query_unref
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new #GstQuery
|
|
|
|
*/
|
|
|
|
GstQuery *
|
|
|
|
gst_query_new_accept_caps (GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2012-03-21 08:00:45 +00:00
|
|
|
g_return_val_if_fail (gst_caps_is_fixed (caps), NULL);
|
|
|
|
|
2011-11-09 16:36:00 +00:00
|
|
|
structure = gst_structure_new_id (GST_QUARK (QUERY_ACCEPT_CAPS),
|
|
|
|
GST_QUARK (CAPS), GST_TYPE_CAPS, caps,
|
|
|
|
GST_QUARK (RESULT), G_TYPE_BOOLEAN, FALSE, NULL);
|
2012-02-10 13:58:13 +00:00
|
|
|
query = gst_query_new_custom (GST_QUERY_ACCEPT_CAPS, structure);
|
2011-11-09 16:36:00 +00:00
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
2011-11-12 00:51:11 +00:00
|
|
|
/**
|
|
|
|
* gst_query_parse_accept_caps:
|
|
|
|
* @query: The query to parse
|
2013-08-12 12:25:34 +00:00
|
|
|
* @caps: (out) (transfer none): A pointer to the caps
|
2011-11-12 00:51:11 +00:00
|
|
|
*
|
|
|
|
* Get the caps from @query. The caps remains valid as long as @query remains
|
|
|
|
* valid.
|
|
|
|
*/
|
2011-11-09 16:36:00 +00:00
|
|
|
void
|
|
|
|
gst_query_parse_accept_caps (GstQuery * query, GstCaps ** caps)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ACCEPT_CAPS);
|
2012-01-30 14:59:02 +00:00
|
|
|
g_return_if_fail (caps != NULL);
|
2011-11-09 16:36:00 +00:00
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2011-11-12 00:51:11 +00:00
|
|
|
*caps = g_value_get_boxed (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (CAPS)));
|
2011-11-09 16:36:00 +00:00
|
|
|
}
|
|
|
|
|
2012-06-15 10:55:20 +00:00
|
|
|
/**
|
|
|
|
* gst_query_set_accept_caps_result:
|
|
|
|
* @query: a GST_QUERY_ACCEPT_CAPS type query #GstQuery
|
|
|
|
* @result: the result to set
|
|
|
|
*
|
|
|
|
* Set @result as the result for the @query.
|
|
|
|
*/
|
2011-11-09 16:36:00 +00:00
|
|
|
void
|
|
|
|
gst_query_set_accept_caps_result (GstQuery * query, gboolean result)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ACCEPT_CAPS);
|
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
gst_structure_id_set (structure,
|
|
|
|
GST_QUARK (RESULT), G_TYPE_BOOLEAN, result, NULL);
|
|
|
|
}
|
|
|
|
|
2012-06-15 10:55:20 +00:00
|
|
|
/**
|
|
|
|
* gst_query_parse_accept_caps_result:
|
|
|
|
* @query: a GST_QUERY_ACCEPT_CAPS type query #GstQuery
|
|
|
|
* @result: location for the result
|
|
|
|
*
|
|
|
|
* Parse the result from @query and store in @result.
|
|
|
|
*/
|
2011-11-09 16:36:00 +00:00
|
|
|
void
|
|
|
|
gst_query_parse_accept_caps_result (GstQuery * query, gboolean * result)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ACCEPT_CAPS);
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
gst_structure_id_get (structure,
|
|
|
|
GST_QUARK (RESULT), G_TYPE_BOOLEAN, result, NULL);
|
|
|
|
}
|
2011-11-14 10:26:17 +00:00
|
|
|
|
|
|
|
/**
|
2011-12-01 18:05:59 +00:00
|
|
|
* gst_query_new_caps:
|
2011-11-24 21:52:19 +00:00
|
|
|
* @filter: a filter
|
2011-11-14 10:26:17 +00:00
|
|
|
*
|
|
|
|
* Constructs a new query object for querying the caps.
|
|
|
|
*
|
2012-06-06 07:15:04 +00:00
|
|
|
* The CAPS query should return the allowable caps for a pad in the context
|
2011-11-15 10:20:48 +00:00
|
|
|
* of the element's state, its link to other elements, and the devices or files
|
|
|
|
* it has opened. These caps must be a subset of the pad template caps. In the
|
|
|
|
* NULL state with no links, the CAPS query should ideally return the same caps
|
|
|
|
* as the pad template. In rare circumstances, an object property can affect
|
|
|
|
* the caps returned by the CAPS query, but this is discouraged.
|
|
|
|
*
|
|
|
|
* For most filters, the caps returned by CAPS query is directly affected by the
|
|
|
|
* allowed caps on other pads. For demuxers and decoders, the caps returned by
|
|
|
|
* the srcpad's getcaps function is directly related to the stream data. Again,
|
|
|
|
* the CAPS query should return the most specific caps it reasonably can, since this
|
|
|
|
* helps with autoplugging.
|
|
|
|
*
|
2012-06-06 07:15:04 +00:00
|
|
|
* The @filter is used to restrict the result caps, only the caps matching
|
|
|
|
* @filter should be returned from the CAPS query. Specifying a filter might
|
|
|
|
* greatly reduce the amount of processing an element needs to do.
|
|
|
|
*
|
2011-11-14 10:26:17 +00:00
|
|
|
* Free-function: gst_query_unref
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new #GstQuery
|
|
|
|
*/
|
|
|
|
GstQuery *
|
2011-11-15 10:20:48 +00:00
|
|
|
gst_query_new_caps (GstCaps * filter)
|
2011-11-14 10:26:17 +00:00
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
structure = gst_structure_new_id (GST_QUARK (QUERY_CAPS),
|
2011-11-15 10:20:48 +00:00
|
|
|
GST_QUARK (FILTER), GST_TYPE_CAPS, filter,
|
2011-11-14 10:26:17 +00:00
|
|
|
GST_QUARK (CAPS), GST_TYPE_CAPS, NULL, NULL);
|
2012-02-10 13:58:13 +00:00
|
|
|
query = gst_query_new_custom (GST_QUERY_CAPS, structure);
|
2011-11-14 10:26:17 +00:00
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-11-15 10:20:48 +00:00
|
|
|
* gst_query_parse_caps:
|
|
|
|
* @query: The query to parse
|
2013-08-12 12:25:34 +00:00
|
|
|
* @filter: (out) (transfer none): A pointer to the caps filter
|
2011-11-15 10:20:48 +00:00
|
|
|
*
|
|
|
|
* Get the filter from the caps @query. The caps remains valid as long as
|
|
|
|
* @query remains valid.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_parse_caps (GstQuery * query, GstCaps ** filter)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CAPS);
|
2012-01-30 14:59:02 +00:00
|
|
|
g_return_if_fail (filter != NULL);
|
2011-11-15 10:20:48 +00:00
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
*filter = g_value_get_boxed (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (FILTER)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_set_caps_result:
|
2011-11-14 10:26:17 +00:00
|
|
|
* @query: The query to use
|
|
|
|
* @caps: (in): A pointer to the caps
|
|
|
|
*
|
2011-11-15 10:20:48 +00:00
|
|
|
* Set the @caps result in @query.
|
2011-11-14 10:26:17 +00:00
|
|
|
*/
|
|
|
|
void
|
2011-11-15 10:20:48 +00:00
|
|
|
gst_query_set_caps_result (GstQuery * query, GstCaps * caps)
|
2011-11-14 10:26:17 +00:00
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CAPS);
|
|
|
|
g_return_if_fail (gst_query_is_writable (query));
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
gst_structure_id_set (structure, GST_QUARK (CAPS), GST_TYPE_CAPS, caps, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-11-15 10:20:48 +00:00
|
|
|
* gst_query_parse_caps_result:
|
2011-11-14 10:26:17 +00:00
|
|
|
* @query: The query to parse
|
2013-08-12 12:25:34 +00:00
|
|
|
* @caps: (out) (transfer none): A pointer to the caps
|
2011-11-14 10:26:17 +00:00
|
|
|
*
|
2011-11-15 10:20:48 +00:00
|
|
|
* Get the caps result from @query. The caps remains valid as long as
|
|
|
|
* @query remains valid.
|
2011-11-14 10:26:17 +00:00
|
|
|
*/
|
|
|
|
void
|
2011-11-15 10:20:48 +00:00
|
|
|
gst_query_parse_caps_result (GstQuery * query, GstCaps ** caps)
|
2011-11-14 10:26:17 +00:00
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CAPS);
|
2012-01-30 14:59:02 +00:00
|
|
|
g_return_if_fail (caps != NULL);
|
2011-11-14 10:26:17 +00:00
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
*caps = g_value_get_boxed (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (CAPS)));
|
|
|
|
}
|
2011-11-15 10:20:48 +00:00
|
|
|
|
2012-06-15 10:55:20 +00:00
|
|
|
#if 0
|
2011-11-15 10:20:48 +00:00
|
|
|
void
|
|
|
|
gst_query_intersect_caps_result (GstQuery * query, GstCaps * filter,
|
|
|
|
GstCapsIntersectMode mode)
|
|
|
|
{
|
2011-12-04 10:42:39 +00:00
|
|
|
GstCaps *res, *caps = NULL;
|
2011-11-15 10:20:48 +00:00
|
|
|
|
|
|
|
gst_query_parse_caps_result (query, &caps);
|
|
|
|
res = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
gst_query_set_caps_result (query, res);
|
|
|
|
gst_caps_unref (res);
|
|
|
|
}
|
2012-06-15 10:55:20 +00:00
|
|
|
#endif
|
2012-03-14 15:14:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_new_drain:
|
|
|
|
*
|
|
|
|
* Constructs a new query object for querying the drain state.
|
|
|
|
*
|
|
|
|
* Free-function: gst_query_unref
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new #GstQuery
|
|
|
|
*/
|
|
|
|
GstQuery *
|
|
|
|
gst_query_new_drain (void)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
structure = gst_structure_new_id_empty (GST_QUARK (QUERY_DRAIN));
|
|
|
|
query = gst_query_new_custom (GST_QUERY_DRAIN, structure);
|
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
2013-03-28 14:35:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_new_context:
|
2013-09-17 11:50:08 +00:00
|
|
|
* @context_type: Context type to query
|
2013-03-28 14:35:13 +00:00
|
|
|
*
|
|
|
|
* Constructs a new query object for querying the pipeline-local context.
|
|
|
|
*
|
|
|
|
* Free-function: gst_query_unref
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new #GstQuery
|
2013-07-16 13:46:15 +00:00
|
|
|
*
|
|
|
|
* Since: 1.2
|
2013-03-28 14:35:13 +00:00
|
|
|
*/
|
|
|
|
GstQuery *
|
2013-09-17 11:50:08 +00:00
|
|
|
gst_query_new_context (const gchar * context_type)
|
2013-03-28 14:35:13 +00:00
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2013-09-17 11:50:08 +00:00
|
|
|
g_return_val_if_fail (context_type != NULL, NULL);
|
|
|
|
|
|
|
|
structure = gst_structure_new_id (GST_QUARK (QUERY_CONTEXT),
|
2013-09-17 19:36:22 +00:00
|
|
|
GST_QUARK (CONTEXT_TYPE), G_TYPE_STRING, context_type, NULL);
|
2013-03-28 14:35:13 +00:00
|
|
|
query = gst_query_new_custom (GST_QUERY_CONTEXT, structure);
|
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_set_context:
|
|
|
|
* @query: a #GstQuery with query type GST_QUERY_CONTEXT
|
|
|
|
* @context: the requested #GstContext
|
|
|
|
*
|
|
|
|
* Answer a context query by setting the requested context.
|
2013-07-16 13:46:15 +00:00
|
|
|
*
|
|
|
|
* Since: 1.2
|
2013-03-28 14:35:13 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_set_context (GstQuery * query, GstContext * context)
|
|
|
|
{
|
|
|
|
GstStructure *s;
|
2013-09-17 11:50:08 +00:00
|
|
|
const gchar *context_type;
|
2013-03-28 14:35:13 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT);
|
|
|
|
|
2013-09-17 11:50:08 +00:00
|
|
|
gst_query_parse_context_type (query, &context_type);
|
|
|
|
g_return_if_fail (strcmp (gst_context_get_context_type (context),
|
|
|
|
context_type) == 0);
|
|
|
|
|
2013-03-28 14:35:13 +00:00
|
|
|
s = GST_QUERY_STRUCTURE (query);
|
|
|
|
|
|
|
|
gst_structure_id_set (s,
|
|
|
|
GST_QUARK (CONTEXT), GST_TYPE_CONTEXT, context, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_parse_context:
|
|
|
|
* @query: The query to parse
|
2013-08-12 12:25:34 +00:00
|
|
|
* @context: (out) (transfer none): A pointer to store the #GstContext
|
2013-03-28 14:35:13 +00:00
|
|
|
*
|
|
|
|
* Get the context from the context @query. The context remains valid as long as
|
|
|
|
* @query remains valid.
|
2013-07-16 13:46:15 +00:00
|
|
|
*
|
|
|
|
* Since: 1.2
|
2013-03-28 14:35:13 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_parse_context (GstQuery * query, GstContext ** context)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
2013-07-16 14:24:38 +00:00
|
|
|
const GValue *v;
|
2013-03-28 14:35:13 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT);
|
|
|
|
g_return_if_fail (context != NULL);
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
2013-07-16 14:24:38 +00:00
|
|
|
v = gst_structure_id_get_value (structure, GST_QUARK (CONTEXT));
|
|
|
|
if (v)
|
|
|
|
*context = g_value_get_boxed (v);
|
|
|
|
else
|
|
|
|
*context = NULL;
|
2013-03-28 14:35:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-09-17 11:50:08 +00:00
|
|
|
* gst_query_parse_context_type:
|
2013-07-16 13:16:16 +00:00
|
|
|
* @query: a GST_QUERY_CONTEXT type query
|
2013-08-12 12:25:34 +00:00
|
|
|
* @context_type: (out) (transfer none) (allow-none): the context type, or NULL
|
2013-03-28 14:35:13 +00:00
|
|
|
*
|
2013-09-17 11:50:08 +00:00
|
|
|
* Parse a context type from an existing GST_QUERY_CONTEXT query.
|
2013-03-28 14:35:13 +00:00
|
|
|
*
|
|
|
|
* Returns: a #gboolean indicating if the parsing succeeded.
|
2013-07-16 13:46:15 +00:00
|
|
|
*
|
|
|
|
* Since: 1.2
|
2013-03-28 14:35:13 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
2013-09-17 11:50:08 +00:00
|
|
|
gst_query_parse_context_type (GstQuery * query, const gchar ** context_type)
|
2013-03-28 14:35:13 +00:00
|
|
|
{
|
|
|
|
GstStructure *structure;
|
2013-09-17 11:50:08 +00:00
|
|
|
const GValue *value;
|
2013-03-28 14:35:13 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT, FALSE);
|
|
|
|
|
|
|
|
structure = GST_QUERY_STRUCTURE (query);
|
|
|
|
|
2013-09-17 11:50:08 +00:00
|
|
|
if (context_type) {
|
|
|
|
value = gst_structure_id_get_value (structure, GST_QUARK (CONTEXT_TYPE));
|
|
|
|
*context_type = g_value_get_string (value);
|
2013-07-16 13:16:16 +00:00
|
|
|
}
|
|
|
|
|
2013-09-17 11:50:08 +00:00
|
|
|
return TRUE;
|
2013-07-16 13:16:16 +00:00
|
|
|
}
|