cec: control volume settings on a CEC capable amp (when one is found) + fix when XBMC is connected to something else than a TV #570

merged 21 commits into from Mar 27, 2012
Team Kodi member

This PR adds the following:

  • check whether a CEC capable amp is avaiable on the bus. when one is found, the PCM volume is set to 100%, and all volume related changes (vol up, down, mute) are sent to the amp.
  • added some settings for the adapter, to configure it's behaviour. since the CEC adapter does not support physical address detection (yet), we need to know to which device and on which HDMI port XBMC is connected, so we can determine the correct address. if the wrong physical address is used, CEC capable devices will use the wrong device as active source. so people who have an amp and have XBMC connected to that amp (which is a standard setup), will not get any sound out of their amp without this change (or without pressing a button on the amp's remote ofc)
  • added settings to configure whether or not you want to send the TV (or other devices) to standby when shutting down, and what devices to wake up when starting
  • no longer puts the TV in standby when rebooting
  • added an optional order to peripheral settings, so they no longer have a semi-random order
  • some more fixes/changes. details can be found in the commit messages
Team Kodi member

rebased, cleaned up and changed so callback methods are used instead of polling.

Team Kodi member

d780a41 was requested by @pike2k

Team Kodi member

cherry-picked cb062e4 into master (trac 12570) and rebased



Please forgive me, if it's wrong place to ask (it's my first post here), but maybe the reason why this request waits over 3 months is caused due nobody can compile this with success? From few hours I'm trying to merge your commits to FernetMenta's xbmc-xvba and still I got same error:

Peripherals.cpp: In member function ‘PERIPHERALS::CPeripheral* PERIPHERALS::CPeripherals::CreatePeripheral(PERIPHERALS::CPeripheralBus&, PERIPHERALS::PeripheralType, const CStdString&, int, int)’:
Peripherals.cpp:272:22: error: expected type-specifier before ‘CPeripheralCecAdapter’
Peripherals.cpp:272:22: error: cannot convert ‘int’ to ‘PERIPHERALS::CPeripheral’ in assignment
Peripherals.cpp:272:22: error: expected ‘;’ before ‘CPeripheralCecAdapter’
make[1]: *** [Peripherals.o] Error 1
make: *** [xbmc/peripherals/peripherals.a] Error 2

Some infos:
gcc: v4.6.1 (tried v4.4 but same errors)
sys: ubuntu oneiric minimal, Linux stolarnia 3.0.0-16-generic #28-Ubuntu SMP Fri Jan 27 17:44:39 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
libcec: 1.5.0 from repo (also tried with compiled from git - still errors)
xbmc: latest version from https://github.com/FernetMenta/xbmc.git, branch xvba

I'm really interested those commits due I've Yamaha AV and cannot use remote controller because xbmc-xvba supports only libcec 1.2 which is obsolete and doesn't work well with AVs between TV and XBMC PC (problem with assigning physical address, in my case 0x1400 - from cec-client commands p 0 1 and p 1 4 do the job but xbmc overrides changes).

Hope it will be helpful and you have some tips how to do that - you're last hope ;)

Cheers from Poland,

Team Kodi member

siarkopol, goto http://packages.pulse-eight.net/ to download builds with it already built in, this is not in due to a feature freeze for Eden, it will go in after as part of the Frodo build

Team Kodi member

no, the reason why this PR hasn't been merged is that we're currently feature frozen, until Eden is out.

this compiles just fine, and has compiled just fine as long as it's been here (although it needs another rebase right now).

as soon as Eden is out, we can merge this in.

I'm running this myself on one machine with the xvba patches rebased onto the latest pvr master, and this on top of it, and it works fine here.

are you sure you have the libcec headers installed on your system?

weird, github didn't show malard's reponse when I posted mine.


Thank you guys for fast answer, I was really in hopeless state, but I see this issue can be solved. So, the facts are:

@malard: I already tried builds from pulse8 repo (I bought 2 adapters from pulse8 already) but I had some problems with hardware acceleration through xvba (fusion board, asrock e350m1), all CEC related stuff works fine but without HW ACC for 1080p (I've also TBS6922 SAT-TV card). I even compiled xbmc from pulse8 repo, but still no HW ACC for 1080p (720p takes ~50% of CPU, enable vaapi causes xbmc to crash). So I switched back to Fernet's branch (tried also wsnipex's builds from launchpad). ATM I got working 1080p HW ACC but with libcec v1.2 which drives me crazy ;) So, this is the reason why I want to recompile it to get working libcec v1.5 under Fernet's xbmc-xvba.

@opdenkamp: yeah, I've already installed libcec and libcec-dev, also successfully compiled this lib from sources. I can also successfully compile xbmc from pulse8 sources and from Fernet's sources, but without your patches... Maybe you know solution how to get fully working 1080p HW ACC (xvba) for 1080p on fusion? I know that profile level v5.1 isn't supported ATM, but it's not a big problem for me, most of satellite dvb sources use level v4.0.

Team Kodi member

@siarkopol I see FernetMenta has just rebased the xvba patches onto the latest xbmc-pvr. If you take that branch, and merge this into it, it should all work just fine.


You are GREAT opdenkamp and FernetMenta :) All your patches work with latest xvba just fine :) Finally I've working 1080p (dvb, mkv, youtube, ~35% CPU) with one AV remote controller - it can controls AV, TV, XBMC and even PS3 at the same time :) There is still some problems with small rectangles during decoding dvb streams, but it's xvba related and I hope it will be fixed in next versions. So, thank you so much for help (btw, proper order of applying patches should be same like in commits section). You are really doing good work. Keep cool!

Team Kodi member

updated after your comments.

@opdenkamp opdenkamp was assigned Mar 25, 2012
Team Kodi member

