Changeset e090e9969c in mythtv


Ignore:
Timestamp:
Oct 26, 2011, 8:07:17 AM (13 years ago)
Author:
Mark Kendall <mkendall@…>
Branches:
devel/2020-player, devel/ffmpeg-resync, devel/gpu-commflag, fixes/0.25, fixes/0.26, fixes/0.27, fixes/0.28, fixes/29, fixes/30, fixes/31, github-templates, master
Children:
98642603cb
Parents:
145b2097a5
Message:

Add libCEC support.

This adds initial support for CEC HDMI devices which allow bidirectional
communication and control between CEC capable devices.

There is a lot going on here, so I'll add a wiki page at some point.

  • will turn the display device on and switch to MythTV's HDMI input when

MythTV is started (configurable).

  • the HDMI input is identified as 'MythTV'.
  • will turn the display off when exiting (configurable).
  • 'advanced' selection of HDMI port (physical address), CEC logical

address and libCEC device (all default to 'auto').

  • there is no settings UI. I will wait and see if we get new, libmythui

settings pages before 0.25 (otherwise I'll add some old style settings
pages).

  • added 2 new actions for powering the display on and off.
  • incoming keypresses from the display's remote control are mapped to

standard keypresses. Certain functions are unmpapped (no obvious meaning
in a MythTV context) and others have slightly unusual mappings to ensure
each button has a unique keypress (and hence maximise the potential for
customisation - but does limit 'out of the box' functionality). There is
still some limited overlap (e.g. M) but most map to conventional,
default MythTV bindings. Use the Key Editor to tweak.

  • no CEC commands (e.g. display telling MythTV to power off) are

currently handled - either because there is no obvious way to handle
them (menu language, power off) or I haven't seen them.

There is a lot of potential for additional functionality, both within
MythTV and libCEC itself, so this will no doubt be a moving feast for a
while. The usefulness of CEC will largely depend on how much individual
manufacturers have 'tailored' their CEC implementations. For me, with a
Toshiba display (Regza-Link = CEC), Playstation3 and VESA mounted Ion
box, everything is pretty seemless and largely 'just works'.

N.B. The keymapping code may change depending on other changes in
libmythui (and I may yet tweak the default keybindings).

