Jump to content


Photo

BufferIndicator is forced to every Screen


  • Please log in to reply
9 replies to this topic

#1 mx3L

  • Senior Member
  • 616 posts

+79
Good

Posted 19 March 2015 - 11:47

As it is now it's not possible to not to show BufferIndicator Screen on evBuffering event, even when InfoBarBase derived Screen without InfoBarBuffer is created.

 

Problem is that BufferIndicator Screen is not derived from InforBarBase and therefore evBuffering event is not filtered by ServiceEventTracker.event only to active InfoBarBase screen.

To fix this, we should make evBuffering event to be part of InfoBarBuffer, which uses BufferIndicator screen. Something like this:

diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py
index 0e4cb62..18af119 100644
--- a/lib/python/Screens/InfoBarGenerics.py
+++ b/lib/python/Screens/InfoBarGenerics.py
@@ -369,7 +369,6 @@ class BufferIndicator(Screen):
 		self.mayShow = False
 		self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
 			{
-				iPlayableService.evBuffering: self.bufferChanged,
 				iPlayableService.evStart: self.__evStart,
 				iPlayableService.evGstreamerPlayStarted: self.__evGstreamerPlayStarted,
 			})
@@ -397,6 +396,13 @@ class InfoBarBuffer():
 	def __init__(self):
 		self.bufferScreen = self.session.instantiateDialog(BufferIndicator)
 		self.bufferScreen.hide()
+		self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
+			{
+				iPlayableService.evBuffering: self.__bufferChanged,
+			})
+
+	def __bufferChanged(self):
+		self.bufferScreen.bufferChanged()
 
 class NumberZap(Screen):
 	def quit(self):

Other events of BufferIndicator are just hiding screen, so it should'nt be neccessary to do them same for them..

 



Re: BufferIndicator is forced to every Screen #2 mx3L

  • Senior Member
  • 616 posts

+79
Good

Posted 19 March 2015 - 12:20

I would like to ask mods to move this post to Third-party-Development, thanks.



Re: BufferIndicator is forced to every Screen #3 littlesat

  • PLi® Core member
  • 56,262 posts

+691
Excellent

Posted 19 March 2015 - 13:31

Problem is that BufferIndicator Screen is not derived from InforBarBase and therefore evBuffering event is not filtered by ServiceEventTracker.event only to active InfoBarBase screen.

To fix this, we should make evBuffering event to be part of InfoBarBuffer, which uses BufferIndicator screen. Something like this:

Sorry I do not understand the issue... as far I  can see this does not make a difference at all????


WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: BufferIndicator is forced to every Screen #4 mx3L

  • Senior Member
  • 616 posts

+79
Good

Posted 19 March 2015 - 14:18

Let's suppose that I want create new InfoBarBase Screen:

class MyInfoBar(InfoBarBase, Screen):
    def __init__(self, session):
        Screen.__init__(self, session)
        InfoBarBase.__init__(self)

When I start playing some service while in MyInfoBar and evBuffering messages are emitted, then buffering messages are shown. But they should be only shown when InfoBarBuffer is part of MyInfoBar, which is not the case.

 

ServiceEventTracker.event is filtering which events should be executed in which Screen.

ServiceEventTracker.event, with added debug messages for evBuffering:

	@staticmethod
	def event(evt):
............
			for func in func_list:
                                #debug_start
				if evt == iPlayableService.evBuffering:
					print "evBuffering - passAll: %s, screen: %s, function: %s" %(str(func[0]), str(func[1]), str(func[2]))
                                #debug_end
				if (func[0] or  # let pass all events to screens not derived from InfoBarBase
					(not old_service_running and stack[ssize-1] == func[1]) or # let pass events from currently running service just to current active screen (derived from InfoBarBase)
					(old_service_running and ssize > 1 and stack[ssize-2] == func[1])): # let pass events from old running service just to previous active screen (derived from InfoBarBase)
					func[2]()

result without modification:

Buffering 5 percent done
evBuffering - passAll: True, screen: <class 'Screens.InfoBarGenerics.BufferIndicator'>, function: <bound method BufferIndicator.bufferChanged of <class 'Screens.InfoBarGenerics.BufferIndicator'

This means that function bufferChanged will be called even if I don't include InfoBarBuffer in MyInfoBar, since passall is set to True.

ServiceEventTracker:

def __init__(self, screen, eventmap):
.................
		self.__passall = not isinstance(screen, InfoBarBase) # let pass all events to screens not derived from InfoBarBase
.................

Result with modification:

