diff --git a/docs/libs/gst-plugins-bad-libs-sections.txt b/docs/libs/gst-plugins-bad-libs-sections.txt index d115a8f781..44f4258e17 100644 --- a/docs/libs/gst-plugins-bad-libs-sections.txt +++ b/docs/libs/gst-plugins-bad-libs-sections.txt @@ -2058,6 +2058,7 @@ gst_player_g_main_context_signal_dispatcher_get_type GstPlayerVideoOverlayVideoRenderer gst_player_video_overlay_video_renderer_new +gst_player_video_overlay_video_renderer_new_with_sink gst_player_video_overlay_video_renderer_get_window_handle gst_player_video_overlay_video_renderer_set_window_handle diff --git a/gst-libs/gst/player/gstplayer-video-overlay-video-renderer.c b/gst-libs/gst/player/gstplayer-video-overlay-video-renderer.c index 7764d43efb..2ba326782a 100644 --- a/gst-libs/gst/player/gstplayer-video-overlay-video-renderer.c +++ b/gst-libs/gst/player/gstplayer-video-overlay-video-renderer.c @@ -40,6 +40,8 @@ struct _GstPlayerVideoOverlayVideoRenderer GstVideoOverlay *video_overlay; gpointer window_handle; gint x, y, width, height; + + GstElement *video_sink; /* configured video sink, or NULL */ }; struct _GstPlayerVideoOverlayVideoRendererClass @@ -55,6 +57,7 @@ enum { VIDEO_OVERLAY_VIDEO_RENDERER_PROP_0, VIDEO_OVERLAY_VIDEO_RENDERER_PROP_WINDOW_HANDLE, + VIDEO_OVERLAY_VIDEO_RENDERER_PROP_VIDEO_SINK, VIDEO_OVERLAY_VIDEO_RENDERER_PROP_LAST }; @@ -81,6 +84,9 @@ gst_player_video_overlay_video_renderer_set_property (GObject * object, gst_video_overlay_set_window_handle (self->video_overlay, (guintptr) self->window_handle); break; + case VIDEO_OVERLAY_VIDEO_RENDERER_PROP_VIDEO_SINK: + self->video_sink = gst_object_ref_sink (g_value_get_object (value)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -98,6 +104,9 @@ gst_player_video_overlay_video_renderer_get_property (GObject * object, case VIDEO_OVERLAY_VIDEO_RENDERER_PROP_WINDOW_HANDLE: g_value_set_pointer (value, self->window_handle); break; + case VIDEO_OVERLAY_VIDEO_RENDERER_PROP_VIDEO_SINK: + g_value_set_object (value, self->video_sink); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -113,6 +122,9 @@ gst_player_video_overlay_video_renderer_finalize (GObject * object) if (self->video_overlay) gst_object_unref (self->video_overlay); + if (self->video_sink) + gst_object_unref (self->video_sink); + G_OBJECT_CLASS (gst_player_video_overlay_video_renderer_parent_class)->finalize (object); } @@ -135,6 +147,12 @@ static void "Window handle to embed the video into", G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); + video_overlay_video_renderer_param_specs + [VIDEO_OVERLAY_VIDEO_RENDERER_PROP_VIDEO_SINK] = + g_param_spec_object ("video-sink", "Video Sink", + "the video output element to use (NULL = default sink)", + GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_properties (gobject_class, VIDEO_OVERLAY_VIDEO_RENDERER_PROP_LAST, video_overlay_video_renderer_param_specs); @@ -145,6 +163,7 @@ static void (GstPlayerVideoOverlayVideoRenderer * self) { self->x = self->y = self->width = self->height = -1; + self->video_sink = NULL; } static GstElement *gst_player_video_overlay_video_renderer_create_video_sink @@ -168,7 +187,7 @@ static GstElement *gst_player_video_overlay_video_renderer_create_video_sink gst_video_overlay_set_render_rectangle (self->video_overlay, self->x, self->y, self->width, self->height); - return NULL; + return self->video_sink; } static void @@ -192,6 +211,23 @@ gst_player_video_overlay_video_renderer_new (gpointer window_handle) "window-handle", window_handle, NULL); } +/** + * gst_player_video_overlay_video_renderer_new_with_sink: + * @window_handle: (allow-none): Window handle to use or %NULL + * @video_sink: (transfer floating): the custom video_sink element to be set for the video renderer + * + * Returns: (transfer full): + * + * Since 1.12 + */ +GstPlayerVideoRenderer * +gst_player_video_overlay_video_renderer_new_with_sink (gpointer window_handle, + GstElement * video_sink) +{ + return g_object_new (GST_TYPE_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER, + "window-handle", window_handle, "video-sink", video_sink, NULL); +} + /** * gst_player_video_overlay_video_renderer_set_window_handle: * @self: #GstPlayerVideoRenderer instance diff --git a/gst-libs/gst/player/gstplayer-video-overlay-video-renderer.h b/gst-libs/gst/player/gstplayer-video-overlay-video-renderer.h index be09113337..8a96e84ae9 100644 --- a/gst-libs/gst/player/gstplayer-video-overlay-video-renderer.h +++ b/gst-libs/gst/player/gstplayer-video-overlay-video-renderer.h @@ -41,6 +41,7 @@ typedef struct _GstPlayerVideoOverlayVideoRendererClass GType gst_player_video_overlay_video_renderer_get_type (void); GstPlayerVideoRenderer * gst_player_video_overlay_video_renderer_new (gpointer window_handle); +GstPlayerVideoRenderer * gst_player_video_overlay_video_renderer_new_with_sink (gpointer window_handle, GstElement * video_sink); void gst_player_video_overlay_video_renderer_set_window_handle (GstPlayerVideoOverlayVideoRenderer * self, gpointer window_handle); gpointer gst_player_video_overlay_video_renderer_get_window_handle (GstPlayerVideoOverlayVideoRenderer * self); diff --git a/win32/common/libgstplayer.def b/win32/common/libgstplayer.def index b6e587ddaf..638a07bcc9 100644 --- a/win32/common/libgstplayer.def +++ b/win32/common/libgstplayer.def @@ -105,6 +105,7 @@ EXPORTS gst_player_video_overlay_video_renderer_get_type gst_player_video_overlay_video_renderer_get_window_handle gst_player_video_overlay_video_renderer_new + gst_player_video_overlay_video_renderer_new_with_sink gst_player_video_overlay_video_renderer_set_render_rectangle gst_player_video_overlay_video_renderer_set_window_handle gst_player_video_renderer_get_type