Commit 1c0123cf authored by Sebastian Dröge's avatar Sebastian Dröge
Browse files

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.
parent 399d4fcb
......@@ -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
......@@ -155,6 +156,9 @@ gst_gio_base_sink_stop (GstBaseSink * base_sink)
GST_DEBUG_OBJECT (sink, "g_outut_stream_close succeeded");
}
g_object_unref (sink->stream);
sink->stream = NULL;
} else {
g_object_unref (sink->stream);
sink->stream = NULL;
}
......
......@@ -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);
......
......@@ -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
......@@ -166,6 +167,9 @@ gst_gio_base_src_stop (GstBaseSrc * base_src)
GST_DEBUG_OBJECT (src, "g_input_stream_close succeeded");
}
g_object_unref (src->stream);
src->stream = NULL;
} else {
g_object_unref (src->stream);
src->stream = NULL;
}
......
......@@ -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);
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment