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
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
2005-10-15 16:01:57 +00:00
|
|
|
|
2005-08-29 21:41:02 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstquery
|
2005-11-10 10:17:01 +00:00
|
|
|
* @short_description: Dynamically register new query types. 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
|
|
|
|
*
|
2005-09-26 15:03:43 +00:00
|
|
|
* GstQuery functions are used to register a new query types to the gstreamer
|
2005-10-15 15:30:24 +00:00
|
|
|
* core.
|
2005-08-29 21:41:02 +00:00
|
|
|
* Query types can be used to perform queries on pads and elements.
|
|
|
|
*
|
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>
|
|
|
|
*
|
|
|
|
* Last reviewed on 2006-02-14 (0.10.4)
|
2005-08-29 21:41:02 +00:00
|
|
|
*/
|
2003-01-01 03:09:39 +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"
|
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
|
|
|
|
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
|
|
|
static void gst_query_finalize (GstQuery * query);
|
|
|
|
static GstQuery *_gst_query_copy (GstQuery * query);
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
|
2003-01-01 03:09:39 +00:00
|
|
|
static GList *_gst_queries = NULL;
|
|
|
|
static GHashTable *_nick_to_query = NULL;
|
|
|
|
static GHashTable *_query_type_to_nick = NULL;
|
2005-03-07 18:27:42 +00:00
|
|
|
static guint32 _n_values = 1; /* we start from 1 because 0 reserved for NONE */
|
2003-01-01 03:09:39 +00:00
|
|
|
|
2008-02-12 12:04:43 +00:00
|
|
|
static GstMiniObjectClass *parent_class = NULL;
|
|
|
|
|
2003-01-01 03:09:39 +00:00
|
|
|
static GstQueryTypeDefinition standard_definitions[] = {
|
2005-11-19 18:57:00 +00:00
|
|
|
{GST_QUERY_POSITION, "position", "Current position", 0},
|
|
|
|
{GST_QUERY_DURATION, "duration", "Total duration", 0},
|
|
|
|
{GST_QUERY_LATENCY, "latency", "Latency", 0},
|
|
|
|
{GST_QUERY_JITTER, "jitter", "Jitter", 0},
|
|
|
|
{GST_QUERY_RATE, "rate", "Configured rate 1000000 = 1", 0},
|
|
|
|
{GST_QUERY_SEEKING, "seeking", "Seeking capabilities and parameters", 0},
|
|
|
|
{GST_QUERY_SEGMENT, "segment", "currently configured segment", 0},
|
|
|
|
{GST_QUERY_CONVERT, "convert", "Converting between formats", 0},
|
|
|
|
{GST_QUERY_FORMATS, "formats", "Supported formats for conversion", 0},
|
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_QUERY_BUFFERING, "buffering", "Buffering status", 0},
|
2008-11-20 10:35:50 +00:00
|
|
|
{GST_QUERY_CUSTOM, "custom", "Custom query", 0},
|
2008-12-20 17:33:44 +00:00
|
|
|
{GST_QUERY_URI, "uri", "URI of the source or sink", 0},
|
2005-11-19 18:57:00 +00:00
|
|
|
{0, NULL, NULL, 0}
|
2003-01-01 03:09:39 +00:00
|
|
|
};
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
void
|
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_initialize (void)
|
2003-01-01 03:09:39 +00:00
|
|
|
{
|
|
|
|
GstQueryTypeDefinition *standards = standard_definitions;
|
|
|
|
|
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_CAT_INFO (GST_CAT_GST_INIT, "init queries");
|
|
|
|
|
2005-05-09 10:53:13 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_query_debug, "query", 0, "query system");
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
g_static_mutex_lock (&mutex);
|
2003-01-01 03:09:39 +00:00
|
|
|
if (_nick_to_query == NULL) {
|
|
|
|
_nick_to_query = g_hash_table_new (g_str_hash, g_str_equal);
|
|
|
|
_query_type_to_nick = g_hash_table_new (NULL, NULL);
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-01-01 03:09:39 +00:00
|
|
|
while (standards->nick) {
|
2005-11-19 18:57:00 +00:00
|
|
|
standards->quark = g_quark_from_static_string (standards->nick);
|
2010-03-03 10:45:38 +00:00
|
|
|
g_hash_table_insert (_nick_to_query, (gpointer) standards->nick, standards);
|
2004-03-13 15:27:01 +00:00
|
|
|
g_hash_table_insert (_query_type_to_nick,
|
2004-03-15 19:27:17 +00:00
|
|
|
GINT_TO_POINTER (standards->value), standards);
|
2003-01-01 03:09:39 +00:00
|
|
|
|
|
|
|
_gst_queries = g_list_append (_gst_queries, standards);
|
|
|
|
standards++;
|
|
|
|
_n_values++;
|
|
|
|
}
|
2005-03-07 18:27:42 +00:00
|
|
|
g_static_mutex_unlock (&mutex);
|
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
|
|
|
|
2007-11-01 21:50:05 +00:00
|
|
|
g_type_class_ref (gst_query_get_type ());
|
2003-01-01 03:09:39 +00:00
|
|
|
}
|
|
|
|
|
2005-11-20 14:50:43 +00:00
|
|
|
/**
|
|
|
|
* gst_query_type_get_name:
|
|
|
|
* @query: the query type
|
|
|
|
*
|
|
|
|
* 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 *
|
|
|
|
gst_query_type_get_name (GstQueryType query)
|
|
|
|
{
|
|
|
|
const GstQueryTypeDefinition *def;
|
|
|
|
|
|
|
|
def = gst_query_type_get_details (query);
|
|
|
|
|
|
|
|
return def->nick;
|
|
|
|
}
|
|
|
|
|
2005-11-20 14:50:43 +00:00
|
|
|
/**
|
|
|
|
* gst_query_type_to_quark:
|
|
|
|
* @query: the query type
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
gst_query_type_to_quark (GstQueryType query)
|
|
|
|
{
|
|
|
|
const GstQueryTypeDefinition *def;
|
|
|
|
|
|
|
|
def = gst_query_type_get_details (query);
|
|
|
|
|
|
|
|
return def->quark;
|
|
|
|
}
|
|
|
|
|
2009-04-04 08:20:36 +00:00
|
|
|
G_DEFINE_TYPE (GstQuery, gst_query, GST_TYPE_MINI_OBJECT);
|
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
|
|
|
|
|
|
|
static void
|
2009-04-04 08:20:36 +00:00
|
|
|
gst_query_class_init (GstQueryClass * klass)
|
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
|
|
|
{
|
2009-04-04 08:20:36 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2008-02-12 12:04:43 +00:00
|
|
|
|
2009-04-04 08:20:36 +00:00
|
|
|
klass->mini_object_class.copy = (GstMiniObjectCopyFunction) _gst_query_copy;
|
|
|
|
klass->mini_object_class.finalize =
|
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
|
|
|
(GstMiniObjectFinalizeFunction) gst_query_finalize;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-04-04 08:20:36 +00:00
|
|
|
static void
|
|
|
|
gst_query_init (GstQuery * query)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
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
|
|
|
static void
|
|
|
|
gst_query_finalize (GstQuery * query)
|
|
|
|
{
|
|
|
|
g_return_if_fail (query != NULL);
|
|
|
|
|
|
|
|
if (query->structure) {
|
|
|
|
gst_structure_set_parent_refcount (query->structure, NULL);
|
|
|
|
gst_structure_free (query->structure);
|
|
|
|
}
|
2008-02-12 12:04:43 +00:00
|
|
|
|
2009-06-24 08:45:52 +00:00
|
|
|
/* GST_MINI_OBJECT_CLASS (parent_class)->finalize (GST_MINI_OBJECT (query)); */
|
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
|
|
|
}
|
|
|
|
|
|
|
|
static GstQuery *
|
|
|
|
_gst_query_copy (GstQuery * query)
|
|
|
|
{
|
|
|
|
GstQuery *copy;
|
|
|
|
|
|
|
|
copy = (GstQuery *) gst_mini_object_new (GST_TYPE_QUERY);
|
|
|
|
|
|
|
|
copy->type = query->type;
|
|
|
|
|
|
|
|
if (query->structure) {
|
|
|
|
copy->structure = gst_structure_copy (query->structure);
|
|
|
|
gst_structure_set_parent_refcount (copy->structure,
|
|
|
|
&query->mini_object.refcount);
|
|
|
|
}
|
|
|
|
|
|
|
|
return copy;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-01-01 03:09:39 +00:00
|
|
|
/**
|
|
|
|
* gst_query_type_register:
|
|
|
|
* @nick: The nick of the new query
|
|
|
|
* @description: The description of the new query
|
|
|
|
*
|
|
|
|
* Create a new GstQueryType based on the nick or return an
|
2005-11-09 19:32:32 +00:00
|
|
|
* already registered query with that nick
|
2003-01-01 03:09:39 +00:00
|
|
|
*
|
|
|
|
* Returns: A new GstQueryType or an already registered query
|
|
|
|
* with the same nick.
|
|
|
|
*/
|
|
|
|
GstQueryType
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_query_type_register (const gchar * nick, const gchar * description)
|
2003-01-01 03:09:39 +00:00
|
|
|
{
|
|
|
|
GstQueryTypeDefinition *query;
|
|
|
|
GstQueryType lookup;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-01-01 03:09:39 +00:00
|
|
|
g_return_val_if_fail (nick != NULL, 0);
|
|
|
|
g_return_val_if_fail (description != NULL, 0);
|
|
|
|
|
|
|
|
lookup = gst_query_type_get_by_nick (nick);
|
|
|
|
if (lookup != GST_QUERY_NONE)
|
|
|
|
return lookup;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2010-03-28 16:05:36 +00:00
|
|
|
query = g_slice_new (GstQueryTypeDefinition);
|
2003-01-01 03:09:39 +00:00
|
|
|
query->value = _n_values;
|
|
|
|
query->nick = g_strdup (nick);
|
|
|
|
query->description = g_strdup (description);
|
2005-11-19 18:57:00 +00:00
|
|
|
query->quark = g_quark_from_static_string (query->nick);
|
2003-01-01 03:09:39 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
g_static_mutex_lock (&mutex);
|
2010-03-03 10:45:38 +00:00
|
|
|
g_hash_table_insert (_nick_to_query, (gpointer) query->nick, query);
|
2004-03-13 15:27:01 +00:00
|
|
|
g_hash_table_insert (_query_type_to_nick, GINT_TO_POINTER (query->value),
|
|
|
|
query);
|
2003-01-01 03:09:39 +00:00
|
|
|
_gst_queries = g_list_append (_gst_queries, query);
|
|
|
|
_n_values++;
|
2005-03-07 18:27:42 +00:00
|
|
|
g_static_mutex_unlock (&mutex);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-01-01 03:09:39 +00:00
|
|
|
return query->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_type_get_by_nick:
|
|
|
|
* @nick: The nick of the query
|
|
|
|
*
|
2005-11-20 14:50:43 +00:00
|
|
|
* Get the query type registered with @nick.
|
|
|
|
*
|
2005-11-10 10:17:01 +00:00
|
|
|
* Returns: The query registered with @nick or #GST_QUERY_NONE
|
2003-01-01 03:09:39 +00:00
|
|
|
* if the query was not registered.
|
|
|
|
*/
|
|
|
|
GstQueryType
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_query_type_get_by_nick (const gchar * nick)
|
2003-01-01 03:09:39 +00:00
|
|
|
{
|
|
|
|
GstQueryTypeDefinition *query;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-01-01 03:09:39 +00:00
|
|
|
g_return_val_if_fail (nick != NULL, 0);
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
g_static_mutex_lock (&mutex);
|
2003-01-01 03:09:39 +00:00
|
|
|
query = g_hash_table_lookup (_nick_to_query, nick);
|
2005-03-07 18:27:42 +00:00
|
|
|
g_static_mutex_unlock (&mutex);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-01-01 03:09:39 +00:00
|
|
|
if (query != NULL)
|
|
|
|
return query->value;
|
|
|
|
else
|
|
|
|
return GST_QUERY_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2003-01-02 18:56:09 +00:00
|
|
|
* gst_query_types_contains:
|
|
|
|
* @types: The query array to search
|
2005-11-09 19:32:32 +00:00
|
|
|
* @type: the #GstQueryType to find
|
2003-01-01 03:09:39 +00:00
|
|
|
*
|
2005-11-09 19:32:32 +00:00
|
|
|
* See if the given #GstQueryType is inside the @types query types array.
|
2003-01-01 03:09:39 +00:00
|
|
|
*
|
2005-11-09 19:32:32 +00:00
|
|
|
* Returns: TRUE if the type is found inside the array
|
2003-01-01 03:09:39 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_query_types_contains (const GstQueryType * types, GstQueryType type)
|
2003-01-01 03:09:39 +00:00
|
|
|
{
|
2003-01-02 18:56:09 +00:00
|
|
|
if (!types)
|
2003-01-01 03:09:39 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2003-01-02 18:56:09 +00:00
|
|
|
while (*types) {
|
|
|
|
if (*types == type)
|
2003-01-01 03:09:39 +00:00
|
|
|
return TRUE;
|
|
|
|
|
2003-01-02 18:56:09 +00:00
|
|
|
types++;
|
2003-01-01 03:09:39 +00:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_type_get_details:
|
2005-11-09 19:32:32 +00:00
|
|
|
* @type: a #GstQueryType
|
2003-01-01 03:09:39 +00:00
|
|
|
*
|
2005-11-09 19:32:32 +00:00
|
|
|
* Get details about the given #GstQueryType.
|
2003-01-01 03:09:39 +00:00
|
|
|
*
|
2005-11-09 19:32:32 +00:00
|
|
|
* Returns: The #GstQueryTypeDefinition for @type or NULL on failure.
|
2003-01-01 03:09:39 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
const GstQueryTypeDefinition *
|
2003-01-02 18:56:09 +00:00
|
|
|
gst_query_type_get_details (GstQueryType type)
|
2003-01-01 03:09:39 +00:00
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
const GstQueryTypeDefinition *result;
|
|
|
|
|
|
|
|
g_static_mutex_lock (&mutex);
|
|
|
|
result = g_hash_table_lookup (_query_type_to_nick, GINT_TO_POINTER (type));
|
|
|
|
g_static_mutex_unlock (&mutex);
|
|
|
|
|
|
|
|
return result;
|
2003-01-01 03:09:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-03-07 18:27:42 +00:00
|
|
|
* gst_query_type_iterate_definitions:
|
2003-01-01 03:09:39 +00:00
|
|
|
*
|
2009-11-23 10:34:07 +00:00
|
|
|
* Get a #GstIterator of all the registered query types. The definitions
|
2005-11-09 19:32:32 +00:00
|
|
|
* iterated over are read only.
|
2003-01-01 03:09:39 +00:00
|
|
|
*
|
2005-03-07 18:27:42 +00:00
|
|
|
* Returns: A #GstIterator of #GstQueryTypeDefinition.
|
2003-01-01 03:09:39 +00:00
|
|
|
*/
|
2005-03-07 18:27:42 +00:00
|
|
|
GstIterator *
|
|
|
|
gst_query_type_iterate_definitions (void)
|
2003-01-01 03:09:39 +00:00
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
GstIterator *result;
|
|
|
|
|
|
|
|
g_static_mutex_lock (&mutex);
|
2005-10-07 00:14:45 +00:00
|
|
|
/* FIXME: register a boxed type for GstQueryTypeDefinition */
|
|
|
|
result = gst_iterator_new_list (G_TYPE_POINTER,
|
|
|
|
g_static_mutex_get_mutex (&mutex), &_n_values, &_gst_queries,
|
|
|
|
NULL, NULL, NULL);
|
2005-03-07 18:27:42 +00:00
|
|
|
g_static_mutex_unlock (&mutex);
|
|
|
|
|
|
|
|
return result;
|
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
|
|
|
|
|
|
|
static GstQuery *
|
|
|
|
gst_query_new (GstQueryType type, GstStructure * structure)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
|
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
|
|
|
query = (GstQuery *) gst_mini_object_new (GST_TYPE_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
|
|
|
|
|
|
|
GST_DEBUG ("creating new query %p %d", query, type);
|
|
|
|
|
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
|
|
|
query->type = 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
|
|
|
|
|
|
|
if (structure) {
|
|
|
|
query->structure = structure;
|
|
|
|
gst_structure_set_parent_refcount (query->structure,
|
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
|
|
|
&query->mini_object.refcount);
|
2005-05-09 10:53:13 +00:00
|
|
|
} else {
|
|
|
|
query->structure = 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
|
|
|
}
|
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
*
|
2005-11-09 19:32:32 +00:00
|
|
|
* Returns: A #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;
|
|
|
|
|
2009-05-29 17:22:42 +00:00
|
|
|
structure = gst_structure_id_new (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
|
|
|
|
2005-05-09 10:53:13 +00:00
|
|
|
query = gst_query_new (GST_QUERY_POSITION, structure);
|
|
|
|
|
|
|
|
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
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_POSITION);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
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_structure_id_set (structure,
|
|
|
|
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-06-16 16:10:06 +00:00
|
|
|
* @format: (out): the storage for the #GstFormat of the position values (may be NULL)
|
|
|
|
* @cur: (out): 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);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
if (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
|
|
|
*format = g_value_get_enum (gst_structure_id_get_value (structure,
|
|
|
|
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
|
|
|
*
|
2005-11-09 19:32:32 +00:00
|
|
|
* Returns: A #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;
|
|
|
|
|
2009-05-29 17:22:42 +00:00
|
|
|
structure = gst_structure_id_new (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
|
|
|
|
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
|
|
|
query = gst_query_new (GST_QUERY_DURATION, structure);
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_DURATION);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
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_structure_id_set (structure,
|
|
|
|
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
|
|
|
|
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-06-16 16:10:06 +00:00
|
|
|
* @format: (out): the storage for the #GstFormat of the duration value, or NULL.
|
|
|
|
* @duration: (out): 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);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
if (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
|
|
|
*format = g_value_get_enum (gst_structure_id_get_value (structure,
|
|
|
|
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.
|
|
|
|
*
|
|
|
|
* Returns: A #GstQuery
|
|
|
|
*
|
|
|
|
* Since: 0.10.12
|
|
|
|
*/
|
|
|
|
GstQuery *
|
|
|
|
gst_query_new_latency (void)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2009-05-29 17:22:42 +00:00
|
|
|
structure = gst_structure_id_new (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
|
|
|
|
|
|
|
query = gst_query_new (GST_QUERY_LATENCY, structure);
|
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_set_latency:
|
|
|
|
* @query: a #GstQuery
|
|
|
|
* @live: if there is a live element upstream
|
|
|
|
* @min_latency: the minimal latency of the live element
|
|
|
|
* @max_latency: the maximal latency of the live element
|
|
|
|
*
|
|
|
|
* Answer a latency query by setting the requested values in the given format.
|
|
|
|
*
|
|
|
|
* Since: 0.10.12
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_set_latency (GstQuery * query, gboolean live,
|
|
|
|
GstClockTime min_latency, GstClockTime max_latency)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY);
|
|
|
|
|
|
|
|
structure = gst_query_get_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
|
|
|
gst_structure_id_set (structure,
|
|
|
|
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-06-16 16:10:06 +00:00
|
|
|
* @live: (out): storage for live or NULL
|
|
|
|
* @min_latency: (out): the storage for the min latency or NULL
|
|
|
|
* @max_latency: (out): 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
|
|
|
*
|
|
|
|
* Since: 0.10.12
|
|
|
|
*/
|
|
|
|
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);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
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
|
|
|
*
|
2005-11-09 19:32:32 +00:00
|
|
|
* Returns: 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;
|
|
|
|
|
2009-05-29 17:22:42 +00:00
|
|
|
structure = gst_structure_id_new (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
|
|
|
|
2005-05-09 10:53:13 +00:00
|
|
|
query = gst_query_new (GST_QUERY_CONVERT, structure);
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONVERT);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
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_structure_id_set (structure,
|
|
|
|
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-06-16 16:10:06 +00:00
|
|
|
* @src_format: (out): the storage for the #GstFormat of the source value, or NULL
|
|
|
|
* @src_value: (out): the storage for the source value, or NULL
|
|
|
|
* @dest_format: (out): the storage for the #GstFormat of the destination value, or NULL
|
|
|
|
* @dest_value: (out): 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);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
if (src_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
|
|
|
*src_format = g_value_get_enum (gst_structure_id_get_value (structure,
|
|
|
|
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)
|
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_format = g_value_get_enum (gst_structure_id_get_value (structure,
|
|
|
|
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
|
|
|
*
|
2005-11-09 19:32:32 +00:00
|
|
|
* Returns: a #GstQuery
|
2005-09-22 17:40:42 +00:00
|
|
|
*/
|
|
|
|
GstQuery *
|
|
|
|
gst_query_new_segment (GstFormat format)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2009-05-29 17:22:42 +00:00
|
|
|
structure = gst_structure_id_new (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
|
|
|
|
2005-09-22 17:40:42 +00:00
|
|
|
query = gst_query_new (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
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEGMENT);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
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_structure_id_set (structure,
|
|
|
|
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-06-16 16:10:06 +00:00
|
|
|
* @rate: (out): the storage for the rate of the segment, or NULL
|
|
|
|
* @format: (out): the storage for the #GstFormat of the values, or NULL
|
|
|
|
* @start_value: (out): the storage for the start value, or NULL
|
|
|
|
* @stop_value: (out): 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);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
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)
|
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
|
|
|
*format = g_value_get_enum (gst_structure_id_get_value (structure,
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_new_application:
|
|
|
|
* @type: the query type
|
|
|
|
* @structure: a structure for the query
|
|
|
|
*
|
|
|
|
* Constructs a new custom application query object. Use gst_query_unref()
|
|
|
|
* when done with it.
|
|
|
|
*
|
2005-11-09 19:32:32 +00:00
|
|
|
* Returns: a #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 *
|
|
|
|
gst_query_new_application (GstQueryType type, GstStructure * structure)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (gst_query_type_get_details (type) != NULL, NULL);
|
|
|
|
g_return_val_if_fail (structure != NULL, NULL);
|
|
|
|
|
|
|
|
return gst_query_new (type, structure);
|
|
|
|
}
|
|
|
|
|
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.
|
|
|
|
*
|
|
|
|
* Returns: The #GstStructure of the query. The structure is still owned
|
|
|
|
* by the query and will therefore be freed when the query is unreffed.
|
|
|
|
*/
|
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
|
|
|
GstStructure *
|
|
|
|
gst_query_get_structure (GstQuery * query)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GST_IS_QUERY (query), NULL);
|
|
|
|
|
|
|
|
return query->structure;
|
|
|
|
}
|
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
|
|
|
/**
|
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
|
|
|
*
|
|
|
|
* Returns: A #GstQuery
|
|
|
|
*/
|
|
|
|
GstQuery *
|
|
|
|
gst_query_new_seeking (GstFormat format)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2009-05-29 17:22:42 +00:00
|
|
|
structure = gst_structure_id_new (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
|
|
|
|
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
|
|
|
query = gst_query_new (GST_QUERY_SEEKING, structure);
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEEKING);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
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_structure_id_set (structure,
|
|
|
|
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-06-16 16:10:06 +00:00
|
|
|
* @format: (out): the format to set for the @segment_start and @segment_end values
|
|
|
|
* @seekable: (out): the seekable flag to set
|
|
|
|
* @segment_start: (out): the segment_start to set
|
|
|
|
* @segment_end: (out): the segment_end to set
|
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);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
if (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
|
|
|
*format = g_value_get_enum (gst_structure_id_get_value (structure,
|
|
|
|
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
|
|
|
}
|
|
|
|
|
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
|
|
|
*
|
|
|
|
* Returns: A #GstQuery
|
|
|
|
*
|
|
|
|
* Since: 0.10.4
|
|
|
|
*/
|
|
|
|
GstQuery *
|
|
|
|
gst_query_new_formats (void)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2009-05-29 17:00:06 +00:00
|
|
|
structure = gst_structure_id_empty_new (GST_QUARK (QUERY_FORMATS));
|
2006-02-14 12:07:16 +00:00
|
|
|
query = gst_query_new (GST_QUERY_FORMATS, structure);
|
|
|
|
|
|
|
|
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, };
|
|
|
|
GstStructure *structure;
|
|
|
|
gint i;
|
|
|
|
|
2006-02-14 12:07:16 +00:00
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
structure = gst_query_get_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.
|
|
|
|
* @formats: An array containing @n_formats @GstFormat values.
|
|
|
|
*
|
|
|
|
* Set the formats query result fields in @query. The number of formats passed
|
|
|
|
* in the @formats array must be equal to @n_formats.
|
|
|
|
*
|
|
|
|
* Since: 0.10.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_set_formatsv (GstQuery * query, gint n_formats, GstFormat * formats)
|
|
|
|
{
|
|
|
|
GValue list = { 0, };
|
|
|
|
GstStructure *structure;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
|
|
|
|
|
|
|
|
g_value_init (&list, GST_TYPE_LIST);
|
|
|
|
for (i = 0; i < n_formats; i++) {
|
|
|
|
gst_query_list_add_format (&list, formats[i]);
|
|
|
|
}
|
|
|
|
structure = gst_query_get_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
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_parse_formats_length:
|
|
|
|
* @query: a #GstQuery
|
2010-06-16 16:10:06 +00:00
|
|
|
* @n_formats: (out): 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
|
|
|
*
|
|
|
|
* Since: 0.10.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_parse_formats_length (GstQuery * query, guint * n_formats)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
|
|
|
|
|
|
|
|
if (n_formats) {
|
|
|
|
const GValue *list;
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
list = gst_structure_get_value (structure, "formats");
|
|
|
|
if (list == NULL)
|
|
|
|
*n_formats = 0;
|
|
|
|
else
|
|
|
|
*n_formats = gst_value_list_get_size (list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_parse_formats_nth:
|
|
|
|
* @query: a #GstQuery
|
2010-06-16 16:10:06 +00:00
|
|
|
* @nth: (out): the nth format to retrieve.
|
|
|
|
* @format: (out): 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.
|
|
|
|
*
|
|
|
|
* Since: 0.10.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_parse_formats_nth (GstQuery * query, guint nth, GstFormat * format)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
|
|
|
|
|
|
|
|
if (format) {
|
|
|
|
const GValue *list;
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
list = gst_structure_get_value (structure, "formats");
|
|
|
|
if (list == NULL) {
|
|
|
|
*format = GST_FORMAT_UNDEFINED;
|
|
|
|
} else {
|
|
|
|
if (nth < gst_value_list_get_size (list)) {
|
|
|
|
*format = g_value_get_enum (gst_value_list_get_value (list, nth));
|
|
|
|
} 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
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_new_buffering
|
|
|
|
* @format: the default #GstFormat for the new query
|
|
|
|
*
|
|
|
|
* Constructs a new query object for querying the buffering status of
|
|
|
|
* a stream.
|
|
|
|
*
|
|
|
|
* Returns: A #GstQuery
|
|
|
|
*
|
|
|
|
* Since: 0.10.20
|
|
|
|
*/
|
|
|
|
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 */
|
2009-05-29 17:22:42 +00:00
|
|
|
structure = gst_structure_id_new (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
|
|
|
|
|
|
|
query = gst_query_new (GST_QUERY_BUFFERING, structure);
|
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_set_buffering_percent
|
|
|
|
* @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
|
|
|
*
|
|
|
|
* Since: 0.10.20
|
|
|
|
*/
|
|
|
|
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
|
|
|
{
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
|
|
|
|
g_return_if_fail (percent >= 0 && percent <= 100);
|
|
|
|
|
|
|
|
gst_structure_id_set (query->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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_parse_buffering_percent
|
|
|
|
* @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
|
2010-06-16 16:10:06 +00:00
|
|
|
* @busy: (out): if buffering is busy
|
|
|
|
* @percent: (out): a 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
|
|
|
*
|
|
|
|
* 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
|
|
|
*
|
|
|
|
* Since: 0.10.20
|
|
|
|
*/
|
|
|
|
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
|
|
|
{
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
|
|
|
|
|
2008-04-08 20:17:49 +00:00
|
|
|
if (busy)
|
|
|
|
*busy = g_value_get_boolean (gst_structure_id_get_value (query->structure,
|
|
|
|
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)
|
|
|
|
*percent = g_value_get_int (gst_structure_id_get_value (query->structure,
|
|
|
|
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
|
|
|
|
* @buffering_left: amount of buffering time left
|
|
|
|
*
|
|
|
|
* Configures the buffering stats values in @query.
|
|
|
|
*
|
|
|
|
* Since: 0.10.20
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_set_buffering_stats (GstQuery * query, GstBufferingMode mode,
|
|
|
|
gint avg_in, gint avg_out, gint64 buffering_left)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
|
|
|
|
|
|
|
|
gst_structure_id_set (query->structure,
|
|
|
|
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-06-16 16:10:06 +00:00
|
|
|
* @mode: (out): a buffering mode
|
|
|
|
* @avg_in: (out): the average input rate
|
|
|
|
* @avg_out: (out): the average output rate
|
|
|
|
* @buffering_left: (out): amount of buffering time left
|
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.
|
|
|
|
*
|
|
|
|
* Since: 0.10.20
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_parse_buffering_stats (GstQuery * query,
|
|
|
|
GstBufferingMode * mode, gint * avg_in, gint * avg_out,
|
|
|
|
gint64 * buffering_left)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
|
|
|
|
|
|
|
|
if (mode)
|
|
|
|
*mode = g_value_get_enum (gst_structure_id_get_value (query->structure,
|
|
|
|
GST_QUARK (BUFFERING_MODE)));
|
|
|
|
if (avg_in)
|
|
|
|
*avg_in = g_value_get_int (gst_structure_id_get_value (query->structure,
|
|
|
|
GST_QUARK (AVG_IN_RATE)));
|
|
|
|
if (avg_out)
|
|
|
|
*avg_out = g_value_get_int (gst_structure_id_get_value (query->structure,
|
|
|
|
GST_QUARK (AVG_OUT_RATE)));
|
|
|
|
if (buffering_left)
|
|
|
|
*buffering_left =
|
|
|
|
g_value_get_int64 (gst_structure_id_get_value (query->structure,
|
|
|
|
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
|
|
|
|
* @estimated_total: estimated total amount of download time
|
|
|
|
*
|
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
|
|
|
*
|
|
|
|
* Since: 0.10.20
|
|
|
|
*/
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
gst_structure_id_set (structure,
|
|
|
|
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-06-16 16:10:06 +00:00
|
|
|
* @format: (out): the format to set for the @segment_start and @segment_end values
|
|
|
|
* @start: (out): the start to set
|
|
|
|
* @stop: (out): the stop to set
|
|
|
|
* @estimated_total: (out): estimated total amount of download time
|
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
|
|
|
|
*
|
|
|
|
* Since: 0.10.20
|
|
|
|
*/
|
|
|
|
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);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
if (format)
|
|
|
|
*format = g_value_get_enum (gst_structure_id_get_value (structure,
|
|
|
|
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
|
|
|
|
2010-08-31 09:35:12 +00:00
|
|
|
/**
|
|
|
|
* gst_query_add_buffering_range
|
|
|
|
* @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.
|
|
|
|
*
|
|
|
|
* Since: 0.10.31
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_query_add_buffering_range (GstQuery * query, gint64 start, gint64 stop)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
GValueArray *array;
|
|
|
|
GValue *last_array_value;
|
|
|
|
const GValue *value;
|
|
|
|
GValue range_value = { 0 };
|
|
|
|
|
2010-09-15 23:37:59 +00:00
|
|
|
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING, 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
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
value = gst_structure_id_get_value (structure, GST_QUARK (BUFFERING_RANGES));
|
|
|
|
if (value) {
|
|
|
|
array = (GValueArray *) g_value_get_boxed (value);
|
|
|
|
last_array_value = g_value_array_get_nth (array, array->n_values - 1);
|
2010-09-15 23:37:59 +00:00
|
|
|
if (G_UNLIKELY (start <= gst_value_get_int64_range_min (last_array_value)))
|
|
|
|
return FALSE;
|
2010-08-31 09:35:12 +00:00
|
|
|
} else {
|
2010-09-15 23:30:14 +00:00
|
|
|
GValue new_array_val = { 0, };
|
|
|
|
|
2010-08-31 09:35:12 +00:00
|
|
|
array = g_value_array_new (0);
|
2010-09-15 23:30:14 +00:00
|
|
|
|
|
|
|
g_value_init (&new_array_val, G_TYPE_VALUE_ARRAY);
|
|
|
|
g_value_take_boxed (&new_array_val, array);
|
|
|
|
|
|
|
|
/* set the value array only once, so we then modify (append to) the
|
|
|
|
* existing value array owned by the GstStructure / the field's GValue */
|
|
|
|
gst_structure_id_take_value (structure, GST_QUARK (BUFFERING_RANGES),
|
|
|
|
&new_array_val);
|
2010-08-31 09:35:12 +00:00
|
|
|
}
|
|
|
|
|
2010-09-15 23:37:59 +00:00
|
|
|
g_value_init (&range_value, GST_TYPE_INT64_RANGE);
|
|
|
|
gst_value_set_int64_range (&range_value, start, stop);
|
|
|
|
g_value_array_append (array, &range_value);
|
|
|
|
/* skip the g_value_unset(&range_value) here, we know it's not needed */
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_get_n_buffering_ranges
|
|
|
|
* @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.
|
|
|
|
*
|
|
|
|
* Since: 0.10.31
|
|
|
|
*/
|
|
|
|
guint
|
|
|
|
gst_query_get_n_buffering_ranges (GstQuery * query)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
GValueArray *array;
|
|
|
|
const GValue *value;
|
|
|
|
guint size = 0;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING, 0);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
value = gst_structure_id_get_value (structure, GST_QUARK (BUFFERING_RANGES));
|
|
|
|
if (value) {
|
|
|
|
array = (GValueArray *) g_value_get_boxed (value);
|
|
|
|
size = array->n_values;
|
|
|
|
}
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_parse_nth_buffering_range
|
|
|
|
* @query: a GST_QUERY_BUFFERING type query #GstQuery
|
|
|
|
* @index: position in the buffered-ranges array to read
|
|
|
|
* @start: (out): the start position to set
|
|
|
|
* @stop: (out): the stop position to set
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Since: 0.10.31
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_query_parse_nth_buffering_range (GstQuery * query, guint index,
|
|
|
|
gint64 * start, gint64 * stop)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
const GValue *value;
|
|
|
|
GValueArray *ranges;
|
|
|
|
GValue *range_value;
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING, ret);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
value = gst_structure_id_get_value (structure, GST_QUARK (BUFFERING_RANGES));
|
|
|
|
ranges = (GValueArray *) g_value_get_boxed (value);
|
|
|
|
range_value = g_value_array_get_nth (ranges, index);
|
|
|
|
if (range_value) {
|
2010-09-03 17:58:49 +00:00
|
|
|
if (start)
|
|
|
|
*start = gst_value_get_int64_range_min (range_value);
|
|
|
|
if (stop)
|
|
|
|
*stop = gst_value_get_int64_range_max (range_value);
|
2010-08-31 09:35:12 +00:00
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
*
|
|
|
|
* Returns: A #GstQuery
|
|
|
|
*
|
|
|
|
* Since: 0.10.22
|
|
|
|
*/
|
|
|
|
GstQuery *
|
|
|
|
gst_query_new_uri (void)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2009-05-29 17:22:42 +00:00
|
|
|
structure = gst_structure_id_new (GST_QUARK (QUERY_URI),
|
|
|
|
GST_QUARK (URI), G_TYPE_STRING, NULL, NULL);
|
2008-12-20 17:33:44 +00:00
|
|
|
|
|
|
|
query = gst_query_new (GST_QUERY_URI, structure);
|
|
|
|
|
|
|
|
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.
|
|
|
|
*
|
|
|
|
* Since: 0.10.22
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_set_uri (GstQuery * query, const gchar * uri)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI);
|
|
|
|
g_return_if_fail (gst_uri_is_valid (uri));
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
gst_structure_id_set (structure, GST_QUARK (URI), G_TYPE_STRING, uri, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_parse_uri:
|
|
|
|
* @query: a #GstQuery
|
2010-06-16 16:10:06 +00:00
|
|
|
* @uri: (out): the storage for the current URI (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.
|
|
|
|
*
|
|
|
|
* Since: 0.10.22
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_parse_uri (GstQuery * query, gchar ** uri)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
if (uri)
|
|
|
|
*uri = g_value_dup_string (gst_structure_id_get_value (structure,
|
|
|
|
GST_QUARK (URI)));
|
|
|
|
}
|