From b4d7be2014cf728f233a2dc1bf4e8b8f9da9075f Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Wed, 4 May 2005 21:29:44 +0000 Subject: [PATCH] GCC 4 fixen. Original commit message from CVS: 2005-05-04 Andy Wingo * check/Makefile.am: * docs/gst/tmpl/gstatomic.sgml: * docs/gst/tmpl/gstplugin.sgml: * gst/base/gstbasesink.c: (gst_basesink_activate): * gst/base/gstbasesrc.c: (gst_basesrc_class_init), (gst_basesrc_init), (gst_basesrc_set_dataflow_funcs), (gst_basesrc_query), (gst_basesrc_set_property), (gst_basesrc_get_property), (gst_basesrc_check_get_range), (gst_basesrc_activate): * gst/base/gstbasesrc.h: * gst/base/gstbasetransform.c: (gst_base_transform_sink_activate), (gst_base_transform_src_activate): * gst/elements/gstelements.c: * gst/elements/gstfakesrc.c: (gst_fakesrc_class_init), (gst_fakesrc_set_property), (gst_fakesrc_get_property): * gst/elements/gsttee.c: (gst_tee_sink_activate): * gst/elements/gsttypefindelement.c: (find_element_get_length), (gst_type_find_element_checkgetrange), (gst_type_find_element_activate): * gst/gstbin.c: (gst_bin_save_thyself), (gst_bin_restore_thyself): * gst/gstcaps.c: (gst_caps_do_simplify), (gst_caps_save_thyself), (gst_caps_load_thyself): * gst/gstelement.c: (gst_element_pads_activate), (gst_element_save_thyself), (gst_element_restore_thyself): * gst/gstpad.c: (gst_pad_load_and_link), (gst_pad_save_thyself), (gst_ghost_pad_save_thyself), (gst_pad_check_pull_range): * gst/gstpad.h: * gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc), (gst_xml_parse_file), (gst_xml_parse_memory), (gst_xml_get_element), (gst_xml_make_element): * gst/indexers/gstfileindex.c: (gst_file_index_load), (_file_index_id_save_xml), (gst_file_index_commit): * gst/registries/gstlibxmlregistry.c: (read_string), (read_uint), (read_enum), (load_pad_template), (load_feature), (load_plugin), (load_paths): * libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps), (gst_dp_packet_from_event), (gst_dp_caps_from_packet): * tools/gst-complete.c: (main): * tools/gst-compprep.c: (main): * tools/gst-inspect.c: (print_element_properties_info): * tools/gst-launch.c: (xmllaunch_parse_cmdline): * tools/gst-xmlinspect.c: (print_element_properties): GCC 4 fixen. --- ChangeLog | 51 +++++++++++++++++++++++++ check/Makefile.am | 1 + docs/gst/tmpl/gstatomic.sgml | 72 ++--------------------------------- docs/gst/tmpl/gstplugin.sgml | 9 ----- gst/base/gstbasesink.c | 1 + gst/base/gstbasesrc.c | 57 ++++++++++++++++++++++++--- gst/base/gstbasesrc.h | 4 ++ gst/base/gstbasetransform.c | 2 + gst/elements/gstelements.c | 2 +- gst/elements/gstfakesrc.c | 27 ++++++++++++- gst/elements/gsttee.c | 1 + gst/elements/gsttypefindelement.c | 10 +++-- gst/gstbin.c | 8 ++-- gst/gstcaps.c | 8 ++-- gst/gstelement.c | 43 ++++++++++++--------- gst/gstpad.c | 29 ++++++++------ gst/gstpad.h | 5 ++- gst/gstxml.c | 42 +++++++++++--------- gst/indexers/gstfileindex.c | 53 +++++++++++++------------- gst/registries/gstlibxmlregistry.c | 14 +++---- libs/gst/base/gstbasesink.c | 1 + libs/gst/base/gstbasesrc.c | 57 ++++++++++++++++++++++++--- libs/gst/base/gstbasesrc.h | 4 ++ libs/gst/base/gstbasetransform.c | 2 + libs/gst/dataprotocol/dataprotocol.c | 12 +++--- plugins/elements/gstelements.c | 2 +- plugins/elements/gstfakesrc.c | 27 ++++++++++++- plugins/elements/gsttee.c | 1 + plugins/elements/gsttypefindelement.c | 10 +++-- plugins/indexers/gstfileindex.c | 53 +++++++++++++------------- tests/check/Makefile.am | 1 + tools/gst-complete.c | 25 ++++++------ tools/gst-compprep.c | 39 ++++++++++--------- tools/gst-inspect.c | 3 +- tools/gst-launch.c | 3 +- tools/gst-xmlinspect.c | 3 +- 36 files changed, 425 insertions(+), 257 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9fb9bcb..68b58c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,49 @@ +2005-05-04 Andy Wingo + + * check/Makefile.am: + * docs/gst/tmpl/gstatomic.sgml: + * docs/gst/tmpl/gstplugin.sgml: + * gst/base/gstbasesink.c: (gst_basesink_activate): + * gst/base/gstbasesrc.c: (gst_basesrc_class_init), + (gst_basesrc_init), (gst_basesrc_set_dataflow_funcs), + (gst_basesrc_query), (gst_basesrc_set_property), + (gst_basesrc_get_property), (gst_basesrc_check_get_range), + (gst_basesrc_activate): + * gst/base/gstbasesrc.h: + * gst/base/gstbasetransform.c: (gst_base_transform_sink_activate), + (gst_base_transform_src_activate): + * gst/elements/gstelements.c: + * gst/elements/gstfakesrc.c: (gst_fakesrc_class_init), + (gst_fakesrc_set_property), (gst_fakesrc_get_property): + * gst/elements/gsttee.c: (gst_tee_sink_activate): + * gst/elements/gsttypefindelement.c: (find_element_get_length), + (gst_type_find_element_checkgetrange), + (gst_type_find_element_activate): + * gst/gstbin.c: (gst_bin_save_thyself), (gst_bin_restore_thyself): + * gst/gstcaps.c: (gst_caps_do_simplify), (gst_caps_save_thyself), + (gst_caps_load_thyself): + * gst/gstelement.c: (gst_element_pads_activate), + (gst_element_save_thyself), (gst_element_restore_thyself): + * gst/gstpad.c: (gst_pad_load_and_link), (gst_pad_save_thyself), + (gst_ghost_pad_save_thyself), (gst_pad_check_pull_range): + * gst/gstpad.h: + * gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc), + (gst_xml_parse_file), (gst_xml_parse_memory), + (gst_xml_get_element), (gst_xml_make_element): + * gst/indexers/gstfileindex.c: (gst_file_index_load), + (_file_index_id_save_xml), (gst_file_index_commit): + * gst/registries/gstlibxmlregistry.c: (read_string), (read_uint), + (read_enum), (load_pad_template), (load_feature), (load_plugin), + (load_paths): + * libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps), + (gst_dp_packet_from_event), (gst_dp_caps_from_packet): + * tools/gst-complete.c: (main): + * tools/gst-compprep.c: (main): + * tools/gst-inspect.c: (print_element_properties_info): + * tools/gst-launch.c: (xmllaunch_parse_cmdline): + * tools/gst-xmlinspect.c: (print_element_properties): + GCC 4 fixen. + 2005-05-03 Thomas Vander Stichele * gst/gstplugin.c: (gst_plugin_check_module), @@ -266,6 +312,11 @@ 2005-04-18 Andy Wingo + * gst/gstelement.c (gst_element_pads_activate): Check pull_range + on the peer, not the pad. I think that was a typo. Pass an extra + arg to see if random access is possible. Activate the pads as + PULL_RANGE if possible. + * gst/elements/gstfakesrc.c: s/ARG_/PROP_/. * gst/base/gstbasesrc.c (gst_basesrc_set_property) diff --git a/check/Makefile.am b/check/Makefile.am index 4be9f45..0f94ba1 100644 --- a/check/Makefile.am +++ b/check/Makefile.am @@ -32,6 +32,7 @@ TESTS = $(top_builddir)/tools/gst-register \ gst/gstobject \ gst/gstpad \ gst/gstsystemclock \ + pipelines/simple_launch_lines \ gst-libs/gdp check_PROGRAMS = $(TESTS) diff --git a/docs/gst/tmpl/gstatomic.sgml b/docs/gst/tmpl/gstatomic.sgml index 700218c..44d76c0 100644 --- a/docs/gst/tmpl/gstatomic.sgml +++ b/docs/gst/tmpl/gstatomic.sgml @@ -19,81 +19,15 @@ as external methods. #GstMemChunk - - - - - - - - -A structure that contains an integer that can be modified -atomically. - - -@counter: -@lock: - - - -Initialize an allocated #GstAtomicInt with a value. Call this method -only once as it will allocate a mutex in the C-fallback case. - - -@aint: a #GstAtomicInt -@val: a new value - - - - -Destroy a #GstAtomicInt. Call this method only once as it will -free the mutex in the C-fallback case. - - -@aint: a #GstAtomicInt - - Atomically set the value on the #GstAtomicInt. +@atomic_int: +@value: + @aint: a #GstAtomicInt @val: The new value - - -Atomically read the contents of a #GstAtomicInt - - -@aint: a #GstAtomicInt -@Returns: the value of the atomic int - - - - -Atomically add the given value to the #GstAtomicInt. - - -@aint: a #GstAtomicInt -@val: the value to add - - - - -Atomically increment the #GstAtomicInt - - -@aint: a #GstAtomicInt - - - - -Atomically decrement the #GstAtomicInt and test if it is zero. - - -@aint: a #GstAtomicInt -@Returns: TRUE if the atomic int is 0 - - diff --git a/docs/gst/tmpl/gstplugin.sgml b/docs/gst/tmpl/gstplugin.sgml index 88949df..cd93138 100644 --- a/docs/gst/tmpl/gstplugin.sgml +++ b/docs/gst/tmpl/gstplugin.sgml @@ -344,12 +344,3 @@ to get a list of plugins that match certain criteria. @Returns: - - - - - -@name: -@Returns: - - diff --git a/gst/base/gstbasesink.c b/gst/base/gstbasesink.c index 4f325c9..6cd07d3 100644 --- a/gst/base/gstbasesink.c +++ b/gst/base/gstbasesink.c @@ -752,6 +752,7 @@ gst_basesink_activate (GstPad * pad, GstActivateMode mode) result = TRUE; break; case GST_ACTIVATE_PULL: + case GST_ACTIVATE_PULL_RANGE: /* if we have a scheduler we can start the task */ g_return_val_if_fail (basesink->has_loop, FALSE); gst_pad_peer_set_active (pad, mode); diff --git a/gst/base/gstbasesrc.c b/gst/base/gstbasesrc.c index c45842b..f4908ae 100644 --- a/gst/base/gstbasesrc.c +++ b/gst/base/gstbasesrc.c @@ -48,6 +48,8 @@ enum { PROP_0, PROP_BLOCKSIZE, + PROP_HAS_LOOP, + PROP_HAS_GETRANGE }; static GstElementClass *parent_class = NULL; @@ -99,8 +101,10 @@ static gboolean gst_basesrc_stop (GstBaseSrc * basesrc); static GstElementStateReturn gst_basesrc_change_state (GstElement * element); +static void gst_basesrc_set_dataflow_funcs (GstBaseSrc * this); static void gst_basesrc_loop (GstPad * pad); -static gboolean gst_basesrc_check_get_range (GstPad * pad); +static gboolean gst_basesrc_check_get_range (GstPad * pad, + gboolean * random_access); static GstFlowReturn gst_basesrc_get_range (GstPad * pad, guint64 offset, guint length, GstBuffer ** buf); @@ -129,6 +133,16 @@ gst_basesrc_class_init (GstBaseSrcClass * klass) "Size in bytes to read per buffer", 1, G_MAXULONG, DEFAULT_BLOCKSIZE, G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HAS_LOOP, + g_param_spec_boolean ("has-loop", "Has loop function", + "True if the element should expose a loop function", TRUE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HAS_GETRANGE, + g_param_spec_boolean ("has-getrange", "Has getrange function", + "True if the element should expose a getrange function", TRUE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_basesrc_change_state); } @@ -150,9 +164,7 @@ gst_basesrc_init (GstBaseSrc * basesrc, gpointer g_class) gst_pad_set_query_function (pad, gst_basesrc_query); gst_pad_set_query_type_function (pad, gst_basesrc_get_query_types); gst_pad_set_formats_function (pad, gst_basesrc_get_formats); - gst_pad_set_loop_function (pad, gst_basesrc_loop); gst_pad_set_checkgetrange_function (pad, gst_basesrc_check_get_range); - gst_pad_set_getrange_function (pad, gst_basesrc_get_range); /* hold ref to pad */ basesrc->srcpad = pad; gst_element_add_pad (GST_ELEMENT (basesrc), pad); @@ -164,6 +176,20 @@ gst_basesrc_init (GstBaseSrc * basesrc, gpointer g_class) GST_FLAG_UNSET (basesrc, GST_BASESRC_STARTED); } +static void +gst_basesrc_set_dataflow_funcs (GstBaseSrc * this) +{ + if (this->has_loop) + gst_pad_set_loop_function (this->srcpad, gst_basesrc_loop); + else + gst_pad_set_loop_function (this->srcpad, NULL); + + if (this->has_getrange) + gst_pad_set_getrange_function (this->srcpad, gst_basesrc_get_range); + else + gst_pad_set_getrange_function (this->srcpad, NULL); +} + static const GstFormat * gst_basesrc_get_formats (GstPad * pad) { @@ -206,7 +232,8 @@ gst_basesrc_query (GstPad * pad, GstQueryType type, { gboolean ret; - ret = gst_basesrc_get_size (src, value); + /* FIXME-wim: is this cast right? */ + ret = gst_basesrc_get_size (src, (guint64 *) value); GST_DEBUG ("getting length %d %lld", ret, *value); return ret; } @@ -223,7 +250,8 @@ gst_basesrc_query (GstPad * pad, GstQueryType type, *value = src->offset; break; case GST_FORMAT_PERCENT: - if (!gst_basesrc_get_size (src, value)) + /* fixme */ + if (!gst_basesrc_get_size (src, (guint64 *) value)) return FALSE; *value = src->offset * GST_FORMAT_PERCENT_MAX / *value; return TRUE; @@ -402,6 +430,14 @@ gst_basesrc_set_property (GObject * object, guint prop_id, const GValue * value, case PROP_BLOCKSIZE: src->blocksize = g_value_get_ulong (value); break; + case PROP_HAS_LOOP: + src->has_loop = g_value_get_boolean (value); + gst_basesrc_set_dataflow_funcs (src); + break; + case PROP_HAS_GETRANGE: + src->has_getrange = g_value_get_boolean (value); + gst_basesrc_set_dataflow_funcs (src); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -420,6 +456,12 @@ gst_basesrc_get_property (GObject * object, guint prop_id, GValue * value, case PROP_BLOCKSIZE: g_value_set_ulong (value, src->blocksize); break; + case PROP_HAS_LOOP: + g_value_set_boolean (value, src->has_loop); + break; + case PROP_HAS_GETRANGE: + g_value_set_boolean (value, src->has_getrange); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -495,7 +537,7 @@ gst_basesrc_get_range (GstPad * pad, guint64 offset, guint length, } static gboolean -gst_basesrc_check_get_range (GstPad * pad) +gst_basesrc_check_get_range (GstPad * pad, gboolean * random_access) { GstBaseSrc *src; @@ -506,6 +548,7 @@ gst_basesrc_check_get_range (GstPad * pad) gst_basesrc_stop (src); } + *random_access = src->random_access; return src->seekable; } @@ -675,6 +718,7 @@ gst_basesrc_activate (GstPad * pad, GstActivateMode mode) switch (mode) { case GST_ACTIVATE_PUSH: case GST_ACTIVATE_PULL: + case GST_ACTIVATE_PULL_RANGE: result = gst_basesrc_start (basesrc); break; default: @@ -701,6 +745,7 @@ gst_basesrc_activate (GstPad * pad, GstActivateMode mode) } break; case GST_ACTIVATE_PULL: + case GST_ACTIVATE_PULL_RANGE: result = TRUE; break; case GST_ACTIVATE_NONE: diff --git a/gst/base/gstbasesrc.h b/gst/base/gstbasesrc.h index 8943fd9..d9cee76 100644 --- a/gst/base/gstbasesrc.h +++ b/gst/base/gstbasesrc.h @@ -56,7 +56,11 @@ struct _GstBaseSrc { gint64 segment_end; gboolean segment_loop; + gboolean has_loop; + gboolean has_getrange; + gboolean seekable; + gboolean random_access; guint64 offset; guint64 size; }; diff --git a/gst/base/gstbasetransform.c b/gst/base/gstbasetransform.c index 7c2baff..8eef186 100644 --- a/gst/base/gstbasetransform.c +++ b/gst/base/gstbasetransform.c @@ -334,6 +334,7 @@ gst_base_transform_sink_activate (GstPad * pad, GstActivateMode mode) switch (mode) { case GST_ACTIVATE_PUSH: case GST_ACTIVATE_PULL: + case GST_ACTIVATE_PULL_RANGE: if (bclass->start) result = bclass->start (trans); break; @@ -357,6 +358,7 @@ gst_base_transform_src_activate (GstPad * pad, GstActivateMode mode) result = TRUE; break; case GST_ACTIVATE_PULL: + case GST_ACTIVATE_PULL_RANGE: result = gst_pad_set_active (trans->sinkpad, mode); result = gst_pad_peer_set_active (trans->sinkpad, mode); break; diff --git a/gst/elements/gstelements.c b/gst/elements/gstelements.c index f093c38..d5b228b 100644 --- a/gst/elements/gstelements.c +++ b/gst/elements/gstelements.c @@ -74,7 +74,7 @@ static struct _elements_entry _elements[] = { // {"statistics", GST_RANK_NONE, gst_statistics_get_type}, {"tee", GST_RANK_NONE, gst_tee_get_type}, {"typefind", GST_RANK_NONE, gst_type_find_element_get_type}, -// {NULL, 0}, + {NULL, 0}, }; static gboolean diff --git a/gst/elements/gstfakesrc.c b/gst/elements/gstfakesrc.c index 79a58e3..4715db5 100644 --- a/gst/elements/gstfakesrc.c +++ b/gst/elements/gstfakesrc.c @@ -88,7 +88,9 @@ enum PROP_SILENT, PROP_DUMP, PROP_PARENTSIZE, - PROP_LAST_MESSAGE + PROP_LAST_MESSAGE, + PROP_HAS_LOOP, + PROP_HAS_GETRANGE }; #define GST_TYPE_FAKESRC_OUTPUT (gst_fakesrc_output_get_type()) @@ -274,6 +276,14 @@ gst_fakesrc_class_init (GstFakeSrcClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DUMP, g_param_spec_boolean ("dump", "Dump", "Dump produced bytes to stdout", DEFAULT_DUMP, G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HAS_LOOP, + g_param_spec_boolean ("has-loop", "Has loop function", + "True if the element exposes a loop function", TRUE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HAS_GETRANGE, + g_param_spec_boolean ("has-getrange", "Has getrange function", + "True if the element exposes a getrange function", TRUE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); gst_fakesrc_signals[SIGNAL_HANDOFF] = g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, @@ -281,6 +291,7 @@ gst_fakesrc_class_init (GstFakeSrcClass * klass) gst_marshal_VOID__BOXED_OBJECT, G_TYPE_NONE, 1, GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE); + /*gstbasesrc_class->is_seekable = GST_DEBUG_FUNCPTR (gst_fakesrc_is_seekable); */ gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_fakesrc_start); gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_fakesrc_stop); gstbasesrc_class->event = GST_DEBUG_FUNCPTR (gst_fakesrc_event_handler); @@ -410,6 +421,14 @@ gst_fakesrc_set_property (GObject * object, guint prop_id, const GValue * value, case PROP_DUMP: src->dump = g_value_get_boolean (value); break; + case PROP_HAS_LOOP: + g_return_if_fail (!GST_FLAG_IS_SET (object, GST_BASESRC_STARTED)); + src->has_loop = g_value_get_boolean (value); + break; + case PROP_HAS_GETRANGE: + g_return_if_fail (!GST_FLAG_IS_SET (object, GST_BASESRC_STARTED)); + src->has_getrange = g_value_get_boolean (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -476,6 +495,12 @@ gst_fakesrc_get_property (GObject * object, guint prop_id, GValue * value, case PROP_LAST_MESSAGE: g_value_set_string (value, src->last_message); break; + case PROP_HAS_LOOP: + g_value_set_boolean (value, src->has_loop); + break; + case PROP_HAS_GETRANGE: + g_value_set_boolean (value, src->has_getrange); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; diff --git a/gst/elements/gsttee.c b/gst/elements/gsttee.c index cd7213c..f0f3060 100644 --- a/gst/elements/gsttee.c +++ b/gst/elements/gsttee.c @@ -369,6 +369,7 @@ gst_tee_sink_activate (GstPad * pad, GstActivateMode mode) result = TRUE; break; case GST_ACTIVATE_PULL: + case GST_ACTIVATE_PULL_RANGE: g_return_val_if_fail (tee->has_sink_loop, FALSE); if (GST_ELEMENT_SCHEDULER (tee)) { GST_STREAM_LOCK (pad); diff --git a/gst/elements/gsttypefindelement.c b/gst/elements/gsttypefindelement.c index 1cce1ab..3c4a07c 100644 --- a/gst/elements/gsttypefindelement.c +++ b/gst/elements/gsttypefindelement.c @@ -128,7 +128,8 @@ static GstFlowReturn gst_type_find_element_chain (GstPad * sinkpad, GstBuffer * buffer); static GstFlowReturn gst_type_find_element_getrange (GstPad * srcpad, guint64 offset, guint length, GstBuffer ** buffer); -static gboolean gst_type_find_element_checkgetrange (GstPad * srcpad); +static gboolean gst_type_find_element_checkgetrange (GstPad * srcpad, + gboolean * random_access); static GstElementStateReturn gst_type_find_element_change_state (GstElement * element); static gboolean @@ -463,7 +464,7 @@ find_element_get_length (gpointer data) if (entry->self->stream_length == 0) { typefind->stream_length_available = gst_pad_query (GST_PAD_PEER (entry->self->sink), GST_QUERY_TOTAL, - &format, &entry->self->stream_length); + &format, (gint64 *) & entry->self->stream_length); if (format != GST_FORMAT_BYTES) typefind->stream_length_available = FALSE; if (!typefind->stream_length_available) { @@ -806,13 +807,13 @@ gst_type_find_element_chain (GstPad * pad, GstBuffer * buffer) } static gboolean -gst_type_find_element_checkgetrange (GstPad * srcpad) +gst_type_find_element_checkgetrange (GstPad * srcpad, gboolean * random_access) { GstTypeFindElement *typefind; typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (srcpad)); - return gst_pad_check_pull_range (typefind->sink); + return gst_pad_check_pull_range (typefind->sink, random_access); } static GstFlowReturn @@ -861,6 +862,7 @@ gst_type_find_element_activate (GstPad * pad, GstActivateMode mode) switch (mode) { case GST_ACTIVATE_PUSH: case GST_ACTIVATE_PULL: + case GST_ACTIVATE_PULL_RANGE: result = TRUE; break; default: diff --git a/gst/gstbin.c b/gst/gstbin.c index f15e10f..f15c4dd 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -1268,7 +1268,7 @@ gst_bin_save_thyself (GstObject * object, xmlNodePtr parent) if (GST_OBJECT_CLASS (parent_class)->save_thyself) GST_OBJECT_CLASS (parent_class)->save_thyself (GST_OBJECT (bin), parent); - childlist = xmlNewChild (parent, NULL, "children", NULL); + childlist = xmlNewChild (parent, NULL, (xmlChar *) "children", NULL); GST_CAT_INFO (GST_CAT_XML, "[%s]: saving %d children", GST_ELEMENT_NAME (bin), bin->numchildren); @@ -1276,7 +1276,7 @@ gst_bin_save_thyself (GstObject * object, xmlNodePtr parent) children = bin->children; while (children) { child = GST_ELEMENT (children->data); - elementnode = xmlNewChild (childlist, NULL, "element", NULL); + elementnode = xmlNewChild (childlist, NULL, (xmlChar *) "element", NULL); gst_object_save_thyself (GST_OBJECT (child), elementnode); children = g_list_next (children); } @@ -1291,12 +1291,12 @@ gst_bin_restore_thyself (GstObject * object, xmlNodePtr self) xmlNodePtr childlist; while (field) { - if (!strcmp (field->name, "children")) { + if (!strcmp ((char *) field->name, "children")) { GST_CAT_INFO (GST_CAT_XML, "[%s]: loading children", GST_ELEMENT_NAME (object)); childlist = field->xmlChildrenNode; while (childlist) { - if (!strcmp (childlist->name, "element")) { + if (!strcmp ((char *) childlist->name, "element")) { GstElement *element = gst_xml_make_element (childlist, GST_OBJECT (bin)); diff --git a/gst/gstcaps.c b/gst/gstcaps.c index 61a7e78..caeaa5b 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -1372,7 +1372,7 @@ gst_caps_switch_structures (GstCaps * caps, GstStructure * old, gboolean gst_caps_do_simplify (GstCaps * caps) { - GstStructure *simplify, *compare, *result; + GstStructure *simplify, *compare, *result = NULL; gint i, j, start; gboolean changed = FALSE; @@ -1439,7 +1439,7 @@ gst_caps_save_thyself (const GstCaps * caps, xmlNodePtr parent) { char *s = gst_caps_to_string (caps); - xmlNewChild (parent, NULL, "caps", s); + xmlNewChild (parent, NULL, (xmlChar *) "caps", (xmlChar *) s); g_free (s); return parent; } @@ -1455,8 +1455,8 @@ gst_caps_save_thyself (const GstCaps * caps, xmlNodePtr parent) GstCaps * gst_caps_load_thyself (xmlNodePtr parent) { - if (strcmp ("caps", parent->name) == 0) { - return gst_caps_from_string (xmlNodeGetContent (parent)); + if (strcmp ("caps", (char *) parent->name) == 0) { + return gst_caps_from_string ((gchar *) xmlNodeGetContent (parent)); } return NULL; diff --git a/gst/gstelement.c b/gst/gstelement.c index 717a7d9..b9ab2e4 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -1985,11 +1985,11 @@ restart: if (GST_IS_REAL_PAD (pad)) { GstRealPad *peer; gboolean pad_loop, pad_get; - gboolean done = FALSE; + gboolean done = FALSE, pad_random = FALSE; /* see if the pad has a loop function and grab * the peer */ - pad_get = gst_pad_check_pull_range (pad); + pad_get = gst_pad_check_pull_range (pad, &pad_random); GST_LOCK (pad); pad_loop = GST_RPAD_LOOPFUNC (pad) != NULL; peer = GST_RPAD_PEER (pad); @@ -1999,9 +1999,11 @@ restart: if (peer) { gboolean peer_loop, peer_get; + gboolean peer_random = FALSE; + GstActivateMode mode; /* see if the peer has a getrange function */ - peer_get = gst_pad_check_pull_range (pad); + peer_get = gst_pad_check_pull_range (GST_PAD_CAST (peer), &peer_random); /* see if the peer has a loop function */ peer_loop = GST_RPAD_LOOPFUNC (peer) != NULL; @@ -2012,8 +2014,10 @@ restart: GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, "%sactivating pad %s pull mode", (active ? "" : "(de)"), GST_OBJECT_NAME (pad)); - result &= gst_pad_set_active (pad, - (active ? GST_ACTIVATE_PULL : GST_ACTIVATE_NONE)); + /* only one of pad_random and peer_random can be true */ + mode = (pad_random || peer_random) + ? GST_ACTIVATE_PULL_RANGE : GST_ACTIVATE_PULL; + result &= gst_pad_set_active (pad, active ? mode : GST_ACTIVATE_NONE); done = TRUE; } gst_object_unref (GST_OBJECT (peer)); @@ -2190,7 +2194,8 @@ gst_element_save_thyself (GstObject * object, xmlNodePtr parent) GList *pads; GstElementClass *oclass; GParamSpec **specs, *spec; - gint nspecs, i; + guint nspecs; + gint i; GValue value = { 0, }; GstElement *element; @@ -2200,12 +2205,14 @@ gst_element_save_thyself (GstObject * object, xmlNodePtr parent) oclass = GST_ELEMENT_GET_CLASS (element); - xmlNewChild (parent, NULL, "name", GST_ELEMENT_NAME (element)); + xmlNewChild (parent, NULL, (xmlChar *) "name", + (xmlChar *) GST_ELEMENT_NAME (element)); if (oclass->elementfactory != NULL) { GstElementFactory *factory = (GstElementFactory *) oclass->elementfactory; - xmlNewChild (parent, NULL, "type", GST_PLUGIN_FEATURE (factory)->name); + xmlNewChild (parent, NULL, (xmlChar *) "type", + (xmlChar *) GST_PLUGIN_FEATURE (factory)->name); } /* FIXME: what is this? */ @@ -2224,8 +2231,8 @@ gst_element_save_thyself (GstObject * object, xmlNodePtr parent) g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (spec)); g_object_get_property (G_OBJECT (element), spec->name, &value); - param = xmlNewChild (parent, NULL, "param", NULL); - xmlNewChild (param, NULL, "name", spec->name); + param = xmlNewChild (parent, NULL, (xmlChar *) "param", NULL); + xmlNewChild (param, NULL, (xmlChar *) "name", (xmlChar *) spec->name); if (G_IS_PARAM_SPEC_STRING (spec)) contents = g_value_dup_string (&value); @@ -2237,7 +2244,7 @@ gst_element_save_thyself (GstObject * object, xmlNodePtr parent) else contents = g_strdup_value_contents (&value); - xmlNewChild (param, NULL, "value", contents); + xmlNewChild (param, NULL, (xmlChar *) "value", (xmlChar *) contents); g_free (contents); g_value_unset (&value); @@ -2251,7 +2258,7 @@ gst_element_save_thyself (GstObject * object, xmlNodePtr parent) /* figure out if it's a direct pad or a ghostpad */ if (GST_ELEMENT (GST_OBJECT_PARENT (pad)) == element) { - xmlNodePtr padtag = xmlNewChild (parent, NULL, "pad", NULL); + xmlNodePtr padtag = xmlNewChild (parent, NULL, (xmlChar *) "pad", NULL); gst_object_save_thyself (GST_OBJECT (pad), padtag); } @@ -2275,14 +2282,14 @@ gst_element_restore_thyself (GstObject * object, xmlNodePtr self) /* parameters */ children = self->xmlChildrenNode; while (children) { - if (!strcmp (children->name, "param")) { + if (!strcmp ((char *) children->name, "param")) { xmlNodePtr child = children->xmlChildrenNode; while (child) { - if (!strcmp (child->name, "name")) { - name = xmlNodeGetContent (child); - } else if (!strcmp (child->name, "value")) { - value = xmlNodeGetContent (child); + if (!strcmp ((char *) child->name, "name")) { + name = (gchar *) xmlNodeGetContent (child); + } else if (!strcmp ((char *) child->name, "value")) { + value = (gchar *) xmlNodeGetContent (child); } child = child->next; } @@ -2298,7 +2305,7 @@ gst_element_restore_thyself (GstObject * object, xmlNodePtr self) /* pads */ children = self->xmlChildrenNode; while (children) { - if (!strcmp (children->name, "pad")) { + if (!strcmp ((char *) children->name, "pad")) { gst_pad_load_and_link (children, GST_OBJECT (element)); } children = children->next; diff --git a/gst/gstpad.c b/gst/gstpad.c index f5236dd..0da4356 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -2493,12 +2493,12 @@ gst_pad_load_and_link (xmlNodePtr self, GstObject * parent) gchar *name = NULL; while (field) { - if (!strcmp (field->name, "name")) { - name = xmlNodeGetContent (field); + if (!strcmp ((char *) field->name, "name")) { + name = (gchar *) xmlNodeGetContent (field); pad = gst_element_get_pad (GST_ELEMENT (parent), name); g_free (name); - } else if (!strcmp (field->name, "peer")) { - peer = xmlNodeGetContent (field); + } else if (!strcmp ((char *) field->name, "peer")) { + peer = (gchar *) xmlNodeGetContent (field); } field = field->next; } @@ -2562,7 +2562,8 @@ gst_pad_save_thyself (GstObject * object, xmlNodePtr parent) realpad = GST_REAL_PAD (object); - xmlNewChild (parent, NULL, "name", GST_PAD_NAME (realpad)); + xmlNewChild (parent, NULL, (xmlChar *) "name", + (xmlChar *) GST_PAD_NAME (realpad)); if (GST_RPAD_PEER (realpad) != NULL) { gchar *content; @@ -2571,10 +2572,10 @@ gst_pad_save_thyself (GstObject * object, xmlNodePtr parent) /* we just save it off */ content = g_strdup_printf ("%s.%s", GST_OBJECT_NAME (GST_PAD_PARENT (peer)), GST_PAD_NAME (peer)); - xmlNewChild (parent, NULL, "peer", content); + xmlNewChild (parent, NULL, (xmlChar *) "peer", (xmlChar *) content); g_free (content); } else - xmlNewChild (parent, NULL, "peer", ""); + xmlNewChild (parent, NULL, (xmlChar *) "peer", (xmlChar *) ""); return parent; } @@ -2595,9 +2596,10 @@ gst_ghost_pad_save_thyself (GstPad * pad, xmlNodePtr parent) g_return_val_if_fail (GST_IS_GHOST_PAD (pad), NULL); - self = xmlNewChild (parent, NULL, "ghostpad", NULL); - xmlNewChild (self, NULL, "name", GST_PAD_NAME (pad)); - xmlNewChild (self, NULL, "parent", GST_OBJECT_NAME (GST_PAD_PARENT (pad))); + self = xmlNewChild (parent, NULL, (xmlChar *) "ghostpad", NULL); + xmlNewChild (self, NULL, (xmlChar *) "name", (xmlChar *) GST_PAD_NAME (pad)); + xmlNewChild (self, NULL, (xmlChar *) "parent", + (xmlChar *) GST_OBJECT_NAME (GST_PAD_PARENT (pad))); /* FIXME FIXME FIXME! */ @@ -2777,7 +2779,7 @@ no_function: * MT safe. */ gboolean -gst_pad_check_pull_range (GstPad * pad) +gst_pad_check_pull_range (GstPad * pad, gboolean * random_access) { GstRealPad *peer; gboolean ret; @@ -2797,13 +2799,14 @@ gst_pad_check_pull_range (GstPad * pad) /* see note in above function */ if (G_LIKELY ((checkgetrangefunc = peer->checkgetrangefunc) == NULL)) { + *random_access = FALSE; ret = GST_RPAD_GETRANGEFUNC (peer) != NULL; } else { GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, "calling checkgetrangefunc %s of peer pad %s:%s", GST_DEBUG_FUNCPTR_NAME (checkgetrangefunc), GST_DEBUG_PAD_NAME (peer)); - ret = checkgetrangefunc (GST_PAD_CAST (peer)); + ret = checkgetrangefunc (GST_PAD_CAST (peer), random_access); } gst_object_unref (GST_OBJECT_CAST (peer)); @@ -2814,6 +2817,7 @@ gst_pad_check_pull_range (GstPad * pad) wrong_direction: { GST_UNLOCK (pad); + *random_access = FALSE; return FALSE; } not_connected: @@ -2821,6 +2825,7 @@ not_connected: GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, "checking pull range, but it was not linked"); GST_UNLOCK (pad); + *random_access = FALSE; return FALSE; } } diff --git a/gst/gstpad.h b/gst/gstpad.h index 3b5cf2e..046423e 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -114,6 +114,7 @@ typedef enum { GST_ACTIVATE_NONE, GST_ACTIVATE_PUSH, GST_ACTIVATE_PULL, + GST_ACTIVATE_PULL_RANGE, } GstActivateMode; #define GST_PAD_MODE_ACTIVATE(mode) ((mode) != GST_ACTIVATE_NONE) @@ -138,7 +139,7 @@ typedef void (*GstPadLoopFunction) (GstPad *pad); typedef GstFlowReturn (*GstPadChainFunction) (GstPad *pad, GstBuffer *buffer); typedef GstFlowReturn (*GstPadGetRangeFunction) (GstPad *pad, guint64 offset, guint length, GstBuffer **buffer); -typedef gboolean (*GstPadCheckGetRangeFunction) (GstPad *pad); +typedef gboolean (*GstPadCheckGetRangeFunction) (GstPad *pad, gboolean *random_access); typedef gboolean (*GstPadEventFunction) (GstPad *pad, GstEvent *event); /* convert/query/format functions */ @@ -523,7 +524,7 @@ GstCaps * gst_pad_get_negotiated_caps (GstPad * pad); /* data passing functions */ GstFlowReturn gst_pad_push (GstPad *pad, GstBuffer *buffer); -gboolean gst_pad_check_pull_range (GstPad *pad); +gboolean gst_pad_check_pull_range (GstPad *pad, gboolean *random_access); GstFlowReturn gst_pad_pull_range (GstPad *pad, guint64 offset, guint size, GstBuffer **buffer); gboolean gst_pad_push_event (GstPad *pad, GstEvent *event); diff --git a/gst/gstxml.c b/gst/gstxml.c index 46d41c1..004d2ee 100644 --- a/gst/gstxml.c +++ b/gst/gstxml.c @@ -118,14 +118,16 @@ gst_xml_write (GstElement * element) xmlNodePtr elementnode; xmlNsPtr gst_ns; - doc = xmlNewDoc ("1.0"); + doc = xmlNewDoc ((xmlChar *) "1.0"); - doc->xmlRootNode = xmlNewDocNode (doc, NULL, "gstreamer", NULL); + doc->xmlRootNode = xmlNewDocNode (doc, NULL, (xmlChar *) "gstreamer", NULL); gst_ns = - xmlNewNs (doc->xmlRootNode, "http://gstreamer.net/gst-core/1.0/", "gst"); + xmlNewNs (doc->xmlRootNode, + (xmlChar *) "http://gstreamer.net/gst-core/1.0/", (xmlChar *) "gst"); - elementnode = xmlNewChild (doc->xmlRootNode, gst_ns, "element", NULL); + elementnode = xmlNewChild (doc->xmlRootNode, gst_ns, (xmlChar *) "element", + NULL); gst_object_save_thyself (GST_OBJECT (element), elementnode); @@ -218,12 +220,13 @@ gst_xml_parse_doc (GstXML * xml, xmlDocPtr doc, const guchar * root) g_warning ("gstxml: empty document\n"); return FALSE; } - ns = xmlSearchNsByHref (doc, cur, "http://gstreamer.net/gst-core/1.0/"); + ns = xmlSearchNsByHref (doc, cur, + (xmlChar *) "http://gstreamer.net/gst-core/1.0/"); if (ns == NULL) { g_warning ("gstxml: document of wrong type, core namespace not found\n"); return FALSE; } - if (strcmp (cur->name, "gstreamer")) { + if (strcmp ((char *) cur->name, "gstreamer")) { g_warning ("gstxml: XML file is in wrong format\n"); return FALSE; } @@ -236,7 +239,7 @@ gst_xml_parse_doc (GstXML * xml, xmlDocPtr doc, const guchar * root) field = cur->xmlChildrenNode; while (field) { - if (!strcmp (field->name, "element") && (field->ns == xml->ns)) { + if (!strcmp ((char *) field->name, "element") && (field->ns == xml->ns)) { GstElement *element; element = gst_xml_make_element (field, NULL); @@ -251,6 +254,7 @@ gst_xml_parse_doc (GstXML * xml, xmlDocPtr doc, const guchar * root) return TRUE; } +/* FIXME 0.9: Why guchar*? */ /** * gst_xml_parse_file: * @xml: a pointer to a GstXML object @@ -275,7 +279,7 @@ gst_xml_parse_file (GstXML * xml, const guchar * fname, const guchar * root) g_return_val_if_fail (fname != NULL, FALSE); - doc = xmlParseFile (fname); + doc = xmlParseFile ((char *) fname); if (!doc) { g_warning ("gstxml: XML file \"%s\" could not be read\n", fname); @@ -285,6 +289,7 @@ gst_xml_parse_file (GstXML * xml, const guchar * fname, const guchar * root) return gst_xml_parse_doc (xml, doc, root); } +/* FIXME guchar* */ /** * gst_xml_parse_memory: * @xml: a pointer to a GstXML object @@ -305,9 +310,9 @@ gst_xml_parse_memory (GstXML * xml, guchar * buffer, guint size, g_return_val_if_fail (buffer != NULL, FALSE); - doc = xmlParseMemory (buffer, size); + doc = xmlParseMemory ((char *) buffer, size); - return gst_xml_parse_doc (xml, doc, root); + return gst_xml_parse_doc (xml, doc, (const xmlChar *) root); } static void @@ -337,6 +342,7 @@ gst_xml_get_topelements (GstXML * xml) return xml->topelements; } +/* FIXME 0.9: why is the arg guchar* instead of gchar*? */ /** * gst_xml_get_element: * @xml: The GstXML to get the element from @@ -365,11 +371,11 @@ gst_xml_get_element (GstXML * xml, const guchar * name) GstElement *top = GST_ELEMENT (topelements->data); GST_DEBUG ("gstxml: getting element \"%s\"", name); - if (!strcmp (GST_ELEMENT_NAME (top), name)) { + if (!strcmp (GST_ELEMENT_NAME (top), (char *) name)) { return top; } else { if (GST_IS_BIN (top)) { - element = gst_bin_get_by_name (GST_BIN (top), name); + element = gst_bin_get_by_name (GST_BIN (top), (gchar *) name); if (element) return element; @@ -394,15 +400,15 @@ gst_xml_make_element (xmlNodePtr cur, GstObject * parent) { xmlNodePtr children = cur->xmlChildrenNode; GstElement *element; - guchar *name = NULL; - guchar *type = NULL; + gchar *name = NULL; + gchar *type = NULL; /* first get the needed tags to construct the element */ while (children) { - if (!strcmp (children->name, "name")) { - name = xmlNodeGetContent (children); - } else if (!strcmp (children->name, "type")) { - type = xmlNodeGetContent (children); + if (!strcmp ((char *) children->name, "name")) { + name = (gchar *) xmlNodeGetContent (children); + } else if (!strcmp ((char *) children->name, "type")) { + type = (gchar *) xmlNodeGetContent (children); } children = children->next; } diff --git a/gst/indexers/gstfileindex.c b/gst/indexers/gstfileindex.c index ee7d891..d0ef6eb 100644 --- a/gst/indexers/gstfileindex.c +++ b/gst/indexers/gstfileindex.c @@ -364,24 +364,24 @@ gst_file_index_load (GstFileIndex * index) //xmlDocFormatDump (stderr, doc, TRUE); root = doc->xmlRootNode; - if (strcmp (root->name, "gstfileindex") != 0) { + if (strcmp ((char *) root->name, "gstfileindex") != 0) { GST_ERROR_OBJECT (index, "root node isn't a gstfileindex"); return; } - val = xmlGetProp (root, "version"); - if (!val || atoi (val) != 1) { + val = xmlGetProp (root, (xmlChar *) "version"); + if (!val || atoi ((char *) val) != 1) { GST_ERROR_OBJECT (index, "version != 1"); return; } free (val); for (part = root->children; part; part = part->next) { - if (strcmp (part->name, "writers") == 0) { + if (strcmp ((char *) part->name, "writers") == 0) { xmlNodePtr writer; for (writer = part->children; writer; writer = writer->next) { - xmlChar *datafile = xmlGetProp (writer, "datafile"); + xmlChar *datafile = xmlGetProp (writer, (xmlChar *) "datafile"); gchar *path = g_strdup_printf ("%s/%s", index->location, datafile); int fd; GstFileIndexId *id_index; @@ -400,22 +400,22 @@ gst_file_index_load (GstFileIndex * index) } id_index = g_new0 (GstFileIndexId, 1); - id_index->id_desc = xmlGetProp (writer, "id"); + id_index->id_desc = (char *) xmlGetProp (writer, (xmlChar *) "id"); for (wpart = writer->children; wpart; wpart = wpart->next) { - if (strcmp (wpart->name, "formats") == 0) { - xmlChar *count_str = xmlGetProp (wpart, "count"); + if (strcmp ((char *) wpart->name, "formats") == 0) { + xmlChar *count_str = xmlGetProp (wpart, (xmlChar *) "count"); gint fx = 0; xmlNodePtr format; - id_index->nformats = atoi (count_str); + id_index->nformats = atoi ((char *) count_str); free (count_str); id_index->format = g_new (GstFormat, id_index->nformats); for (format = wpart->children; format; format = format->next) { - xmlChar *nick = xmlGetProp (format, "nick"); - GstFormat fmt = gst_format_get_by_nick (nick); + xmlChar *nick = xmlGetProp (format, (xmlChar *) "nick"); + GstFormat fmt = gst_format_get_by_nick ((gchar *) nick); if (fmt == GST_FORMAT_UNDEFINED) GST_ERROR_OBJECT (index, "format '%s' undefined", nick); @@ -431,8 +431,8 @@ gst_file_index_load (GstFileIndex * index) _fc_alloc_array (id_index); g_assert (id_index->array->data == NULL); /* little bit risky */ - entries_str = xmlGetProp (writer, "entries"); - id_index->array->len = atoi (entries_str); + entries_str = xmlGetProp (writer, (xmlChar *) "entries"); + id_index->array->len = atoi ((char *) entries_str); free (entries_str); array_data = @@ -505,22 +505,22 @@ _file_index_id_save_xml (gpointer _key, GstFileIndexId * ii, xmlNodePtr writers) return; } - writer = xmlNewChild (writers, NULL, "writer", NULL); - xmlSetProp (writer, "id", ii->id_desc); + writer = xmlNewChild (writers, NULL, (xmlChar *) "writer", NULL); + xmlSetProp (writer, (xmlChar *) "id", (xmlChar *) ii->id_desc); g_snprintf (buf, bufsize, "%d", ii->array->len); - xmlSetProp (writer, "entries", buf); + xmlSetProp (writer, (xmlChar *) "entries", (xmlChar *) buf); g_snprintf (buf, bufsize, "%d", ii->id); /* any unique number is OK */ - xmlSetProp (writer, "datafile", buf); + xmlSetProp (writer, (xmlChar *) "datafile", (xmlChar *) buf); - formats = xmlNewChild (writer, NULL, "formats", NULL); + formats = xmlNewChild (writer, NULL, (xmlChar *) "formats", NULL); g_snprintf (buf, bufsize, "%d", ii->nformats); - xmlSetProp (formats, "count", buf); + xmlSetProp (formats, (xmlChar *) "count", (xmlChar *) buf); for (xx = 0; xx < ii->nformats; xx++) { - xmlNodePtr format = xmlNewChild (formats, NULL, "format", NULL); + xmlNodePtr format = xmlNewChild (formats, NULL, (xmlChar *) "format", NULL); const GstFormatDefinition *def = gst_format_get_details (ii->format[xx]); - xmlSetProp (format, "nick", def->nick); + xmlSetProp (format, (xmlChar *) "nick", (xmlChar *) def->nick); } } @@ -591,11 +591,12 @@ gst_file_index_commit (GstIndex * _index, gint _writer_id) GST_FLAG_UNSET (index, GST_INDEX_WRITABLE); - doc = xmlNewDoc ("1.0"); - doc->xmlRootNode = xmlNewDocNode (doc, NULL, "gstfileindex", NULL); - xmlSetProp (doc->xmlRootNode, "version", "1"); + doc = xmlNewDoc ((xmlChar *) "1.0"); + doc->xmlRootNode = + xmlNewDocNode (doc, NULL, (xmlChar *) "gstfileindex", NULL); + xmlSetProp (doc->xmlRootNode, (xmlChar *) "version", (xmlChar *) "1"); - writers = xmlNewChild (doc->xmlRootNode, NULL, "writers", NULL); + writers = xmlNewChild (doc->xmlRootNode, NULL, (xmlChar *) "writers", NULL); g_hash_table_foreach (index->id_index, (GHFunc) _file_index_id_save_xml, writers); @@ -623,7 +624,7 @@ gst_file_index_commit (GstIndex * _index, gint _writer_id) int xmlsize; xmlDocDumpMemory (doc, &xmlmem, &xmlsize); - g_io_channel_write_chars (tocfile, xmlmem, xmlsize, NULL, &err); + g_io_channel_write_chars (tocfile, (gchar *) xmlmem, xmlsize, NULL, &err); if (err) { GST_ERROR_OBJECT (index, "%s", err->message); return; diff --git a/gst/registries/gstlibxmlregistry.c b/gst/registries/gstlibxmlregistry.c index 2e5bcf8..0d7bad7 100644 --- a/gst/registries/gstlibxmlregistry.c +++ b/gst/registries/gstlibxmlregistry.c @@ -587,7 +587,7 @@ read_string (xmlTextReaderPtr reader, gchar ** write_to) if (xmlTextReaderNodeType (reader) == XML_READER_TYPE_TEXT) { if (found) return FALSE; - *write_to = g_strdup (xmlTextReaderConstValue (reader)); + *write_to = g_strdup ((gchar *) xmlTextReaderConstValue (reader)); found = TRUE; } } @@ -610,7 +610,7 @@ read_uint (xmlTextReaderPtr reader, guint * write_to) if (found) return FALSE; - *write_to = strtol (xmlTextReaderConstValue (reader), &ret, 0); + *write_to = strtol ((char *) xmlTextReaderConstValue (reader), &ret, 0); if (ret != NULL) return FALSE; found = TRUE; @@ -641,7 +641,7 @@ read_enum (xmlTextReaderPtr reader, GType enum_type, guint * write_to) return FALSE; value = g_enum_get_value_by_nick (enum_class, - xmlTextReaderConstValue (reader)); + (gchar *) xmlTextReaderConstValue (reader)); if (value) { *write_to = value->value; found = TRUE; @@ -674,7 +674,7 @@ load_pad_template (xmlTextReaderPtr reader) } if (xmlTextReaderNodeType (reader) == XML_READER_TYPE_ELEMENT && xmlTextReaderDepth (reader) == depth + 1) { - const gchar *tag = xmlTextReaderConstName (reader); + const gchar *tag = (gchar *) xmlTextReaderConstName (reader); if (g_str_equal (tag, "nametemplate")) { read_string (reader, &name); @@ -720,7 +720,7 @@ load_feature (xmlTextReaderPtr reader) return feature; if (xmlTextReaderNodeType (reader) == XML_READER_TYPE_ELEMENT && xmlTextReaderDepth (reader) == depth + 1) { - const gchar *tag = xmlTextReaderConstName (reader); + const gchar *tag = (gchar *) xmlTextReaderConstName (reader); if (g_str_equal (tag, "name")) read_string (reader, &feature->name); @@ -812,7 +812,7 @@ load_plugin (xmlTextReaderPtr reader) } if (xmlTextReaderNodeType (reader) == XML_READER_TYPE_ELEMENT && xmlTextReaderDepth (reader) == 2) { - const gchar *tag = xmlTextReaderConstName (reader); + const gchar *tag = (gchar *) xmlTextReaderConstName (reader); if (g_str_equal (tag, "name")) { if (!read_string (reader, &plugin->desc.name)) @@ -860,7 +860,7 @@ load_paths (xmlTextReaderPtr reader, GstXMLRegistry * registry) } if (xmlTextReaderNodeType (reader) == XML_READER_TYPE_ELEMENT && xmlTextReaderDepth (reader) == 2) { - const gchar *tag = xmlTextReaderConstName (reader); + const gchar *tag = (gchar *) xmlTextReaderConstName (reader); if (g_str_equal (tag, "path")) { gchar *s = NULL; diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index 4f325c9..6cd07d3 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -752,6 +752,7 @@ gst_basesink_activate (GstPad * pad, GstActivateMode mode) result = TRUE; break; case GST_ACTIVATE_PULL: + case GST_ACTIVATE_PULL_RANGE: /* if we have a scheduler we can start the task */ g_return_val_if_fail (basesink->has_loop, FALSE); gst_pad_peer_set_active (pad, mode); diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index c45842b..f4908ae 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -48,6 +48,8 @@ enum { PROP_0, PROP_BLOCKSIZE, + PROP_HAS_LOOP, + PROP_HAS_GETRANGE }; static GstElementClass *parent_class = NULL; @@ -99,8 +101,10 @@ static gboolean gst_basesrc_stop (GstBaseSrc * basesrc); static GstElementStateReturn gst_basesrc_change_state (GstElement * element); +static void gst_basesrc_set_dataflow_funcs (GstBaseSrc * this); static void gst_basesrc_loop (GstPad * pad); -static gboolean gst_basesrc_check_get_range (GstPad * pad); +static gboolean gst_basesrc_check_get_range (GstPad * pad, + gboolean * random_access); static GstFlowReturn gst_basesrc_get_range (GstPad * pad, guint64 offset, guint length, GstBuffer ** buf); @@ -129,6 +133,16 @@ gst_basesrc_class_init (GstBaseSrcClass * klass) "Size in bytes to read per buffer", 1, G_MAXULONG, DEFAULT_BLOCKSIZE, G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HAS_LOOP, + g_param_spec_boolean ("has-loop", "Has loop function", + "True if the element should expose a loop function", TRUE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HAS_GETRANGE, + g_param_spec_boolean ("has-getrange", "Has getrange function", + "True if the element should expose a getrange function", TRUE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_basesrc_change_state); } @@ -150,9 +164,7 @@ gst_basesrc_init (GstBaseSrc * basesrc, gpointer g_class) gst_pad_set_query_function (pad, gst_basesrc_query); gst_pad_set_query_type_function (pad, gst_basesrc_get_query_types); gst_pad_set_formats_function (pad, gst_basesrc_get_formats); - gst_pad_set_loop_function (pad, gst_basesrc_loop); gst_pad_set_checkgetrange_function (pad, gst_basesrc_check_get_range); - gst_pad_set_getrange_function (pad, gst_basesrc_get_range); /* hold ref to pad */ basesrc->srcpad = pad; gst_element_add_pad (GST_ELEMENT (basesrc), pad); @@ -164,6 +176,20 @@ gst_basesrc_init (GstBaseSrc * basesrc, gpointer g_class) GST_FLAG_UNSET (basesrc, GST_BASESRC_STARTED); } +static void +gst_basesrc_set_dataflow_funcs (GstBaseSrc * this) +{ + if (this->has_loop) + gst_pad_set_loop_function (this->srcpad, gst_basesrc_loop); + else + gst_pad_set_loop_function (this->srcpad, NULL); + + if (this->has_getrange) + gst_pad_set_getrange_function (this->srcpad, gst_basesrc_get_range); + else + gst_pad_set_getrange_function (this->srcpad, NULL); +} + static const GstFormat * gst_basesrc_get_formats (GstPad * pad) { @@ -206,7 +232,8 @@ gst_basesrc_query (GstPad * pad, GstQueryType type, { gboolean ret; - ret = gst_basesrc_get_size (src, value); + /* FIXME-wim: is this cast right? */ + ret = gst_basesrc_get_size (src, (guint64 *) value); GST_DEBUG ("getting length %d %lld", ret, *value); return ret; } @@ -223,7 +250,8 @@ gst_basesrc_query (GstPad * pad, GstQueryType type, *value = src->offset; break; case GST_FORMAT_PERCENT: - if (!gst_basesrc_get_size (src, value)) + /* fixme */ + if (!gst_basesrc_get_size (src, (guint64 *) value)) return FALSE; *value = src->offset * GST_FORMAT_PERCENT_MAX / *value; return TRUE; @@ -402,6 +430,14 @@ gst_basesrc_set_property (GObject * object, guint prop_id, const GValue * value, case PROP_BLOCKSIZE: src->blocksize = g_value_get_ulong (value); break; + case PROP_HAS_LOOP: + src->has_loop = g_value_get_boolean (value); + gst_basesrc_set_dataflow_funcs (src); + break; + case PROP_HAS_GETRANGE: + src->has_getrange = g_value_get_boolean (value); + gst_basesrc_set_dataflow_funcs (src); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -420,6 +456,12 @@ gst_basesrc_get_property (GObject * object, guint prop_id, GValue * value, case PROP_BLOCKSIZE: g_value_set_ulong (value, src->blocksize); break; + case PROP_HAS_LOOP: + g_value_set_boolean (value, src->has_loop); + break; + case PROP_HAS_GETRANGE: + g_value_set_boolean (value, src->has_getrange); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -495,7 +537,7 @@ gst_basesrc_get_range (GstPad * pad, guint64 offset, guint length, } static gboolean -gst_basesrc_check_get_range (GstPad * pad) +gst_basesrc_check_get_range (GstPad * pad, gboolean * random_access) { GstBaseSrc *src; @@ -506,6 +548,7 @@ gst_basesrc_check_get_range (GstPad * pad) gst_basesrc_stop (src); } + *random_access = src->random_access; return src->seekable; } @@ -675,6 +718,7 @@ gst_basesrc_activate (GstPad * pad, GstActivateMode mode) switch (mode) { case GST_ACTIVATE_PUSH: case GST_ACTIVATE_PULL: + case GST_ACTIVATE_PULL_RANGE: result = gst_basesrc_start (basesrc); break; default: @@ -701,6 +745,7 @@ gst_basesrc_activate (GstPad * pad, GstActivateMode mode) } break; case GST_ACTIVATE_PULL: + case GST_ACTIVATE_PULL_RANGE: result = TRUE; break; case GST_ACTIVATE_NONE: diff --git a/libs/gst/base/gstbasesrc.h b/libs/gst/base/gstbasesrc.h index 8943fd9..d9cee76 100644 --- a/libs/gst/base/gstbasesrc.h +++ b/libs/gst/base/gstbasesrc.h @@ -56,7 +56,11 @@ struct _GstBaseSrc { gint64 segment_end; gboolean segment_loop; + gboolean has_loop; + gboolean has_getrange; + gboolean seekable; + gboolean random_access; guint64 offset; guint64 size; }; diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index 7c2baff..8eef186 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -334,6 +334,7 @@ gst_base_transform_sink_activate (GstPad * pad, GstActivateMode mode) switch (mode) { case GST_ACTIVATE_PUSH: case GST_ACTIVATE_PULL: + case GST_ACTIVATE_PULL_RANGE: if (bclass->start) result = bclass->start (trans); break; @@ -357,6 +358,7 @@ gst_base_transform_src_activate (GstPad * pad, GstActivateMode mode) result = TRUE; break; case GST_ACTIVATE_PULL: + case GST_ACTIVATE_PULL_RANGE: result = gst_pad_set_active (trans->sinkpad, mode); result = gst_pad_peer_set_active (trans->sinkpad, mode); break; diff --git a/libs/gst/dataprotocol/dataprotocol.c b/libs/gst/dataprotocol/dataprotocol.c index 0ae75af..9210f29 100644 --- a/libs/gst/dataprotocol/dataprotocol.c +++ b/libs/gst/dataprotocol/dataprotocol.c @@ -237,7 +237,7 @@ gst_dp_packet_from_caps (const GstCaps * caps, GstDPHeaderFlag flags, { guint8 *h; guint16 crc; - gchar *string; + guchar *string; /* FIXME: GST_IS_CAPS doesn't work g_return_val_if_fail (GST_IS_CAPS (caps), FALSE); */ @@ -248,7 +248,7 @@ gst_dp_packet_from_caps (const GstCaps * caps, GstDPHeaderFlag flags, *length = GST_DP_HEADER_LENGTH; h = g_malloc (GST_DP_HEADER_LENGTH); - string = gst_caps_to_string (caps); + string = (guchar *) gst_caps_to_string (caps); /* version, flags, type */ h[0] = (guint8) GST_DP_VERSION_MAJOR; @@ -257,7 +257,7 @@ gst_dp_packet_from_caps (const GstCaps * caps, GstDPHeaderFlag flags, h[3] = GST_DP_PAYLOAD_CAPS; /* buffer properties */ - GST_WRITE_UINT32_BE (h + 4, strlen (string) + 1); /* include trailing 0 */ + GST_WRITE_UINT32_BE (h + 4, strlen ((gchar *) string) + 1); /* include trailing 0 */ GST_WRITE_UINT64_BE (h + 8, (guint64) 0); GST_WRITE_UINT64_BE (h + 16, (guint64) 0); GST_WRITE_UINT64_BE (h + 24, (guint64) 0); @@ -276,7 +276,7 @@ gst_dp_packet_from_caps (const GstCaps * caps, GstDPHeaderFlag flags, crc = 0; if (flags & GST_DP_HEADER_FLAG_CRC_PAYLOAD) { - crc = gst_dp_crc (string, strlen (string) + 1); + crc = gst_dp_crc (string, strlen ((gchar *) string) + 1); } GST_WRITE_UINT16_BE (h + 58, crc); @@ -379,7 +379,7 @@ gst_dp_packet_from_event (const GstEvent * event, GstDPHeaderFlag flags, crc = 0; /* events can have a NULL payload */ if (*payload && flags & GST_DP_HEADER_FLAG_CRC_PAYLOAD) { - crc = gst_dp_crc (*payload, strlen (*payload) + 1); + crc = gst_dp_crc (*payload, strlen ((gchar *) * payload) + 1); } GST_WRITE_UINT16_BE (h + 58, crc); @@ -443,7 +443,7 @@ gst_dp_caps_from_packet (guint header_length, const guint8 * header, g_return_val_if_fail (GST_DP_HEADER_PAYLOAD_TYPE (header) == GST_DP_PAYLOAD_CAPS, FALSE); - string = payload; + string = (gchar *) payload; caps = gst_caps_from_string (string); return caps; } diff --git a/plugins/elements/gstelements.c b/plugins/elements/gstelements.c index f093c38..d5b228b 100644 --- a/plugins/elements/gstelements.c +++ b/plugins/elements/gstelements.c @@ -74,7 +74,7 @@ static struct _elements_entry _elements[] = { // {"statistics", GST_RANK_NONE, gst_statistics_get_type}, {"tee", GST_RANK_NONE, gst_tee_get_type}, {"typefind", GST_RANK_NONE, gst_type_find_element_get_type}, -// {NULL, 0}, + {NULL, 0}, }; static gboolean diff --git a/plugins/elements/gstfakesrc.c b/plugins/elements/gstfakesrc.c index 79a58e3..4715db5 100644 --- a/plugins/elements/gstfakesrc.c +++ b/plugins/elements/gstfakesrc.c @@ -88,7 +88,9 @@ enum PROP_SILENT, PROP_DUMP, PROP_PARENTSIZE, - PROP_LAST_MESSAGE + PROP_LAST_MESSAGE, + PROP_HAS_LOOP, + PROP_HAS_GETRANGE }; #define GST_TYPE_FAKESRC_OUTPUT (gst_fakesrc_output_get_type()) @@ -274,6 +276,14 @@ gst_fakesrc_class_init (GstFakeSrcClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DUMP, g_param_spec_boolean ("dump", "Dump", "Dump produced bytes to stdout", DEFAULT_DUMP, G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HAS_LOOP, + g_param_spec_boolean ("has-loop", "Has loop function", + "True if the element exposes a loop function", TRUE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HAS_GETRANGE, + g_param_spec_boolean ("has-getrange", "Has getrange function", + "True if the element exposes a getrange function", TRUE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); gst_fakesrc_signals[SIGNAL_HANDOFF] = g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, @@ -281,6 +291,7 @@ gst_fakesrc_class_init (GstFakeSrcClass * klass) gst_marshal_VOID__BOXED_OBJECT, G_TYPE_NONE, 1, GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE); + /*gstbasesrc_class->is_seekable = GST_DEBUG_FUNCPTR (gst_fakesrc_is_seekable); */ gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_fakesrc_start); gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_fakesrc_stop); gstbasesrc_class->event = GST_DEBUG_FUNCPTR (gst_fakesrc_event_handler); @@ -410,6 +421,14 @@ gst_fakesrc_set_property (GObject * object, guint prop_id, const GValue * value, case PROP_DUMP: src->dump = g_value_get_boolean (value); break; + case PROP_HAS_LOOP: + g_return_if_fail (!GST_FLAG_IS_SET (object, GST_BASESRC_STARTED)); + src->has_loop = g_value_get_boolean (value); + break; + case PROP_HAS_GETRANGE: + g_return_if_fail (!GST_FLAG_IS_SET (object, GST_BASESRC_STARTED)); + src->has_getrange = g_value_get_boolean (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -476,6 +495,12 @@ gst_fakesrc_get_property (GObject * object, guint prop_id, GValue * value, case PROP_LAST_MESSAGE: g_value_set_string (value, src->last_message); break; + case PROP_HAS_LOOP: + g_value_set_boolean (value, src->has_loop); + break; + case PROP_HAS_GETRANGE: + g_value_set_boolean (value, src->has_getrange); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; diff --git a/plugins/elements/gsttee.c b/plugins/elements/gsttee.c index cd7213c..f0f3060 100644 --- a/plugins/elements/gsttee.c +++ b/plugins/elements/gsttee.c @@ -369,6 +369,7 @@ gst_tee_sink_activate (GstPad * pad, GstActivateMode mode) result = TRUE; break; case GST_ACTIVATE_PULL: + case GST_ACTIVATE_PULL_RANGE: g_return_val_if_fail (tee->has_sink_loop, FALSE); if (GST_ELEMENT_SCHEDULER (tee)) { GST_STREAM_LOCK (pad); diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index 1cce1ab..3c4a07c 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -128,7 +128,8 @@ static GstFlowReturn gst_type_find_element_chain (GstPad * sinkpad, GstBuffer * buffer); static GstFlowReturn gst_type_find_element_getrange (GstPad * srcpad, guint64 offset, guint length, GstBuffer ** buffer); -static gboolean gst_type_find_element_checkgetrange (GstPad * srcpad); +static gboolean gst_type_find_element_checkgetrange (GstPad * srcpad, + gboolean * random_access); static GstElementStateReturn gst_type_find_element_change_state (GstElement * element); static gboolean @@ -463,7 +464,7 @@ find_element_get_length (gpointer data) if (entry->self->stream_length == 0) { typefind->stream_length_available = gst_pad_query (GST_PAD_PEER (entry->self->sink), GST_QUERY_TOTAL, - &format, &entry->self->stream_length); + &format, (gint64 *) & entry->self->stream_length); if (format != GST_FORMAT_BYTES) typefind->stream_length_available = FALSE; if (!typefind->stream_length_available) { @@ -806,13 +807,13 @@ gst_type_find_element_chain (GstPad * pad, GstBuffer * buffer) } static gboolean -gst_type_find_element_checkgetrange (GstPad * srcpad) +gst_type_find_element_checkgetrange (GstPad * srcpad, gboolean * random_access) { GstTypeFindElement *typefind; typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (srcpad)); - return gst_pad_check_pull_range (typefind->sink); + return gst_pad_check_pull_range (typefind->sink, random_access); } static GstFlowReturn @@ -861,6 +862,7 @@ gst_type_find_element_activate (GstPad * pad, GstActivateMode mode) switch (mode) { case GST_ACTIVATE_PUSH: case GST_ACTIVATE_PULL: + case GST_ACTIVATE_PULL_RANGE: result = TRUE; break; default: diff --git a/plugins/indexers/gstfileindex.c b/plugins/indexers/gstfileindex.c index ee7d891..d0ef6eb 100644 --- a/plugins/indexers/gstfileindex.c +++ b/plugins/indexers/gstfileindex.c @@ -364,24 +364,24 @@ gst_file_index_load (GstFileIndex * index) //xmlDocFormatDump (stderr, doc, TRUE); root = doc->xmlRootNode; - if (strcmp (root->name, "gstfileindex") != 0) { + if (strcmp ((char *) root->name, "gstfileindex") != 0) { GST_ERROR_OBJECT (index, "root node isn't a gstfileindex"); return; } - val = xmlGetProp (root, "version"); - if (!val || atoi (val) != 1) { + val = xmlGetProp (root, (xmlChar *) "version"); + if (!val || atoi ((char *) val) != 1) { GST_ERROR_OBJECT (index, "version != 1"); return; } free (val); for (part = root->children; part; part = part->next) { - if (strcmp (part->name, "writers") == 0) { + if (strcmp ((char *) part->name, "writers") == 0) { xmlNodePtr writer; for (writer = part->children; writer; writer = writer->next) { - xmlChar *datafile = xmlGetProp (writer, "datafile"); + xmlChar *datafile = xmlGetProp (writer, (xmlChar *) "datafile"); gchar *path = g_strdup_printf ("%s/%s", index->location, datafile); int fd; GstFileIndexId *id_index; @@ -400,22 +400,22 @@ gst_file_index_load (GstFileIndex * index) } id_index = g_new0 (GstFileIndexId, 1); - id_index->id_desc = xmlGetProp (writer, "id"); + id_index->id_desc = (char *) xmlGetProp (writer, (xmlChar *) "id"); for (wpart = writer->children; wpart; wpart = wpart->next) { - if (strcmp (wpart->name, "formats") == 0) { - xmlChar *count_str = xmlGetProp (wpart, "count"); + if (strcmp ((char *) wpart->name, "formats") == 0) { + xmlChar *count_str = xmlGetProp (wpart, (xmlChar *) "count"); gint fx = 0; xmlNodePtr format; - id_index->nformats = atoi (count_str); + id_index->nformats = atoi ((char *) count_str); free (count_str); id_index->format = g_new (GstFormat, id_index->nformats); for (format = wpart->children; format; format = format->next) { - xmlChar *nick = xmlGetProp (format, "nick"); - GstFormat fmt = gst_format_get_by_nick (nick); + xmlChar *nick = xmlGetProp (format, (xmlChar *) "nick"); + GstFormat fmt = gst_format_get_by_nick ((gchar *) nick); if (fmt == GST_FORMAT_UNDEFINED) GST_ERROR_OBJECT (index, "format '%s' undefined", nick); @@ -431,8 +431,8 @@ gst_file_index_load (GstFileIndex * index) _fc_alloc_array (id_index); g_assert (id_index->array->data == NULL); /* little bit risky */ - entries_str = xmlGetProp (writer, "entries"); - id_index->array->len = atoi (entries_str); + entries_str = xmlGetProp (writer, (xmlChar *) "entries"); + id_index->array->len = atoi ((char *) entries_str); free (entries_str); array_data = @@ -505,22 +505,22 @@ _file_index_id_save_xml (gpointer _key, GstFileIndexId * ii, xmlNodePtr writers) return; } - writer = xmlNewChild (writers, NULL, "writer", NULL); - xmlSetProp (writer, "id", ii->id_desc); + writer = xmlNewChild (writers, NULL, (xmlChar *) "writer", NULL); + xmlSetProp (writer, (xmlChar *) "id", (xmlChar *) ii->id_desc); g_snprintf (buf, bufsize, "%d", ii->array->len); - xmlSetProp (writer, "entries", buf); + xmlSetProp (writer, (xmlChar *) "entries", (xmlChar *) buf); g_snprintf (buf, bufsize, "%d", ii->id); /* any unique number is OK */ - xmlSetProp (writer, "datafile", buf); + xmlSetProp (writer, (xmlChar *) "datafile", (xmlChar *) buf); - formats = xmlNewChild (writer, NULL, "formats", NULL); + formats = xmlNewChild (writer, NULL, (xmlChar *) "formats", NULL); g_snprintf (buf, bufsize, "%d", ii->nformats); - xmlSetProp (formats, "count", buf); + xmlSetProp (formats, (xmlChar *) "count", (xmlChar *) buf); for (xx = 0; xx < ii->nformats; xx++) { - xmlNodePtr format = xmlNewChild (formats, NULL, "format", NULL); + xmlNodePtr format = xmlNewChild (formats, NULL, (xmlChar *) "format", NULL); const GstFormatDefinition *def = gst_format_get_details (ii->format[xx]); - xmlSetProp (format, "nick", def->nick); + xmlSetProp (format, (xmlChar *) "nick", (xmlChar *) def->nick); } } @@ -591,11 +591,12 @@ gst_file_index_commit (GstIndex * _index, gint _writer_id) GST_FLAG_UNSET (index, GST_INDEX_WRITABLE); - doc = xmlNewDoc ("1.0"); - doc->xmlRootNode = xmlNewDocNode (doc, NULL, "gstfileindex", NULL); - xmlSetProp (doc->xmlRootNode, "version", "1"); + doc = xmlNewDoc ((xmlChar *) "1.0"); + doc->xmlRootNode = + xmlNewDocNode (doc, NULL, (xmlChar *) "gstfileindex", NULL); + xmlSetProp (doc->xmlRootNode, (xmlChar *) "version", (xmlChar *) "1"); - writers = xmlNewChild (doc->xmlRootNode, NULL, "writers", NULL); + writers = xmlNewChild (doc->xmlRootNode, NULL, (xmlChar *) "writers", NULL); g_hash_table_foreach (index->id_index, (GHFunc) _file_index_id_save_xml, writers); @@ -623,7 +624,7 @@ gst_file_index_commit (GstIndex * _index, gint _writer_id) int xmlsize; xmlDocDumpMemory (doc, &xmlmem, &xmlsize); - g_io_channel_write_chars (tocfile, xmlmem, xmlsize, NULL, &err); + g_io_channel_write_chars (tocfile, (gchar *) xmlmem, xmlsize, NULL, &err); if (err) { GST_ERROR_OBJECT (index, "%s", err->message); return; diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 4be9f45..0f94ba1 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -32,6 +32,7 @@ TESTS = $(top_builddir)/tools/gst-register \ gst/gstobject \ gst/gstpad \ gst/gstsystemclock \ + pipelines/simple_launch_lines \ gst-libs/gdp check_PROGRAMS = $(TESTS) diff --git a/tools/gst-complete.c b/tools/gst-complete.c index 9eda6ab..2f4f254 100644 --- a/tools/gst-complete.c +++ b/tools/gst-complete.c @@ -108,44 +108,45 @@ main (int argc, char *argv[]) elementnode = rootnode->xmlChildrenNode; while (elementnode) { - if (!strcmp (elementnode->name, "element")) { + if (!strcmp ((char *) elementnode->name, "element")) { element = g_new0 (comp_element, 1); propnode = elementnode->xmlChildrenNode; while (propnode) { - if (!strcmp (propnode->name, "name")) { - element->name = xmlNodeGetContent (propnode); + if (!strcmp ((char *) propnode->name, "name")) { + element->name = (gchar *) xmlNodeGetContent (propnode); /* fprintf(stderr,element->name); */ - } else if (!strcmp (propnode->name, "srcpad")) { + } else if (!strcmp ((char *) propnode->name, "srcpad")) { element->srcpads = g_slist_prepend (element->srcpads, xmlNodeGetContent (propnode)); /* fprintf(stderr,"."); */ - } else if (!strcmp (propnode->name, "sinkpad")) { + } else if (!strcmp ((char *) propnode->name, "sinkpad")) { element->sinkpads = g_slist_prepend (element->sinkpads, xmlNodeGetContent (propnode)); - } else if (!strcmp (propnode->name, "srcpadtemplate")) { + } else if (!strcmp ((char *) propnode->name, "srcpadtemplate")) { element->srcpadtemplates = g_slist_prepend (element->srcpadtemplates, xmlNodeGetContent (propnode)); /* fprintf(stderr,"."); */ - } else if (!strcmp (propnode->name, "sinkpad")) { + } else if (!strcmp ((char *) propnode->name, "sinkpad")) { element->sinkpadtemplates = g_slist_prepend (element->sinkpadtemplates, xmlNodeGetContent (propnode)); - } else if (!strcmp (propnode->name, "argument")) { + } else if (!strcmp ((char *) propnode->name, "argument")) { argument = g_new0 (comp_argument, 1); - argument->name = xmlNodeGetContent (propnode); + argument->name = (gchar *) xmlNodeGetContent (propnode); argument->type = ARG_INT; /* walk through the values data */ argnode = propnode->xmlChildrenNode; while (argnode) { - if (!strcmp (argnode->name, "filename")) { + if (!strcmp ((char *) argnode->name, "filename")) { argument->type = ARG_FILENAME; - } else if (!strcmp (argnode->name, "option")) { + } else if (!strcmp ((char *) argnode->name, "option")) { argument->type = ARG_ENUM; option = g_new0 (enum_value, 1); - sscanf (xmlNodeGetContent (argnode), "%d", &option->value); + sscanf ((char *) xmlNodeGetContent (argnode), "%d", + &option->value); argument->enums = g_slist_prepend (argument->enums, option); } argnode = argnode->next; diff --git a/tools/gst-compprep.c b/tools/gst-compprep.c index 57ae252..f96727c 100644 --- a/tools/gst-compprep.c +++ b/tools/gst-compprep.c @@ -40,8 +40,9 @@ main (int argc, char *argv[]) GST_DEBUG_CATEGORY_INIT (debug_compprep, "compprep", GST_DEBUG_BOLD, "gst-compprep application"); - doc = xmlNewDoc ("1.0"); - doc->xmlRootNode = xmlNewDocNode (doc, NULL, "GST-CompletionRegistry", NULL); + doc = xmlNewDoc ((xmlChar *) "1.0"); + doc->xmlRootNode = xmlNewDocNode (doc, NULL, + (xmlChar *) "GST-CompletionRegistry", NULL); plugins = g_list_copy (gst_registry_pool_plugin_list ()); while (plugins) { @@ -63,9 +64,10 @@ main (int argc, char *argv[]) factory = GST_ELEMENT_FACTORY (feature); - factorynode = xmlNewChild (doc->xmlRootNode, NULL, "element", NULL); - xmlNewChild (factorynode, NULL, "name", - GST_PLUGIN_FEATURE_NAME (factory)); + factorynode = xmlNewChild (doc->xmlRootNode, NULL, (xmlChar *) "element", + NULL); + xmlNewChild (factorynode, NULL, (xmlChar *) "name", + (xmlChar *) GST_PLUGIN_FEATURE_NAME (factory)); element = gst_element_factory_create (factory, NULL); GST_DEBUG ("adding factory %s", GST_PLUGIN_FEATURE_NAME (factory)); @@ -83,12 +85,12 @@ main (int argc, char *argv[]) if (padtemplate->direction == GST_PAD_SRC) padnode = - xmlNewChild (factorynode, NULL, "srcpadtemplate", - padtemplate->name_template); + xmlNewChild (factorynode, NULL, (xmlChar *) "srcpadtemplate", + (xmlChar *) padtemplate->name_template); else if (padtemplate->direction == GST_PAD_SINK) padnode = - xmlNewChild (factorynode, NULL, "sinkpadtemplate", - padtemplate->name_template); + xmlNewChild (factorynode, NULL, (xmlChar *) "sinkpadtemplate", + (xmlChar *) padtemplate->name_template); } pads = element->pads; @@ -97,11 +99,11 @@ main (int argc, char *argv[]) pads = g_list_next (pads); if (GST_PAD_DIRECTION (pad) == GST_PAD_SRC) - padnode = - xmlNewChild (factorynode, NULL, "srcpad", GST_PAD_NAME (pad)); + padnode = xmlNewChild (factorynode, NULL, (xmlChar *) "srcpad", + (xmlChar *) GST_PAD_NAME (pad)); else if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK) - padnode = - xmlNewChild (factorynode, NULL, "sinkpad", GST_PAD_NAME (pad)); + padnode = xmlNewChild (factorynode, NULL, (xmlChar *) "sinkpad", + (xmlChar *) GST_PAD_NAME (pad)); } /* write out the args */ @@ -111,9 +113,10 @@ main (int argc, char *argv[]) for (i = 0; i < num_properties; i++) { GParamSpec *param = property_specs[i]; - argnode = xmlNewChild (factorynode, NULL, "argument", param->name); + argnode = xmlNewChild (factorynode, NULL, (xmlChar *) "argument", + (xmlChar *) param->name); if (param->value_type == GST_TYPE_URI) { - xmlNewChild (argnode, NULL, "filename", NULL); + xmlNewChild (argnode, NULL, (xmlChar *) "filename", NULL); } else if (G_IS_PARAM_SPEC_ENUM (param) == G_TYPE_ENUM) { GEnumValue *values; gint j; @@ -122,8 +125,10 @@ main (int argc, char *argv[]) for (j = 0; values[j].value_name; j++) { gchar *value = g_strdup_printf ("%d", values[j].value); - optionnode = xmlNewChild (argnode, NULL, "option", value); - xmlNewChild (optionnode, NULL, "value_nick", values[j].value_nick); + optionnode = xmlNewChild (argnode, NULL, (xmlChar *) "option", + (xmlChar *) value); + xmlNewChild (optionnode, NULL, (xmlChar *) "value_nick", + (xmlChar *) values[j].value_nick); g_free (value); } } diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index 1c31d20..67b25d6 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -239,7 +239,8 @@ static void print_element_properties_info (GstElement * element) { GParamSpec **property_specs; - gint num_properties, i; + guint num_properties; + gint i; gboolean readable; const char *string_val; diff --git a/tools/gst-launch.c b/tools/gst-launch.c index 20f7db0..76a7d41 100644 --- a/tools/gst-launch.c +++ b/tools/gst-launch.c @@ -84,7 +84,8 @@ xmllaunch_parse_cmdline (const gchar ** argv) } xml = gst_xml_new (); - err = gst_xml_parse_file (xml, arg, NULL); + /* FIXME guchar from gstxml.c */ + err = gst_xml_parse_file (xml, (guchar *) arg, NULL); if (err != TRUE) { fprintf (stderr, _("ERROR: parse of xml file '%s' failed.\n"), arg); diff --git a/tools/gst-xmlinspect.c b/tools/gst-xmlinspect.c index 2e5a0b6..fd478a6 100644 --- a/tools/gst-xmlinspect.c +++ b/tools/gst-xmlinspect.c @@ -179,7 +179,8 @@ static void print_element_properties (GstElement * element, gint pfx) { GParamSpec **property_specs; - gint num_properties, i; + guint num_properties; + gint i; gboolean readable; property_specs = g_object_class_list_properties -- 2.7.4