Skip to content

Commit

Permalink
[osx] remove 10.4 specific code in favor of 10.6 api
Browse files Browse the repository at this point in the history
  • Loading branch information
davilla committed May 10, 2012
1 parent fcd9376 commit 9dda396
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 164 deletions.
4 changes: 0 additions & 4 deletions XBMC.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,6 @@
E3E920020D8C622A002BF43D /* EventClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3E920010D8C622A002BF43D /* EventClient.cpp */; };
E43196170FB2382E0030E150 /* HTSPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43196140FB2382E0030E150 /* HTSPDirectory.cpp */; };
E43196180FB2382E0030E150 /* HTSPSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43196160FB2382E0030E150 /* HTSPSession.cpp */; };
E435380411076A2900792AB8 /* eprintf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5ACB5370FC3DF3D00AAA056 /* eprintf.cpp */; };
E46F7C2A0F77217400C25D29 /* Zeroconf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E46F7C280F77217400C25D29 /* Zeroconf.cpp */; };
E46F7C2D0F77219700C25D29 /* ZeroconfOSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E46F7C2C0F77219700C25D29 /* ZeroconfOSX.cpp */; };
E49ACD8C100745C400A86ECD /* ZeroconfDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E49ACD8B100745C400A86ECD /* ZeroconfDirectory.cpp */; };
Expand Down Expand Up @@ -2965,7 +2964,6 @@
F5AACA670FB3DE2D00DBB77C /* GUIDialogSelect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogSelect.cpp; sourceTree = "<group>"; };
F5AACA950FB3E2B800DBB77C /* GUIDialogSlider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogSlider.cpp; sourceTree = "<group>"; };
F5AACA960FB3E2B800DBB77C /* GUIDialogSlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogSlider.h; sourceTree = "<group>"; };
F5ACB5370FC3DF3D00AAA056 /* eprintf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = eprintf.cpp; sourceTree = "<group>"; };
F5AD1EA60F488A1A0065EB5D /* GUIWindowKaraokeLyrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowKaraokeLyrics.h; sourceTree = "<group>"; };
F5AD1EA70F488A1A0065EB5D /* GUIWindowKaraokeLyrics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowKaraokeLyrics.cpp; sourceTree = "<group>"; };
F5AE406F13415D8C0004BD79 /* HttpApi.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HttpApi.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4287,7 +4285,6 @@
F5EA05C00F733812005C2EC5 /* CocoaInterface.mm */,
F5B13C8B1334056B0045076D /* DarwinUtils.h */,
F5B13C8C1334056B0045076D /* DarwinUtils.mm */,
F5ACB5370FC3DF3D00AAA056 /* eprintf.cpp */,
F54BCC5D1439345300F86B0F /* HotKeyController.h */,
F54BCC5E1439345300F86B0F /* HotKeyController.m */,
6E2FACD20E26E92800DF79EA /* Info.plist */,
Expand Down Expand Up @@ -6908,7 +6905,6 @@
F595994510E9F322004B58B3 /* DVDVideoCodecCrystalHD.cpp in Sources */,
7C45DBE910F325C400D4BBF3 /* DAVDirectory.cpp in Sources */,
F592568810FBF2E100D2C91D /* ConvolutionKernels.cpp in Sources */,
E435380411076A2900792AB8 /* eprintf.cpp in Sources */,
F5DC87E2110A287400EE1B15 /* RingBuffer.cpp in Sources */,
F5DC8801110A46C700EE1B15 /* ModplugCodec.cpp in Sources */,
F5F240EF110A4F76009126C6 /* CrystalHD.cpp in Sources */,
Expand Down
39 changes: 0 additions & 39 deletions xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,8 @@
#endif

#ifdef TARGET_DARWIN
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4
#include <CoreVideo/CoreVideo.h>
#include <OpenGL/CGLIOSurface.h>
#else
enum CVPixelBufferLockFlags {
kCVPixelBufferLock_ReadOnly = 0x00000001,
};
#include <CoreVideo/CVPixelBuffer.h>
#endif
#endif

#ifdef HAS_GLX
Expand Down Expand Up @@ -2448,24 +2441,6 @@ void CLinuxRendererGL::UploadCVRefTexture(int index)
YUVFIELDS &fields = m_buffers[index].fields;
YUVPLANE &plane = fields[0][0];

#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
CVPixelBufferLockBaseAddress(cvBufferRef, kCVPixelBufferLock_ReadOnly);
int bufferWidth = CVPixelBufferGetWidth(cvBufferRef);
int bufferHeight = CVPixelBufferGetHeight(cvBufferRef);
unsigned char *bufferBase = (unsigned char *)CVPixelBufferGetBaseAddress(cvBufferRef);

