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)



RE: New MythTV add-on using libcmyth - pgjensen - 2012-09-28

janbar: compiling now to test for you

compilation failed.

http://pastebin.com/9tAV9hMR


RE: New MythTV add-on using libcmyth - janbar - 2012-09-28

(2012-09-28, 04:42)pgjensen Wrote: janbar: compiling now to test for you

compilation failed.

http://pastebin.com/9tAV9hMR

Miss boost header files.

For cfetzer addon (branch news) before compile have you run the script "xbmc-pvr-addons / project / BuildDependencies / scripts / boost_d.bat" ?

For my addon (branch master), before compile you must run the script "xbmc-pvr-addons / addons / pvr.cmyth / Win32 / boost_win32_dependency.bat"
If no way to compile cfetzer at this time, try addon from banch master called "pvr.cmyth". On linux it is ok. On windows 7 maybe... (i tested it on XP, but with some changes not committed in the repo !). On Os X , i will test it soon, i need to install xcode 3.6 and setup something.


RE: New MythTV add-on using libcmyth - Aubrien - 2012-09-28

@janbar

When I compile and run your latest master my channel changes seem to be timing out after just a few seconds, long before the IR blaster even has time to change the channel and make a signal lock. I use an HD-PVR and Linux. I didn't seem to have this issue a few days ago and it works fine in the default mythfrontend as well. Funny thing is the channel change shell script I use has a sleep 5 at the end to wait for the channel lock and xbmc is timing out before the channel change script is even complete. mythfrontend obeys this sleep however and wont assume the channel is changed until the script is complete. Also I have my channel change timeout set to 40000ms in the live tv playback settings so it isn't that. Shouldn't xbmc at least be waiting for the channel change script to complete before trying to start playback? It just seems like the only way this is going to work if you use an IR blaster. Or at the very least we should be able to set a delay in xbmc if it won't obey the delay in the external script that mythtv calls on channel change events. Thanks!


RE: New MythTV add-on using libcmyth - fetzerch - 2012-09-28

I'm working on the build/install steps. Will let you know when it's working again.
Also I'm preparing a PR for opdenkamps repo. Will have to change fileops (and move from boost to the internal xbmc functions for file system access)

@janbar. Great to hear. I'll have a look at your change later today :-)


RE: New MythTV add-on using libcmyth - janbar - 2012-09-28

(2012-09-28, 09:23)Aubrien Wrote: @janbar

When I compile and run your latest master my channel changes seem to be timing out after just a few seconds, long before the IR blaster even has time to change the channel and make a signal lock. I use an HD-PVR and Linux. I didn't seem to have this issue a few days ago and it works fine in the default mythfrontend as well. Funny thing is the channel change shell script I use has a sleep 5 at the end to wait for the channel lock and xbmc is timing out before the channel change script is even complete. mythfrontend obeys this sleep however and wont assume the channel is changed until the script is complete. Also I have my channel change timeout set to 40000ms in the live tv playback settings so it isn't that. Shouldn't xbmc at least be waiting for the channel change script to complete before trying to start playback? It just seems like the only way this is going to work if you use an IR blaster. Or at the very least we should be able to set a delay in xbmc if it won't obey the delay in the external script that mythtv calls on channel change events. Thanks!
Funny, in your case fast channel switch should be prohibited. I am not at home now, so if exists in xbmc a setting to setup the delay before playback, the problem will be resolved.
Also maybe playback delay is not yet coded. If not i can add a new addon setting to setup it.


RE: New MythTV add-on using libcmyth - janbar - 2012-09-28

@Aubrien

Ok, xbmc has already a setting for delay channel switch in TV - settings / Playback. I would check that it is applicable when switch channel. Normally it exists to solve your issue.


RE: New MythTV add-on using libcmyth - Aubrien - 2012-09-28

@janbar
I have been looking for the feature you descibed to delay playback but I cannot find it. If one exists I would be happy to change it and give it a try. I am thinking that you may need to add a setting in the addon to alow a playback delay for anyone that uses an IR blaster and/or has a set top box like mine that takes 2-3s after tuning before there is a picture. I use the HD-PVR capture device with the built in IR blaster to control a Vip-211k DISH Network HD reciever. The channel change script can take 3s or so before sending all of the digits and then the Vip-211k takes just as long to get a signal after tuning. I would need to set the playback delay to the worst case scenario and by then I should have a non 0 size file to play back. Currently it tries to playback before the file exists or has any data.

