Kodi Community Forum
New MythTV add-on using libcmyth - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+---- Forum: PVR (https://forum.kodi.tv/forumdisplay.php?fid=136)
+---- Thread: New MythTV add-on using libcmyth (/showthread.php?tid=110694)



- tsp42 - 2012-03-04

guyrichie: Another solution that is currently used in this addon, is to iterate though all the tunners (and that includes the virtual tunners too) until one of them is free to serve the requested channel. For details see the function PVRClientMythTV::SwitchChannel(const PVR_CHANNEL &channelinfo)


- tsp42 - 2012-03-04

KeithLM Wrote:No worries on the delay, I'm just tinkering at this point.

I'm just using one HDHomeRun Prime with a cablecard and it has 3 built-in tuners. From what I've gathered, different tuner devices actually affect the value of chanid in the channel table, or something like that. Looking in my channel table all my chanid fields are equal to 1000 + channum. I believe if I had a second source then those chanid fields would be 2000 + channum.
I've updated the code now. Please see if it helps.

I found this post about the difference between channel name, channel id, call sign and channel number in MythTV. slightly confusing...


- KeithLM - 2012-03-04

tsp42 Wrote:I've updated the code now. Please see if it helps.

I found this post about the difference between channel name, channel id, call sign and channel number in MythTV. slightly confusing...

OK, well it looks like I have two streams recording, and another viewing live, all from XBMC. Excellent.

That post explains a lot. It seems to make more sense now. Perhaps callsign is within the HD protocol so that is guaranteed to be consistent between tuners and providers, so by using that as a basis for recording your scheduled recordings will remain if you switch devices and/or service.

Are you working on adding the options to do transcoding and user jobs? I know I saw variables for those in one of the structures related to timers. I'm thinking about working out a user job to use Handbrake as the transcoder, because I find the results with the MythTV transcoder to be poor. I can't seem to get DD audio through it, and I either end up with a larger size file, or a horrible looking compressed file, I can't seem to get anything in between with it.


- nmcaullay - 2012-03-05

Hi there, i have a recent git build including this addon, but when i have a scheduled recording happening on the mythtv backend (channel A), the logic in the addon doesnt seem to allow for watching livetv on channel B. I'll try to explain my self in dot points Smile

1) Scheduled recording starts on Channel A (Multiplex 1)
2) Try to watch liveTV Channel B (on multiplex 1, same as channel A)
3) LiveTV works

1) Scheduled recording starts on Channel A (Multiplex 1)
2) Try to watch liveTV Channel Z (on multiplex 2, different multiplex to channel A)
3) LiveTV shows a channel from Multiplex 1

So, as far as I can tell, when a scheduled recording is happening, and you choose to watch liveTV, the addon will enumerate the tuners (physical and virtual), but will settle on the first available virtual tuner regardless of it's current "tuned" status.

Is there a way to ensure etiher
1) When virtual tuners are iterated through, that the virtual tuner is able to lock onto the multiplex requested (i.e. it is not locked to a different multiplex due to the parent physical tuner recording something), or
2) When iterating through available tuners, ignore virtual tuners that are already locked on different multiplexes?

This is good progress.... I was fighting with this last night, and assumed it was some mythtv configuration issue, but it seems that it isnt just me Smile

Cheers Nathan

tsp42 Wrote:guyrichie: Another solution that is currently used in this addon, is to iterate though all the tunners (and that includes the virtual tunners too) until one of them is free to serve the requested channel. For details see the function PVRClientMythTV::SwitchChannel(const PVR_CHANNEL &channelinfo)



- robweber - 2012-03-05

I'm trying to compile this on Windows but am getting some errors related to the Boost libraries not being available. I saw a few posts back that this was mentioned in relation to Linux builds but nothing about Windows that I can see yet.

Can anyone tell me where I should put the Boost libraries so that I can compile in VS2010 on Windows? Does it require any config in the project properties?

Thanks.


- myksterx - 2012-03-05

just viewed the video on the first post and i am extremly impressed with what im seeing !! good work guys - hope this will be implemented by default to the XBMC build eventually as this really is the dogs bollocks!


- tsp42 - 2012-03-05

robweber:
Try running the bat file in the myth-cmyth directory:
xbmc/xbmc/pvrclients/mythtv-cmyth/boost_win32_dependency.bat
I thought it would run by it self when building the projetc but apparently this is not the case.

