~timo-jyrinki/ubuntu/trusty/pitivi/backport_utopic_fixes

« back to all changes in this revision

Viewing changes to pitivi/factories/operation.py

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-05-26 15:29:58 UTC
  • mfrom: (3.1.20 experimental)
  • Revision ID: james.westby@ubuntu.com-20110526152958-90je1myzzjly26vw
Tags: 0.13.9.90-1ubuntu1
* Resynchronize on Debian
* debian/control:
  - Depend on python-launchpad-integration
  - Drop hal from Recommends to Suggests. This version has the patch applied
    to not crash without hal.
* debian/patches/01_lpi.patch:
  - launchpad integration  
* debian/rules:
  - Use gnome.mk so a translation template is built

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
from pitivi.factories.base import OperationFactory
25
25
from pitivi.stream import AudioStream, VideoStream
26
26
 
 
27
from gettext import gettext as _
 
28
 
27
29
# FIXME: define a proper hierarchy
28
30
class OperationFactoryError(Exception):
29
31
    pass
54
56
    def _requestNewInputStream(self, *args):
55
57
        raise OperationFactoryError("TransformFactory doesn't allow request pads")
56
58
 
 
59
class EffectFactory (TransformFactory):
 
60
    """
 
61
    Factories that applies an effect on a stream
 
62
    """
 
63
    def __init__ (self, effect, name='', categories=[_("Uncategorized")],
 
64
                  human_name="", description="", icon=None):
 
65
        TransformFactory.__init__(self, name)
 
66
        self.effectname = effect
 
67
        self.categories = categories
 
68
        self.description = description
 
69
        self.human_name = human_name
 
70
        self._setIcon(icon)
 
71
 
 
72
    def getHumanName(self):
 
73
        return self.human_name
 
74
 
 
75
    def getDescription(self):
 
76
        return self.description
 
77
 
 
78
    def getCategories(self):
 
79
        return self.categories
 
80
 
 
81
    def _makeBin (self, *args):
 
82
        bin = gst.Bin()
 
83
        fx = gst.element_factory_make(self.effectname, "effect")
 
84
        if isinstance(self.input_streams[0], VideoStream):
 
85
            csp = gst.element_factory_make("ffmpegcolorspace")
 
86
        else:
 
87
            csp = gst.parse_bin_from_description("audioconvert ! audioresample",
 
88
                                                 True)
 
89
 
 
90
        bin.add(fx, csp)
 
91
        csp.link(fx)
 
92
 
 
93
        bin.add_pad(gst.GhostPad("sink", csp.get_pad("sink")))
 
94
        bin.add_pad(gst.GhostPad("src", fx.get_pad("src")))
 
95
 
 
96
        return bin
 
97
 
 
98
    def _releaseBin(self, bin):
 
99
        elements = bin.elements()
 
100
        for element in elements.next():
 
101
            del element
 
102
 
 
103
 
 
104
    def addInputStream(self, stream):
 
105
        return OperationFactory.addInputStream(self, stream)
 
106
 
 
107
    def addOutputStream(self, stream):
 
108
        return OperationFactory.addOutputStream(self, stream)
 
109
 
57
110
class StreamModifierFactory(TransformFactory):
58
111
    """
59
112
    Factories that modify the nature/type of a stream.