← Back to team overview

openshot.code team mailing list archive

[Branch ~openshot.code/openshot/main] Rev 499: Fixed bug #602638, FLAC support. Previously, FLAC files were being identified as image type files...

 

------------------------------------------------------------
revno: 499
committer: Andy Finch <we.rocked.in79@xxxxxxxxx>
branch nick: openshot
timestamp: Thu 2011-08-11 22:59:28 +0100
message:
  Fixed bug #602638, FLAC support. Previously, FLAC files were being identified as image type files. By checking some extra properties during the import we can now more reliably identify them. Using this method also exposes some extra file information, such as video and audio codecs, audio frequency etc., that are available on the file object, should we wish to display them anywhere. The FLAC files get imported with the correct length and play ok on the timeline - but you cannot seek within them, this seems to be a ffmpeg limitation.
modified:
  openshot/classes/files.py
  openshot/classes/thumbnail.py
  openshot/windows/FileProperties.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/files.py'
--- openshot/classes/files.py	2011-08-11 19:33:49 +0000
+++ openshot/classes/files.py	2011-08-11 21:59:28 +0000
@@ -54,6 +54,11 @@
 		self.parent = None
 		self.project = project	  # reference to project
 		
+		self.video_codec = ""
+		self.audio_codec = ""
+		self.audio_frequency = ""
+		self.audio_channels = ""
+		
 		
 	def get_thumbnail(self, width, height):
 		"""Get and resize the pixbuf thumbnail for a file"""	

=== modified file 'openshot/classes/thumbnail.py'
--- openshot/classes/thumbnail.py	2011-01-31 00:57:46 +0000
+++ openshot/classes/thumbnail.py	2011-08-11 21:59:28 +0000
@@ -95,13 +95,39 @@
 				height = int(self.p.get("height"))
 			if self.p.get("width"):
 				width = int(self.p.get("width"))
-
+				
+			audio_index = self.p.get_int("audio_index")
+			video_index = self.p.get_int("video_index")
+			audio_property = "meta.media.%s.codec.long_name" % audio_index
+			if self.p.get(audio_property):
+				self.audio_codec = self.p.get(audio_property)
+			else:
+				self.audio_codec = ""
+					
+			video_property = "meta.media.%s.codec.long_name" % video_index
+			if self.p.get(video_property):
+				self.video_codec = self.p.get(video_property)
+			else:
+				self.video_codec = ""
+			
+			if self.p.get_frame():
+				frame = self.p.get_frame()
+				self.audio_frequency = frame.get_int("frequency")
+				self.audio_channels = frame.get_int("channels")
+			
 			# determine if this is an image
 			is_image = False
-			if self.p.get_length() == 15000:
+			if self.p.get_length() == 15000 and video_index == 0 and audio_index == 0:
 				# images always have exactly 15000 frames
 				is_image = True
-				self.file_type = "image"
+				self.file_type = "image"	
+
+			# determine if this is an image
+			#is_image = False
+			#if self.p.get_length() == 15000:
+				# images always have exactly 15000 frames
+				#is_image = True
+				#self.file_type = "image"
 				
 				# set the max length of the image to 300 seconds (i.e. 5 minutes)
 				max_frames = producer_fps * 300
@@ -148,6 +174,10 @@
 			newFile.fps = producer_fps
 			newFile.file_type = self.file_type
 			newFile.label = self.label
+			newFile.audio_channels = self.audio_channels
+			newFile.audio_codec = self.audio_codec
+			newFile.audio_frequency = self.audio_frequency
+			newFile.video_codec = self.video_codec
 
 			# return the OpenShotFile object
 			return newFile

=== modified file 'openshot/windows/FileProperties.py'
--- openshot/windows/FileProperties.py	2011-07-18 21:18:29 +0000
+++ openshot/windows/FileProperties.py	2011-08-11 21:59:28 +0000
@@ -67,7 +67,7 @@
 		#video specific properties
 			self.lblRateValue.set_label(str(file.videorate[0]) + "/" + str(file.videorate[1]))
 			self.lblSizeValue.set_label(str(file.width) + " x " + str(file.height))
-			
+		
 		else:
 			self.lblRate.set_sensitive(False)
 			self.lblSize.set_sensitive(False)