mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
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.
This commit is contained in:
parent
399d4fcbe7
commit
1c0123cf58
6 changed files with 14 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue