diff --git a/mythtv/configure b/mythtv/configure
index 1efe803..6d012b0 100755
--- a/mythtv/configure
+++ b/mythtv/configure
@@ -3060,13 +3060,14 @@ EOF
             disable mmx
             enable disable_mmx_for_debugging   # prevent later call to die
         fi
+		disable ffmpeg
         disable opengl_vsync
         disable v4l
         disable x11
         # Workaround compile errors from missing gmtime_r/localtime_r/uint def
         CFLAGS=`echo $CFLAGS | sed 's/-D_POSIX_C_SOURCE=200112//'`
         ###### Standard ffmpeg configure stuff follows:
-        SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
+        SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,99 -Wl,-read_only_relocs,suppress'
         strip="${strip} -x"
         add_ldflags -Wl,-dynamic,-search_paths_first
         SLIBSUF=".dylib"
@@ -4568,7 +4569,7 @@ fi
 
 if test $target_os = darwin; then
   # Qt, by default builds .app bundles everywhere. Prevent this.
-  enabled mac_bundle || echo "CONFIG -= app_bundle" >> $MYTH_CONFIG_MAK
+  enabled mac_bundle || echo "CONFIG-= app_bundle" >> $MYTH_CONFIG_MAK
 fi
 
 cat > $TMPH <<EOF
diff --git a/mythtv/filters/yadif/yadif.pro b/mythtv/filters/yadif/yadif.pro
index ec45a0a..9011d54 100644
--- a/mythtv/filters/yadif/yadif.pro
+++ b/mythtv/filters/yadif/yadif.pro
@@ -12,3 +12,8 @@ contains(ARCH_X86, yes) {
 }
 
 macx:debug:DEFINES -= MMX
+
+macx {
+	CC            = gcc-4.0
+	CXX           = g++-4.0
+}
diff --git a/mythtv/libs/libmyth/libmyth.pro b/mythtv/libs/libmyth/libmyth.pro
index fb4f5e6..581fc8b 100644
--- a/mythtv/libs/libmyth/libmyth.pro
+++ b/mythtv/libs/libmyth/libmyth.pro
@@ -83,7 +83,7 @@ LIBS += -L../libmythui           -lmythui-$${LIBVERSION}
 LIBS += -L../libmythupnp         -lmythupnp-$${LIBVERSION}
 LIBS += -L../libmythfreesurround -lmythfreesurround-$${LIBVERSION}
 LIBS += -L../../external/FFmpeg/libavcodec -lmythavcodec
-LIBS += -L../../external/FFmpeg/libavcore  -lmythavcodec
+LIBS += -L../../external/FFmpeg/libavcore  -lmythavcore
 LIBS += -L../../external/FFmpeg/libavutil  -lmythavutil
 
 TARGETDEPS += ../libmythsamplerate/libmythsamplerate-$${MYTH_LIB_EXT}
diff --git a/mythtv/libs/libmythtv/darwinfirewiredevice.cpp b/mythtv/libs/libmythtv/darwinfirewiredevice.cpp
index 6046b86..2b005dc 100644
--- a/mythtv/libs/libmythtv/darwinfirewiredevice.cpp
+++ b/mythtv/libs/libmythtv/darwinfirewiredevice.cpp
@@ -30,7 +30,6 @@ using namespace std;
 
 // Apple Firewire example headers
 #include <AVCVideoServices/StringLogger.h>
-#include <AVCVideoServices/AVSShared.h>
 #include <AVCVideoServices/MPEG2Receiver.h>
 
 // header not used because it also requires MPEG2Transmitter.h
diff --git a/mythtv/libs/libmythtv/decoderbase.h b/mythtv/libs/libmythtv/decoderbase.h
index e4311e3..6d913c7 100644
--- a/mythtv/libs/libmythtv/decoderbase.h
+++ b/mythtv/libs/libmythtv/decoderbase.h
@@ -18,7 +18,7 @@ class TeletextViewer;
 class MythPlayer;
 class AudioPlayer;
 
