Kodi Community Forum

Full Version: New MythTV add-on using libcmyth
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
(2012-09-27, 16:39)allen00se Wrote: [ -> ]
(2012-09-27, 16:22)kburkart Wrote: [ -> ]
(2012-09-26, 22:58)allen00se Wrote: [ -> ]LinixMCE... yup i suffered with that for a few years. Got tired of no one caring about the actual Media. All anyone over there wanted was telecom and home automation, and no one cared that the UI was fugly. Plus I got laughed at for saying someone should develop a remote for the iPad instead of that tablet thing... Oh well, if i can get this liveTV sorted out I will finally be content.

Thanks for the heads up on ring buffer, I will try that tonight when I get home. Did you ever see random pixelation too? I would describe it almost like a glitch every few minutes or so. Are you using the USB or PCI version?

Using PCI w/Cincinnati Bell fioptics all channels except premium are CCI=0 so I get close to 230 channels. I think the ring buffer should help the pixelization as well, if not again try VDPAU profiles.

There were some definite things I loved about LinuxMCE, the UI was definitly not one of them, although they are working on that, but the fact that TV was unstable ruined it for me. It would be great if you could take the best parts of XBMC, MythTV and LinuxMCE and mix them together.

Kevin

100% agree about taking things from each system, I do miss the home automation from LMCE. I think I am going to end up just writing some code for controlling my lights and just have a web frontend.

As far as your Ceton card goes, what signal strength do you usually show (looking at the ceton device web page)? I am wondering if boosting my signal would help as well. The few times I have checked it shows -3 to -4 db and I read online a booster could take it up to -15db.

Krys,

I'm getting a signal anywhere from -7 to -12db usually closer to the higher end. If you get a booster make sure it boosts a clean signal and its not some piece of crap. Smile

(2012-09-29, 05:19)Aubrien Wrote: [ -> ]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!

Great if you could find exactly where the delay should be better in the code. If this new place (at the end of OpenStream before return) is ok then you have also a delay when spawn. Perfect. Let me know if with this configuration your issue is fully resolved.
Then send me your update and i commit it. Also you right by checking the recorder status, probably it is the solution.
@pgjensen

Right, sometime playback stop. I saw logs and some errors in stream are reported by mythbackend. Then It skip frames and ring buffer is empty for a short period. Probably we need to add a delay when buffer is empty before return and finally stop playback because no stream... I take note.
When tune is not very good, lot of frames are skipped. With a fast channel switch the "timeshift" is short and when buffer cannot to be filled the playback stop.
@pgjensen

For this case, probably you need a "delay channel switch" requested by Aubrien. See previous post. You can test it, few ms (100 - 500?) could be resolve issue.
Give me a couple hours and I should have the exact details worked out on the delay channel switch change and I can post a diff. Also, I was thinking that adding a delay between live tv episodes should prevent the buffer from running out as discussed above, but does this mean that each time an episode ends we get more and more behind actual live tv? I would be nice to only do a delay between episodes if it is needed instead of embedding a static delay that would be added between every episode no matter if it is needed or not. For example, you watch the same channel all day and between each episode there is a 5s delay. By the end of the day you may have inserted enough delays to be 2-3 minutes behind. We just need to be careful to only delay if we really need to. Just something for us all to be thinking about with these delays.
OK. I basically just moved the delay code out of the switch channel function and into the open stream function right before returning. It only gets executed if the recorder is null since there is no channel switch in between episodes on the same channel which is when the recorder would not be null. It gives me working tuning from both playing nothing and changing the channel while already watching live tv.

Code:
--- addons/pvr.cmyth/src/PVRcmyth.cpp
***************
*** 678,683 ****
--- 678,692 ----
          }
          if(m_rec.SpawnLiveTV(chan))
          {
+           /* Delay channel switch before playback */
+           if (g_iPlayBackDelay > 0) {
+             int i = 0;
+             while (i<g_iPlayBackDelay) {
+               usleep(100000);
+               i += 100;
+               XBMC->Log(LOG_DEBUG,"%s: Delay channel switch: %d/%d",__FUNCTION__,i,g_iPlayBackDelay);
+             }
+           }
          return true;
          }
        }
***************
*** 778,795 ****
    }
    if(g_bExtraDebug)
      XBMC->Log(LOG_DEBUG,"%s - Done",__FUNCTION__);
