[pitivi] Discoverer: Limit size of video to thumbnail to 720x720.



commit ab81f4fd774e046d86bec93ec39a665c5973968e
Author: Edward Hervey <bilboed bilboed com>
Date:   Sun May 10 11:55:49 2009 +0200

    Discoverer: Limit size of video to thumbnail to 720x720.
    
    We use videoscale in nearest-neighbour mode (which is faster).
---
 pitivi/discoverer.py |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/pitivi/discoverer.py b/pitivi/discoverer.py
index b712502..c964dcd 100644
--- a/pitivi/discoverer.py
+++ b/pitivi/discoverer.py
@@ -407,24 +407,28 @@ class Discoverer(Signallable, Loggable):
 
     def _newVideoPadCb(self, pad):
         """ a new video pad was found """
-        self.debug("pad %s", pad)
+        self.debug("pad %r", pad)
 
         queue = gst.element_factory_make("queue")
         queue.props.max_size_bytes = 5 * 1024 * 1024
         queue.props.max_size_time = 5 * gst.SECOND
+        vscale = gst.element_factory_make("videoscale")
+        vscale.props.method = 0
         csp = gst.element_factory_make("ffmpegcolorspace")
         pngenc = gst.element_factory_make("pngenc")
         pngsink = gst.element_factory_make("filesink")
         self.thumbnails[pad] = thumbnail = self._getThumbnailFilenameFromPad(pad)
         pngsink.props.location = thumbnail
 
-        self.dynamic_elements.extend([queue, csp, pngenc, pngsink])
+        self.dynamic_elements.extend([queue, vscale, csp, pngenc, pngsink])
 
-        self.pipeline.add(queue, csp, pngenc, pngsink)
-        gst.element_link_many(queue, csp, pngenc, pngsink)
+        self.pipeline.add(queue, vscale, csp, pngenc, pngsink)
+        queue.link(vscale)
+        vscale.link(csp, gst.Caps("video/x-raw-rgb,width=[1,720],height=[1,720];video/x-raw-yuv,width=[1,720],height=[1,720]"))
+        gst.element_link_many(csp, pngenc, pngsink)
         pad.link(queue.get_pad("sink"))
 
-        for element in [queue, csp, pngenc, pngsink]:
+        for element in [queue, vscale, csp, pngenc, pngsink]:
             element.sync_state_with_parent()
 
     def _newPadCb(self, pad):



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