glEnable(m_textureTarget);
glBindTexture(m_textureTarget, plane.id);
// Set storage hint. Can also use GL_STORAGE_SHARED_APPLE see docs.
glTexParameteri(m_textureTarget, GL_TEXTURE_STORAGE_HINT_APPLE , GL_STORAGE_CACHED_APPLE);
// Using GL_YCBCR_422_APPLE extension to pull in video frame data directly
glTexSubImage2D(m_textureTarget, 0, 0, 0, bufferWidth, bufferHeight, GL_YCBCR_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE, bufferBase);
glBindTexture(m_textureTarget, 0);
glDisable(m_textureTarget);

CVPixelBufferUnlockBaseAddress(cvBufferRef, kCVPixelBufferLock_ReadOnly);
#else
// CGLTexImageIOSurface2D only exits in 10.5sdk and above.
// It is the fastest way to render a CVPixelBuffer backed
// with an IOSurface as there is no CPU -> GPU upload.
CGLContextObj cgl_ctx = (CGLContextObj)g_Windowing.GetCGLContextObj();
Expand All @@ -2484,7 +2459,6 @@ void CLinuxRendererGL::UploadCVRefTexture(int index)
texWidth, texHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, surface, 0);
glBindTexture(m_textureTarget, 0);
glDisable(m_textureTarget);
#endif

CVBufferRelease(cvBufferRef);
m_buffers[index].cvBufferRef = NULL;
Expand Down Expand Up @@ -2541,19 +2515,6 @@ bool CLinuxRendererGL::CreateCVRefTexture(int index)
}
glEnable(m_textureTarget);
glGenTextures(1, &plane.id);

#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
glBindTexture(m_textureTarget, plane.id);
// Set storage hint. Can also use GL_STORAGE_SHARED_APPLE see docs.
glTexParameteri(m_textureTarget, GL_TEXTURE_STORAGE_HINT_APPLE , GL_STORAGE_CACHED_APPLE);
glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// This is necessary for non-power-of-two textures
glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(m_textureTarget, 0, GL_RGBA, plane.texwidth, plane.texheight, 0, GL_YCBCR_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE, NULL);
glBindTexture(m_textureTarget, 0);
#endif
glDisable(m_textureTarget);

m_eventTexturesDone[index]->Set();
Expand Down
10 changes: 0 additions & 10 deletions xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,6 @@
(field_pic_flag: 1 would indicate a normal interlaced frame).
*/

// missing in 10.4 SDK
#if (MAC_OS_X_VERSION_MAX_ALLOWED < 1050)
#include "dlfcn.h"
enum {
// component Y'CbCr 8-bit 4:2:2, ordered Cb Y'0 Cr Y'1 .
kCVPixelFormatType_422YpCbCr8 = FourCharCode('2vuy'),
kCVPixelFormatType_32BGRA = FourCharCode('BGRA')
};
const CFStringRef kCVPixelBufferIOSurfacePropertiesKey = CFSTR("IOSurfaceProperties");
#endif

////////////////////////////////////////////////////////////////////////////////////////////
// http://developer.apple.com/mac/library/technotes/tn2010/tn2267.html
Expand Down
2 changes: 1 addition & 1 deletion xbmc/linux/PlatformDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ typedef int (*LPTHREAD_START_ROUTINE)(void *);
typedef fpos_t fpos64_t;
#define __stat64 stat
#define stat64 stat
#if (MAC_OS_X_VERSION_MAX_ALLOWED < 1050) || defined(TARGET_DARWIN_IOS)
#if defined(TARGET_DARWIN_IOS)
#define statfs64 statfs
#endif
#define fstat64 fstat
Expand Down
18 changes: 6 additions & 12 deletions xbmc/osx/CocoaInterface.mm
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,12 @@ void Cocoa_CVDisplayLinkUpdate(void)
}
else
{
// NOTE: The refresh rate will be REPORTED AS 0 for many DVI and notebook displays.
CGDirectDisplayID display_id;
CFDictionaryRef mode;

display_id = (CGDirectDisplayID)Cocoa_GL_GetCurrentDisplayID();
mode = CGDisplayCurrentMode(display_id);
if (mode)
{
CFNumberGetValue( (CFNumberRef)CFDictionaryGetValue(mode, kCGDisplayRefreshRate), kCFNumberDoubleType, &fps);
if (fps <= 0.0)
fps = 60.0;
}
CGDisplayModeRef display_mode;
display_mode = (CGDisplayModeRef)Cocoa_GL_GetCurrentDisplayID();
fps = CGDisplayModeGetRefreshRate(display_mode);
CGDisplayModeRelease(display_mode);
if (fps <= 0.0)
fps = 60.0;
}

