GNOME Bugzilla – Bug 728451
glimagesink: expects a NSWindow instead of a NSView as the window handle
Last modified: 2014-05-02 05:09:12 UTC
glimagesink's GstVideoOverlay implementation expects a NSWindow instead of a NSView in set_window_handle, breaking backwards compatibility and making it more difficult to embed in applications.
Hi, indeed. Looking at osxvideosink implementation I can see it adds its internal NSView to the foreign view passed with set_window_handle: [internalView addSubview:foreignView]; Whereas currently we set our internal view as the view of the foreign window: [foreignWindow setContentView: internalView]; I'll have a try with the example in gst-plugins-gl/tests/examples/cocoa/videooverlay/. It was in my plan to move it to -bad too.
commit 510040e0336a57d3244df0a0ffe751040753dd43 Author: Julien Isorce <julien.isorce@gmail.com> Date: Thu Apr 24 10:37:00 2014 +0100 gl/cocoa: pass a NSView to set_window_handle instead of a NSWindow Fix backwards compatibility https://bugzilla.gnome.org/show_bug.cgi?id=728451
I will move gst-plugins-gl/tests/examples/cocoa/videooverlay/main.m to -bad before to close the bug. Maybe tomorrow. The diff is just to replace "window" by "[window contentView]" in gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), (guintptr) window);
So in order to move gst-plugins-gl/tests/examples/cocoa/videooverlay/main.m to -bad I did the following: 1- In in a clone dir of gst-plugins-gl: git format-patch --subject-prefix="" --numbered --root -- tests/examples/cocoa/ It generates 18 patches to keep this history: http://cgit.freedesktop.org/gstreamer/gst-plugins-gl/log/tests/examples/cocoa 0001-add-Cocoa-xoverlay-interface-example.patch 0002-make-cocoa-backend-work-on-MacOSX.patch 0003-Cocoa-backend-fix-crash-when-resizing.patch 0004-Cocoa-backend-improve-support-on-GNUStep.patch 0005-tests-replace-_set_xwindow_id-with-_set_window_handl.patch 0006-cocoa-example-remove-white-spaces.patch 0007-cocoa-example-do-not-set-pipeline-to-null-state-twic.patch 0008-objc-add-GST_OBJCFLAGS-and-friends.patch 0009-Update-versioning-for-gstreamer-1.0.patch 0010-tests-update-for-1.0.patch 0011-update-add-.gitignore-files.patch 0012-determine-the-GL-platform-to-use-at-runtime.patch 0013-fix-cocoa-videooverlay-example.patch 0014-remove-GNUstep-makefiles.patch 0015-fix-build-failure-when-building-Cocoa-tests.patch 0016-Use-gst_object_-un-ref-so-we-can-get-refcounts-in-th.patch 0017-cocoa-fix-build-when-GNUSTEP-is-not-defined.patch 0018-gl-Some-less-long-ulong-gulong-usage.patch For example the content of 0001-add-Cocoa-xoverlay-interface-example.patch is : ... From: Julien Isorce <julien.isorce@gmail.com> Date: Sat, 7 Mar 2009 03:17:04 +0100 Subject: [01/18] add Cocoa xoverlay interface example ... 2- In a clone dir of gst-plugins-bad, from master branch: git checkout -b move_gl_cocoa_example git am -3 -k *.patch (-k to keep [n/m]) 3- now merge: git checkout master git merge --no-ff -m "examples: move cocoa-videooverlay from gst-plugins-gl" move_gl_cocoa_example the log would looks like: commit a170e4ede596ff81a03ce70c83ced91bc3d49617 Merge: 4e90366 a0154c Author: Julien Isorce <julien.isorce@gmail.com> Date: Sun Apr 27 19:36:20 2014 +0100 examples: move cocoa-videooverlay from gst-plugins-gl commit a0154cbbed3303769042514f37cc75de59bf48df Author: Sebastian Dröge <slomo@circular-chaos.org> Date: Wed Jul 17 11:22:02 2013 +0200 [18/18] gl: Some less long/ulong/gulong usage commit f33a1d381b5c8b1e9220e94b97f27bc349948614 Author: Julien Isorce <julien.isorce@gmail.com> Date: Wed Jul 10 15:47:23 2013 +0100 [17/18] cocoa: fix build when GNUSTEP is not defined commit 99df7c26cd471122234fbc7ce055780b76e4c96f Author: Matthew Waters <ystreet00@gmail.com> Date: Thu Jun 13 14:36:41 2013 +1000 ... [01/18] ... But then I would like to rename the test from tests/examples/cocoa to tests/examples/overlay/cocoa-videooverlay.m to match same naming as in gst-plugins-base. The result is that git log tests/examples/overlay will no show the old history. It would require to do git log --follow It would be the same result as gstglimagesink.c : http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/log/ext/gl/gstglimagesink.c where we do not see commits earlier than the move except if you pass --follow It is ok to do this way ?
Also I think the history for this example is not particularly interesting so I would go for just one commit that adds tests/examples/overlay/cocoa-videooverlay.m and its Makefile.am + activation in configure.ac, based on the code from gst-plugins-gl/tests/examples/cocoa/videooverlay/main.m Any suggestion ? (see also solution #4)
I have a patch that just moves all of the examples into their own gl directory from gst-plugins-gl that I am about to push. I didn't bother with preserving the history for the examples.
ah nice! Go ahead :) . I'll do the fix for the cocoa example after your push.
commit 619e7be7489d0f7a65288e4f72ee3c798618a2a3 Author: Julien Isorce <julien.isorce@gmail.com> Date: Fri May 2 05:51:36 2014 +0100 gl: pass NSView instead of NSWindow in cocoa-videooverlay example https://bugzilla.gnome.org/show_bug.cgi?id=728451