After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 776490 - player: Add support for selecting a specific video sink
player: Add support for selecting a specific video sink
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.x
Other Linux
: Normal enhancement
: 1.11.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-12-26 05:47 UTC by Lyon
Modified: 2017-01-17 11:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for add video/audio/text sink property (3.05 KB, patch)
2016-12-26 05:48 UTC, Lyon
needs-work Details | Review
patch for set video-sink via video-renderer.c (4.77 KB, patch)
2016-12-27 09:29 UTC, Lyon
needs-work Details | Review
Update patch for videorenderer video sink set (5.53 KB, patch)
2017-01-10 06:20 UTC, Lyon
none Details | Review
Update patch for set video sink. (5.40 KB, patch)
2017-01-11 10:41 UTC, Lyon
none Details | Review
Update patch for set video sink (5.50 KB, patch)
2017-01-17 10:50 UTC, Lyon
committed Details | Review

Description Lyon 2016-12-26 05:47:38 UTC
Add video/audio/text sink property, So that it is easier for gstplayer to set video/audio/text sink
Comment 1 Lyon 2016-12-26 05:48:21 UTC
Created attachment 342470 [details] [review]
patch for add video/audio/text sink property
Comment 2 Sebastian Dröge (slomo) 2016-12-26 09:47:25 UTC
For the video-sink there's also the GstPlayerVideoRenderer interface. For audio/text sinks I'd prefer something similar too, something that does not involve juggling with raw GStreamer elements from the application.
Comment 3 Lyon 2016-12-27 09:29:18 UTC
Created attachment 342488 [details] [review]
patch for set video-sink via video-renderer.c

in gstplayer-video-overlay-video-renderer..c 
gst_player_video_overlay_video_renderer_create_video_sink() will always return NULL, and therefore, in gstplayer gst_player_main() thread, the custom video sink will not be set successfully.

The patch add "video-sink" property for overlayvideorender, so that it could  be set outside. also return the video-sink element via gst_player_video_overlay_video_renderer_create_video_sink()
Comment 4 Lyon 2016-12-27 09:33:40 UTC
also update gst_player_video_overlay_video_renderer_new() to set video-sink when creating the renderer.
Comment 5 Lyon 2017-01-07 07:30:36 UTC
Hi, Slomo,
    How about the above patch for the video sink set ?  do you have any advice about it?

Thanks
Lyon
Comment 6 Sebastian Dröge (slomo) 2017-01-09 13:34:25 UTC
Review of attachment 342488 [details] [review]:

This looks generally like the right approach

::: gst-libs/gst/player/gstplayer-video-overlay-video-renderer.c
@@ +86,3 @@
       break;
+    case VIDEO_OVERLAY_VIDEO_RENDERER_PROP_VIDEO_SINK:
+      self->video_sink = g_value_get_object (value);

_dup_object() and unref() in finalize()

@@ +204,3 @@
 GstPlayerVideoRenderer *
+gst_player_video_overlay_video_renderer_new (gpointer window_handle,
+    GstElement * video_sink)

Add documentation too

::: gst-libs/gst/player/gstplayer-video-overlay-video-renderer.h
@@ +42,2 @@
 GType gst_player_video_overlay_video_renderer_get_type (void);
+GstPlayerVideoRenderer * gst_player_video_overlay_video_renderer_new (gpointer window_handle, GstElement * video_sink);

Don't change the API please, better add a new "_new_with_sink()" function here
Comment 7 Lyon 2017-01-10 06:20:29 UTC
Created attachment 343211 [details] [review]
Update patch for videorenderer video sink set

Hi, Slomo,
    Please see attached file for the update patch.

Thanks
Lyon
Comment 8 Sebastian Dröge (slomo) 2017-01-10 15:09:51 UTC
Review of attachment 343211 [details] [review]:

::: gst-libs/gst/player/gstplayer-video-overlay-video-renderer.c
@@ +229,3 @@
+
+  return g_object_new (GST_TYPE_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER,
+      "window-handle", window_handle, "video-sink", video_sink, NULL);

You pass a string to a GstElement* property, that doesn't work

::: gst-libs/gst/player/gstplayer-video-overlay-video-renderer.h
@@ +42,3 @@
 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, const gchar * video_sink_name);

A GstElement* here would be better. You might want to pass something that does not have a GstElementFactory, like some custom bin with various other elements
Comment 9 Lyon 2017-01-11 10:41:35 UTC
Created attachment 343293 [details] [review]
Update patch for set video sink.

Update the patch, change back to pass GstElement * video_sink as parameter
Comment 10 Lyon 2017-01-16 06:10:09 UTC
Hi, Slomo,
    How about the updated patch for video-sink setting?

Thanks
Lyon
Comment 11 Sebastian Dröge (slomo) 2017-01-16 10:22:50 UTC
Review of attachment 343293 [details] [review]:

Thanks, mostly looks good just one more thing

::: gst-libs/gst/player/gstplayer-video-overlay-video-renderer.c
@@ +86,3 @@
       break;
+    case VIDEO_OVERLAY_VIDEO_RENDERER_PROP_VIDEO_SINK:
+      self->video_sink = g_value_dup_object (value);

This should actually probably work like the video-sink property on playsink. Please check the playsink code, but IIRC it does get_object() and then ref_sink() on the object.

This also needs to be mentioned in the docs then, that this function takes the argument as "transfer floating".
Comment 12 Lyon 2017-01-17 10:50:43 UTC
Created attachment 343633 [details] [review]
Update patch for set video sink

Update patch for set video sink
- modify set/get property of video-sink
Comment 13 Sebastian Dröge (slomo) 2017-01-17 11:15:32 UTC
commit b22fec8293521d9270b679f29415bc713eeb3749
Author: Lyon Wang <lyon.wang@nxp.com>
Date:   Tue Dec 27 17:13:58 2016 +0800

    player: Add support for selecting a specific video sink
    
    - Add overlay video renderer "video-sink" property, so that can be set
    - In create_video_sink, it returns video sink instead of always NULL
    - Add new renderer_new_with_sink() API to set video sink
    
    https://bugzilla.gnome.org/show_bug.cgi?id=776490