-const int kDecoderProbeBufferSize = 128 * 1024;
+const int kDecoderProbeBufferSize = 65536;
 
 /// Track types
 typedef enum TrackTypes
diff --git a/mythtv/libs/libmythtv/privatedecoder_vda.cpp b/mythtv/libs/libmythtv/privatedecoder_vda.cpp
index 0414042..853cf23 100644
--- a/mythtv/libs/libmythtv/privatedecoder_vda.cpp
+++ b/mythtv/libs/libmythtv/privatedecoder_vda.cpp
@@ -198,7 +198,8 @@ bool PrivateDecoderVDA::Init(const QString &decoder,
 #ifdef USING_QUARTZ_VIDEO
     OSType cvPixelFormatType = k422YpCbCr8PixelFormat;
 #else
-    OSType cvPixelFormatType = kCVPixelFormatType_422YpCbCr8;
+    //OSType cvPixelFormatType = kCVPixelFormatType_422YpCbCr8;
+	OSType cvPixelFormatType = '2vuy';
 #endif
     CFNumberRef pixelFormat  = CFNumberCreate(kCFAllocatorDefault,
                                               kCFNumberSInt32Type,
diff --git a/mythtv/libs/libmythui/AppleRemote.cpp b/mythtv/libs/libmythui/AppleRemote.cpp
index 76d9e34..1409286 100644
--- a/mythtv/libs/libmythui/AppleRemote.cpp
+++ b/mythtv/libs/libmythui/AppleRemote.cpp
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <ctype.h>
 #include <sys/errno.h>
+#include <sys/sysctl.h>
 #include <sysexits.h>
 #include <mach/mach.h>
 #include <mach/mach_error.h>
@@ -14,16 +15,31 @@
 #include <IOKit/hid/IOHIDLib.h>
 #include <IOKit/hid/IOHIDKeys.h>
 #include <CoreFoundation/CoreFoundation.h>
+#include <CoreServices/CoreServices.h>
 
 #include <sstream>
+#include <QTimer>
+
+
 
 #include "mythverbose.h"
 
 AppleRemote*      AppleRemote::_instance = 0;
 const int         AppleRemote::REMOTE_SWITCH_COOKIE = 19;
+// For ATV v2.3 onwards
+const int		  LONG_PRESS_COUNT = 10;
+const int		  KEY_RESPONSE_TIME = 150;	// msecs before we send a key up event
 
 const QString     LOC = "AppleRemote::";
 
+typedef struct _ATV_IR_EVENT {
+	UInt32    time_ms32;
+	UInt32    time_ls32; // units of microsecond 
+	UInt32    unknown1;
+	UInt32    keycode;
+	UInt32    unknown2;
+} ATV_IR_EVENT;
+
 static io_object_t _findAppleRemoteDevice(const char *devName);
 
 AppleRemote::Listener::~Listener()
@@ -32,7 +48,7 @@ AppleRemote::Listener::~Listener()
 
 AppleRemote * AppleRemote::Get()
 {
-    if (_instance == 0)
+	if (_instance == 0)
         _instance = new AppleRemote();
 
     return _instance;
@@ -41,6 +57,8 @@ AppleRemote * AppleRemote::Get()
 AppleRemote::~AppleRemote()
 {
     stopListening();
+	if (usingNewAtv)
+		delete mCallbackTimer;
 }
 
 bool AppleRemote::isListeningToRemote()
@@ -108,9 +126,57 @@ AppleRemote::AppleRemote() : openInExclusiveMode(true),
                              hidDeviceInterface(0),
                              queue(0),
                              remoteId(0),
-                             _listener(0)
+                             _listener(0),
+							 usingNewAtv(false),
+							 mLastEvent(AppleRemote::Undefined),
+							 mEventCount(0),
+							 mKeyIsDown(false)
 {
-    _initCookieMap();
+	SInt32 macVersion;
+	size_t len = 512;
+	char hw_model[512] = "unknown";
+	
+	// Figure out if we're running on the Apple TV, past version 2.3
+	Gestalt(gestaltSystemVersion, &macVersion);
+	
+	
+	if (macVersion < 0x1050) // OSX 10.4 / AppleTV
+	{
+        sysctlbyname("hw.model", &hw_model, &len, NULL, 0);
+
+		if ( strstr(hw_model,"AppleTV1,1") ) 
+		{
+			FILE* inpipe;
+			
+			//Find the build version of the AppleTV OS
+			inpipe = popen("sw_vers -buildVersion", "r");
+			char linebuf[1000];
+			if (inpipe) 
+			{
+				if ( fgets(linebuf, sizeof(linebuf) - 1, inpipe) ) 
+				{
+					if ( !( strstr(linebuf,"8N5107") || // v1.0
+							strstr(linebuf,"8N5239") || // v1.1
+							strstr(linebuf,"8N5400") || // v2.0
+							strstr(linebuf,"8N5455") || // v2.01
+							strstr(linebuf,"8N5461") || // v2.02
+							strstr(linebuf,"8N5519") || // v2.1
+							strstr(linebuf,"8N5622") )) // v2.2
+					{
+						VERBOSE(VB_IMPORTANT, LOC + "::AppleRemote detected Apple TV > v2.3");
+						usingNewAtv = true;
+						mCallbackTimer = new QTimer(this);
+						connect(mCallbackTimer, SIGNAL(timeout()), this, SLOT(TimeoutHandler()));
+						mCallbackTimer->setSingleShot(true);
+						mCallbackTimer->setInterval(KEY_RESPONSE_TIME);
+					}  
+				}
+			}
+			pclose(inpipe); 
+		}
+	}
+	
+	_initCookieMap();
 }
 
 /// Apple keeps changing the "interface" between the remote and the OS.
@@ -124,80 +190,85 @@ AppleRemote::AppleRemote() : openInExclusiveMode(true),
 ///
 void AppleRemote::_initCookieMap()
 {
-    // 10.4 sequences:
-    cookieToButtonMapping["14_12_11_6_5_"]        = Up;
-    cookieToButtonMapping["14_13_11_6_5_"]        = Down;
-    cookieToButtonMapping["14_7_6_5_14_7_6_5_"]   = Menu;
-    cookieToButtonMapping["14_8_6_5_14_8_6_5_"]   = Select;
-    cookieToButtonMapping["14_9_6_5_14_9_6_5_"]   = Right;
-    cookieToButtonMapping["14_10_6_5_14_10_6_5_"] = Left;
-    cookieToButtonMapping["14_6_5_4_2_"]          = RightHold;
-    cookieToButtonMapping["14_6_5_3_2_"]          = LeftHold;
-    cookieToButtonMapping["14_6_5_14_6_5_"]       = MenuHold;
-    cookieToButtonMapping["18_14_6_5_18_14_6_5_"] = PlayHold;
-    cookieToButtonMapping["19_"]                  = ControlSwitched;
-
-    // 10.5 sequences:
-    cookieToButtonMapping["31_29_28_18_"]         = Up;
-    cookieToButtonMapping["31_30_28_18_"]         = Down;
-    cookieToButtonMapping["31_20_18_31_20_18_"]   = Menu;
-    cookieToButtonMapping["31_21_18_31_21_18_"]   = Select;
-    cookieToButtonMapping["31_22_18_31_22_18_"]   = Right;
-    cookieToButtonMapping["31_23_18_31_23_18_"]   = Left;
-    cookieToButtonMapping["31_18_4_2_"]           = RightHold;
-    cookieToButtonMapping["31_18_3_2_"]           = LeftHold;
-    cookieToButtonMapping["31_18_31_18_"]         = MenuHold;
-    cookieToButtonMapping["35_31_18_35_31_18_"]   = PlayHold;
-    cookieToButtonMapping["39_"]                  = ControlSwitched;
-
-    // ATV 1.0, 2.0-2.02
-    cookieToButtonMapping["14_12_11_6_"]          = Up;
-    cookieToButtonMapping["14_13_11_6_"]          = Down;
-    cookieToButtonMapping["14_7_6_14_7_6_"]       = Menu;
-    cookieToButtonMapping["14_8_6_14_8_6_"]       = Select;
-    cookieToButtonMapping["14_9_6_14_9_6_"]       = Right;
-    cookieToButtonMapping["14_10_6_14_10_6_"]     = Left;
-    cookieToButtonMapping["14_6_4_2_"]            = RightHold;
-    cookieToButtonMapping["14_6_3_2_"]            = LeftHold;
-    cookieToButtonMapping["14_6_14_6_"]           = MenuHold;
-    cookieToButtonMapping["18_14_6_18_14_6_"]     = PlayHold;
-
-    // ATV 1.0, 2.1-2.2
-    cookieToButtonMapping["15_13_12_"]            = Up;
-    cookieToButtonMapping["15_14_12_"]            = Down;
-    cookieToButtonMapping["15_8_15_8_"]           = Menu;
-    cookieToButtonMapping["15_9_15_9_"]           = Select;
-    cookieToButtonMapping["15_10_15_10_"]         = Right;
-    cookieToButtonMapping["15_11_15_11_"]         = Left;
-    cookieToButtonMapping["15_5_3_"]              = RightHold;
-    cookieToButtonMapping["15_4_3_"]              = LeftHold;
-    cookieToButtonMapping["15_6_15_6_"]           = MenuHold;
-    cookieToButtonMapping["19_15_19_15_"]         = PlayHold;
-
-    // ATV 2.30
-    cookieToButtonMapping["80"]                   = Up;
-    cookieToButtonMapping["48"]                   = Down;
-    cookieToButtonMapping["64"]                   = Menu;
-    cookieToButtonMapping["32"]                   = Select;
-    cookieToButtonMapping["96"]                   = Right;
-    cookieToButtonMapping["16"]                   = Left;
-
-    // 10.6 sequences:
-    cookieToButtonMapping["33_31_30_21_20_2_"]            = Up;
-    cookieToButtonMapping["33_32_30_21_20_2_"]            = Down;
-    cookieToButtonMapping["33_22_21_20_2_33_22_21_20_2_"] = Menu;
-    cookieToButtonMapping["33_23_21_20_2_33_23_21_20_2_"] = Select;
-    cookieToButtonMapping["33_24_21_20_2_33_24_21_20_2_"] = Right;
-    cookieToButtonMapping["33_25_21_20_2_33_25_21_20_2_"] = Left;
-    cookieToButtonMapping["33_21_20_14_12_2_"]            = RightHold;
-    cookieToButtonMapping["33_21_20_13_12_2_"]            = LeftHold;
-    cookieToButtonMapping["33_21_20_2_33_21_20_2_"]       = MenuHold;
-    cookieToButtonMapping["37_33_21_20_2_37_33_21_20_2_"] = PlayHold;
-
-    // Aluminium remote which has an extra button:
-    cookieToButtonMapping["33_21_20_8_2_33_21_20_8_2_"]   = PlayPause;
-    cookieToButtonMapping["33_21_20_3_2_33_21_20_3_2_"]   = Select;
-    cookieToButtonMapping["33_21_20_11_2_33_21_20_11_2_"] = PlayHold;
+	if (!usingNewAtv) 
+	{
+		// 10.4 sequences:
+		cookieToButtonMapping["14_12_11_6_5_"]        = Up;
+		cookieToButtonMapping["14_13_11_6_5_"]        = Down;
+		cookieToButtonMapping["14_7_6_5_14_7_6_5_"]   = Menu;
+		cookieToButtonMapping["14_8_6_5_14_8_6_5_"]   = Select;
+		cookieToButtonMapping["14_9_6_5_14_9_6_5_"]   = Right;
+		cookieToButtonMapping["14_10_6_5_14_10_6_5_"] = Left;
+		cookieToButtonMapping["14_6_5_4_2_"]          = RightHold;
+		cookieToButtonMapping["14_6_5_3_2_"]          = LeftHold;
+		cookieToButtonMapping["14_6_5_14_6_5_"]       = MenuHold;
+		cookieToButtonMapping["18_14_6_5_18_14_6_5_"] = PlayHold;
+		cookieToButtonMapping["19_"]                  = ControlSwitched;
+		
+		// 10.5 sequences:
+		cookieToButtonMapping["31_29_28_18_"]         = Up;
+		cookieToButtonMapping["31_30_28_18_"]         = Down;
+		cookieToButtonMapping["31_20_18_31_20_18_"]   = Menu;
+		cookieToButtonMapping["31_21_18_31_21_18_"]   = Select;
+		cookieToButtonMapping["31_22_18_31_22_18_"]   = Right;
+		cookieToButtonMapping["31_23_18_31_23_18_"]   = Left;
+		cookieToButtonMapping["31_18_4_2_"]           = RightHold;
+		cookieToButtonMapping["31_18_3_2_"]           = LeftHold;
+		cookieToButtonMapping["31_18_31_18_"]         = MenuHold;
+		cookieToButtonMapping["35_31_18_35_31_18_"]   = PlayHold;
+		cookieToButtonMapping["39_"]                  = ControlSwitched;
+		
+		// ATV 1.0, 2.0-2.02 
+		cookieToButtonMapping["14_12_11_6_"]          = Up;
+		cookieToButtonMapping["14_13_11_6_"]          = Down;
+		cookieToButtonMapping["14_7_6_14_7_6_"]       = Menu;
+		cookieToButtonMapping["14_8_6_14_8_6_"]       = Select;
+		cookieToButtonMapping["14_9_6_14_9_6_"]       = Right;
+		cookieToButtonMapping["14_10_6_14_10_6_"]     = Left;
+		cookieToButtonMapping["14_6_4_2_"]            = RightHold;
+		cookieToButtonMapping["14_6_3_2_"]            = LeftHold;
+		cookieToButtonMapping["14_6_14_6_"]           = MenuHold;
+		cookieToButtonMapping["18_14_6_18_14_6_"]     = PlayHold;
+		
+		// ATV 1.0, 2.1-2.2 
+		cookieToButtonMapping["15_13_12_"]            = Up;
+		cookieToButtonMapping["15_14_12_"]            = Down;
+		cookieToButtonMapping["15_8_15_8_"]           = Menu;
+		cookieToButtonMapping["15_9_15_9_"]           = Select;
+		cookieToButtonMapping["15_10_15_10_"]         = Right;
+		cookieToButtonMapping["15_11_15_11_"]         = Left;
+		cookieToButtonMapping["15_5_3_"]              = RightHold;
+		cookieToButtonMapping["15_4_3_"]              = LeftHold;
+		cookieToButtonMapping["15_6_15_6_"]           = MenuHold;
+		cookieToButtonMapping["19_15_19_15_"]         = PlayHold;
+	
+	    // 10.6 sequences:
+		cookieToButtonMapping["33_31_30_21_20_2_"]            = Up;
+		cookieToButtonMapping["33_32_30_21_20_2_"]            = Down;
+		cookieToButtonMapping["33_22_21_20_2_33_22_21_20_2_"] = Menu;
+		cookieToButtonMapping["33_23_21_20_2_33_23_21_20_2_"] = Select;
+		cookieToButtonMapping["33_24_21_20_2_33_24_21_20_2_"] = Right;
+		cookieToButtonMapping["33_25_21_20_2_33_25_21_20_2_"] = Left;
+		cookieToButtonMapping["33_21_20_14_12_2_"]            = RightHold;
+		cookieToButtonMapping["33_21_20_13_12_2_"]            = LeftHold;
+		cookieToButtonMapping["33_21_20_2_33_21_20_2_"]       = MenuHold;
+		cookieToButtonMapping["37_33_21_20_2_37_33_21_20_2_"] = PlayHold;
+
+		// Aluminium remote which has an extra button:
+		cookieToButtonMapping["33_21_20_8_2_33_21_20_8_2_"]   = PlayPause;
+		cookieToButtonMapping["33_21_20_3_2_33_21_20_3_2_"]   = Select;
+		cookieToButtonMapping["33_21_20_11_2_33_21_20_11_2_"] = PlayHold;
+	} 
+	else 
+	{
+		// ATV 2.30 
+		cookieToButtonMapping["17_9_280_80"]                   = Up;
+		cookieToButtonMapping["17_9_280_48"]                   = Down;
+		cookieToButtonMapping["17_9_280_64"]                   = Menu;
+		cookieToButtonMapping["17_9_280_32"]                   = Select;
+		cookieToButtonMapping["17_9_280_96"]                   = Right;
+		cookieToButtonMapping["17_9_280_16"]                   = Left;	
+	}
 }
 
 static io_object_t _findAppleRemoteDevice(const char *devName)
@@ -316,6 +387,8 @@ bool AppleRemote::_openDevice()
         VERBOSE(VB_IMPORTANT, LOC + "_openDevice() failed");
         return false;
     }
+	VERBOSE(VB_IMPORTANT, LOC + "Opened AppleRemote Device");
+	
     queue = (*hidDeviceInterface)->allocQueue(hidDeviceInterface);
     if (!queue)
     {
@@ -373,39 +446,206 @@ void AppleRemote::_queueCallbackFunction(IOReturn result,
     SInt32            sumOfValues = 0;
     std::stringstream cookieString;
 
-    while (result == kIOReturnSuccess)
-    {
-        IOHIDEventStruct event;
-
-        result = (*queue)->getNextEvent(queue, &event, zeroTime, 0);
-        if (result != kIOReturnSuccess)
-            break;
-
-        if (REMOTE_SWITCH_COOKIE == (int)event.elementCookie)
-        {
-            remoteId=event.value;
-            _handleEventWithCookieString("19_",0);
-        }
-        else
-        {
-            sumOfValues+=event.value;
-            cookieString << std::dec << (int)event.elementCookie << "_";
-        }
+	if (!usingNewAtv) 
+	{
+		while (result == kIOReturnSuccess)
+		{
+			IOHIDEventStruct event;
+		
+			result = (*queue)->getNextEvent(queue, &event, zeroTime, 0);
+        	if (result != kIOReturnSuccess)
+            	break;
+
+			if (REMOTE_SWITCH_COOKIE == (int)event.elementCookie)
+			{
+				remoteId=event.value;
+				_handleEventWithCookieString("19_",0);
+			}
+			else
+			{
+				sumOfValues+=event.value;
+				cookieString << std::dec << (int)event.elementCookie << "_";
+			}
+		}
+		_handleEventWithCookieString(cookieString.str(), sumOfValues);
     }
-
-    _handleEventWithCookieString(cookieString.str(), sumOfValues);
+	else // AppleTV from v2.3 onwards 
+	{
+		if (mCallbackTimer->isActive())
+		{
+			mCallbackTimer->stop();
+		}
+		
+		IOHIDEventStruct event;
+		UInt32 key_code = 0;
+		
+		while (result == kIOReturnSuccess)
+		{
+			result = (*queue)->getNextEvent(queue, &event, zeroTime, 0);
+			if (result != kIOReturnSuccess) {
+				continue;
+			}
+			
+			if ( ((int)event.elementCookie == 280) && (event.longValueSize == 20)) {
+				ATV_IR_EVENT* atv_ir_event = (ATV_IR_EVENT*)event.longValue;
+				key_code = atv_ir_event->keycode;
+			}
+			
+			if (((int)event.elementCookie) != 5 ) {
+				sumOfValues += event.value;
+				cookieString << std::dec << (int)event.elementCookie << "_";
+			}
+		}
+		char endCode[10] = "17_9_280_";
+		if (strcmp(cookieString.str().c_str(), endCode) == 0) {
+
+			cookieString << std::dec << (int) ( (key_code & 0x00007F00) >> 8);
+			
+			sumOfValues = 1;
+			_handleEventWithCookieString(cookieString.str(), sumOfValues);	
+		}
+	}
 }
 
-void AppleRemote::_handleEventWithCookieString(std::string cookieString,
-                                          SInt32 sumOfValues)
+void AppleRemote::_handleEventWithCookieString(std::string cookieString, 
+												SInt32 sumOfValues)
 {
-    std::map<std::string,AppleRemote::Event>::iterator ii;
-
-    ii = cookieToButtonMapping.find(cookieString);
-    if (ii != cookieToButtonMapping.end() && _listener)
+	std::map<std::string,AppleRemote::Event>::iterator ii;
+	ii = cookieToButtonMapping.find(cookieString);
+    
+	
+	if (ii != cookieToButtonMapping.end() )
     {
-        AppleRemote::Event buttonid = ii->second;
-        if (_listener)
-            _listener->appleRemoteButton(buttonid, sumOfValues>0);
+		AppleRemote::Event event = ii->second;
+		
+		if (!usingNewAtv) {	
+			if (_listener)
+			{
+				_listener->appleRemoteButton(event, sumOfValues>0);
+			}
+		} 
+		else 
+		{
+			// With the ATV from 2.3 onwards, we just get IR events. We need to simulate the 
+			// key up and hold events
+			
+			if (mLastEvent == Undefined)	// new event
+			{
+				mEventCount = 1;
+				// Need to figure out if this is a long press or a short press,
+				// so can't just send a key down event right now. It will be
+				// scheduled to run
+			} 
+			else if (event != mLastEvent)	// a new event, faster than timer
+			{
+				mEventCount = 1;
+				mKeyIsDown = true;
+				
+				if (_listener) 
+				{
+					// Only send key up events for events that have separateRelease
+					// defined as true in AppleRemoteListener.cpp
+					if (mLastEvent == Up || mLastEvent == Down ||
+						mLastEvent == LeftHold || mLastEvent == RightHold) 
+					{
+						_listener->appleRemoteButton(mLastEvent, /*pressedDown*/false);
+					}
+					_listener->appleRemoteButton(event, mKeyIsDown);
+				}
+			} 
+			else // Same event again 
+			{
+				mEventCount+=1;
+				AppleRemote::Event newEvent = Undefined;
+				
+				// Can the event have a hold state?
+				switch (event) 
+				{
+					case Right:
+						newEvent = RightHold;
+						break;
+					case Left:
+						newEvent = LeftHold;
+						break;
+					case Menu:
+						newEvent = MenuHold;
+						break;
+					case Select:
+						newEvent = PlayHold;
+						break;	
+					default:
+						newEvent = event;
+				}
+				
+				if (newEvent == event) // Doesn't have a long press
+				{
+					if (mKeyIsDown)
+					{
+						if (_listener)
+						{
+							// Only send key up events for events that have separateRelease
+							// defined as true in AppleRemoteListener.cpp
+							if (mLastEvent == Up || mLastEvent == Down ||
+								mLastEvent == LeftHold || mLastEvent == RightHold) 
+							{
+								_listener->appleRemoteButton(mLastEvent, /*pressedDown*/false);
+							}
+						}
+					}
+					
+					mKeyIsDown = true;
+					if (_listener)
+					{
+						_listener->appleRemoteButton(newEvent, mKeyIsDown);
+					}
+				}  
+				else if (mEventCount == LONG_PRESS_COUNT)
+				{
+					mKeyIsDown = true;
+					if (_listener)
+					{
+						_listener->appleRemoteButton(newEvent, mKeyIsDown);
+					}
+				}
+			}
+			
+			mLastEvent = event;
+			mCallbackTimer->start();
+        }
     }
 }
+
+// Calls key down / up events on the ATV > v2.3
+void AppleRemote::TimeoutHandler()
+{
+	if (_listener) 
+	{
+		_listener->appleRemoteButton(mLastEvent, !mKeyIsDown);
+	}
+	
+	mKeyIsDown = !mKeyIsDown;
+	
+	if (!mKeyIsDown) 
+	{
+		mEventCount = 0;
+		mLastEvent = Undefined;
+	}
+	else
+	{
+		// Schedule a key up event for events that have separateRelease
+		// defined as true in AppleRemoteListener.cpp
+		
+		if (mLastEvent == Up || mLastEvent == Down ||
+			mLastEvent == LeftHold || mLastEvent == RightHold) 
+		{
+			mCallbackTimer->start();
+		}
+		else 
+		{
+			mKeyIsDown = false;
+			mEventCount = 0;
+			mLastEvent = Undefined;
+		}
+
+	}
+}
diff --git a/mythtv/libs/libmythui/AppleRemote.h b/mythtv/libs/libmythui/AppleRemote.h
index 23b43a3..7a95615 100644
--- a/mythtv/libs/libmythui/AppleRemote.h
+++ b/mythtv/libs/libmythui/AppleRemote.h
@@ -5,6 +5,7 @@
 #include <vector>
 #include <map>
 #include <QThread>
+#include <QTimer>
 
 #include <IOKit/IOKitLib.h>
 #include <IOKit/IOCFPlugIn.h>
@@ -14,6 +15,7 @@
 
 class AppleRemote : public QThread
 {
+	Q_OBJECT
 public:
     enum Event
     { // label/meaning on White ... and Aluminium remote
@@ -28,7 +30,8 @@ public:
         MenuHold,
         PlayHold,  // was PlaySleep
         ControlSwitched,
-        PlayPause      // Play or Pause
+        PlayPause,      // Play or Pause
+		Undefined		// Used to handle the Apple TV > v2.3
     };
 
     class Listener
@@ -65,6 +68,12 @@ private:
     std::map< std::string, Event > cookieToButtonMapping;
     int                    remoteId;
     Listener*              _listener;
+	
+	bool				   usingNewAtv;
+	AppleRemote::Event	   mLastEvent;
+	int					   mEventCount;
+	bool				   mKeyIsDown;
+	QTimer*				   mCallbackTimer;
 
     void        _initCookieMap();
     bool        _initCookies();
@@ -77,6 +86,11 @@ private:
                                        void* refcon, void* sender);
     void        _handleEventWithCookieString(std::string cookieString,
                                              SInt32 sumOfValues);
+	
+private slots:
+	// Key up event handling on the ATV v2.3 and above							 
+	void 		TimeoutHandler();
+	
 };
 
 #endif // APPLEREMOTE
diff --git a/mythtv/libs/libmythui/libmythui.pro b/mythtv/libs/libmythui/libmythui.pro
index a6153e6..5dba56c 100644
--- a/mythtv/libs/libmythui/libmythui.pro
+++ b/mythtv/libs/libmythui/libmythui.pro
@@ -2,7 +2,7 @@ include ( ../../settings.pro )
 
 TEMPLATE = lib
 TARGET = mythui-$$LIBVERSION
-CONFIG += thread dll
+CONFIG += qt thread dll
 target.path = $${LIBDIR}
 INSTALLS = target
 
