pitivi r1182 - in branches/SOC_2008_BLEWIS: . pitivi pitivi/ui



Author: edwardrv
Date: Thu Jul 17 15:55:06 2008
New Revision: 1182
URL: http://svn.gnome.org/viewvc/pitivi?rev=1182&view=rev

Log:
* pitivi/discoverer.py:
* pitivi/objectfactory.py:
* pitivi/ui/sourcefactories.py:
Initial still image support. They now properly load in the source list,
but are still not usable in the timeline.


Modified:
   branches/SOC_2008_BLEWIS/ChangeLog
   branches/SOC_2008_BLEWIS/pitivi/discoverer.py
   branches/SOC_2008_BLEWIS/pitivi/objectfactory.py
   branches/SOC_2008_BLEWIS/pitivi/ui/sourcefactories.py

Modified: branches/SOC_2008_BLEWIS/pitivi/discoverer.py
==============================================================================
--- branches/SOC_2008_BLEWIS/pitivi/discoverer.py	(original)
+++ branches/SOC_2008_BLEWIS/pitivi/discoverer.py	Thu Jul 17 15:55:06 2008
@@ -89,6 +89,7 @@
         self.error = None # reason for error
         self.extrainfo = None # extra information about the error
         self.fakesink = None
+        self.isimage = False # Used to know if the file is an image
 
     def addFile(self, filename):
         """ queue a filename to be discovered """
@@ -153,7 +154,9 @@
             self.emit('not_media_file', self.current, self.error, self.extrainfo)
         elif self.currentfactory:
             self.currentfactory.addMediaTags(self.currentTags)
-            if not self.currentfactory.length:
+            if self.isimage:
+                self.currentfactory.setThumbnail(gst.uri_get_location(self.current))
+            if not self.currentfactory.length and not self.isimage:
                 self.emit('not_media_file', self.current,
                           _("Could not establish the duration of the file."),
                           _("This clip seems to be in a format which cannot be accessed in a random fashion."))
@@ -169,6 +172,7 @@
         self.nomorepads = False
         self.error = None
         self.extrainfo = None
+        self.isimage = False
 
         # restart an analysis if there's more...
         if self.queue:
@@ -211,6 +215,8 @@
         self.signalsid.append((dbin, dbin.connect("new-decoded-pad", self._newDecodedPadCb)))
         self.signalsid.append((dbin, dbin.connect("unknown-type", self._unknownTypeCb)))
         self.signalsid.append((dbin, dbin.connect("no-more-pads", self._noMorePadsCb)))
+        tfind = dbin.get_by_name("typefind")
+        self.signalsid.append((tfind, tfind.connect("have-type", self._typefindHaveTypeCb)))
         self.pipeline.add(source, dbin)
         source.link(dbin)
         gst.info("analysis pipeline created")
@@ -237,6 +243,10 @@
         # return False so we don't get called again
         return False
 
+    def _typefindHaveTypeCb(self, typefind, perc, caps):
+        if caps.to_string().startswith("image/"):
+            self.isimage = True
+
     def _busMessageCb(self, unused_bus, message):
         if self.thisdone:
             return
@@ -250,7 +260,7 @@
                     # Let's get the information from all the pads
                     self._getPadsInfo()
                     # Only go to PLAYING if we have an video stream to thumbnail
-                    if self.currentfactory and self.currentfactory.is_video:
+                    if self.currentfactory and self.currentfactory.is_video and not self.isimage:
                         gst.log("pipeline has gone to PAUSED, now pushing to PLAYING")
                         if self.pipeline.set_state(gst.STATE_PLAYING) == gst.STATE_CHANGE_FAILURE:
                             if not self.error:
@@ -290,7 +300,7 @@
 
     def _handleError(self, gerror, detail, unused_source):
         gst.warning("got an ERROR")
-        
+
         if not self.error:
             self.error = _("An internal error occured while analyzing this file : %s") % gerror.message
             self.extrainfo = detail

Modified: branches/SOC_2008_BLEWIS/pitivi/objectfactory.py
==============================================================================
--- branches/SOC_2008_BLEWIS/pitivi/objectfactory.py	(original)
+++ branches/SOC_2008_BLEWIS/pitivi/objectfactory.py	Thu Jul 17 15:55:06 2008
@@ -312,8 +312,11 @@
                                                                                                        gst.TIME_ARGS(value)))
             self.length = value
         elif property.name == "thumbnail":
+            gst.debug("thumbnail : %s" % value)
             if os.path.isfile(value):
                 self.thumbnail = value
+            else:
+                gst.warning("Thumbnail path is invalid !")
         else:
             ObjectFactory.do_set_property(self, property, value)
 

Modified: branches/SOC_2008_BLEWIS/pitivi/ui/sourcefactories.py
==============================================================================
--- branches/SOC_2008_BLEWIS/pitivi/ui/sourcefactories.py	(original)
+++ branches/SOC_2008_BLEWIS/pitivi/ui/sourcefactories.py	Thu Jul 17 15:55:06 2008
@@ -339,6 +339,7 @@
         try:
             pixbuf = gtk.gdk.pixbuf_new_from_file(factory.thumbnail)
         except:
+            gst.error("Failure to create thumbnail from file %s" % factory.thumbnail)
             if factory.is_video:
                 thumbnail = self.videofilepixbuf
             elif factory.is_audio:
@@ -355,7 +356,7 @@
                                 factory.getPrettyInfo(),
                                 factory,
                                 factory.name,
-                                "<b>%s</b>" % beautify_length(factory.length)])
+                                factory.length and "<b>%s</b>" % beautify_length(factory.length) or ""])
         self._displayTreeView()
 
     # sourcelist callbacks



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]