evBuffering - passAll: False, screen: <class 'Screens.InfoBar.InfoBar'>, function: <bound method InfoBar.__bufferChanged of <class 'Screens.InfoBar.InfoBar'>>

passall is set to False, since InfoBarBuffer is part of InfoBarBase and InfoBar.__bufferChanged will be not called when MyInfoBar is active

 

 

I was thinking and we should also make sure that bufferScreen is hidden onExecEnd, in case new InfoBarBase Screen is created right between evStart and evGstreamerPlayStarted.

diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py
index 0e4cb62..17e3303 100644
--- a/lib/python/Screens/InfoBarGenerics.py
+++ b/lib/python/Screens/InfoBarGenerics.py
@@ -369,7 +369,6 @@ class BufferIndicator(Screen):
 		self.mayShow = False
 		self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
 			{
-				iPlayableService.evBuffering: self.bufferChanged,
 				iPlayableService.evStart: self.__evStart,
 				iPlayableService.evGstreamerPlayStarted: self.__evGstreamerPlayStarted,
 			})
@@ -397,6 +396,18 @@ class InfoBarBuffer():
 	def __init__(self):
 		self.bufferScreen = self.session.instantiateDialog(BufferIndicator)
 		self.bufferScreen.hide()
+		self.onExecEnd.append(self.__onExecEnd)
+		self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
+			{
+				iPlayableService.evBuffering: self.__bufferChanged,
+			})
+
+	def __onExecEnd(self):
+		if self.bufferScreen.shown:
+			self.bufferScreen.hide()
+
+	def __bufferChanged(self):
+		self.bufferScreen.bufferChanged()


Re: BufferIndicator is forced to every Screen #5 littlesat

  • PLi® Core member
  • 56,262 posts

+691
Excellent

Posted 19 March 2015 - 19:10

I do not see any difference.... Sorry... And on exec end I will not hide it... That was not intenden... In both situations the event is there....

Edited by littlesat, 19 March 2015 - 19:11.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: BufferIndicator is forced to every Screen #6 mx3L

  • Senior Member
  • 616 posts

+79
Good

Posted 19 March 2015 - 20:09

Difference is in passall:

 

1. if passall is True then function registered to this event is everytime executed

2. if passall is False then function registered to this event is executed either only for currently running service just to current active screen (derived from InfoBarBase) or old running service just to previous active screen (derived from InfoBarBase)

 

So event is there in both situations, difference is that one time is corresponding function to this event called(evBuffering registered in BufferIndicator - pasall = True) and other time not(evBuffering registered in InfoBarBuffer[derived from InfoBarBase] - pasall = False).

 

I don't think that this was intended to globally show buffering messages for every screen when evBuffering is emmited, ie. playing streams. I would like to have a choice not to show this buffering dialog in custom Screen.


Edited by mx3L, 19 March 2015 - 20:13.


Re: BufferIndicator is forced to every Screen #7 littlesat

  • PLi® Core member
  • 56,262 posts

+691
Excellent

Posted 19 March 2015 - 20:23

It was intended to put it on every screen.... Not only when we were at the infobar. So when you are in channel selection and preview to a stream, you also see the buffer status....

Why do you want to hide it....? Note it will only be shown when a stream is started.... Once played it will be hiden....

Edited by littlesat, 19 March 2015 - 20:26.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: BufferIndicator is forced to every Screen #8 mx3L

  • Senior Member
  • 616 posts

+79
Good

Posted 19 March 2015 - 20:29

Because I created customized buffer status(size of buffer, buffer level, average in rate, possible to turn on/off..., shows buffer also after gstreamerStartEvent(re-buffering)), but now there are just two of them :)..

Yes I know it's hidden after start, not a big deal, just thought that this was not intended behaviour...


Edited by mx3L, 19 March 2015 - 20:31.


Re: BufferIndicator is forced to every Screen #9 littlesat

  • PLi® Core member
  • 56,262 posts

+691
Excellent

Posted 19 March 2015 - 20:41

Thanks for your feedback at least and sorry that we did not understand eachother...
How did you arrange rebuffering... Because gstreamer is playing mad here... ;)

I hope you did create a nice plugin ;)

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: BufferIndicator is forced to every Screen #10 mx3L

  • Senior Member
  • 616 posts

+79
Good

Posted 19 March 2015 - 21:00

No worries :), rebuffering - I ment that once gstreamerStartEvent is emitted then you set mayShow to False to not to show buffering messages. I let these messages to show, since bandwidth can fluctuate and buffer can go down again causing rebuffering.

Thanks ;)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users