return(fps);
Expand Down
15 changes: 0 additions & 15 deletions xbmc/osx/HotKeyController.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,6 @@
#import <IOKit/hidsystem/ev_keymap.h>
#import <sys/sysctl.h>

#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
#if __LP64__ || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#define NSUIntegerMax ULONG_MAX
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#define NSUIntegerMax UINT_MAX
#endif
#endif

NSString* const MediaKeyPower = @"MediaKeyPower";
NSString* const MediaKeySoundMute = @"MediaKeySoundMute";
NSString* const MediaKeySoundUp = @"MediaKeySoundUp";
Expand Down Expand Up @@ -180,9 +168,6 @@ static CGEventRef tapEventCallback2(CGEventTapProxy proxy, CGEventType type, CGE
if ((type != NX_SYSDEFINED) || (![hot_key_controller getActive]))
return event;

// eventWithCGEvent does not exist under 10.4 SDK,
// but thanks to how objc works, it will resolve at runtime on 10.5+
// but we will get a compile warning, just ignore it.
NSEvent *nsEvent = [NSEvent eventWithCGEvent:event];
if (!nsEvent || [nsEvent subtype] != 8)
return event;
Expand Down
1 change: 0 additions & 1 deletion xbmc/osx/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ INCLUDES=-I$(abs_top_srcdir) \

.SUFFIXES : .m .mm

# do not include eprintf.cpp as make links to libgcc.a where as xcode does not.
SRCS = \
SDLMain.mm \
XBMCHelper.m \
Expand Down
41 changes: 0 additions & 41 deletions xbmc/osx/eprintf.cpp

This file was deleted.

5 changes: 0 additions & 5 deletions xbmc/powermanagement/osx/CocoaPowerSyscall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ typedef unsigned char BYTE;

#include "osx/DarwinUtils.h"

// missing in 10.4/10.5 SDKs.
#if (MAC_OS_X_VERSION_MAX_ALLOWED < 1060)
#define kIOPSNotifyLowBattery "com.apple.system.powersources.lowbattery"
#endif

#include "CocoaInterface.h"

#if defined(TARGET_DARWIN_OSX)
Expand Down
36 changes: 0 additions & 36 deletions xbmc/windowing/osx/WinSystemOSX.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1080,11 +1080,7 @@ static void DisplayReconfigured(CGDirectDisplayID display,
void CWinSystemOSX::EnableVSync(bool enable)
{
// OpenGL Flush synchronised with vertical retrace
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4
GLint swapInterval = enable ? 1 : 0;
#else
const long int swapInterval = enable ? 1 : 0;
#endif
[[NSOpenGLContext currentContext] setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
}

Expand Down Expand Up @@ -1281,37 +1277,6 @@ static void DisplayReconfigured(CGDirectDisplayID display,

void CWinSystemOSX::EnableSystemScreenSaver(bool bEnable)
{
#if (MAC_OS_X_VERSION_MAX_ALLOWED < 1050)
// static games because NSTimer is an object-c class and we cannot
// forward declare nor include NSTimer.h in WinSystemOSX.h
static NSTimer *display_tickle;

if (bEnable)
{
if (display_tickle != NULL)
{
[display_tickle invalidate];
[display_tickle release];
display_tickle = NULL;
}
}
else
{
if (display_tickle == NULL)
{
// NSTimer will retain the target until it is released,
// so we do not worry about retaining/releasing it.
windowInhibitScreenSaverClass *inhibitScreenSaver;
inhibitScreenSaver = [[[windowInhibitScreenSaverClass alloc] init] autorelease];
// schedule every 30 seconds
display_tickle = [NSTimer scheduledTimerWithTimeInterval:30.0
target:inhibitScreenSaver selector:@selector(updateSystemActivity:) userInfo:nil repeats:YES];
[display_tickle retain];
}
}
m_use_system_screensaver = (display_tickle == NULL);
#else
// only present in 10.5 SDK and above
// kIOPMAssertionTypeNoDisplaySleep prevents display idle sleep
static IOPMAssertionID assertionID = 0;

Expand All @@ -1321,7 +1286,6 @@ static void DisplayReconfigured(CGDirectDisplayID display,
IOPMAssertionRelease(assertionID);

m_use_system_screensaver = bEnable;
#endif
}

bool CWinSystemOSX::IsSystemScreenSaverEnabled()
Expand Down

0 comments on commit 9dda396

Please sign in to comment.