nmcaullay:
Sounds like a bug. It should only select a tunner if it is able to tune in to the requested channel. Could you post an extented debug log so I can see what's going on.

KeithLM:
Yes I'm working on exposuring the additional recording options. I've added it to the libcmyth code but the GUI part is still missing (it is a bit more complicated/boring to do).


- Kr0nZ - 2012-03-06

this doesnt work for me
XBMC just freezes when trying to access mythtv through videos

I just add my backend in videos right? using the myth:// protocol?

mythbackend --version:
Code:
Please attach all output as a file in bug reports.
MythTV Version   : v0.24.2-17-g0f6bb92
MythTV Branch    : fixes/0.24
Network Protocol : 63
Library API      : 0.24.20110505-1
QT Version       : 4.7.0
Options compiled in:
linux profile using_alsa using_oss using_pulse using_pulseoutput using_backend using_bindings_perl using_bindings_python using_crystalhd using_dvb using_firewire using_frontend using_hdhomerun using_hdpvr using_iptv using_ivtv using_joystick_menu using_lirc using_mheg using_opengl_video using_opengl_vsync using_qtdbus using_qtwebkit using_v4l using_x11 using_xrandr using_xv using_bindings_perl using_bindings_python using_mythtranscode using_opengl using_vdpau using_ffmpeg_threads using_live using_mheg

mythbackend.log shows:
Code:
2012-03-05 18:17:59.798 MainServer::HandleVersion - Client speaks protocol version 8 but we speak 63!
2012-03-05 18:17:59.807 MainServer, Warning: Unknown socket closing MythSocket(0xffffffffa6015f58)
2012-03-05 18:17:59.808 MainServer::ANN Playback
2012-03-05 18:17:59.897 adding: mythdemon as a client (events: 0)
2012-03-05 18:18:00.319 MainServer::HandleVersion - Client speaks protocol version 8 but we speak 63!
2012-03-05 18:18:00.326 MainServer, Warning: Unknown socket closing MythSocket(0xffffffffa57a7688)
2012-03-05 18:18:00.327 MainServer::ANN Playback
2012-03-05 18:18:00.373 adding: mythdemon as a client (events: 0)
2012-03-05 18:18:00.571 MainServer, Warning: Unknown socket closing MythSocket(0xffffffffa60623f0)
2012-03-05 18:18:00.571 MainServer::HandleVersion - Client speaks protocol version 8 but we speak 63!
2012-03-05 18:18:00.599 MainServer, Warning: Unknown socket closing MythSocket(0xffffffffa5a48590)
2012-03-05 18:18:00.599 MainServer::ANN Playback
2012-03-05 18:18:00.613 adding: mythdemon as a client (events: 0)
2012-03-05 18:18:00.605 MainServer, Warning: Unknown socket closing MythSocket(0xffffffffa5a48590)
2012-03-05 18:18:00.583 MythSocket(ffffffffa60623f0:-1): writeStringList: Error, socket went unconnected.
                        We wrote 0 of 220 bytes with 1 errors
2012-03-05 18:18:00.642 MythSocket(ffffffffa5a48590:-1): writeStringList: Error, socket went unconnected.
                        We wrote 0 of 21 bytes with 1 errors
2012-03-05 18:18:00.665 MainServer, Warning: Unknown socket closing MythSocket(0xffffffffa5a48590)
2012-03-05 18:18:00.693 Waiting for a process request thread..
2012-03-05 18:18:00.801 MainServer, Warning: Unknown socket closing MythSocket(0xffffffffaf032bf8)
2012-03-05 18:18:00.811 MythSocket(ffffffffaf032bf8:-1): writeStringList: Error, socket went unconnected.
                        We wrote 0 of 379 bytes with 1 errors



- nmcaullay - 2012-03-06

Hi there, I'm not convinced you have read the initial posts, and compiled xbmc as per directions. The mythtv integration in xbmc (when compiled as described in the first page of this topic) is via the LiveTV menu, not Videos.

Please confirm that you have compiled as per instructions, and then the clever people in this topic can provide guidance (i.e. make sure livetv is enabled, home to configure the libcmyth addon etc).

Cheers Nathan


- Kr0nZ - 2012-03-06