Location:
mythtv
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • mythtv/configure

    r145b2097a5 re090e9969c  
    106106  --disable-lirc           disable lirc support (Infrared Remotes)
    107107  --disable-joystick-menu  disable joystick menu
     108  --disable-libcec         disable libCEC device support
     109  --libcec-path=HDRLOC     location of directory containing
     110                           cec.h [$libcec_path_default]
    108111  --disable-firewire       disable support for FireWire cable boxes
    109112  --disable-iptv           disable support for recording RTSP/UDP/RTP streams
     
    13471350    asi
    13481351    joystick_menu
     1352    libcec
    13491353    libfftw3
    13501354    libmpeg2external
     
    14291433    dvb_path
    14301434    incdir
     1435    libcec_path
    14311436    libdir
    14321437    mandir
     
    19871992enable lamemp3
    19881993enable libass
     1994enable libcec
    19891995enable libxml2
    19901996enable libudf
     
    20072013dvb_path_default="${sysroot}/usr/include"
    20082014x11_path_default="${sysroot}/usr/X11R6/include"
     2015libcec_path_default="${sysroot}/usr/include/libcec"
    20092016libxml2_path_default="${sysroot}/usr/include/libxml2"
    20102017
     
    41064113enabled libass && check_lib2 ass/ass.h ass_flush_events -lass || disable libass
    41074114
     4115enabled libcec && check_cxx -I"$libcec_path" <<EOF || { echolog "libCEC support needs libcec >= 7" && disable libcec; }
     4116#include <libcec/cec.h>
     4117#include <iostream>
     4118using namespace std;
     4119using namespace CEC;
     4120#include <libcec/cecloader.h>
     4121int main(void) {
     4122    if (CEC_LIB_VERSION < 7)
     4123        return 0;
     4124    return (long) LoadLibCec;
     4125}
     4126EOF
     4127
    41084128if enabled libxml2 ; then
    41094129   if pkg-config --exists libxml-2.0 ; then
     
    44384458  echo "Joystick menu             ${joystick_menu-no}"
    44394459  echo "lirc support              ${lirc-no}"
     4460  echo "libCEC device support     ${libcec-no} [$libcec_path]"
    44404461  if test x"$target_os" = x"darwin" ; then
    44414462    echo "Apple Remote              ${appleremote-no}"
     
    48314852fi
    48324853
     4854if enabled libcec; then
     4855  append CONFIG_DEFINES "using_libcec"
     4856  append CONFIG_INCLUDEPATH "$libcec_path"
     4857fi
     4858
    48334859if enabled libxml2; then
    48344860  if [ -d $libxml2_path ] ; then
  • mythtv/libs/libmythui/libmythui.pro

    r145b2097a5 re090e9969c  
    117117}
    118118
     119using_libcec {
     120    DEFINES += USING_LIBCEC
     121    HEADERS += cecadapter.h
     122    SOURCES += cecadapter.cpp
     123}
     124
    119125using_xrandr {
    120126    DEFINES += USING_XRANDR
  • mythtv/libs/libmythui/mythmainwindow.cpp

    r145b2097a5 re090e9969c  
    6363#endif
    6464
     65#ifdef USING_LIBCEC
     66#include "cecadapter.h"
     67#endif
     68
    6569#include "mythscreentype.h"
    6670#include "mythpainter.h"
     
    135139        appleRemote(NULL),
    136140#endif
     141
     142#ifdef USING_LIBCEC
     143        cecAdapter(NULL),
     144#endif
     145
    137146        exitingtomain(false),
    138147        popwindows(false),
     
    201210    AppleRemoteListener *appleRemoteListener;
    202211    AppleRemote         *appleRemote;
     212#endif
     213
     214#ifdef USING_LIBCEC
     215    CECAdapter* cecAdapter;
    203216#endif
    204217
     
    445458#endif
    446459
     460#ifdef USING_LIBCEC
     461    d->cecAdapter = new CECAdapter();
     462    if (!d->cecAdapter->IsValid())
     463    {
     464        delete d->cecAdapter;
     465        d->cecAdapter = NULL;
     466    }
     467#endif
     468
    447469    d->m_udpListener = new MythUDPListener();
    448470
     
    523545
    524546    delete d->appleRemoteListener;
     547#endif
     548
     549#ifdef USING_LIBCEC
     550    if (d->cecAdapter)
     551        delete d->cecAdapter;
    525552#endif
    526553
     
    11031130    RegisterKey("Global", ACTION_9, QT_TRANSLATE_NOOP("MythControls","9"), "9");
    11041131
     1132    RegisterKey("Global", ACTION_TVPOWERON,  QT_TRANSLATE_NOOP("MythControls",
     1133        "Turn the display on"),   "");
     1134    RegisterKey("Global", ACTION_TVPOWEROFF, QT_TRANSLATE_NOOP("MythControls",
     1135        "Turn the display off"),  "");
     1136
    11051137    RegisterKey("Global", "SYSEVENT01", QT_TRANSLATE_NOOP("MythControls",
    11061138        "Trigger System Key Event #1"), "");
     
    18231855
    18241856    return false;
     1857}
     1858
     1859void MythMainWindow::HandleTVPower(bool poweron)
     1860{
     1861    if (poweron)
     1862    {
     1863#ifdef USING_LIBCEC
     1864        if (d->cecAdapter)
     1865            d->cecAdapter->Action(ACTION_TVPOWERON);
     1866#endif
     1867    }
     1868    else
     1869    {
     1870#ifdef USING_LIBCEC
     1871        if (d->cecAdapter)
     1872            d->cecAdapter->Action(ACTION_TVPOWEROFF);
     1873#endif
     1874    }
    18251875}
    18261876
  • mythtv/libs/libmythui/mythmainwindow.h

    r145b2097a5 re090e9969c  
    7777                     int season=0, int episode=0, const QString& inetref="",
    7878                     int lenMins=120, const QString& year="1895");
     79    void HandleTVPower(bool poweron);
    7980
    8081    void JumpTo(const QString &destination, bool pop = true);
  • mythtv/libs/libmythui/mythscreentype.cpp

    r145b2097a5 re090e9969c  
    472472            gCoreContext->SendSystemEvent(QString("KEY_%1").arg(action.mid(8)));
    473473        else if (action == ACTION_SCREENSHOT)
    474         {
    475474            GetMythMainWindow()->ScreenShot();
    476         }
     475        else if (action == ACTION_TVPOWERON)
     476            GetMythMainWindow()->HandleTVPower(true);
     477        else if (action == ACTION_TVPOWEROFF)
     478            GetMythMainWindow()->HandleTVPower(false);
    477479        else
    478480            handled = false;
  • mythtv/libs/libmythui/mythuiactions.h

    r145b2097a5 re090e9969c  
    2222#define ACTION_SCREENSHOT  "SCREENSHOT"
    2323
     24#define ACTION_TVPOWEROFF  "TVPOWEROFF"
     25#define ACTION_TVPOWERON   "TVPOWERON"
     26
    2427#endif // MYTHUI_ACTIONS_H
Note: See TracChangeset for help on using the changeset viewer.