NextPVR Forums
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 4 5 6 7 8 … 93 Next »
Stopping Live TV

 
  • 0 Vote(s) - 0 Average
Stopping Live TV
Vitenka
Offline

Junior Member

Posts: 31
Threads: 4
Joined: Apr 2013
#1
2014-12-06, 11:41 PM
For reference, I'm tring to implement a simple alarmclock/sleep mode plugin; it seemed an easy starting point.

Starting up LiveTV is simple enough:
PluginHelperFactory.GetPluginHelper().PlayLiveTV( /* optional channel */ )
Even getting the channel is reasonably easy, starting from Channel.LoadAll() and iterating till I find the one I want.

But how do I make it _stop_ correctly?
I've found two big pitfalls so far:
PluginHelperFactory.GetPluginHelper().GetPlaybackProxy().Stop()
a) Doesn't appear to actually exit the live TV mode. The OSD is still shown, and keyboard input resopnds as though in live mode (showing channel list etc.)
Even adding PluginHelperFactory.GetPluginHelper().ActivateScreen(this) didn't help.

b) And what if something else has already manually exited live mode? I can easily enough check if GetPlaybackProxy() is returning null - but I'd actually quite like to pick back up and have my plugin start doing stuff again.
I thought maybe I'd get an Activate() call, but I omly get that when you go in via the menu. I suspect the secret is going to be needing to register some form of callback?


So yeah, how do I do this?

(While I'm at it, there's some nastiness with PlayLiveTV() crashing if the screensaver is currently running. I addd BlockScreenSaver() and that seems to fix it.)
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 45,343
Threads: 867
Joined: May 2006
#2
2014-12-06, 11:49 PM
Does NUtility.StopAllStreams() or StopStream(int) work better?

Martin
Vitenka
Offline

Junior Member

Posts: 31
Threads: 4
Joined: Apr 2013
#3
2014-12-07, 12:13 AM (This post was last modified: 2014-12-07, 12:20 AM by Vitenka.)
I don't think I have an NUtility to call stuff on; and the IDE doesn't think it has a StopAllStreams() method anyway.

Ah, there's a StopAllStreams() on IRecored; I don't think that's what I want to mess with though.
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 45,343
Threads: 867
Joined: May 2006
#4
2014-12-07, 12:17 AM
Sure it is a key part of the NextPVR API, just add it from the program folder.

Martin
Vitenka
Offline

Junior Member

Posts: 31
Threads: 4
Joined: Apr 2013
#5
2014-12-07, 12:22 AM
I meant, I don't think I've got an instance of it.
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 102,401
Threads: 741
Joined: Nov 2003
#6
2014-12-07, 06:41 AM
I was initially going to suggest PluginHelperFactory.GetPluginHelper().GetPlaybackProxy().Stop() was the right thing to use, but I can see why that's not working. I'd forgotten this interfaces is only really controlling the playback, not the UI etc.

As a work around, you can use the attached patch with the following code. This method can provide other benefits to developers wanting to control the UI in future.
Code:
EventBus.GetInstance().Notify("HANDLE_COMMAND", "Stop");
Vitenka
Offline

Junior Member

Posts: 31
Threads: 4
Joined: Apr 2013
#7
2014-12-07, 08:54 AM
Thank you for the patch!

Unfortunately, it's not quite working.
If I do:
PluginHelperFactory.GetPluginHelper().Stop();
EventBus.GetInstance().Notify("HANDLE_COMMAND", "Stop");

Then it gets as close to working as I've had so far - but I get the "This tuner is needed for another recording" message - and it requires a machine reboot to get rid of. Restarting NextPVR just gets me "No Tuner available" for all Live TV operations.

Without the .Stop() first; i.e. just:
EventBus.GetInstance().Notify("HANDLE_COMMAND", "Stop");

Crashes NextPVR ("Applicaiton not responding").