nmcaullay Wrote:Please confirm that you have compiled as per instructions, and then the clever people in this topic can provide guidance (i.e. make sure livetv is enabled, home to configure the libcmyth addon etc).
Cheers Nathan

Thnx working now, I had it configured but I didnt have it enabled in 'system > live tv'

I've been waiting sooo long for a working mythtv addon and this so far seems to be working good

XBMC looks so much nicer than mythfrontend


- nmcaullay - 2012-03-06

Cool, nice one.... mythfrontend is horrible, and is the main reason for me to look elsewhere for a frontend. Mythtv is still hard to beat for the backend (i've tried tvheadend, but some of the EPG problems and the limited support for hdhomerun makes it difficult and not reliable).

Cheers Nathan


- nmcaullay - 2012-03-06

tsp42 Wrote:nmcaullay:
Sounds like a bug. It should only select a tunner if it is able to tune in to the requested channel. Could you post an extented debug log so I can see what's going on.

Hi tsp42, i captured the xbmc and mythtv logs in the scenario i explained earlier.

1) Schedule a recording in mythtv (channel 9 - Top Gear)
MYTHTV
http://pastebin.com/btdT9FAU
XBMC
http://pastebin.com/iCzt3B8j

2) Try to watch liveTV from a different multiplex through xbmc (channel 10)
XBMC
http://pastebin.com/RQKMDmsL
MYTHTV
http://pastebin.com/v46bgZ0q


The Allocation of Tuners - guyrichie - 2012-03-06

Hello Nathan,
nmcaullay Wrote:...1) Scheduled recording starts on Channel A (Multiplex 1)
2) Try to watch liveTV Channel B (on multiplex 1, same as channel A)
3) LiveTV works

