plugin: Present fallback window right after assembled UI

When started from gst-play/launch-1.0 show window right after it was created.
No need to idle dispatch window present when changing state, since we are
already on correct thread when opening resources using start() method.
This commit is contained in:
Rafał Dzięgiel
2023-02-12 13:53:45 +01:00
parent 9556ec4da2
commit bf52197896
2 changed files with 3 additions and 22 deletions

View File

@@ -67,7 +67,6 @@ window_clear_no_lock (GstClapperSink *self)
self->window_destroy_id = 0;
}
self->window = NULL;
self->presented_window = FALSE;
}
static void
@@ -568,6 +567,9 @@ gst_clapper_sink_start_on_main (GstClapperSink *self)
self->window_destroy_id = g_signal_connect (self->window,
"destroy", G_CALLBACK (window_destroy_cb), self);
GST_INFO_OBJECT (self, "Presenting window");
gtk_window_present (self->window);
}
GST_CLAPPER_SINK_UNLOCK (self);
@@ -575,15 +577,6 @@ gst_clapper_sink_start_on_main (GstClapperSink *self)
return TRUE;
}
static gboolean
window_present_on_main_idle (GtkWindow *window)
{
GST_INFO ("Presenting window");
gtk_window_present (window);
return G_SOURCE_REMOVE;
}
static gboolean
gst_clapper_sink_start (GstBaseSink *bsink)
{
@@ -658,16 +651,6 @@ gst_clapper_sink_change_state (GstElement *element, GstStateChange transition)
}
GST_CLAPPER_SINK_UNLOCK (self);
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
GST_CLAPPER_SINK_LOCK (self);
if (G_UNLIKELY (self->window && !self->presented_window)) {
g_idle_add_full (G_PRIORITY_DEFAULT,
(GSourceFunc) window_present_on_main_idle,
g_object_ref (self->window), (GDestroyNotify) g_object_unref);
self->presented_window = TRUE;
}
GST_CLAPPER_SINK_UNLOCK (self);
break;
default:
break;
}

View File

@@ -54,8 +54,6 @@ struct _GstClapperSink
GtkWidget *widget;
GtkWindow *window;
gboolean presented_window;
/* Properties */
gboolean force_aspect_ratio;
gint par_n, par_d;