Ticket #6422: 0.23.diff

File 0.23.diff, 26.1 KB (added by emlyn.bolton@…, 13 years ago)

Patch for 0.23-fixes. Test build on 10.4, executed on ATVv1 v3.02

  • mythtv/filters/yadif/yadif.pro

    diff --git a/mythtv/filters/yadif/yadif.pro b/mythtv/filters/yadif/yadif.pro
    index ec45a0a..9011d54 100644
    a b contains(ARCH_X86, yes) { 
    1212}
    1313
    1414macx:debug:DEFINES -= MMX
     15
     16macx {
     17        CC            = gcc-4.0
     18        CXX           = g++-4.0
     19}
  • mythtv/libs/libavcodec/libavcodec.pro

    diff --git a/mythtv/libs/libavcodec/libavcodec.pro b/mythtv/libs/libavcodec/libavcodec.pro
    index d91e57a..7e0677a 100644
    a b contains( HAVE_VIS, yes ) { 
    677677
    678678macx {
    679679    QMAKE_LFLAGS_SHLIB += -read_only_relocs warning
     680    contains( HAVE_MMX, yes ) : QMAKE_CFLAGS_RELEASE += -mdynamic-no-pic
    680681}
    681682
    682683# TODO: generate hardcoded tables
  • mythtv/libs/libmythtv/decoderbase.h

    diff --git a/mythtv/libs/libmythtv/decoderbase.h b/mythtv/libs/libmythtv/decoderbase.h
    index 8748e75..325f122 100644
    a b class RingBuffer; 
    1717class TeletextViewer;
    1818class NuppelVideoPlayer;
    1919
    20 const int kDecoderProbeBufferSize = 1024 * 1024;
     20const int kDecoderProbeBufferSize = 65536;
    2121
    2222/// Track types
    2323typedef enum TrackTypes
  • mythtv/libs/libmythui/AppleRemote.cpp

    diff --git a/mythtv/libs/libmythui/AppleRemote.cpp b/mythtv/libs/libmythui/AppleRemote.cpp
    index 3996c18..4311036 100644
    a b  
    66#include <stdlib.h>
    77#include <ctype.h>
    88#include <sys/errno.h>
     9#include <sys/sysctl.h>
    910#include <sysexits.h>
    1011#include <mach/mach.h>
    1112#include <mach/mach_error.h>
     
    1415#include <IOKit/hid/IOHIDLib.h>
    1516#include <IOKit/hid/IOHIDKeys.h>
    1617#include <CoreFoundation/CoreFoundation.h>
     18#include <CoreServices/CoreServices.h>
    1719
    1820#include <sstream>
     21#include <QTimer>
     22
     23
    1924
    2025#include "mythverbose.h"
    2126
    2227AppleRemote*      AppleRemote::_instance = 0;
    23 const char* const AppleRemote::AppleRemoteDeviceName = "AppleIRController";
    2428const int         AppleRemote::REMOTE_SWITCH_COOKIE = 19;
     29// For ATV v2.3 onwards
     30const int         LONG_PRESS_COUNT = 10;
     31const int         KEY_RESPONSE_TIME = 150;  // msecs before we send a key up event
    2532
    2633const QString     LOC = "AppleRemote::";
    2734
     35typedef struct _ATV_IR_EVENT {
     36    UInt32    time_ms32;
     37    UInt32    time_ls32; // units of microsecond
     38    UInt32    unknown1;
     39    UInt32    keycode;
     40    UInt32    unknown2;
     41} ATV_IR_EVENT;
     42
     43static io_object_t _findAppleRemoteDevice(const char *devName);
     44
    2845AppleRemote::Listener::~Listener()
    2946{
    3047}
    AppleRemote * AppleRemote::Get() 
    4057AppleRemote::~AppleRemote()
    4158{
    4259    stopListening();
     60    if (usingNewAtv)
     61        delete mCallbackTimer;
    4362}
    4463
    4564bool AppleRemote::isListeningToRemote()
    void AppleRemote::startListening() 
    5675{
    5776    if (queue != NULL)   // already listening
    5877        return;
    59  
    60     io_object_t hidDevice = _findAppleRemoteDevice();
    6178
    62     if (hidDevice == 0) goto error;
    63     if (!_createDeviceInterface(hidDevice)) goto error;
    64     if (!_initCookies()) goto error;
    65     if (!_openDevice()) goto error;
    66     goto cleanup;
     79    io_object_t hidDevice = _findAppleRemoteDevice("AppleIRController");
    6780
    68   error:
    69     stopListening();
     81    if (!hidDevice)
     82        hidDevice = _findAppleRemoteDevice("AppleTVIRReceiver");
     83
     84    if (!hidDevice ||
     85        !_createDeviceInterface(hidDevice) ||
     86        !_initCookies() || !_openDevice())
     87    {
     88        VERBOSE(VB_IMPORTANT, LOC + "startListening() failed");
     89        stopListening();
     90        return;
     91    }
    7092
    71   cleanup:
    7293    IOObjectRelease(hidDevice);
    7394}
    7495
    AppleRemote::AppleRemote() : openInExclusiveMode(true), 
    105126                             hidDeviceInterface(0),
    106127                             queue(0),
    107128                             remoteId(0),
    108                              _listener(0)
     129                             _listener(0),
     130                             usingNewAtv(false),
     131                             mLastEvent(AppleRemote::Undefined),
     132                             mEventCount(0),
     133                             mKeyIsDown(false)
    109134{
     135    SInt32 macVersion;
     136    size_t len = 512;
     137    char hw_model[512] = "unknown";
     138
     139    // Figure out if we're running on the Apple TV, past version 2.3
     140    Gestalt(gestaltSystemVersion, &macVersion);
     141
     142
     143    if (macVersion < 0x1050) // OSX 10.4 / AppleTV
     144    {
     145        sysctlbyname("hw.model", &hw_model, &len, NULL, 0);
     146
     147        if ( strstr(hw_model,"AppleTV1,1") )
     148        {
     149            FILE* inpipe;
     150
     151            //Find the build version of the AppleTV OS
     152            inpipe = popen("sw_vers -buildVersion", "r");
     153            char linebuf[1000];
     154            if (inpipe)
     155            {
     156                if ( fgets(linebuf, sizeof(linebuf) - 1, inpipe) )
     157                {
     158                    if ( !( strstr(linebuf,"8N5107") || // v1.0
     159                            strstr(linebuf,"8N5239") || // v1.1
     160                            strstr(linebuf,"8N5400") || // v2.0
     161                            strstr(linebuf,"8N5455") || // v2.01
     162                            strstr(linebuf,"8N5461") || // v2.02
     163                            strstr(linebuf,"8N5519") || // v2.1
     164                            strstr(linebuf,"8N5622") )) // v2.2
     165                    {
     166                        VERBOSE(VB_IMPORTANT, LOC + "::AppleRemote detected Apple TV > v2.3");
     167                        usingNewAtv = true;
     168                        mCallbackTimer = new QTimer(this);
     169                        connect(mCallbackTimer, SIGNAL(timeout()), this, SLOT(TimeoutHandler()));
     170                        mCallbackTimer->setSingleShot(true);
     171                        mCallbackTimer->setInterval(KEY_RESPONSE_TIME);
     172                    }
     173                }
     174            }
     175            pclose(inpipe);
     176        }
     177    }
    110178    _initCookieMap();
    111179}
    112180
    113 // private
     181/// Apple keeps changing the "interface" between the remote and the OS.
     182/// This initialises a table that stores those mappings.
     183///
     184/// The white plastic remote has a Play+Pause button in the middle of the
     185/// navigation ring, but for menu navigation, we send an "enter" event instead.
     186/// Ideally we would remap that for TV/videos, but MythTV can't easily do that.
     187///
     188/// The new Aluminium remote has separate Select and Play+Pause buttons.
     189///
    114190void AppleRemote::_initCookieMap()
    115191{
    116     // 10.4 sequences:
    117     cookieToButtonMapping["14_12_11_6_5_"]        = VolumePlus;
    118     cookieToButtonMapping["14_13_11_6_5_"]        = VolumeMinus;
    119     cookieToButtonMapping["14_7_6_5_14_7_6_5_"]   = Menu;
    120     cookieToButtonMapping["14_8_6_5_14_8_6_5_"]   = Play;
    121     cookieToButtonMapping["14_9_6_5_14_9_6_5_"]   = Right;
    122     cookieToButtonMapping["14_10_6_5_14_10_6_5_"] = Left;
    123     cookieToButtonMapping["14_6_5_4_2_"]          = RightHold;
    124     cookieToButtonMapping["14_6_5_3_2_"]          = LeftHold;
    125     cookieToButtonMapping["14_6_5_14_6_5_"]       = MenuHold;
    126     cookieToButtonMapping["18_14_6_5_18_14_6_5_"] = PlaySleep;
    127     cookieToButtonMapping["19_"]                  = ControlSwitched;
    128 
    129     // 10.5 sequences:
    130     cookieToButtonMapping["31_29_28_18_"]         = VolumePlus;
    131     cookieToButtonMapping["31_30_28_18_"]         = VolumeMinus;
    132     cookieToButtonMapping["31_20_18_31_20_18_"]   = Menu;
    133     cookieToButtonMapping["31_21_18_31_21_18_"]   = Play;
    134     cookieToButtonMapping["31_22_18_31_22_18_"]   = Right;
    135     cookieToButtonMapping["31_23_18_31_23_18_"]   = Left;
    136     cookieToButtonMapping["31_18_4_2_"]           = RightHold;
    137     cookieToButtonMapping["31_18_3_2_"]           = LeftHold;
    138     cookieToButtonMapping["31_18_31_18_"]         = MenuHold;
    139     cookieToButtonMapping["35_31_18_35_31_18_"]   = PlaySleep;
    140     cookieToButtonMapping["39_"]                  = ControlSwitched;
     192    if (!usingNewAtv)
     193    {
     194        // 10.4 sequences:
     195        cookieToButtonMapping["14_12_11_6_5_"]        = Up;
     196        cookieToButtonMapping["14_13_11_6_5_"]        = Down;
     197        cookieToButtonMapping["14_7_6_5_14_7_6_5_"]   = Menu;
     198        cookieToButtonMapping["14_8_6_5_14_8_6_5_"]   = Select;
     199        cookieToButtonMapping["14_9_6_5_14_9_6_5_"]   = Right;
     200        cookieToButtonMapping["14_10_6_5_14_10_6_5_"] = Left;
     201        cookieToButtonMapping["14_6_5_4_2_"]          = RightHold;
     202        cookieToButtonMapping["14_6_5_3_2_"]          = LeftHold;
     203        cookieToButtonMapping["14_6_5_14_6_5_"]       = MenuHold;
     204        cookieToButtonMapping["18_14_6_5_18_14_6_5_"] = PlayHold;
     205        cookieToButtonMapping["19_"]                  = ControlSwitched;
     206
     207        // 10.5 sequences:
     208        cookieToButtonMapping["31_29_28_18_"]         = Up;
     209        cookieToButtonMapping["31_30_28_18_"]         = Down;
     210        cookieToButtonMapping["31_20_18_31_20_18_"]   = Menu;
     211        cookieToButtonMapping["31_21_18_31_21_18_"]   = Select;
     212        cookieToButtonMapping["31_22_18_31_22_18_"]   = Right;
     213        cookieToButtonMapping["31_23_18_31_23_18_"]   = Left;
     214        cookieToButtonMapping["31_18_4_2_"]           = RightHold;
     215        cookieToButtonMapping["31_18_3_2_"]           = LeftHold;
     216        cookieToButtonMapping["31_18_31_18_"]         = MenuHold;
     217        cookieToButtonMapping["35_31_18_35_31_18_"]   = PlayHold;
     218        cookieToButtonMapping["39_"]                  = ControlSwitched;
     219
     220        // ATV 1.0, 2.0-2.02
     221        cookieToButtonMapping["14_12_11_6_"]          = Up;
     222        cookieToButtonMapping["14_13_11_6_"]          = Down;
     223        cookieToButtonMapping["14_7_6_14_7_6_"]       = Menu;
     224        cookieToButtonMapping["14_8_6_14_8_6_"]       = Select;
     225        cookieToButtonMapping["14_9_6_14_9_6_"]       = Right;
     226        cookieToButtonMapping["14_10_6_14_10_6_"]     = Left;
     227        cookieToButtonMapping["14_6_4_2_"]            = RightHold;
     228        cookieToButtonMapping["14_6_3_2_"]            = LeftHold;
     229        cookieToButtonMapping["14_6_14_6_"]           = MenuHold;
     230        cookieToButtonMapping["18_14_6_18_14_6_"]     = PlayHold;
     231
     232        // ATV 1.0, 2.1-2.2
     233        cookieToButtonMapping["15_13_12_"]            = Up;
     234        cookieToButtonMapping["15_14_12_"]            = Down;
     235        cookieToButtonMapping["15_8_15_8_"]           = Menu;
     236        cookieToButtonMapping["15_9_15_9_"]           = Select;
     237        cookieToButtonMapping["15_10_15_10_"]         = Right;
     238        cookieToButtonMapping["15_11_15_11_"]         = Left;
     239        cookieToButtonMapping["15_5_3_"]              = RightHold;
     240        cookieToButtonMapping["15_4_3_"]              = LeftHold;
     241        cookieToButtonMapping["15_6_15_6_"]           = MenuHold;
     242        cookieToButtonMapping["19_15_19_15_"]         = PlayHold;
     243
     244        // 10.6 sequences:
     245        cookieToButtonMapping["33_31_30_21_20_2_"]            = Up;
     246        cookieToButtonMapping["33_32_30_21_20_2_"]            = Down;
     247        cookieToButtonMapping["33_22_21_20_2_33_22_21_20_2_"] = Menu;
     248        cookieToButtonMapping["33_23_21_20_2_33_23_21_20_2_"] = Select;
     249        cookieToButtonMapping["33_24_21_20_2_33_24_21_20_2_"] = Right;
     250        cookieToButtonMapping["33_25_21_20_2_33_25_21_20_2_"] = Left;
     251        cookieToButtonMapping["33_21_20_14_12_2_"]            = RightHold;
     252        cookieToButtonMapping["33_21_20_13_12_2_"]            = LeftHold;
     253        cookieToButtonMapping["33_21_20_2_33_21_20_2_"]       = MenuHold;
     254        cookieToButtonMapping["37_33_21_20_2_37_33_21_20_2_"] = PlayHold;
     255
     256        // Aluminium remote which has an extra button:
     257        cookieToButtonMapping["33_21_20_8_2_33_21_20_8_2_"]   = PlayPause;
     258        cookieToButtonMapping["33_21_20_3_2_33_21_20_3_2_"]   = Select;
     259        cookieToButtonMapping["33_21_20_11_2_33_21_20_11_2_"] = PlayHold;
     260    }
     261    else
     262    {
     263        // ATV 2.30
     264        cookieToButtonMapping["17_9_280_80"]                   = Up;
     265        cookieToButtonMapping["17_9_280_48"]                   = Down;
     266        cookieToButtonMapping["17_9_280_64"]                   = Menu;
     267        cookieToButtonMapping["17_9_280_32"]                   = Select;
     268        cookieToButtonMapping["17_9_280_96"]                   = Right;
     269        cookieToButtonMapping["17_9_280_16"]                   = Left;
     270    }
    141271}
    142272
    143 // private
    144 io_object_t AppleRemote::_findAppleRemoteDevice()
     273static io_object_t _findAppleRemoteDevice(const char *devName)
    145274{
    146275    CFMutableDictionaryRef hidMatchDictionary = 0;
    147276    io_iterator_t          hidObjectIterator = 0;
    io_object_t AppleRemote::_findAppleRemoteDevice() 
    149278    IOReturn               ioReturnValue;
    150279
    151280
    152     hidMatchDictionary = IOServiceMatching(AppleRemoteDeviceName);
     281    hidMatchDictionary = IOServiceMatching(devName);
    153282
    154283    // check for matching devices
    155     ioReturnValue = IOServiceGetMatchingServices(kIOMasterPortDefault, 
    156                                                  hidMatchDictionary, 
     284    ioReturnValue = IOServiceGetMatchingServices(kIOMasterPortDefault,
     285                                                 hidMatchDictionary,
    157286                                                 &hidObjectIterator);
    158287
    159288    if ((ioReturnValue == kIOReturnSuccess) && (hidObjectIterator != 0))
    160289        hidDevice = IOIteratorNext(hidObjectIterator);
     290    else
     291        VERBOSE(VB_IMPORTANT, (LOC + "_findAppleRemoteDevice(%1) failed")
     292                              .arg(devName));
    161293
    162294    // IOServiceGetMatchingServices consumes a reference to the dictionary,
    163295    // so we don't need to release the dictionary ref.
    bool AppleRemote::_openDevice() 
    265397    if (result != S_OK || !queue)
    266398        VERBOSE(VB_IMPORTANT, LOC + "_openDevice() - error creating queue");
    267399
    268     for (std::vector<int>::iterator iter = cookies.begin(); 
     400    for (std::vector<int>::iterator iter = cookies.begin();
    269401         iter != cookies.end();
    270402         ++iter)
    271403    {
    bool AppleRemote::_openDevice() 
    296428    return true;
    297429}
    298430
    299 void AppleRemote::QueueCallbackFunction(void* target, IOReturn result, 
     431void AppleRemote::QueueCallbackFunction(void* target, IOReturn result,
    300432                                   void* refcon, void* sender)
    301433{
    302434    AppleRemote* remote = static_cast<AppleRemote*>(target);
    void AppleRemote::_queueCallbackFunction(IOReturn result, 
    311443    SInt32            sumOfValues = 0;
    312444    std::stringstream cookieString;
    313445
    314     while (result == kIOReturnSuccess)
     446    if (!usingNewAtv)
    315447    {
    316         IOHIDEventStruct event;
     448        while (result == kIOReturnSuccess)
     449        {
     450            IOHIDEventStruct event;
     451
     452            result = (*queue)->getNextEvent(queue, &event, zeroTime, 0);
     453            if (result != kIOReturnSuccess)
     454                break;
     455
     456            if (REMOTE_SWITCH_COOKIE == (int)event.elementCookie)
     457            {
     458                remoteId=event.value;
     459                _handleEventWithCookieString("19_",0);
     460            }
     461            else
     462            {
     463                sumOfValues+=event.value;
     464                cookieString << std::dec << (int)event.elementCookie << "_";
     465            }
     466        }
     467        _handleEventWithCookieString(cookieString.str(), sumOfValues);
     468    }
     469    else // AppleTV from v2.3 onwards
     470    {
     471        if (mCallbackTimer->isActive())
     472        {
     473            mCallbackTimer->stop();
     474        }
    317475
    318         result = (*queue)->getNextEvent(queue, &event, zeroTime, 0);
    319         if (result != kIOReturnSuccess)
    320             break;
     476        IOHIDEventStruct event;
     477        UInt32 key_code = 0;
    321478
    322         if (REMOTE_SWITCH_COOKIE == (int)event.elementCookie)
     479        while (result == kIOReturnSuccess)
    323480        {
    324             remoteId=event.value;
    325             _handleEventWithCookieString("19_",0);
     481            result = (*queue)->getNextEvent(queue, &event, zeroTime, 0);
     482            if (result != kIOReturnSuccess) {
     483                continue;
     484            }
     485
     486            if ( ((int)event.elementCookie == 280) && (event.longValueSize == 20)) {
     487                ATV_IR_EVENT* atv_ir_event = (ATV_IR_EVENT*)event.longValue;
     488                key_code = atv_ir_event->keycode;
     489            }
     490
     491            if (((int)event.elementCookie) != 5 ) {
     492                sumOfValues += event.value;
     493                cookieString << std::dec << (int)event.elementCookie << "_";
     494            }
    326495        }
    327         else
    328         {
    329             sumOfValues+=event.value;
    330             cookieString << std::dec << (int)event.elementCookie << "_";
     496        char endCode[10] = "17_9_280_";
     497        if (strcmp(cookieString.str().c_str(), endCode) == 0) {
     498
     499            cookieString << std::dec << (int) ( (key_code & 0x00007F00) >> 8);
     500
     501            sumOfValues = 1;
     502            _handleEventWithCookieString(cookieString.str(), sumOfValues);
    331503        }
    332504    }
    333 
    334     _handleEventWithCookieString(cookieString.str(), sumOfValues);
    335505}
    336506
    337 void AppleRemote::_handleEventWithCookieString(std::string cookieString, 
    338                                           SInt32 sumOfValues)
     507void AppleRemote::_handleEventWithCookieString(std::string cookieString,
     508                                                SInt32 sumOfValues)
    339509{
    340510    std::map<std::string,AppleRemote::Event>::iterator ii;
    341511
    342512    ii = cookieToButtonMapping.find(cookieString);
    343     if (ii != cookieToButtonMapping.end() && _listener)
     513
     514
     515    if (ii != cookieToButtonMapping.end() )
     516    {
     517        AppleRemote::Event event = ii->second;
     518
     519        if (!usingNewAtv) {
     520            if (_listener)
     521            {
     522                _listener->appleRemoteButton(event, sumOfValues>0);
     523            }
     524        }
     525        else
     526        {
     527            // With the ATV from 2.3 onwards, we just get IR events. We need to simulate the
     528            // key up and hold events
     529
     530            if (mLastEvent == Undefined)    // new event
     531            {
     532                mEventCount = 1;
     533                // Need to figure out if this is a long press or a short press,
     534                // so can't just send a key down event right now. It will be
     535                // scheduled to run
     536            }
     537            else if (event != mLastEvent)   // a new event, faster than timer
     538            {
     539                mEventCount = 1;
     540                mKeyIsDown = true;
     541
     542                if (_listener)
     543                {
     544                    // Only send key up events for events that have separateRelease
     545                    // defined as true in AppleRemoteListener.cpp
     546                    if (mLastEvent == Up || mLastEvent == Down ||
     547                        mLastEvent == LeftHold || mLastEvent == RightHold)
     548                    {
     549                        _listener->appleRemoteButton(mLastEvent, /*pressedDown*/false);
     550                    }
     551                    _listener->appleRemoteButton(event, mKeyIsDown);
     552                }
     553            }
     554            else // Same event again
     555            {
     556                mEventCount+=1;
     557                AppleRemote::Event newEvent = Undefined;
     558
     559                // Can the event have a hold state?
     560                switch (event)
     561                {
     562                    case Right:
     563                        newEvent = RightHold;
     564                        break;
     565                    case Left:
     566                        newEvent = LeftHold;
     567                        break;
     568                    case Menu:
     569                        newEvent = MenuHold;
     570                        break;
     571                    case Select:
     572                        newEvent = PlayHold;
     573                        break;
     574                    default:
     575                        newEvent = event;
     576                }
     577
     578                if (newEvent == event) // Doesn't have a long press
     579                {
     580                    if (mKeyIsDown)
     581                    {
     582                        if (_listener)
     583                        {
     584                            // Only send key up events for events that have separateRelease
     585                            // defined as true in AppleRemoteListener.cpp
     586                            if (mLastEvent == Up || mLastEvent == Down ||
     587                                mLastEvent == LeftHold || mLastEvent == RightHold)
     588                            {
     589                                _listener->appleRemoteButton(mLastEvent, /*pressedDown*/false);
     590                            }
     591                        }
     592                    }
     593
     594                    mKeyIsDown = true;
     595                    if (_listener)
     596                    {
     597                        _listener->appleRemoteButton(newEvent, mKeyIsDown);
     598                    }
     599                }
     600                else if (mEventCount == LONG_PRESS_COUNT)
     601                {
     602                    mKeyIsDown = true;
     603                    if (_listener)
     604                    {
     605                        _listener->appleRemoteButton(newEvent, mKeyIsDown);
     606                    }
     607                }
     608            }
     609
     610            mLastEvent = event;
     611            mCallbackTimer->start();
     612        }
     613    }
     614}
     615
     616// Calls key down / up events on the ATV > v2.3
     617void AppleRemote::TimeoutHandler()
     618{
     619    if (_listener)
     620    {
     621        _listener->appleRemoteButton(mLastEvent, !mKeyIsDown);
     622    }
     623
     624    mKeyIsDown = !mKeyIsDown;
     625
     626    if (!mKeyIsDown)
     627    {
     628        mEventCount = 0;
     629        mLastEvent = Undefined;
     630    }
     631    else
    344632    {
    345         AppleRemote::Event buttonid = ii->second;
    346         if (_listener)
    347             _listener->appleRemoteButton(buttonid, sumOfValues>0);
     633        // Schedule a key up event for events that have separateRelease
     634        // defined as true in AppleRemoteListener.cpp
     635
     636        if (mLastEvent == Up || mLastEvent == Down ||
     637            mLastEvent == LeftHold || mLastEvent == RightHold)
     638        {
     639            mCallbackTimer->start();
     640        }
     641        else
     642        {
     643            mKeyIsDown = false;
     644            mEventCount = 0;
     645            mLastEvent = Undefined;
     646        }
     647
    348648    }
    349649}
  • mythtv/libs/libmythui/AppleRemote.h

    diff --git a/mythtv/libs/libmythui/AppleRemote.h b/mythtv/libs/libmythui/AppleRemote.h
    index 596abfc..419e5e5 100644
    a b  
    55#include <vector>
    66#include <map>
    77#include <QThread>
     8#include <QTimer>
    89
    910#include <IOKit/IOKitLib.h>
    1011#include <IOKit/IOCFPlugIn.h>
     
    1415
    1516class AppleRemote : public QThread
    1617{
     18    Q_OBJECT
    1719public:
    18     enum Event {
    19         VolumePlus = 0,
    20         VolumeMinus,
     20    enum Event
     21    { // label/meaning on White ... and Aluminium remote
     22        Up = 0,        // VolumePlus    Up
     23        Down,          // VolumeMinus   Down
    2124        Menu,
    22         Play,
     25        Select,        // Play          Select
    2326        Right,
    2427        Left,
    2528        RightHold,
    2629        LeftHold,
    2730        MenuHold,
    28         PlaySleep,
    29         ControlSwitched
     31        PlayHold,  // was PlaySleep
     32        ControlSwitched,
     33        PlayPause,      // Play or Pause
     34        Undefined       // Used to handle the Apple TV > v2.3
    3035    };
    3136
    32     class Listener {
     37    class Listener
     38    {
    3339    public:
    3440        virtual      ~Listener();
    3541        virtual void appleRemoteButton(Event button, bool pressedDown) = 0;
    protected: 
    5157    AppleRemote(); // will be a singleton class
    5258
    5359    static AppleRemote*      _instance;
    54     static const char* const AppleRemoteDeviceName;
    5560    static const int         REMOTE_SWITCH_COOKIE;
    5661
    5762
    private: 
    6469    int                    remoteId;
    6570    Listener*              _listener;
    6671
     72    bool                   usingNewAtv;
     73    AppleRemote::Event     mLastEvent;
     74    int                    mEventCount;
     75    bool                   mKeyIsDown;
     76    QTimer*                mCallbackTimer;
     77
    6778    void        _initCookieMap();
    68     io_object_t _findAppleRemoteDevice();
    6979    bool        _initCookies();
    7080    bool        _createDeviceInterface(io_object_t hidDevice);
    7181    bool        _openDevice();
    7282
    73     static void QueueCallbackFunction(void* target, IOReturn result, 
     83    static void QueueCallbackFunction(void* target, IOReturn result,
    7484                                      void* refcon, void* sender);
    7585    void        _queueCallbackFunction(IOReturn result,
    7686                                       void* refcon, void* sender);
    7787    void        _handleEventWithCookieString(std::string cookieString,
    7888                                             SInt32 sumOfValues);
     89
     90private slots:
     91    // Key event handling on the ATV v2.3 and above
     92    void        TimeoutHandler();
     93
    7994};
    8095
    8196#endif // APPLEREMOTE
  • mythtv/libs/libmythui/AppleRemoteListener.cpp

    diff --git a/mythtv/libs/libmythui/AppleRemoteListener.cpp b/mythtv/libs/libmythui/AppleRemoteListener.cpp
    index d8543e8..e5406ab 100644
    a b void AppleRemoteListener::appleRemoteButton(AppleRemote::Event button, 
    1818
    1919    switch (button)
    2020    {
    21         case AppleRemote::VolumePlus:
     21        case AppleRemote::Up:
    2222            code="Up";
    2323            separateRelease=true;
    2424            break;
    25         case AppleRemote::VolumeMinus:
     25        case AppleRemote::Down:
    2626            code="Down";
    2727            separateRelease=true;
    2828            break;
    2929        case AppleRemote::Menu:
    3030            code="Esc";
    3131            break;
    32         case AppleRemote::Play:
     32        case AppleRemote::Select:
    3333            code="Enter";
    3434            break;
    3535        case AppleRemote::Right:
    void AppleRemoteListener::appleRemoteButton(AppleRemote::Event button, 
    4949        case AppleRemote::MenuHold:
    5050            code="M";
    5151            break;
    52         case AppleRemote::PlaySleep:
     52        case AppleRemote::PlayPause:
     53        case AppleRemote::PlayHold:
    5354            code="P";
    5455            break;
    5556        case AppleRemote::ControlSwitched:
    void AppleRemoteListener::appleRemoteButton(AppleRemote::Event button, 
    6970            QCoreApplication::postEvent(mainWindow, new LircKeycodeEvent(
    7071                QEvent::KeyRelease, keycode, Qt::NoModifier, code, code));
    7172    }
    72  
     73
    7374}
  • mythtv/libs/libmythui/libmythui.pro

    diff --git a/mythtv/libs/libmythui/libmythui.pro b/mythtv/libs/libmythui/libmythui.pro
    index ee76855..363a941 100644
    a b include ( ../../settings.pro ) 
    22
    33TEMPLATE = lib
    44TARGET = mythui-$$LIBVERSION
    5 CONFIG += thread dll
     5CONFIG += qt thread dll
    66target.path = $${LIBDIR}
    77INSTALLS = target
    88
  • mythtv/libs/libswscale/libswscale.pro

    diff --git a/mythtv/libs/libswscale/libswscale.pro b/mythtv/libs/libswscale/libswscale.pro
    index 9c86ee3..0cf5076 100644
    a b contains( HAVE_ALTIVEC, yes ) { 
    7070
    7171macx {
    7272    QMAKE_LFLAGS_SHLIB += -read_only_relocs warning
     73    contains( HAVE_MMX, yes ) : QMAKE_CFLAGS_RELEASE += -mdynamic-no-pic
    7374}
    7475
    7576include ( ../libs-targetfix.pro )