Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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
merged 21 commits into from
@opdenkamp
Collaborator

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
@opdenkamp
Collaborator

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

@opdenkamp
Collaborator

d780a41 was requested by @pike2k

@opdenkamp
Collaborator

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

@siarkopol

Hi,

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,
siarkopol

@malard
Collaborator

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

@opdenkamp
Collaborator

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?

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

@siarkopol

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.

@opdenkamp
Collaborator

@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.

@siarkopol

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!

@opdenkamp
Collaborator

updated after your comments.

@opdenkamp opdenkamp was assigned
@opdenkamp
Collaborator

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

@jmarshallnz
Owner

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?

@opdenkamp
Collaborator

@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.

@jmarshallnz
Owner

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.

@opdenkamp
Collaborator

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

opdenkamp added some commits
@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
4da15c1
@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.
56ce04d
@opdenkamp opdenkamp cec: use callback methods instead of constant polling. this requires …
…libCEC 1.4.0 or higher
5046a58
@opdenkamp opdenkamp cec: only send an inactive source messages when not sending a power o…
…ff command, or AVR devices will power up again
710bca0
@opdenkamp opdenkamp cec: removed the cec_debug_logging setting. always show cec debug log…
…ging when debugging in XBMC is enabled
ab8f57c
@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
b4d5d21
@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
cf80b6e
@opdenkamp opdenkamp cec: updated to libCEC 1.5. uses struct libcec_configuration to get a…
…nd set the config in libCEC.
4ae83c3
@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
81e0c48
@opdenkamp opdenkamp cec: added an option to configure whether or not to send an 'inactive…
… source' message. bugzid: 439
53be108
@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
a4dcf1c
@opdenkamp opdenkamp cec: don't send an updated configuration to libCEC when stopping the …
…update thread
8d3cc06
@opdenkamp opdenkamp cec: check whether the CEC adapter is enabled in peripheralsettings b…
…efore trying to open a connection
fcf1e4d
@opdenkamp opdenkamp cec: moved the CEC related volume change code from CApplication to CP…
…eripherals, so it's not filled with #ifdef parts
428508d
@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
6c4a3fe
@opdenkamp opdenkamp merged commit b4a6871 into from
@Montellese

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).

Owner

^^ and what he said :)

@theuni

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

Collaborator

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

Collaborator

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

Owner

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

Collaborator

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

http://packages.pulse-eight.net/pulse/sources/libcec/

Collaborator

fixed in mainline

Collaborator

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

@xbmcfanboy

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.

Collaborator

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

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 ;-)

Collaborator
@tru tru referenced this pull request from a commit in plexinc/plex-home-theater-public
@tru tru Grab latest GDM code from PMS to switch to broadcast instead of multi…
…cast

Fixes #570
8025a26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 27, 2012
  1. @opdenkamp
  2. @opdenkamp

    cec: set the HDMI port and the device to which the CEC adapter was co…

    opdenkamp authored
    …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
  3. @opdenkamp
  4. @opdenkamp

    cec: some TVs don't like us querying it while activating sources. mov…

    opdenkamp authored
    …ed the queries to a background thread, and only query after the TV reports power state active.
  5. @opdenkamp
  6. @opdenkamp

    cec: only send an inactive source messages when not sending a power o…

    opdenkamp authored
    …ff command, or AVR devices will power up again
  7. @opdenkamp

    cec: removed the cec_debug_logging setting. always show cec debug log…

    opdenkamp authored
    …ging when debugging in XBMC is enabled
  8. @opdenkamp
  9. @opdenkamp

    peripherals: change the 'keymap_enabled' setting for HID devices into…

    opdenkamp authored
    … 'do_not_use_custom_keymap', and hide the setting when the keymap is not configurable
  10. @opdenkamp
  11. @opdenkamp
  12. @opdenkamp
  13. @opdenkamp

    cec: updated to libCEC 1.5. uses struct libcec_configuration to get a…

    opdenkamp authored
    …nd set the config in libCEC.
  14. @opdenkamp

    cec: don't send an inactive source message / standby command directly…

    opdenkamp authored
    … when receiving the OnQuit notification, but just stop the thread. fixes 'double standby' commands being sent. bugzid: 439
  15. @opdenkamp

    cec: added an option to configure whether or not to send an 'inactive…

    opdenkamp authored
    … source' message. bugzid: 439
  16. @opdenkamp
  17. @opdenkamp

    cec: get libCEC-latest from packages.pulse-eight.net, so it can be up…

    opdenkamp authored
    …dated separately, e.g. to add vendor support
  18. @opdenkamp
  19. @opdenkamp

    cec: check whether the CEC adapter is enabled in peripheralsettings b…

    opdenkamp authored
    …efore trying to open a connection
  20. @opdenkamp

    cec: moved the CEC related volume change code from CApplication to CP…

    opdenkamp authored
    …eripherals, so it's not filled with #ifdef parts
  21. @opdenkamp

    cec: included an empty CPeripheralCecAdapter implementation when libC…

    opdenkamp authored
    …EC is not available, so it can be compiled without needing a whole lot of #ifdef's
Something went wrong with that request. Please try again.