Added dynamic request size to the TV module. Makes playback much more stable in initial testing.
This commit is contained in:
parent
77bc6a25af
commit
1593e437b5
|
@ -81,12 +81,14 @@ class VideoController:
|
||||||
alpha = clutter.Alpha(timeline, clutter.ramp_inc_func)
|
alpha = clutter.Alpha(timeline, clutter.ramp_inc_func)
|
||||||
self.behaviour = clutter.BehaviourOpacity(alpha, 255,0)
|
self.behaviour = clutter.BehaviourOpacity(alpha, 255,0)
|
||||||
self.behaviour.apply(self.video_texture)
|
self.behaviour.apply(self.video_texture)
|
||||||
|
if not (self.blackdrop is None):
|
||||||
self.behaviour.apply(self.blackdrop)
|
self.behaviour.apply(self.blackdrop)
|
||||||
|
|
||||||
timeline.start()
|
timeline.start()
|
||||||
|
|
||||||
def end_video_event(self, data):
|
def end_video_event(self, data):
|
||||||
self.stage.remove(self.video_texture)
|
self.stage.remove(self.video_texture)
|
||||||
|
if not (self.blackdrop is None):
|
||||||
self.stage.remove(self.blackdrop)
|
self.stage.remove(self.blackdrop)
|
||||||
self.blackdrop = None
|
self.blackdrop = None
|
||||||
|
|
||||||
|
@ -143,11 +145,16 @@ class VideoController:
|
||||||
def set_fullscreen(self, texture, width, height):
|
def set_fullscreen(self, texture, width, height):
|
||||||
texture.set_property("sync-size", False)
|
texture.set_property("sync-size", False)
|
||||||
texture.set_position(0, 0)
|
texture.set_position(0, 0)
|
||||||
xy_ratio = float(height) / float(width)
|
ratio = float(self.stage.get_width()) / float(width)
|
||||||
#print "XY Ratio: " + str(xy_ratio)
|
xy_ratio = float(width) / float(height)
|
||||||
|
#print "Width: " + str(width)
|
||||||
|
#print "Height: " + str(height)
|
||||||
|
#print "XY Ratio: " + str(ratio)
|
||||||
|
|
||||||
width = int(self.stage.get_width())
|
width = int(self.stage.get_width())
|
||||||
height = int (width * xy_ratio)
|
height = int ((height * ratio))
|
||||||
|
#print "New Width: " + str(width)
|
||||||
|
#print "New Height: " + str(height)
|
||||||
|
|
||||||
if height < self.stage.get_height():
|
if height < self.stage.get_height():
|
||||||
#Create a black backdrop that the video can sit on
|
#Create a black backdrop that the video can sit on
|
||||||
|
|
|
@ -170,6 +170,8 @@ class MythBackendConnection(threading.Thread):
|
||||||
buffer_file_name = "test.mpg"
|
buffer_file_name = "test.mpg"
|
||||||
self.buffer_file = open(buffer_file_name,"w")
|
self.buffer_file = open(buffer_file_name,"w")
|
||||||
request_size = 32768
|
request_size = 32768
|
||||||
|
max_request_size = 135000
|
||||||
|
request_size_step = 16384
|
||||||
|
|
||||||
#Need to create a bit of a buffer so playback will begin
|
#Need to create a bit of a buffer so playback will begin
|
||||||
x=0
|
x=0
|
||||||
|
@ -193,6 +195,16 @@ class MythBackendConnection(threading.Thread):
|
||||||
data = data_sock.recv(num_bytes)
|
data = data_sock.recv(num_bytes)
|
||||||
self.buffer_file.write(data)
|
self.buffer_file.write(data)
|
||||||
|
|
||||||
|
#This tries to optimise the request size
|
||||||
|
#print "Received: " + str(num_bytes)
|
||||||
|
if (num_bytes == request_size) and (request_size < max_request_size):
|
||||||
|
request_size = request_size + request_size_step
|
||||||
|
if request_size > max_request_size:
|
||||||
|
request_size = max_request_size
|
||||||
|
elif (request_size > request_size_step):
|
||||||
|
request_size = request_size - request_size_step
|
||||||
|
|
||||||
|
|
||||||
print "Ending playback"
|
print "Ending playback"
|
||||||
self.buffer_file.close()
|
self.buffer_file.close()
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ class Module:
|
||||||
self.myConn.stop() # Stops the backend / frontend streaming
|
self.myConn.stop() # Stops the backend / frontend streaming
|
||||||
|
|
||||||
def stop_video(self):
|
def stop_video(self):
|
||||||
self.stop()
|
self.myConn.stop()
|
||||||
|
|
||||||
def on_key_press_event (self, stage, event):
|
def on_key_press_event (self, stage, event):
|
||||||
if self.isRunning:
|
if self.isRunning:
|
||||||
|
|
Loading…
Reference in New Issue