@jmarshallnz: moved the CEC specific code out of CApplication in 2cd1c50

Team Kodi member

Yeah, looks nicer I think. You could probably pass a boolean for volume_up to save including Key.h in Peripherals.cpp? Mayaswell reduce the include spaghetti where reasonable?

Team Kodi member

@jmarshallnz: I renamed the method to OnAction, and moved the mute toggle from CApplication to CPeripherals too. It's likely that peripherals will handle more actions later.

I could reduce the #ifdef's by defining an empty CPeripheralCecAdapter class. it's now referencing code that won't be included when libCEC isn't available.

Team Kodi member

An empty CecAdaptor class would get it to compile without the ifdef (no ifdef's in that file currently by the looks), and wouldn't add any overhead at runtime as GetPeripheralWithFeature() would return false anyway.

Team Kodi member

@jmarshallnz: added the empty implementation. it's only got #ifdef parts where needed now.

opdenkamp added some commits Jan 12, 2012
@opdenkamp opdenkamp cec: added volume control on a CEC enabled amplifier when one is found ff2e663
@opdenkamp opdenkamp cec: set the HDMI port and the device to which the CEC adapter was co…
…nnected, to be able to determine the correct physical address. this is needed for people who have connected XBMC to something else than the TV
@opdenkamp opdenkamp cec: also mark XBMC as active source when powering up devices d0ae503
@opdenkamp opdenkamp cec: some TVs don't like us querying it while activating sources. mov…
…ed the queries to a background thread, and only query after the TV reports power state active.
@opdenkamp opdenkamp cec: use callback methods instead of constant polling. this requires …
…libCEC 1.4.0 or higher
@opdenkamp opdenkamp cec: only send an inactive source messages when not sending a power o…
…ff command, or AVR devices will power up again
@opdenkamp opdenkamp cec: removed the cec_debug_logging setting. always show cec debug log…
…ging when debugging in XBMC is enabled
@opdenkamp opdenkamp peripherals: added an optional order to settings ce51827
@opdenkamp opdenkamp peripherals: change the 'keymap_enabled' setting for HID devices into…
… 'do_not_use_custom_keymap', and hide the setting when the keymap is not configurable
@opdenkamp opdenkamp cec: don't call libCEC directly from the GUI thread 6be5784
@opdenkamp opdenkamp peripherals: use std::set for changed settings instead of std::vector ed34efe
@opdenkamp opdenkamp cec: update settings async, so we don't block the gui thread when the…
… OK button is pressed
@opdenkamp opdenkamp cec: updated to libCEC 1.5. uses struct libcec_configuration to get a…
…nd set the config in libCEC.
@opdenkamp opdenkamp cec: don't send an inactive source message / standby command directly…
… when receiving the OnQuit notification, but just stop the thread. fixes 'double standby' commands being sent. bugzid: 439
@opdenkamp opdenkamp cec: added an option to configure whether or not to send an 'inactive…
… source' message. bugzid: 439
@opdenkamp opdenkamp cec: don't send standby or inactive source messages when rebooting 689be59
@opdenkamp opdenkamp cec: get libCEC-latest from packages.pulse-eight.net, so it can be up…
…dated separately, e.g. to add vendor support
@opdenkamp opdenkamp cec: don't send an updated configuration to libCEC when stopping the …
…update thread
@opdenkamp opdenkamp cec: check whether the CEC adapter is enabled in peripheralsettings b…
…efore trying to open a connection
@opdenkamp opdenkamp cec: moved the CEC related volume change code from CApplication to CP…
…eripherals, so it's not filled with #ifdef parts
@opdenkamp opdenkamp cec: included an empty CPeripheralCecAdapter implementation when libC…
…EC is not available, so it can be compiled without needing a whole lot of #ifdef's
@opdenkamp opdenkamp merged commit b4a6871 into xbmc:master Mar 27, 2012

Uhm IMO "latest" is a very bad version identifier as you never really know what version you are on. Furthermore I'd prefer if those packages would be uploaded to XBMC's ftp and mirrors like all the other dependencies as well (same applies to OSX deps).

Team Kodi member

^^ and what he said :)

Team Kodi member

Source needs to be added to the mirrors. If build breaks because of hosting issues, we need to be able to fix ourselves.

Team Kodi member

I don't have access to the mirrors afaik. Can you put http://packages.pulse-eight.net/pulse/sources/libcec/libcec-latest.tar.bz2 on there and name it libcec-1.5.2.tar.bz2, or tell me how I can upload it myself?

Same goes for the windows dep, http://packages.pulse-eight.net/windows/libcec1.5.2.zip

libcec-1.5.2.tar.gz is on the mirrors.

Team Kodi member

so someone should bump back the version in the depends (not near a dev rig today...)

Team Kodi member

yeah will do. was waiting for them to be on the mirrors first to avoid failing builds. wasn't there when I checked.

pulse-eight does not seem to have a package - libcec-latest.tar.gz


fixed in mainline

Team Kodi member

there's also a -latest.tar.gz on our pulse-eight mirror again.


This is causing a build error for me. cectypes.h hasn't been moved into libcec folder on my repo, not sure if I've missed a step or found a problem. I'm still very new to c++ and git.

Team Kodi member

Under which platform? On Windows you have to run DownloadBuildDeps.bat to update the build dependencies

Team Kodi member

I always pull the latest changes, start building and if an include or something is missing I run DownloadBuildDeps.bat and hope that it resolves the problem ;-)

Team Kodi member
@tru tru added a commit to plexinc/plex-home-theater-public that referenced this pull request Aug 9, 2013
@tru tru Grab latest GDM code from PMS to switch to broadcast instead of multi…

Fixes #570
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment