diff --git a/VideoController.py b/VideoController.py index 45c6903..a39a371 100644 --- a/VideoController.py +++ b/VideoController.py @@ -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 diff --git a/modules/myth_tv_player/MythBackendConn.py b/modules/myth_tv_player/MythBackendConn.py index da2366e..f8f94b9 100644 --- a/modules/myth_tv_player/MythBackendConn.py +++ b/modules/myth_tv_player/MythBackendConn.py @@ -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() diff --git a/modules/myth_tv_player/myth_tv_player.py b/modules/myth_tv_player/myth_tv_player.py index 329de3e..aa96af6 100644 --- a/modules/myth_tv_player/myth_tv_player.py +++ b/modules/myth_tv_player/myth_tv_player.py @@ -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: