From 68a1d6cfd59d02d70f08bbb4a78a1de5ab4b2c22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 29 Sep 2007 07:01:55 +0000 Subject: ext/gio/: Some minor cleanup and allow setting the location only when the element is not playing or paused. Original commit message from CVS: * ext/gio/gstgiosink.c: (gst_gio_sink_base_init), (gst_gio_sink_set_property), (gst_gio_sink_render): * ext/gio/gstgiosrc.c: (gst_gio_src_base_init), (gst_gio_src_set_property): Some minor cleanup and allow setting the location only when the element is not playing or paused. --- ext/gio/gstgiosink.c | 13 +++++++++---- ext/gio/gstgiosrc.c | 9 ++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'ext') diff --git a/ext/gio/gstgiosink.c b/ext/gio/gstgiosink.c index 0b2f65aa..2d9677b9 100644 --- a/ext/gio/gstgiosink.c +++ b/ext/gio/gstgiosink.c @@ -55,8 +55,7 @@ enum static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("ANY") - ); + GST_STATIC_CAPS_ANY); GST_BOILERPLATE_FULL (GstGioSink, gst_gio_sink, GstBaseSink, GST_TYPE_BASE_SINK, gst_gio_uri_handler_do_init); @@ -81,7 +80,7 @@ gst_gio_sink_base_init (gpointer gclass) static GstElementDetails element_details = { "GIO sink", "Sink/File", - "Write to any GVFS-supported location", + "Write to any GIO-supported location", "Ren\xc3\xa9 Stadler " }; GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); @@ -154,6 +153,10 @@ gst_gio_sink_set_property (GObject * object, guint prop_id, switch (prop_id) { case ARG_LOCATION: + if (GST_STATE (sink) == GST_STATE_PLAYING || + GST_STATE (sink) == GST_STATE_PAUSED) + break; + g_free (sink->location); sink->location = g_strdup (g_value_get_string (value)); break; @@ -370,7 +373,9 @@ gst_gio_sink_render (GstBaseSink * base_sink, GstBuffer * buffer) /* FIXME: Can this happen? Should we handle it gracefully? gnomevfssink * doesn't... */ GST_ELEMENT_ERROR (sink, RESOURCE, WRITE, (NULL), - ("Could not write to location %s: (short write)", sink->location)); + ("Could not write to location %s: (short write, only %" + G_GUINT64_FORMAT " bytes of %d bytes written)", + sink->location, written, GST_BUFFER_SIZE (buffer))); return GST_FLOW_ERROR; } diff --git a/ext/gio/gstgiosrc.c b/ext/gio/gstgiosrc.c index 6f41e449..15e0b9d2 100644 --- a/ext/gio/gstgiosrc.c +++ b/ext/gio/gstgiosrc.c @@ -49,8 +49,7 @@ enum static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("ANY") - ); + GST_STATIC_CAPS_ANY); GST_BOILERPLATE_FULL (GstGioSrc, gst_gio_src, GstBaseSrc, GST_TYPE_BASE_SRC, gst_gio_uri_handler_do_init); @@ -76,7 +75,7 @@ gst_gio_src_base_init (gpointer gclass) static GstElementDetails element_details = { "GIO source", "Source/File", - "Read from any GVFS-supported location", + "Read from any GIO-supported location", "Ren\xc3\xa9 Stadler " }; GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); @@ -147,6 +146,10 @@ gst_gio_src_set_property (GObject * object, guint prop_id, switch (prop_id) { case ARG_LOCATION: + if (GST_STATE (src) == GST_STATE_PLAYING || + GST_STATE (src) == GST_STATE_PAUSED) + break; + g_free (src->location); src->location = g_strdup (g_value_get_string (value)); break; -- cgit v1.2.1