-
-    /* Delay channel switch before playback */
-    // Need to Pause the recorder ?
-   if (g_iPlayBackDelay > 0) {
-     int i = 0;
-     while (i<g_iPlayBackDelay) {
-       usleep(100000);
-       i += 100;
-       XBMC->Log(LOG_DEBUG,"%s: Delay channel switch: %d/%d",__FUNCTION__,i,g_iPlayBackDelay);
-     }
-   }
-
    return retval;
  }

--- 787,792 ----
Has anyone managed to get fetzerch's build working under Windows?
Yes I've gotten his build working on Windows 7. Many thanks everyone who's come together to make this add-on what it is today. It seems it's so close to being complete. I have built off of fetzerch's github repo as it seems everything has been merged there as of now (If I'm incorrect please let me know Wink ).

Now then, as I mentioned the build works for me with Windows 7 and the nightly from September 30th for XBMC and building the addon off fetzerch's repo and copying it into my AppData addons folder. I've tried the build on Ubuntu (12.04), I installed a nightly, built the add-on and i get a failure message right upon enabling the add-on. I then tried fetzerch's xbmc fork and still same error when enabling the plugin. I'll take a look at xbmc.log tomorrow to see if it provides any insight.

After struggling a bit, I was able to get things working on Ubuntu with a normal xbmc install from a repo. The key was to do -
Code:
./configure --prefix=/usr/
sudo make install
As of yesterday both cfetzer and janbar are not compatible with the newest changes in the xbmc master. I saw that lars had changed the api version from 1.2.0 to 1.3.0 and added support for seeking and time shifting features. While this is good news, it breaks the addons until they can be updated. In order to roll these changes out and use the addons I had to backtrack my local source to commit bb0a56cd069ed8960af767a4e11349bc17d5710b which is the last commit yesterday before these changes. I do the following...

Code:
git reset --hard bb0a56cd069ed8960af767a4e11349bc17d5710b

Recompile and install xbmc after the reset. I wouldn't recommend updating your xbmc nightlies until these addons have been updated or else the addon wont load anymore. Also, for those of you that need the channel change delay that janbar has been working on helping me with, you can use cfetzer's build by adding in a delay manually...

xbmc-pvr-addons / addons / pvr.mythtv.cmyth / src / pvrclient-mythtv.cpp @ line 1226 change
Code:
if (m_rec.SpawnLiveTV(chan))
    return true;

to

Code:
if (m_rec.SpawnLiveTV(chan))
{
    usleep(15000000) // Sleep for 15s
    return true;
}

Note that the 15s is tailored for me based on my channel change script, time to tune for set to box, and time to fill buffers. If I remove the delay it tries to read a 0 size stream before it is ready.
(2012-09-29, 14:59)kburkart Wrote: [ -> ]
(2012-09-27, 16:39)allen00se Wrote: [ -> ]
(2012-09-27, 16:22)kburkart Wrote: [ -> ]Using PCI w/Cincinnati Bell fioptics all channels except premium are CCI=0 so I get close to 230 channels. I think the ring buffer should help the pixelization as well, if not again try VDPAU profiles.

There were some definite things I loved about LinuxMCE, the UI was definitly not one of them, although they are working on that, but the fact that TV was unstable ruined it for me. It would be great if you could take the best parts of XBMC, MythTV and LinuxMCE and mix them together.

Kevin

100% agree about taking things from each system, I do miss the home automation from LMCE. I think I am going to end up just writing some code for controlling my lights and just have a web frontend.

As far as your Ceton card goes, what signal strength do you usually show (looking at the ceton device web page)? I am wondering if boosting my signal would help as well. The few times I have checked it shows -3 to -4 db and I read online a booster could take it up to -15db.

Krys,

I'm getting a signal anywhere from -7 to -12db usually closer to the higher end. If you get a booster make sure it boosts a clean signal and its not some piece of crap. Smile

Ok well I guess I am confused now... I originally thought that a better/stronger signal was a negative number, but over the weekend I read something that lead me to believe it was a positive. I added a booster to my signal and it went from -3db to +3db. Maybe it doesnt matter...

The good news is, after I increased the HD ring buffer my livetv is now stable and watchable. I now need to figure out how to fine tune it. There are some channels that arent as clear as others, especially during sporting events. For lack of a better term the image appears like it needs to be deinterlaced.

This is what it looks like on certain channels (only during fast action scenes, or where the camera pans rapidly) not sure why it is only on some channels and not others. Any ideas?
Image
You need to set up the SW deinterlacing in XBMC. Get playback started and open the video settings. Look for interlacing and set it to auto detect VDPAU if applicable, or just auto detect if you dont have VDPAU support. There should be a way to tell it to use that setting for every video. Note that you can only set this from the menu when the video is playing. That would look great on a CRT, but you need to deinterlace it before using a digital display.

And for signal strength 3dB is stronger and better than -3dB.

I have tried upping my HD ring buffer in mythbackend and had no luck. I can however up my cachemembuffersize in XBMC advancedsettings.xml and get it to roll over to the second show. Problem is, it won't get to the third now because the buffer is run out by then. I need to actually pause to fill my buffer if I use buffer size increases to get me to the next show. The funny thing about live tv is that you are consuming the video at the same rate it is being created at so there is no way for the buffer to "catch up" without a pause in playback.
(2012-10-01, 16:37)allen00se Wrote: [ -> ]
(2012-09-29, 14:59)kburkart Wrote: [ -> ]
(2012-09-27, 16:39)allen00se Wrote: [ -> ]100% agree about taking things from each system, I do miss the home automation from LMCE. I think I am going to end up just writing some code for controlling my lights and just have a web frontend.

As far as your Ceton card goes, what signal strength do you usually show (looking at the ceton device web page)? I am wondering if boosting my signal would help as well. The few times I have checked it shows -3 to -4 db and I read online a booster could take it up to -15db.

Krys,

I'm getting a signal anywhere from -7 to -12db usually closer to the higher end. If you get a booster make sure it boosts a clean signal and its not some piece of crap. Smile

Ok well I guess I am confused now... I originally thought that a better/stronger signal was a negative number, but over the weekend I read something that lead me to believe it was a positive. I added a booster to my signal and it went from -3db to +3db. Maybe it doesnt matter...

The good news is, after I increased the HD ring buffer my livetv is now stable and watchable. I now need to figure out how to fine tune it. There are some channels that arent as clear as others, especially during sporting events. For lack of a better term the image appears like it needs to be deinterlaced.

This is what it looks like on certain channels (only during fast action scenes, or where the camera pans rapidly) not sure why it is only on some channels and not others. Any ideas?
Image

Looks like you need to turn deinterlacing on. Just set the deinterlacing settings to auto and it will turn on the deinterlacer when it is needed.
@Aubrien

Thanks for info about new features of xbmc. I sleep in the code to resolve the "end stop show" as soon as possible. I'll think to update addon with last xbmc api at the next commit. Great news about timeshift. Br
(2012-10-01, 03:48)PhoenixMage Wrote: [ -> ]Has anyone managed to get fetzerch's build working under Windows?

Usually I run a quick test before pushing on both windows and linux. If it doesn't compile or run, please pastebin a debug log and I'll assist you.

(2012-10-01, 16:35)Aubrien Wrote: [ -> ]As of yesterday both cfetzer and janbar are not compatible with the newest changes in the xbmc master. I saw that lars had changed the api version from 1.2.0 to 1.3.0 and added support for seeking and time shifting features. While this is good news, it breaks the addons until they can be updated. In order to roll these changes out and use the addons I had to backtrack my local source to commit bb0a56cd069ed8960af767a4e11349bc17d5710b which is the last commit yesterday before these changes. I do the following...

Code:
git reset --hard bb0a56cd069ed8960af767a4e11349bc17d5710b

Recompile and install xbmc after the reset. I wouldn't recommend updating your xbmc nightlies until these addons have been updated or else the addon wont load anymore. Also, for those of you that need the channel change delay that janbar has been working on helping me with, you can use cfetzer's build by adding in a delay manually...

xbmc-pvr-addons / addons / pvr.mythtv.cmyth / src / pvrclient-mythtv.cpp @ line 1226 change
Code:
if (m_rec.SpawnLiveTV(chan))
    return true;

to

Code:
if (m_rec.SpawnLiveTV(chan))
{
    usleep(15000000) // Sleep for 15s
    return true;
}

Note that the 15s is tailored for me based on my channel change script, time to tune for set to box, and time to fill buffers. If I remove the delay it tries to read a 0 size stream before it is ready.

Updated my branch just a few minues ago. But be aware that XBMC's october merge window is open starting today and they're adding features till the 10.10 that might bring also some instabilities. So it might be a good idea for most of you to stick with the september's alpha.

BTW: If the API version is bumped and you're doing an in source build (within xbmc) under linux, you can always try to call 'make sync' before building. It will copy the API headers to the pvr-addons directory. (Just checkout the toplevel Makefile.am)

For the timeshift feature: It's currently not yet in master as far as I can see: https://github.com/xbmc/xbmc/pull/1504