1) Scheduled recording starts on Channel A (Multiplex 1)
2) Try to watch liveTV Channel Z (on multiplex 2, different multiplex to channel A)
3) LiveTV shows a channel from Multiplex 1...
Thanks for the above, this scenario perfectly describes my earlier posts intentions and experiences (http://forum.xbmc.org/showpost.php?p=1035447&postcount=450). I too wondered if it was a backend configuration fault.

Hello tsp42,

The current intended methodology for assigning tuners...
tsp42 Wrote:guyrichie: Another solution that is currently used in this addon, is to iterate though all the tunners (and that includes the virtual tunners too) until one of them is free to serve the requested channel. For details see the function PVRClientMythTV::SwitchChannel(const PVR_CHANNEL &channelinfo)
...I personally think is inefficient. Blush

A proposed methodology of selecting tuners is laid out below, with explanations as to why in italics:

Scenario 1 - Allocating tuners whilst scheduling recordings

  1. Allocate the first physical tuner as defined in the MythTV backend setup list.
  2. Allocate the virtual tuner(s) attached to the first physical tuner as defined in the MythTV backend setup list; provided their parent / physical tuner is on the same multiplex.
  3. Repeat above allocation method using the next physical tuner(s) (ascending order) and its virtual tuner(s) (ascending order) as defined in the MythTV backend setup list.
  4. Parse / echo any conflicting scheduled recordings to XBMC and if necessary report if all devices are busy.
Most people will add tuners in the MythTV backend setup in priority of performance. With this in mind the above methodology will allocate the better performing hardware first. This will give rise to higher quality recordings.

Scenario 2 - Allocating tuners whist requesting Live TV

  1. Allocate a virtual tuner in ascending order of the MythTV backend setup, provided that 1; The parent / physical tuner is on the same multiplex as the requested channel, 2; The tuner is not currently busy or 3; The tuner is not scheduled for a recording that conflicts with the now or next EPG events of the requested live tv channel.
    - This will keep as many physical tuners free as possible, whilst allowing the first available good performing TV card to be used. It will also ensure that the requested live channel (now and next programmes) will not be interrupted by a scheduled recording, but moreover, the live channel viewing will not override a scheduled recording.
  2. Allocate a physical tuner in ascending order of the MythTV backend setup, provided it is not currently busy or scheduled for a recording that conflicts with the now or next EPG events of the requested live tv channel.
    - Reasons are generally as above
  3. If all tuners fail to meet these conditions echo to XBMC that all devices are busy.
    - To let the user aware that to watch Live TV, they must free up some tuners by re-scheduling the timers

P.S I just tested the following, Nathan can you please test on your setup to confirm:

  1. Set a recording / timer on Channel A, multiplex 1 to start in the near future (say in 10min time).
  2. Then immediately tune into Channel Z, on multiplex 2 and keep tuned in till 12min elapse (i.e recording of Channel A should have started).
  3. Result at my end is that the scheduled recording fails. The LiveTV overrides the scheduled recording.
- Is there a feature that will disconnect a Live TV client (with a warning) in order to record a scheduled recording or automatically switch to the next available tuner?

Overall still very impressed, please keep up the much appreciated work.

Many thanks,
Guy


- 321liftoff - 2012-03-07

Trying out the windows binary from the first post (31/12/2011), but am getting this error:
Code:
02:06:19 T:2136  NOTICE: -----------------------------------------------------------------------
02:06:19 T:2136  NOTICE: Starting XBMC, Platform: Windows XP Professional Service Pack 3 build 2600. Built on Dec 31 2011 (Git:20111231-165c5c8, compiler 1600)
02:06:19 T:2136  NOTICE: Intel(R) Core(TM)2 Duo CPU     T5250  @ 1.50GHz
02:06:19 T:2136  NOTICE: Desktop Resolution: 1280x800 32Bit at 60Hz
02:06:19 T:2136  NOTICE: Running with administrator rights
02:06:19 T:2136  NOTICE: Aero is disabled
02:06:19 T:2136  NOTICE: special://xbmc/ is mapped to: C:\Program Files\XBMC
02:06:19 T:2136  NOTICE: special://xbmcbin/ is mapped to: C:\Program Files\XBMC
02:06:19 T:2136  NOTICE: special://masterprofile/ is mapped to: C:\Documents and Settings\xxxxx\Application Data\XBMC\userdata
02:06:19 T:2136  NOTICE: special://home/ is mapped to: C:\Documents and Settings\xxxxx\Application Data\XBMC\
02:06:19 T:2136  NOTICE: special://temp/ is mapped to: C:\Documents and Settings\xxxxx\Application Data\XBMC\cache
02:06:19 T:2136  NOTICE: The executable running is: C:\Program Files\XBMC\XBMC.exe
02:06:19 T:2136  NOTICE: Log File is located: C:\Documents and Settings\xxxxx\Application Data\XBMC\xbmc.log
02:06:19 T:2136  NOTICE: -----------------------------------------------------------------------
02:06:19 T:2136  NOTICE: Setup SDL
02:06:20 T:2136  NOTICE: Found screen: Plug and Play Monitor on Mobile Intel(R) 965 Express Chipset Family, adapter 0.
02:06:20 T:2136  NOTICE: Primary mode: 1280x800 @ 60.00 - Full Screen
02:06:20 T:2136  NOTICE: Additional mode: 320x200 @ 60.00 - Full Screen
02:06:20 T:2136  NOTICE: Additional mode: 320x240 @ 60.00 - Full Screen
02:06:20 T:2136  NOTICE: Additional mode: 400x300 @ 60.00 - Full Screen
02:06:20 T:2136  NOTICE: Additional mode: 512x384 @ 60.00 - Full Screen
02:06:20 T:2136  NOTICE: Additional mode: 640x400 @ 60.00 - Full Screen
02:06:20 T:2136  NOTICE: Additional mode: 640x480 @ 60.00 - Full Screen
02:06:20 T:2136  NOTICE: Additional mode: 800x600 @ 60.00 - Full Screen
02:06:20 T:2136  NOTICE: Additional mode: 1024x768 @ 60.00 - Full Screen
02:06:20 T:2136  NOTICE: Additional mode: 1280x600 @ 60.00 - Full Screen
02:06:20 T:2136  NOTICE: Additional mode: 1280x720 @ 60.00 - Full Screen
02:06:20 T:2136  NOTICE: Additional mode: 1280x768 @ 60.00 - Full Screen
02:06:20 T:2136  NOTICE: Additional mode: 1280x800 @ 60.00 - Full Screen
02:06:20 T:2136  NOTICE: load settings...
02:06:20 T:2136  NOTICE: special://profile/ is mapped to: special://masterprofile/
02:06:20 T:2136  NOTICE: loading special://masterprofile/guisettings.xml
02:06:20 T:2136   ERROR: special://masterprofile/guisettings.xml, Line 0
                                            Failed to open file
02:06:20 T:2136   ERROR: Unable to load special://masterprofile/guisettings.xml, creating new special://masterprofile/guisettings.xml with default values
02:06:20 T:2136  NOTICE: Getting hardware information now...
02:06:20 T:2136  NOTICE: Checking resolution 12
02:06:20 T:2136  NOTICE: Loading player core factory settings from special://xbmc/system/playercorefactory.xml.
02:06:20 T:2136  NOTICE: Loaded playercorefactory configuration
02:06:20 T:2136  NOTICE: Loading player core factory settings from special://masterprofile/playercorefactory.xml.
02:06:20 T:2136  NOTICE: special://masterprofile/playercorefactory.xml does not exist. Skipping.
02:06:20 T:2136  NOTICE: No settings file to load to load (special://xbmc/system/advancedsettings.xml)
02:06:20 T:2136  NOTICE: No settings file to load to load (special://masterprofile/advancedsettings.xml)
02:06:20 T:2136  NOTICE: Default DVD Player: dvdplayer
02:06:20 T:2136  NOTICE: Default Video Player: dvdplayer
02:06:20 T:2136  NOTICE: Default Audio Player: paplayer
02:06:20 T:2136  NOTICE: Disabled debug logging due to GUI setting. Level 0.
02:06:20 T:2136  NOTICE: Log level changed to 0
02:06:20 T:2136  NOTICE: Loading media sources from special://masterprofile/sources.xml
02:06:24 T:2136   ERROR: Keymapping error: no such action 'language' defined
02:06:24 T:2136  NOTICE: initializing playlistplayer
02:06:24 T:2136  NOTICE: DONE initializing playlistplayer
02:06:24 T:3640   ERROR: CRemoteControl::Connect - failed to connect
02:06:27 T:2136  NOTICE: EPG::CEpgContainer::Start - EPG thread started
02:06:27 T:2136  NOTICE: initialize done
02:06:27 T:2136  NOTICE: Running the application...
02:06:28 T:2136  NOTICE: ES: Starting event server
02:06:28 T:2868  NOTICE: ES: Starting UDP Event server on 0.0.0.0:9777
02:06:28 T:2868  NOTICE: UDP: Listening on port 9777
02:06:30 T:2700  NOTICE: -->Python Interpreter Initialized<--
02:06:31 T:2700   ERROR: Error Type: <type 'exceptions.ImportError'>
02:06:31 T:2700   ERROR: Error Contents: No module named simplejson
02:06:31 T:2700   ERROR: Traceback (most recent call last):
                                              File "C:\Program Files\XBMC\addons\weather.wunderground\default.py", line 17, in <module>
                                                import os, sys, urllib2, base64, socket, simplejson
                                            ImportError: No module named simplejson
02:06:33 T:448   ERROR: ADDON: extension '' is not currently supported for service addon
02:06:33 T:448   ERROR: CThread::staticThread : Access violation at 0x0042caa4: Reading location 0x00000000
02:06:39 T:2136  NOTICE: PVRManager - starting up
02:06:44 T:2136  NOTICE: PVRManager - stopping
02:06:44 T:1276   ERROR: PVRManager - PVR::CPVRManager::Process - failed to load PVR data
02:06:44 T:2136  NOTICE: PVRManager - starting up
02:06:46 T:3052   ERROR: Win32DllLoader::Load: Failed to load C:\Program Files\XBMC\addons\..\system\libcmyth.dll with error 127:The specified procedure could not be found.
02:06:46 T:3052   ERROR: LoadLibrary('libcmyth.dll') failed
02:06:46 T:3052   ERROR: AddOnLog: MythTV cmyth PVR Client: Failed to load cmyth library!
02:06:46 T:3052   ERROR: ADDON: Dll MythTV cmyth PVR Client - Client returned bad status (4) from Create and is not usable
02:06:46 T:3052   ERROR: PVR - PVR::CPVRClients::InitialiseClient - can't initialise add-on 'MythTV cmyth PVR Client'
.....
repeat error

I double checked and libcmyth.dll is located in C:\Program Files\XBMC\system.


- robweber - 2012-03-08

@tsp42 - I did get the boost libraries and everything working on my Windows box. Thanks for letting me know where that batch file was, it did not get processed automatically when doing the build.