No obvious cause in the log:
2014-12-07 08:48:46.776 [DEBUG][1] Hiding OSD.
2014-12-07 08:48:46.899 [DEBUG][1] GetEventCode() returned: 0x8100
2014-12-07 08:48:46.899 [DEBUG][1] GetEventCode() returned: 0x8100
2014-12-07 08:48:48.084 [DEBUG][1] GetEventCode() returned: 0x8100
2014-12-07 08:48:49.178 [DEBUG][1] GetEventCode() returned: 0x8100
2014-12-07 08:48:50.051 [DEBUG][1] Client about to request renewal of handle: 140002
2014-12-07 08:48:50.374 [DEBUG][1] GetEventCode() returned: 0x8100
2014-12-07 08:48:51.453 [DEBUG][1] GetEventCode() returned: 0x8100
2014-12-07 08:48:51.734 [DEBUG][1] GetEventCode() returned: 0x8100
2014-12-07 08:48:52.728 [DEBUG][1] GetEventCode() returned: 0x8100
2014-12-07 08:48:53.811 [DEBUG][9] Stopping graph@1
2014-12-07 08:48:54.024 [DEBUG][9] Stopping graph@2
2014-12-07 08:48:54.024 [DEBUG][1] Stopping graph@1


Should I assume a "Stop" notification is the way to go?
Will listening for this notification in my own plugin be the right way to see someone else has closed LiveTV (and potentially started something else) so that I know not to issue a new Stop?
Vitenka
Offline

Junior Member

Posts: 31
Threads: 4
Joined: Apr 2013
#8
2014-12-07, 09:53 AM
For detecting something els ehas stopped TV; I think I should do:

EventBus.GetInstance().AddListener(listener)
Where the listener is a clas that implements: void Notify(string eventName, object eventArg) to check for eventName=="PLAYBACK_STOPPED"

Is that right?
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 102,401
Threads: 741
Joined: Nov 2003
#9
2014-12-07, 06:27 PM
Odd. EventBus.GetInstance().Notify("HANDLE_COMMAND", "Stop") seems to stop it cleanly here. Can you post the npvr.log showing it? With that method, you definitely shouldn't be also calling GetPluginHelper().Stop(); That'll happen automatically as part of the Notify("HANDLE_COMMAND", "Stop") processing.
Vitenka
Offline

Junior Member

Posts: 31
Threads: 4
Joined: Apr 2013
#10
2014-12-07, 07:30 PM
Ah - slight difference. The "Not responding" does actually recover after a while; with a JIT error.
Once I clear that, it recovers.

JIT error is:
************** Exception Text **************
System.InvalidOperationException: Object is currently in use elsewhere.
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.FillRectangle(Brush brush, Int32 x, Int32 y, Int32 width, Int32 height)
at System.Drawing.Graphics.FillRectangle(Brush brush, Rectangle rect)
at NextPVR.TV.TVGuide.UpdateGuide()
at NextPVR.TV.TVGuide.Notify(String eventName, Object eventArg)
at NUtility.EventBus.Notify(String eventName, Object eventArg)
at NextPVR.Players.LiveTvPlayer.Stop()
at NextPVR.Players.LiveTvPlayer.RefeshOSD()
at NextPVR.ControllerForm.timer1_Tick(Object sender, EventArgs e)
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


