Skip to content

Commit

Permalink
clapper-gtk: video: Use GtkGraphicsOffload
Browse files Browse the repository at this point in the history
Place our widget inside GtkGraphicsOffload when possible. For now we place
it always except Windows OS where it does not do anything currently.
  • Loading branch information
Rafostar committed Jan 22, 2025
1 parent 4016da9 commit 8819412
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ project('clapper', 'c',

glib_req = '>= 2.76.0'
gst_req = '>= 1.24.0'
gtk4_req = '>= 4.10.0'
gtk4_req = '>= 4.16.0'
adw_req = '>= 1.4.0'

clapper_version = meson.project_version().split('-')[0]
Expand Down
13 changes: 13 additions & 0 deletions src/lib/clapper-gtk/clapper-gtk-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,19 @@ _video_sink_changed_cb (ClapperPlayer *player,
gst_object_unref (vsink);
}

#ifndef G_OS_WIN32
if (widget) {
GtkWidget *offload = gtk_graphics_offload_new (widget);

gtk_graphics_offload_set_black_background (GTK_GRAPHICS_OFFLOAD (offload), TRUE);

GST_DEBUG_OBJECT (self, "Sink widget is placed within graphics offload");

g_object_unref (widget);
widget = g_object_ref_sink (offload);
}
#endif

if (!widget) {
GST_DEBUG_OBJECT (self, "No widget from video sink, using placeholder");
widget = g_object_ref_sink (clapper_gtk_video_placeholder_new ());
Expand Down

0 comments on commit 8819412

Please sign in to comment.