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
|
|
|
*
|
|
|
|
* gstquery.c: GstQueryType registration
|
|
|
|
*
|
|
|
|
* 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-08-29 21:41:02 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstquery
|
|
|
|
* @short_description: Dynamically register new query types and parse results
|
|
|
|
* @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
|
|
|
|
* core.
|
2005-08-29 21:41:02 +00:00
|
|
|
* Query types can be used to perform queries on pads and elements.
|
|
|
|
*
|
|
|
|
* Query answer can be parsed using gst_query_parse_xxx() helpers.
|
|
|
|
*/
|
2003-01-01 03:09:39 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2004-05-03 16:03:24 +00:00
|
|
|
#include "gst_private.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"
|
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_init (GTypeInstance * instance, gpointer g_class);
|
|
|
|
static void gst_query_class_init (gpointer g_class, gpointer class_data);
|
|
|
|
static void gst_query_finalize (GstQuery * query);
|
|
|
|
static GstQuery *_gst_query_copy (GstQuery * query);
|
|
|
|
|
gst/gstquery.h
Original commit message from CVS:
2005-05-06 Andy Wingo <wingo@pobox.com>
* gst/gstquery.h
* gst/gstquery.c (_gst_query_initialize): Extend GstQuery from
GstData, init a memchunk.
(standard_definitions): Add a few query types, deprecate a few.
(gst_query_get_type): New proc.
(_gst_query_copy, _gst_query_free, gst_query_new): GstData
implementation.
(gst_query_new_application, gst_query_get_structure): New public
procs.
* docs/design/draft-query.txt: Removed LINKS from the query types,
because all the rest can be dispatched to other pads -- seemed
ugly to have a query that couldn't be dispatched. internal_links
is fine as a pad method.
* gst/gstpad.h: Add query2 as a pad method, add the new functions
in gstpad.c, but maintain binary compatibility for the moment.
Will fix before 0.9 is out.
* gst/gstqueryutils.c:
* gst/gstqueryutils.h: New files, implement 3 methods for each
query type: parse_query, parse_response, and set. Probably need an
allocator as well.
* gst/gst.h: Add gstquery.h and gstqueryutils.h to the list.
* gst/elements/gstfilesink.c (gst_filesink_query2):
* gst/base/gstbasesrc.c (gst_basesrc_query2): Replace old query,
query_types, and formats methods.
* gst/gstpad.c (gst_pad_query2, gst_pad_query2_default)
(gst_pad_set_query2_function): New functions.
(gst_real_pad_init): Set query2_default as the default query2
function. Basically just dispatches to internally linked pads.
Needs review!
* gst/gstdata_private.h (_GST_DATA_INIT): Set data->refcount to 1
without using the atomic operations. Only one thread can possibly
be accessing the data at this point. Changed so as to avoid
gst_atomic operations.
2005-05-06 21:41:22 +00:00
|
|
|
|
2005-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
|
|
|
|
|
|
|
static GstQueryTypeDefinition standard_definitions[] = {
|
2005-09-22 17:40:42 +00:00
|
|
|
{GST_QUERY_POSITION, "position", "Current position and total duration"},
|
2004-03-13 15:27:01 +00:00
|
|
|
{GST_QUERY_LATENCY, "latency", "Latency"},
|
|
|
|
{GST_QUERY_JITTER, "jitter", "Jitter"},
|
|
|
|
{GST_QUERY_RATE, "rate", "Configured rate 1000000 = 1"},
|
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_SEEKING, "seeking", "Seeking capabilities and parameters"},
|
2005-09-22 17:40:42 +00:00
|
|
|
{GST_QUERY_SEGMENT, "segment", "currently configured segment"},
|
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_CONVERT, "convert", "Converting between formats"},
|
2005-07-07 08:43:17 +00:00
|
|
|
{GST_QUERY_FORMATS, "formats", "Supported formats for conversion"},
|
2004-03-13 15:27:01 +00:00
|
|
|
{0, NULL, NULL}
|
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) {
|
|
|
|
g_hash_table_insert (_nick_to_query, 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
|
|
|
|
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
|
|
|
gst_query_get_type ();
|
2003-01-01 03:09:39 +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
|
|
|
GType
|
|
|
|
gst_query_get_type (void)
|
|
|
|
{
|
|
|
|
static GType _gst_query_type;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (_gst_query_type == 0)) {
|
|
|
|
static const GTypeInfo query_info = {
|
|
|
|
sizeof (GstQueryClass),
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
gst_query_class_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
sizeof (GstQuery),
|
|
|
|
0,
|
|
|
|
gst_query_init,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
_gst_query_type = g_type_register_static (GST_TYPE_MINI_OBJECT,
|
|
|
|
"GstQuery", &query_info, 0);
|
|
|
|
}
|
|
|
|
return _gst_query_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_query_class_init (gpointer g_class, gpointer class_data)
|
|
|
|
{
|
|
|
|
GstQueryClass *query_class = GST_QUERY_CLASS (g_class);
|
|
|
|
|
|
|
|
query_class->mini_object_class.copy =
|
|
|
|
(GstMiniObjectCopyFunction) _gst_query_copy;
|
|
|
|
query_class->mini_object_class.finalize =
|
|
|
|
(GstMiniObjectFinalizeFunction) gst_query_finalize;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_query_init (GTypeInstance * instance, gpointer g_class)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
* allrady registered query with that nick
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
2003-01-01 03:09:39 +00:00
|
|
|
query = g_new0 (GstQueryTypeDefinition, 1);
|
|
|
|
query->value = _n_values;
|
|
|
|
query->nick = g_strdup (nick);
|
|
|
|
query->description = g_strdup (description);
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
g_static_mutex_lock (&mutex);
|
2003-01-01 03:09:39 +00:00
|
|
|
g_hash_table_insert (_nick_to_query, 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
|
|
|
|
*
|
|
|
|
* Return the query registered with the given nick.
|
|
|
|
*
|
|
|
|
* Returns: The query with @nick or GST_QUERY_NONE
|
|
|
|
* 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
|
|
|
|
* @type: the querytype to find
|
2003-01-01 03:09:39 +00:00
|
|
|
*
|
|
|
|
* See if the given query is inside the query array.
|
|
|
|
*
|
|
|
|
* Returns: TRUE if the query is found inside the array
|
|
|
|
*/
|
|
|
|
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:
|
2003-01-02 18:56:09 +00:00
|
|
|
* @type: The query to get details of
|
2003-01-01 03:09:39 +00:00
|
|
|
*
|
|
|
|
* Get details about the given query.
|
|
|
|
*
|
|
|
|
* Returns: The #GstQueryTypeDefinition for @query or NULL on failure.
|
|
|
|
*/
|
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
|
|
|
*
|
2005-03-07 18:27:42 +00:00
|
|
|
* Get an Iterator of all the registered query types. The querytype
|
|
|
|
* definition is 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);
|
|
|
|
result = gst_iterator_new_list (g_static_mutex_get_mutex (&mutex),
|
|
|
|
&_n_values, &_gst_queries, NULL, NULL, NULL);
|
|
|
|
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()
|
|
|
|
* when done with it.
|
|
|
|
*
|
|
|
|
* Returns: A new #GstQuery
|
|
|
|
*/
|
2005-05-09 10:53:13 +00:00
|
|
|
GstQuery *
|
|
|
|
gst_query_new_position (GstFormat format)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
structure = gst_structure_new ("GstQueryPosition",
|
|
|
|
"format", GST_TYPE_FORMAT, format,
|
|
|
|
"cur", G_TYPE_INT64, (gint64) - 1,
|
|
|
|
"end", G_TYPE_INT64, (gint64) - 1, NULL);
|
|
|
|
query = gst_query_new (GST_QUERY_POSITION, structure);
|
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
2005-08-29 21:41:02 +00:00
|
|
|
/**
|
|
|
|
* gst_query_set_position:
|
|
|
|
* @query: the query to fill in
|
|
|
|
* @format: the requested #GstFormat
|
|
|
|
* @cur: the current position
|
|
|
|
* @end: the end position
|
|
|
|
*
|
|
|
|
* Answer a position query by setting the requested values.
|
|
|
|
*/
|
2005-05-09 10:53:13 +00:00
|
|
|
void
|
|
|
|
gst_query_set_position (GstQuery * query, GstFormat format,
|
|
|
|
gint64 cur, gint64 end)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_POSITION);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
gst_structure_set (structure,
|
|
|
|
"format", GST_TYPE_FORMAT, format,
|
|
|
|
"cur", G_TYPE_INT64, cur, "end", G_TYPE_INT64, end, NULL);
|
|
|
|
}
|
|
|
|
|
2005-08-29 21:41:02 +00:00
|
|
|
/**
|
|
|
|
* gst_query_parse_position:
|
2005-09-22 17:40:42 +00:00
|
|
|
* @query: the query to parse
|
|
|
|
* @format: the storage for the #GstFormat of the position values
|
2005-08-29 21:41:02 +00:00
|
|
|
* @cur: the storage for the current position
|
|
|
|
* @end: the storage for the end position
|
|
|
|
*
|
|
|
|
* Parse a position query answer.
|
|
|
|
*/
|
2005-05-09 10:53:13 +00:00
|
|
|
void
|
|
|
|
gst_query_parse_position (GstQuery * query, GstFormat * format,
|
|
|
|
gint64 * cur, gint64 * end)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_POSITION);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
if (format)
|
|
|
|
*format = g_value_get_enum (gst_structure_get_value (structure, "format"));
|
|
|
|
if (cur)
|
|
|
|
*cur = g_value_get_int64 (gst_structure_get_value (structure, "cur"));
|
|
|
|
if (end)
|
|
|
|
*end = g_value_get_int64 (gst_structure_get_value (structure, "end"));
|
|
|
|
}
|
|
|
|
|
2005-09-22 17:40:42 +00:00
|
|
|
/**
|
|
|
|
* gst_query_new_convert:
|
|
|
|
* @src_fmt: the source #GstFormat for the new query
|
|
|
|
* @value: the value to convert
|
|
|
|
* @dest_fmt: the target #GstFormat
|
|
|
|
*
|
|
|
|
* Constructs a new query convert object. Use gst_query_unref()
|
|
|
|
* when done with it.
|
|
|
|
*
|
|
|
|
* Returns: A new #GstQuery
|
|
|
|
*/
|
2005-05-09 10:53:13 +00:00
|
|
|
GstQuery *
|
|
|
|
gst_query_new_convert (GstFormat src_fmt, gint64 value, GstFormat dest_fmt)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
2005-08-24 15:49:03 +00:00
|
|
|
g_return_val_if_fail (value >= 0, NULL);
|
|
|
|
|
2005-05-09 10:53:13 +00:00
|
|
|
structure = gst_structure_new ("GstQueryConvert",
|
|
|
|
"src_format", GST_TYPE_FORMAT, src_fmt,
|
|
|
|
"src_value", G_TYPE_INT64, value,
|
|
|
|
"dest_format", GST_TYPE_FORMAT, dest_fmt,
|
|
|
|
"dest_value", G_TYPE_INT64, (gint64) - 1, NULL);
|
|
|
|
query = gst_query_new (GST_QUERY_CONVERT, structure);
|
|
|
|
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
2005-09-22 17:40:42 +00:00
|
|
|
/**
|
|
|
|
* gst_query_set_convert:
|
|
|
|
* @query: the query to fill in
|
|
|
|
* @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);
|
|
|
|
gst_structure_set (structure,
|
|
|
|
"src_format", GST_TYPE_FORMAT, src_format,
|
|
|
|
"src_value", G_TYPE_INT64, src_value,
|
|
|
|
"dest_format", GST_TYPE_FORMAT, dest_format,
|
|
|
|
"dest_value", G_TYPE_INT64, dest_value, NULL);
|
|
|
|
}
|
|
|
|
|
2005-09-22 17:40:42 +00:00
|
|
|
/**
|
|
|
|
* gst_query_parse_convert:
|
|
|
|
* @query: the query to parse
|
|
|
|
* @src_format: the storage for the #GstFormat of the source value
|
|
|
|
* @src_value: the storage for the source value
|
|
|
|
* @dest_format: the storage for the #GstFormat of the destination value
|
|
|
|
* @dest_value: the storage for the destination value
|
|
|
|
*
|
|
|
|
* Parse a convert query answer.
|
|
|
|
*/
|
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)
|
|
|
|
*src_format =
|
|
|
|
g_value_get_enum (gst_structure_get_value (structure, "src_format"));
|
|
|
|
if (src_value)
|
|
|
|
*src_value =
|
|
|
|
g_value_get_int64 (gst_structure_get_value (structure, "src_value"));
|
|
|
|
if (dest_format)
|
|
|
|
*dest_format =
|
|
|
|
g_value_get_enum (gst_structure_get_value (structure, "dest_format"));
|
|
|
|
if (dest_value)
|
|
|
|
*dest_value =
|
|
|
|
g_value_get_int64 (gst_structure_get_value (structure, "dest_value"));
|
|
|
|
}
|
|
|
|
|
2005-09-22 17:40:42 +00:00
|
|
|
/**
|
|
|
|
* gst_query_new_segment:
|
|
|
|
* @format: the #GstFormat for the new query
|
|
|
|
*
|
|
|
|
* Constructs a new query segment object. Use gst_query_unref()
|
|
|
|
* when done with it.
|
|
|
|
*
|
|
|
|
* Returns: A new #GstQuery
|
|
|
|
*/
|
|
|
|
GstQuery *
|
|
|
|
gst_query_new_segment (GstFormat format)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
structure = gst_structure_new ("GstQuerySegment",
|
|
|
|
"format", GST_TYPE_FORMAT, format, NULL);
|
|
|
|
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:
|
|
|
|
* @query: the query to fill in
|
|
|
|
* @rate: the rate of the segment
|
|
|
|
* @format: the #GstFormat of the segment values
|
|
|
|
* @start_value: the start value
|
|
|
|
* @stop_value: the stop value
|
|
|
|
* @base: the base value
|
|
|
|
*
|
|
|
|
* Answer a segment query by setting the requested values.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_set_segment (GstQuery * query, gdouble rate, GstFormat format,
|
|
|
|
gint64 start_value, gint64 stop_value, gint64 base)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEGMENT);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
gst_structure_set (structure,
|
|
|
|
"rate", G_TYPE_DOUBLE, rate,
|
|
|
|
"format", GST_TYPE_FORMAT, format,
|
|
|
|
"start_value", G_TYPE_INT64, start_value,
|
|
|
|
"stop_value", G_TYPE_INT64, stop_value, "base", G_TYPE_INT64, base, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_query_parse_segment:
|
|
|
|
* @query: the query to parse
|
|
|
|
* @rate: the storage for the rate of the segment
|
|
|
|
* @format: the storage for the #GstFormat of the values
|
|
|
|
* @start_value: the storage for the start value
|
|
|
|
* @stop_value: the storage for the stop value
|
|
|
|
* @base: the storage for the base value
|
|
|
|
*
|
|
|
|
* Parse a segment query answer.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_query_parse_segment (GstQuery * query, gdouble * rate, GstFormat * format,
|
|
|
|
gint64 * start_value, gint64 * stop_value, gint64 * base)
|
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEGMENT);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
if (rate)
|
|
|
|
*rate = g_value_get_double (gst_structure_get_value (structure, "rate"));
|
|
|
|
if (format)
|
|
|
|
*format = g_value_get_enum (gst_structure_get_value (structure, "format"));
|
|
|
|
if (start_value)
|
|
|
|
*start_value =
|
|
|
|
g_value_get_int64 (gst_structure_get_value (structure, "start_value"));
|
|
|
|
if (stop_value)
|
|
|
|
*stop_value =
|
|
|
|
g_value_get_int64 (gst_structure_get_value (structure, "stop_value"));
|
|
|
|
if (base)
|
|
|
|
*base = g_value_get_int64 (gst_structure_get_value (structure, "base"));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Returns: A new #GstQuery
|
|
|
|
*/
|
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:
|
|
|
|
* @query: the query to parse
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
|
|
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);
|
|
|
|
gst_structure_set (structure,
|
|
|
|
"format", GST_TYPE_FORMAT, format,
|
|
|
|
"seekable", G_TYPE_BOOLEAN, seekable,
|
|
|
|
"segment-start", G_TYPE_INT64, segment_start,
|
|
|
|
"segment-end", G_TYPE_INT64, segment_end, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gst_query_set_formats (GstQuery * query, gint n_formats, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
GValue list = { 0, };
|
|
|
|
GValue item = { 0, };
|
|
|
|
GstStructure *structure;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
g_value_init (&list, GST_TYPE_LIST);
|
|
|
|
|
|
|
|
va_start (ap, n_formats);
|
|
|
|
|
|
|
|
for (i = 0; i < n_formats; i++) {
|
|
|
|
g_value_init (&item, GST_TYPE_FORMAT);
|
|
|
|
g_value_set_enum (&item, va_arg (ap, GstFormat));
|
|
|
|
gst_value_list_append_value (&list, &item);
|
|
|
|
g_value_unset (&item);
|
|
|
|
}
|
|
|
|
|
|
|
|
va_end (ap);
|
|
|
|
|
|
|
|
structure = gst_query_get_structure (query);
|
|
|
|
gst_structure_set_value (structure, "formats", &list);
|
|
|
|
}
|