Added dynamic request size to the TV module. Makes playback much more stable in initial testing.

This commit is contained in:
noisymime 2007-11-20 10:57:49 +00:00
parent 77bc6a25af
commit 1593e437b5
3 changed files with 26 additions and 7 deletions

View File

@ -81,13 +81,15 @@ class VideoController:
alpha = clutter.Alpha(timeline, clutter.ramp_inc_func)
self.behaviour = clutter.BehaviourOpacity(alpha, 255,0)
self.behaviour.apply(self.video_texture)
self.behaviour.apply(self.blackdrop)
if not (self.blackdrop is None):
self.behaviour.apply(self.blackdrop)
timeline.start()
def end_video_event(self, data):
self.stage.remove(self.video_texture)
self.stage.remove(self.blackdrop)
if not (self.blackdrop is None):
self.stage.remove(self.blackdrop)
self.blackdrop = None
def customBin(self):
@ -143,11 +145,16 @@ class VideoController:
def set_fullscreen(self, texture, width, height):
texture.set_property("sync-size", False)
texture.set_position(0, 0)
xy_ratio = float(height) / float(width)
#print "XY Ratio: " + str(xy_ratio)
ratio = float(self.stage.get_width()) / float(width)
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())
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():
#Create a black backdrop that the video can sit on

View File

@ -169,7 +169,9 @@ class MythBackendConnection(threading.Thread):
#Create a buffer file
buffer_file_name = "test.mpg"
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
x=0
@ -192,6 +194,16 @@ class MythBackendConnection(threading.Thread):
num_bytes = int(self.receive_reply(cmd_sock))
data = data_sock.recv(num_bytes)
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"
self.buffer_file.close()

View File

@ -68,7 +68,7 @@ class Module:
self.myConn.stop() # Stops the backend / frontend streaming
def stop_video(self):
self.stop()
self.myConn.stop()
def on_key_press_event (self, stage, event):
if self.isRunning: