[Spice-devel] [spice-gtk v1 2/6] display-gst: rely on SpiceSession init of GStreamer
Victor Toso
victortoso at redhat.com
Mon Sep 2 16:04:45 UTC 2019
From: Victor Toso <me at victortoso.com>
This means we can drop gstvideo_init() function and replace its calls
with gst_is_initialized().
Signed-off-by: Victor Toso <victortoso at redhat.com>
---
src/channel-display-gst.c | 23 +++++------------------
1 file changed, 5 insertions(+), 18 deletions(-)
diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index 6fccf62..a34b5d0 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -748,22 +748,6 @@ static gboolean spice_gst_decoder_queue_frame(VideoDecoder *video_decoder,
return TRUE;
}
-static gboolean gstvideo_init(void)
-{
- static int success = 0;
- if (!success) {
- GError *err = NULL;
- if (gst_init_check(NULL, NULL, &err)) {
- success = 1;
- } else {
- spice_warning("Disabling GStreamer video support: %s", err->message);
- g_clear_error(&err);
- success = -1;
- }
- }
- return success > 0;
-}
-
G_GNUC_INTERNAL
VideoDecoder* create_gstreamer_decoder(int codec_type, display_stream *stream)
{
@@ -771,7 +755,7 @@ VideoDecoder* create_gstreamer_decoder(int codec_type, display_stream *stream)
g_return_val_if_fail(VALID_VIDEO_CODEC_TYPE(codec_type), NULL);
- if (gstvideo_init()) {
+ if (gst_is_initialized()) {
decoder = g_new0(SpiceGstDecoder, 1);
decoder->base.destroy = spice_gst_decoder_destroy;
decoder->base.reschedule = spice_gst_decoder_reschedule;
@@ -820,7 +804,10 @@ gboolean gstvideo_has_codec(int codec_type)
GstCaps *caps;
GstElementFactoryListType type;
- g_return_val_if_fail(gstvideo_init(), FALSE);
+ if (!gst_is_initialized()) {
+ return FALSE;
+ }
+
g_return_val_if_fail(VALID_VIDEO_CODEC_TYPE(codec_type), FALSE);
type = GST_ELEMENT_FACTORY_TYPE_DECODER |
--
2.21.0
More information about the Spice-devel
mailing list