GNOME Bugzilla – Bug 676331
osxvideosink: Improvements for OSX's video sink
Last modified: 2012-11-24 15:09:13 UTC
The attached patches provides the following list of improvements for osxvideosink: * create and internal window when no one is provided through the GstVideoOverlay API, which makes it work again with gst-launch. * implement the GstNavigation interface. * add 'force-aspect-ratio' property to respect the input PAR adding black borders. The creation of an internal Cocoa window, needed to make this sink usable with gst-launch for instance, was removed some time ago because it was racy causing random crashes. This happens because Cocoa's framework is not thread-safe and all cocoa-related operations must always happen in the "main thread", which is the first thread created by the application. This issues is now fixed deferring all the operations to create, resize, draw frame and destroy to the main thread using performSelectorOnMainThread. For this to work, the main run loop must be running to process theses messages and convert them into calls on the main thread. A typical GUI application will always be running the main run loop in the main thread, as it happens with every native Cocoa application calling [NSApp run], gtk application calling gtk_main() (gdk event loop integrates with cocoa's one) or qt apps. For applications that don't run the main run loop in the main thread, like gst-launch, we assume that there is at least glib's main loop spinning in this main thread. This allows us attaching a GSource that poll events regularly on the main thread to make the internal Cocoa Window responsive and process the performSelectorOnMainThread calls. You can find the branch with the proposed patches here: https://github.com/ylatuya/gst-plugins-good/commits/osxvideosink
Created attachment 214364 [details] [review] 0001-osvideosink-create-destroy-resize-and-draw-from-the-.patch Call create, destroy, resize and draw from the main thread
Created attachment 214365 [details] [review] 0002-osxvideosink-implement-the-navigation-interface.patch Implement the GstNavigation interface
Created attachment 214366 [details] [review] 0003-osxvideosink-start-internal-window-if-no-view-is-pro.patch Start an internal window when no external view is provided
Created attachment 214367 [details] [review] 0004-osxvideosink-add-force-aspect-ratio-property.patch Add 'force-apsect-ratio' porperty to keep DAR drawing black borders
Created attachment 214368 [details] [review] 0005-osxvideosink-fix-navigation-when-force-aspect-ratio-.patch Fix navigation when using black borders
Created attachment 214369 [details] [review] 0006-osxvideosink-reset-the-embed-property-for-backward-c.patch Reset the embed property for application that want tho embed their own view but don't respond the 'have-ns-view' synchronously. 'have-ns-view' should be completely removed for 1.0 in favour of the GstVideoOverlay API.
Looks like these were pushed a while ago: commit 04e8a9fa574cc6058f290b08b833e111d167271c Author: Andoni Morales Alastruey <ylatuya@gmail.com> Date: Wed May 16 21:52:45 2012 +0200 osxvideosink: reset the embed property for backward compatilibity commit b0e664ca7bac61f62378fcb434561fc60bf57f2b Author: Andoni Morales Alastruey <ylatuya@gmail.com> Date: Wed May 16 21:12:22 2012 +0200 osxvideosink: fix navigation when force-aspect-ratio is activated commit 31d6828cd1e82de1b4aa1e21ae5f8dccc35575d6 Author: Andoni Morales Alastruey <ylatuya@gmail.com> Date: Wed May 16 18:52:45 2012 +0200 osxvideosink: add force-aspect-ratio property commit 8132de5d96f12935bc5bb978cf03f3e63ef21076 Author: Andoni Morales Alastruey <ylatuya@gmail.com> Date: Mon May 14 18:01:02 2012 +0200 osxvideosink: start internal window if no view is provided commit 8daff6e1c77f0aec9e1e7fd57c5f228a4677e5a0 Author: Andoni Morales Alastruey <ylatuya@gmail.com> Date: Mon May 14 14:27:58 2012 +0200 osxvideosink: implement the navigation interface commit 37a90e96e6c17bdb355401555e77430b003fd41a Author: Andoni Morales Alastruey <ylatuya@gmail.com> Date: Fri May 11 18:24:08 2012 +0200 osvideosink: create, destroy, resize and draw from the main thread