osxvideo: fix build on Mac OSX Mavericks and put new window in front
authorThijs Vermeir <thijsvermeir@gmail.com>
Wed, 5 Mar 2014 12:35:19 +0000 (13:35 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Wed, 5 Mar 2014 19:35:31 +0000 (20:35 +0100)
GetCurrentProcess/SetFrontProcess/TransformProcessType was deprecated
and now removed in Mac OSX 10.9. orderFrontRegardless is used to make
the video window the most front window.

sys/osxvideo/cocoawindow.m
sys/osxvideo/osxvideosink.m

index 5f1f6f3..03bd4c1 100644 (file)
@@ -16,8 +16,8 @@
  * License along with this library; if not, write to the
  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  * Boston, MA 02110-1301, USA.
- * 
- * The development of this code was made possible due to the involvement of Pioneers 
+ *
+ * The development of this code was made possible due to the involvement of Pioneers
  * of the Inevitable, the creators of the Songbird Music player
  *
  */
@@ -283,20 +283,20 @@ const gchar* gst_keycode_to_keyname(gint16 keycode)
 /* The object has to be released */
 - (id) initWithContentNSRect: (NSRect) rect
                 styleMask: (unsigned int) styleMask
-                  backing: (NSBackingStoreType) bufferingType 
+                  backing: (NSBackingStoreType) bufferingType
                     defer: (BOOL) flag
                    screen:(NSScreen *) aScreen
 {
   self = [super initWithContentRect: rect
                styleMask: styleMask
-               backing: bufferingType 
-               defer: flag 
+               backing: bufferingType
+               defer: flag
                screen:aScreen];
 
   GST_DEBUG ("Initializing GstOSXvideoSinkWindow");
 
   gstview = [[GstGLView alloc] initWithFrame:rect];
-  
+
   if (gstview)
     [self setContentView:gstview];
   [self setTitle:@"GStreamer Video Output"];
@@ -448,7 +448,7 @@ const gchar* gst_keycode_to_keyname(gint16 keycode)
 
   glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
   glPixelStorei (GL_UNPACK_ROW_LENGTH, width);
-  
+
   glBindTexture (GL_TEXTURE_RECTANGLE_EXT, pi_texture);
 
   /* Use VRAM texturing */
@@ -472,7 +472,7 @@ const gchar* gst_keycode_to_keyname(gint16 keycode)
   // glPixelStorei (GL_UNPACK_ROW_LENGTH, 0); WHY ??
 
   glTexImage2D (GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA,
-               width, height, 0, 
+               width, height, 0,
                GL_YCBCR_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE, data);
 
 
@@ -613,7 +613,7 @@ const gchar* gst_keycode_to_keyname(gint16 keycode)
   } else if (fullscreen && !flag) {
     // fullscreen now and needs to go back to normal
     initDone = NO;
-    
+
     actualContext = [self openGLContext];
 
     [NSOpenGLContext clearCurrentContext];
index 6e29cb7..2b2881f 100644 (file)
@@ -2,7 +2,7 @@
  * OSX video sink
  * Copyright (C) 2004-6 Zaheer Abbas Merali <zaheerabbas at merali dot org>
  * Copyright (C) 2007,2008,2009 Pioneers of the Inevitable <songbird@songbirdnest.com>
- * 
+ *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
  * License as published by the Free Software Foundation; either
@@ -20,7 +20,7 @@
  *
  * The development of this code was made possible due to the involvement of
  * Pioneers of the Inevitable, the creators of the Songbird Music player.
- * 
+ *
  */
 
 /**
@@ -29,9 +29,9 @@
  * The OSXVideoSink renders video frames to a MacOSX window. The video output
  * must be directed to a window embedded in an existing NSApp.
  *
- * When the NSView to be embedded is created an element #GstMessage with a 
- * name of 'have-ns-view' will be created and posted on the bus. 
- * The pointer to the NSView to embed will be in the 'nsview' field of that 
+ * When the NSView to be embedded is created an element #GstMessage with a
+ * name of 'have-ns-view' will be created and posted on the bus.
+ * The pointer to the NSView to embed will be in the 'nsview' field of that
  * message. The application MUST handle this message and embed the view
  * appropriately.
  */
@@ -391,7 +391,7 @@ gst_osx_video_sink_change_state (GstElement * element,
 
   osxvideosink = GST_OSX_VIDEO_SINK (element);
 
-  GST_DEBUG_OBJECT (osxvideosink, "%s => %s", 
+  GST_DEBUG_OBJECT (osxvideosink, "%s => %s",
         gst_element_state_get_name(GST_STATE_TRANSITION_CURRENT (transition)),
         gst_element_state_get_name(GST_STATE_TRANSITION_NEXT (transition)));
 
@@ -777,7 +777,6 @@ gst_osx_video_sink_get_type (void)
 -(void) createInternalWindow
 {
   GstOSXWindow *osxwindow = osxvideosink->osxwindow;
-  ProcessSerialNumber psn;
   NSRect rect;
   unsigned int mask;
 
@@ -794,12 +793,6 @@ gst_osx_video_sink_get_type (void)
   rect.size.width = (float) osxwindow->width;
   rect.size.height = (float) osxwindow->height;
 
-
-  if (!GetCurrentProcess(&psn)) {
-      TransformProcessType(&psn, kProcessTransformToForegroundApplication);
-      SetFrontProcess(&psn);
-  }
-
   osxwindow->win =[[[GstOSXVideoSinkWindow alloc]
                        initWithContentNSRect: rect
                        styleMask: mask
@@ -807,7 +800,7 @@ gst_osx_video_sink_get_type (void)
                        defer: NO
                        screen: nil] retain];
   GST_DEBUG("VideoSinkWindow created, %p", osxwindow->win);
-  [osxwindow->win makeKeyAndOrderFront:NSApp];
+  [osxwindow->win orderFrontRegardless];
   osxwindow->gstview =[osxwindow->win gstView];
   [osxwindow->win setDelegate:[[GstWindowDelegate alloc]
       initWithSink:osxvideosink]];
@@ -884,11 +877,11 @@ gst_osx_video_sink_get_type (void)
   GST_OBJECT_LOCK (osxvideosink);
   if (osxvideosink->osxwindow == NULL)
       goto no_window;
-  
+
   texture_buffer = (guint8 *) [osxvideosink->osxwindow->gstview getTextureBuffer];
   if (G_UNLIKELY (texture_buffer == NULL))
       goto no_texture_buffer;
-  
+
   vmeta = (GstVideoMeta *) gst_buffer_get_meta (buf, GST_VIDEO_META_API_TYPE);
   gst_video_meta_map (vmeta, 0, &info, (gpointer *) &data, &stride, GST_MAP_READ);
   readp = data;