The capture card is very common as is the set top box so I know others will need such a setting as well. In the mythfrontend it waits until my channel change script is complete as I described above, and then starts playback. It looks like xbmc has no way of telling if the channel change script is complete yet or not (or maybe it can?) so putting a sleep in the script still makes the mythbackend delay before startying capture which is good, but xbmc is full speed ahead and starts capture way early no matter what settings I change. I could compile and test such a feature if implemented and could report back the results.
I tried that setting as well. The highest it allows is 2s and I am not seeing any difference when I use it. I'm not sure if it affects the playback delay or what it does really, but I did indeed try it and I didn't see a difference. I also set the channel change timeout to 40s and still no joy.


RE: New MythTV add-on using libcmyth - fetzerch - 2012-09-28

@janbar: Your livetv fix seems to work pretty good here :-) From 30->6s is really nice already. It's now integrated into my master branch.
@all: The build/install problems should be fixed (tested in linux and win7). Let me know if it works for you.


RE: New MythTV add-on using libcmyth - kburkart - 2012-09-28

(2012-09-28, 21:24)cfetzer Wrote: @janbar: Your livetv fix seems to work pretty good here :-) From 30->6s is really nice already. It's now integrated into my master branch.
@all: The build/install problems should be fixed (tested in linux and win7). Let me know if it works for you.

ok cfetzer how bout some instructions. Does this also fix livetv stopping after a show ends?


RE: New MythTV add-on using libcmyth - janbar - 2012-09-28

(2012-09-28, 17:21)Aubrien Wrote: @janbar
I have been looking for the feature you descibed to delay playback but I cannot find it. If one exists I would be happy to change it and give it a try. I am thinking that you may need to add a setting in the addon to alow a playback delay for anyone that uses an IR blaster and/or has a set top box like mine that takes 2-3s after tuning before there is a picture. I use the HD-PVR capture device with the built in IR blaster to control a Vip-211k DISH Network HD reciever. The channel change script can take 3s or so before sending all of the digits and then the Vip-211k takes just as long to get a signal after tuning. I would need to set the playback delay to the worst case scenario and by then I should have a non 0 size file to play back. Currently it tries to playback before the file exists or has any data.

The capture card is very common as is the set top box so I know others will need such a setting as well. In the mythfrontend it waits until my channel change script is complete as I described above, and then starts playback. It looks like xbmc has no way of telling if the channel change script is complete yet or not (or maybe it can?) so putting a sleep in the script still makes the mythbackend delay before startying capture which is good, but xbmc is full speed ahead and starts capture way early no matter what settings I change. I could compile and test such a feature if implemented and could report back the results.
I tried that setting as well. The highest it allows is 2s and I am not seeing any difference when I use it. I'm not sure if it affects the playback delay or what it does really, but I did indeed try it and I didn't see a difference. I also set the channel change timeout to 40s and still no joy.

@Aubrien

Do you need a delay for spawn and switch or only for switch ?

(2012-09-28, 22:26)kburkart Wrote:
(2012-09-28, 21:24)cfetzer Wrote: @janbar: Your livetv fix seems to work pretty good here :-) From 30->6s is really nice already. It's now integrated into my master branch.
@all: The build/install problems should be fixed (tested in linux and win7). Let me know if it works for you.

ok cfetzer how bout some instructions. Does this also fix livetv stopping after a show ends?

I have not yet investigate for this point. I am looking for it, so I need logs to identify exactly the issue so it take some time. If any others have an idea ?


RE: New MythTV add-on using libcmyth - janbar - 2012-09-28

(2012-09-28, 21:24)cfetzer Wrote: @janbar: Your livetv fix seems to work pretty good here :-) From 30->6s is really nice already. It's now integrated into my master branch.
@all: The build/install problems should be fixed (tested in linux and win7). Let me know if it works for you.

Great, i hope that is like this for all. But funny thing, now Aubrien and maybe someone need a "delay channel switch" for his system.
(2012-09-28, 23:42)janbar Wrote:
(2012-09-28, 21:24)cfetzer Wrote: @janbar: Your livetv fix seems to work pretty good here :-) From 30->6s is really nice already. It's now integrated into my master branch.
@all: The build/install problems should be fixed (tested in linux and win7). Let me know if it works for you.

Great, i hope that is like this for all. But funny thing, now Aubrien and maybe someone need a "delay channel switch" for his system.

Also i will try to resolve few others issues to complete achievement of tsp's work and then push back the addon to master. Hopefully.


RE: New MythTV add-on using libcmyth - pgjensen - 2012-09-29

noticed with merge of janbar's code that when i change channels, it just stops playing and i have to choose the channel again to get video back.