And the log is (I added a bunch 'info' for my plugin; the lines most obviously interesting are "Stopping Live TV: Send Notify" which is just before I send the stop notify; and the apparant hang between Stopping graph@1 and Stopping graph@2. (At 19:18 I then exit NextPVR so that I can send this log)

<SNIP due to character limit>
2014-12-07 19:15:43.564 [DEBUG][1] FadeThroughTransitionHelper.GetRenderList() created
2014-12-07 19:15:43.564 [DEBUG][1] ACTIVATE_PLUGIN: TV Guide
2014-12-07 19:15:43.579 [DEBUG][1] Load@6
2014-12-07 19:15:43.585 [INFO][1] Setting Alarm for 00:00:15 from now.
2014-12-07 19:15:44.047 [DEBUG][1] Load@7
2014-12-07 19:15:44.047 [DEBUG][1] Load@8
2014-12-07 19:15:44.048 [DEBUG][1] Load@exit
2014-12-07 19:15:44.082 [DEBUG][1] FadeThroughTransitionHelper.GetRenderList() transition complete
2014-12-07 19:15:49.406 [DEBUG][1] Frame Render Rate=85.9205093383789
2014-12-07 19:15:58.600 [INFO][7] (start live TV here) Wakey Wakey!
2014-12-07 19:15:59.915 [DEBUG][7] GetServerStatus() returns:
<Status>
<Device oid="20" identifier="WinTV Nova-T Stick DVB-T Tuner (Dev1 Path0) :1">
</Device>
<Device oid="21" identifier="IPTV">
</Device>
</Status>
2014-12-07 19:16:00.093 [DEBUG][7] StartLiveTV@1
2014-12-07 19:16:00.093 [DEBUG][7] StartLiveTV@2
2014-12-07 19:16:00.096 [DEBUG][7] StartLiveTV@3
2014-12-07 19:16:00.096 [DEBUG][7] StartLiveTV@4

<SNIP due to character limit>

2014-12-07 19:16:07.943 [DEBUG][1] Dynamic reference clock set to: MPEG1 Audio Renderer
2014-12-07 19:16:07.943 [DEBUG][1] Reference clock was already se correctly. No change required.
2014-12-07 19:16:07.943 [DEBUG][1] GetEventCode() returned: 0x8102
2014-12-07 19:16:08.700 [DEBUG][1] Aspect ratio now: 16x9
2014-12-07 19:16:08.701 [DEBUG][1] Resolution is now: 704x576
2014-12-07 19:16:08.701 [DEBUG][1] GetEventCode() returned: 0x8101
2014-12-07 19:16:09.191 [DEBUG][1] GetEventCode() returned: 0x8100
2014-12-07 19:16:09.859 [DEBUG][1] Hiding OSD.
2014-12-07 19:16:09.887 [DEBUG][1] GetEventCode() returned: 0x8100
2014-12-07 19:16:10.324 [DEBUG][1] GetEventCode() returned: 0x8100
2014-12-07 19:16:11.482 [DEBUG][1] GetEventCode() returned: 0x8100
2014-12-07 19:16:12.724 [DEBUG][1] GetEventCode() returned: 0x8100
2014-12-07 19:16:12.724 [DEBUG][1] GetEventCode() returned: 0x8100
2014-12-07 19:16:13.138 [DEBUG][1] Client about to request renewal of handle: 14001C
2014-12-07 19:16:13.735 [DEBUG][1] GetEventCode() returned: 0x8100
2014-12-07 19:16:14.775 [DEBUG][1] GetEventCode() returned: 0x8100
2014-12-07 19:16:16.001 [DEBUG][1] GetEventCode() returned: 0x8100
2014-12-07 19:16:16.136 [INFO][5] Stopping Live TV: Send Notify("HANDLE_COMMAND", "Stop")
2014-12-07 19:16:16.886 [DEBUG][5] Stopping graph@1
2014-12-07 19:16:17.010 [DEBUG][5] Stopping graph@2
2014-12-07 19:16:17.010 [DEBUG][5] Stopping graph@2
2014-12-07 19:16:17.010 [DEBUG][1] Stopping graph@1
2014-12-07 19:16:42.120 [DEBUG][1] Stopping graph@2
2014-12-07 19:16:42.122 [DEBUG][5] Stopping graph@3
2014-12-07 19:16:42.160 [DEBUG][1] Stopping graph@3
2014-12-07 19:16:42.188 [DEBUG][1] Removing filter NPVR CC Dump
2014-12-07 19:16:42.190 [DEBUG][1] Removing filter EVR Renderer
2014-12-07 19:16:42.192 [DEBUG][1] Removing filter NPVR PES Collector (Teletext)
2014-12-07 19:16:42.194 [DEBUG][1] Removing filter NPVR PES Collector (DVBSubs)
2014-12-07 19:16:42.194 [DEBUG][1] Removing filter MPEG1 Audio Renderer
2014-12-07 19:16:42.221 [DEBUG][1] Removing filter AC3 Audio Renderer
2014-12-07 19:16:42.241 [DEBUG][1] Removing filter Line 21 Decoder
2014-12-07 19:16:42.242 [DEBUG][1] Removing filter Microsoft DTV-DVD Audio Decoder 0001
2014-12-07 19:16:42.244 [DEBUG][1] Removing filter Microsoft DTV-DVD Audio Decoder
2014-12-07 19:16:42.246 [DEBUG][1] Removing filter Microsoft DTV-DVD Video Decoder
2014-12-07 19:16:42.265 [DEBUG][1] Removing filter MPEG-2 Demultiplexer
2014-12-07 19:16:42.266 [DEBUG][1] Removing filter NPVR TS Reader2
2014-12-07 19:16:42.282 [INFO][5] Sleepy timer cancelled
2014-12-07 19:16:42.306 [INFO][1] Sleepy timer cancelled
2014-12-07 19:16:42.352 [DEBUG][5] LoadChannelListings(channel=7157)
2014-12-07 19:16:42.373 [DEBUG][5] LoadChannelListings done (listings = 243)
2014-12-07 19:16:42.374 [DEBUG][5] LoadChannelListings(channel=7157)
2014-12-07 19:16:42.402 [DEBUG][5] LoadChannelListings done (listings = 243)
2014-12-07 19:16:42.403 [DEBUG][5] LoadChannelListings(channel=7150)
2014-12-07 19:16:42.427 [DEBUG][5] LoadChannelListings done (listings = 253)
2014-12-07 19:16:42.427 [DEBUG][5] LoadChannelListings(channel=7155)
2014-12-07 19:16:42.488 [DEBUG][1] LoadChannelListings(channel=7157)
2014-12-07 19:16:42.553 [DEBUG][5] LoadChannelListings done (listings = 354)
2014-12-07 19:16:42.553 [DEBUG][5] LoadChannelListings(channel=7156)
2014-12-07 19:16:42.569 [DEBUG][5] LoadChannelListings done (listings = 120)
2014-12-07 19:16:42.570 [DEBUG][5] LoadChannelListings(channel=7202)
2014-12-07 19:16:42.581 [DEBUG][1] LoadChannelListings done (listings = 243)
2014-12-07 19:16:42.581 [DEBUG][1] LoadChannelListings(channel=7157)
2014-12-07 19:16:42.606 [DEBUG][5] LoadChannelListings done (listings = 245)
2014-12-07 19:16:42.607 [DEBUG][5] LoadChannelListings(channel=7201)
2014-12-07 19:16:42.623 [DEBUG][1] LoadChannelListings done (listings = 243)
2014-12-07 19:16:42.623 [DEBUG][1] LoadChannelListings(channel=7150)
2014-12-07 19:16:42.652 [DEBUG][5] LoadChannelListings done (listings = 287)
2014-12-07 19:16:42.653 [DEBUG][5] LoadChannelListings(channel=7238)
2014-12-07 19:16:42.667 [DEBUG][1] LoadChannelListings done (listings = 253)
2014-12-07 19:16:42.667 [DEBUG][1] LoadChannelListings(channel=7155)
2014-12-07 19:16:42.669 [DEBUG][5] LoadChannelListings done (listings = 150)
2014-12-07 19:16:42.670 [DEBUG][5] LoadChannelListings(channel=7154)
2014-12-07 19:16:42.702 [DEBUG][5] LoadChannelListings done (listings = 256)
2014-12-07 19:16:42.702 [DEBUG][5] LoadChannelListings(channel=7213)
2014-12-07 19:16:42.722 [DEBUG][1] LoadChannelListings done (listings = 354)
2014-12-07 19:16:42.722 [DEBUG][1] LoadChannelListings(channel=7156)
2014-12-07 19:16:42.734 [DEBUG][5] LoadChannelListings done (listings = 240)
2014-12-07 19:16:42.734 [DEBUG][5] LoadChannelListings(channel=7241)
2014-12-07 19:16:42.737 [DEBUG][1] LoadChannelListings done (listings = 120)
2014-12-07 19:16:42.737 [DEBUG][1] LoadChannelListings(channel=7202)
2014-12-07 19:16:42.754 [DEBUG][5] LoadChannelListings done (listings = 146)
2014-12-07 19:16:42.754 [DEBUG][5] LoadChannelListings(channel=7217)
2014-12-07 19:16:42.775 [DEBUG][1] LoadChannelListings done (listings = 245)
2014-12-07 19:16:42.776 [DEBUG][1] LoadChannelListings(channel=7217)
2014-12-07 19:16:42.797 [DEBUG][5] LoadChannelListings done (listings = 363)
2014-12-07 19:16:42.797 [DEBUG][5] LoadChannelListings(channel=7215)
2014-12-07 19:16:42.821 [DEBUG][5] LoadChannelListings done (listings = 213)
2014-12-07 19:16:42.823 [DEBUG][1] LoadChannelListings done (listings = 363)
2014-12-07 19:16:42.982 [DEBUG][5] UiStatic.Dispose()
2014-12-07 19:17:43.093 [DEBUG][1] ActivatePopup: RandomPhoto
2014-12-07 19:17:43.265 [DEBUG][1] File: C:\Users\Vitenka\Downloads\Images\ranger17.jpg Orientation:
2014-12-07 19:17:43.559 [DEBUG][1] No C:\Users\Public\NPVR\Scripts\ScreenSaverStart.bat file found
2014-12-07 19:17:46.066 [DEBUG][1] File: C:\Users\Vitenka\Downloads\Images\mtg\set-files\Reality Alarm.jpg Orientation:
2014-12-07 19:17:56.080 [DEBUG][1] File: C:\Users\Vitenka\Downloads\Images\mtg\set-files\Mantle of Insight.jpg Orientation:
2014-12-07 19:18:03.179 [INFO][1] Sleepy timer cancelled
2014-12-07 19:18:03.179 [INFO][1] Alarm timer cancelled


amd while I'm reporting problems - I tried to upload my plugin source for you; but got:

Warning: Declaration of vB_Image_Magick::fetch_image_info() should be compatible with that of vB_Image_Abstract::fetch_image_info() in ..../includes/class_image.php on line 1256

Warning: Declaration of vB_Image_GD::fetch_image_info() should be compatible with that of vB_Image_Abstract::fetch_image_info() in ..../includes/class_image.php on line 2488
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (2): 1 2 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  What is being sent when using /live?channel=3.1 scJohn 2 1,185 2020-01-30, 04:51 PM
Last Post: sub
  Stopping live tv mvallevand 3 1,712 2014-03-11, 04:19 AM
Last Post: mvallevand
  What causes a new tuner to be used services/live?channel= psycik 2 1,721 2014-02-04, 05:32 PM
Last Post: psycik
  Tracking Live TV status imilne 2 1,732 2011-07-13, 07:04 PM
Last Post: imilne
  Live GBPVR CD/DVD/Thumb drive :D pBS 101 20,800 2010-01-03, 06:22 AM
Last Post: pBS
  vlc as live TV Source theGressier 4 1,975 2008-09-13, 12:35 AM
Last Post: drlava
  Grabbing live TV video frame Snarky 1 970 2007-05-12, 05:30 AM
Last Post: sub
  stopping the screensaver taking focus idkpmiller 2 1,089 2007-01-21, 12:43 AM
Last Post: idkpmiller
  Query live preview mode fla 3 1,716 2006-07-12, 12:18 AM
Last Post: fla
  Displaying graphics over a live TV or recording picture funkybro_uk 3 1,270 2005-05-10, 05:18 PM
Last Post: sub

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode