← Back to team overview

openshot.code team mailing list archive

[Branch ~openshot.code/openshot/main] Rev 672: Set the length property on the clips producer to prevent transition glitches.

 

------------------------------------------------------------
revno: 672
committer: Andy Finch <we.rocked.in79@xxxxxxxxx>
branch nick: openshot
timestamp: Tue 2012-05-22 21:04:06 +0100
message:
  Set the length property on the clips producer to prevent transition glitches.
modified:
  openshot/classes/clip.py
  openshot/windows/MainGTK.py


--
lp:openshot
https://code.launchpad.net/~openshot.code/openshot/main

Your team OpenShot Code is subscribed to branch lp:openshot.
To unsubscribe from this branch go to https://code.launchpad.net/~openshot.code/openshot/main/+edit-subscription
=== modified file 'openshot/classes/clip.py'
--- openshot/classes/clip.py	2012-05-06 20:50:56 +0000
+++ openshot/classes/clip.py	2012-05-22 20:04:06 +0000
@@ -416,7 +416,16 @@
 		producer.setAttribute("id", self.unique_id)
 		producer.setAttribute("novdpau", "1")
 		producer.setAttribute("in", str(int(round(in_frame_number))))
-		producer.setAttribute("out", str(int(round(out_frame_number))))
+		# need to set the out & length producer properties to prevent glitches
+		if out_frame_number + 1 >= self.file_object.max_frames:
+			producer.setAttribute("out", str(int(round(self.file_object.max_frames - 1))))	
+		elif (out_frame_number >= self.file_object.max_frames):
+			producer.setAttribute("out", str(int(round(self.file_object.max_frames - 1))))
+		else:
+			producer.setAttribute("out", str(int(round(out_frame_number))))
+		
+		if self.parent.name != "Background Track":
+			producer.setAttribute("length", str(int(round(self.file_object.max_frames))))
 
 		# hide video (if needed)
 		if self.play_video == False or self.parent.play_video == False:

=== modified file 'openshot/windows/MainGTK.py'
--- openshot/windows/MainGTK.py	2012-05-19 21:03:16 +0000
+++ openshot/windows/MainGTK.py	2012-05-22 20:04:06 +0000
@@ -1440,7 +1440,7 @@
 			else:
 				distance_from_clip = 0.0
 			
-			# Animate the transition to it's new position
+			# Animate the clip to it's new position
 			self.new_clip.animate(distance_from_clip, float(drop_track.y_top) - float(self.new_clip.get_bounds().y1) + 2.0, 1.0, 0.0, False, 200, 4, goocanvas.ANIMATE_FREEZE)
 			
 			# move the clip object on the timeline to correct position (snapping to the y and x of the track)		
@@ -1448,7 +1448,7 @@
 			
 			# update clip's settings
 			self.new_clip_object.update(self.new_clip.get_bounds().x1, self.new_clip.get_bounds().y1, drop_track) 
-			
+						
 			# check if the timeline needs to be expanded
 			self.expand_timeline(self.new_clip_object)
 			
@@ -1472,8 +1472,7 @@
 
 		return False
 	#////////////////////
-
-
+	
 	def expand_timeline(self, clip_object):
 		""" Determine if the timeline needs to be expanded. """
 		# get end time of dropped clip