RE: New MythTV add-on using libcmyth - Aubrien - 2012-09-29

@janbar

The delay is just needed for switch. If it were in place for spawn too then it would delay when live tv rolls over to the next show. The issue is the fast switching doesn't wait for channel changes to complete. As for the livetv stopping between shows, I think it is related to the HD ring buffer running dry before the next show starts playing. The buffer runs out and since there is nothing ready to play it just stops. This is just a hunch though, but others have said that increasing their HD ring buffer size fixed the issue. Just don't make it so big that you start swapping. If I get my channel changing working again in xbmc I can test that theory, but as of now I can't even tune at all anymore unless I use the default mythfrontend until we work out the delay issue.

@pgjensen
I bet you are seeing the same issue as me. On the first channel change it tunes but fails to play because xbmc didn't wait for the tune to complete. I bet if you looked at your tuner, it in fact did tune the first time. The second time you tune it is already on the right channel so playback just starts.


RE: New MythTV add-on using libcmyth - janbar - 2012-09-29

(2012-09-29, 00:48)Aubrien Wrote: @janbar

The delay is just needed for switch. If it were in place for spawn too then it would delay when live tv rolls over to the next show. The issue is the fast switching doesn't wait for channel changes to complete. As for the livetv stopping between shows, I think it is related to the HD ring buffer running dry before the next show starts playing. The buffer runs out and since there is nothing ready to play it just stops. This is just a hunch though, but others have said that increasing their HD ring buffer size fixed the issue. Just don't make it so big that you start swapping. If I get my channel changing working again in xbmc I can test that theory, but as of now I can't even tune at all anymore unless I use the default mythfrontend until we work out the delay issue.

@pgjensen
I bet you are seeing the same issue as me. On the first channel change it tunes but fails to play because xbmc didn't wait for the tune to complete. I bet if you looked at your tuner, it in fact did tune the first time. The second time you tune it is already on the right channel so playback just starts.

I add a new setting to setup the delay for channel switch. git clone https://github.com/janbar/xbmc-pvr-addons.git (master), make it and unzip it in .xbmc/addons/. Start xbmc and then go to the configuration of addon (or edit the setting.xml file if you prefer) and then enter the delay in ms. for example 5000. In my case it is ok: after switch, playback starts only after delay. Hopefully it will be ok for you. Let me know. br




RE: New MythTV add-on using libcmyth - Aubrien - 2012-09-29

Janbar,
I appreciate you trying to help. I didn't expect you to get back so soon. I have compiled and tested the changes and while it does indeed compile and I do see the new setting, I still don't have working channel changes and I used 5000, 10000, and 15000 in the new setting. Below is my logs for both xbmc and mythbackend. I started the channel change at 22.42.07 and 3s later it is already done. Channel changing still hasn't completed on mythbackend by the time it fails as I have a 5s sleep on the backend channel change script. Still working in mythfrontend however.

mythbackend.log
http://pastebin.com/vxAy5c9n

xbmc.log
http://pastebin.com/JAscQrYC

changeChannel.sh
Code:
#!/bin/bash

# Wake up if asleep from daily update
irsend --device=/dev/lircd SEND_ONCE blaster 1_142_KEY_MNSELECT

# Split channel into digits and send key presses
for DIGIT in $(echo ${1} | sed -e 's/./& /g'); do
  irsend --device=/dev/lircd SEND_ONCE blaster 1_142_KEY_${DIGIT}
done

# Confirm channel to avoid waiting
irsend --device=/dev/lircd SEND_ONCE blaster 1_142_KEY_MNSELECT

# Wait for lock
sleep 5

I been looking through logs and the new source and I noticed that your delay code should be logging the delay
Code:
XBMC->Log(LOG_DEBUG,"%s: Delay channel switch: %d/%d",__FUNCTION__,i,g_iPlayBackDelay);
but I get no entries even when I cut on additional debug info in your addon settings. It looks like the new code isn't run before it tries to read the 0 size stream. Maybe spawn and switch was the way to go? I just assumed that the initial opening of a stream also was considered a channel switch since it fired the channel change script on the backend but I guess I was wrong. What do you think janbar? You would know better than me. I'll just test whatever you come up with.

Edit:
Sorry for the long post but I decided to play around in the code and try a sloppy fix as a proof of concept. I copied you delay code block from the ChannelSwitch function into the OpenLiveStream function right before the "return true" if the recorder is null and I can now tune. It may or may not be the best place but at least we know that this was indeed the issue. I'll leave the rest to the real cpp developers. I need some sleep. Thanks!