osxvideo: fix build on Mac OSX Mavericks and put new window in front

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.
This commit is contained in:
Thijs Vermeir 2014-03-05 13:35:19 +01:00 committed by Sebastian Dröge
parent b2bf1f1882
commit e96f0c03ef
2 changed files with 18 additions and 25 deletions

View 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];

View 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;