summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-07-08 17:19:29 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-07-08 17:19:29 +0200
commit1c0123cf5889c1ba3560ccf67a619f4d44bcba6e (patch)
tree81cec414d2ac60c89fbde39e7a1b62f575b7b13a
parent399d4fcbe778388e0852612d4853a0da332294a6 (diff)
gio: Don't close the GIO streams for the giostream{src,sink} elements
This makes it possible to do something useful with the streams after the element has stopped. Fixes bug #587896.
-rw-r--r--ext/gio/gstgiobasesink.c6
-rw-r--r--ext/gio/gstgiobasesink.h1
-rw-r--r--ext/gio/gstgiobasesrc.c6
-rw-r--r--ext/gio/gstgiobasesrc.h1
-rw-r--r--ext/gio/gstgiosink.c1
-rw-r--r--ext/gio/gstgiosrc.c1
6 files changed, 14 insertions, 2 deletions
diff --git a/ext/gio/gstgiobasesink.c b/ext/gio/gstgiobasesink.c
index 6a878717a..7ddd97062 100644
--- a/ext/gio/gstgiobasesink.c
+++ b/ext/gio/gstgiobasesink.c
@@ -134,10 +134,11 @@ static gboolean
gst_gio_base_sink_stop (GstBaseSink * base_sink)
{
GstGioBaseSink *sink = GST_GIO_BASE_SINK (base_sink);
+ GstGioBaseSinkClass *klass = GST_GIO_BASE_SINK_GET_CLASS (sink);
gboolean success;
GError *err = NULL;
- if (G_IS_OUTPUT_STREAM (sink->stream)) {
+ if (klass->close_on_stop && G_IS_OUTPUT_STREAM (sink->stream)) {
GST_DEBUG_OBJECT (sink, "closing stream");
/* FIXME: can block but unfortunately we can't use async operations
@@ -157,6 +158,9 @@ gst_gio_base_sink_stop (GstBaseSink * base_sink)
g_object_unref (sink->stream);
sink->stream = NULL;
+ } else {
+ g_object_unref (sink->stream);
+ sink->stream = NULL;
}
return TRUE;
diff --git a/ext/gio/gstgiobasesink.h b/ext/gio/gstgiobasesink.h
index 9a1422549..7f13a854b 100644
--- a/ext/gio/gstgiobasesink.h
+++ b/ext/gio/gstgiobasesink.h
@@ -61,6 +61,7 @@ struct _GstGioBaseSinkClass
GstBaseSinkClass parent_class;
GOutputStream * (*get_stream) (GstGioBaseSink *bsink);
+ gboolean close_on_stop;
};
GType gst_gio_base_sink_get_type (void);
diff --git a/ext/gio/gstgiobasesrc.c b/ext/gio/gstgiobasesrc.c
index cfeab575b..f67015270 100644
--- a/ext/gio/gstgiobasesrc.c
+++ b/ext/gio/gstgiobasesrc.c
@@ -145,10 +145,11 @@ static gboolean
gst_gio_base_src_stop (GstBaseSrc * base_src)
{
GstGioBaseSrc *src = GST_GIO_BASE_SRC (base_src);
+ GstGioBaseSrcClass *klass = GST_GIO_BASE_SRC_GET_CLASS (src);
gboolean success;
GError *err = NULL;
- if (G_IS_INPUT_STREAM (src->stream)) {
+ if (klass->close_on_stop && G_IS_INPUT_STREAM (src->stream)) {
GST_DEBUG_OBJECT (src, "closing stream");
/* FIXME: can block but unfortunately we can't use async operations
@@ -168,6 +169,9 @@ gst_gio_base_src_stop (GstBaseSrc * base_src)
g_object_unref (src->stream);
src->stream = NULL;
+ } else {
+ g_object_unref (src->stream);
+ src->stream = NULL;
}
return TRUE;
diff --git a/ext/gio/gstgiobasesrc.h b/ext/gio/gstgiobasesrc.h
index d1eea7014..7a14859cb 100644
--- a/ext/gio/gstgiobasesrc.h
+++ b/ext/gio/gstgiobasesrc.h
@@ -62,6 +62,7 @@ struct _GstGioBaseSrcClass
GstBaseSrcClass parent_class;
GInputStream * (*get_stream) (GstGioBaseSrc *bsrc);
+ gboolean close_on_stop;
};
GType gst_gio_base_src_get_type (void);
diff --git a/ext/gio/gstgiosink.c b/ext/gio/gstgiosink.c
index cf8cea5b9..57d102494 100644
--- a/ext/gio/gstgiosink.c
+++ b/ext/gio/gstgiosink.c
@@ -126,6 +126,7 @@ gst_gio_sink_class_init (GstGioSinkClass * klass)
gstgiobasesink_class->get_stream =
GST_DEBUG_FUNCPTR (gst_gio_sink_get_stream);
+ gstgiobasesink_class->close_on_stop = TRUE;
}
static void
diff --git a/ext/gio/gstgiosrc.c b/ext/gio/gstgiosrc.c
index e4e39cb7b..ce944be6b 100644
--- a/ext/gio/gstgiosrc.c
+++ b/ext/gio/gstgiosrc.c
@@ -129,6 +129,7 @@ gst_gio_src_class_init (GstGioSrcClass * klass)
GST_DEBUG_FUNCPTR (gst_gio_src_check_get_range);
gstgiobasesrc_class->get_stream = GST_DEBUG_FUNCPTR (gst_gio_src_get_stream);
+ gstgiobasesrc_class->close_on_stop = TRUE;
}
static void