24
24
from pitivi.factories.base import OperationFactory
25
25
from pitivi.stream import AudioStream, VideoStream
27
from gettext import gettext as _
27
29
# FIXME: define a proper hierarchy
28
30
class OperationFactoryError(Exception):
54
56
def _requestNewInputStream(self, *args):
55
57
raise OperationFactoryError("TransformFactory doesn't allow request pads")
59
class EffectFactory (TransformFactory):
61
Factories that applies an effect on a stream
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
72
def getHumanName(self):
73
return self.human_name
75
def getDescription(self):
76
return self.description
78
def getCategories(self):
79
return self.categories
81
def _makeBin (self, *args):
83
fx = gst.element_factory_make(self.effectname, "effect")
84
if isinstance(self.input_streams[0], VideoStream):
85
csp = gst.element_factory_make("ffmpegcolorspace")
87
csp = gst.parse_bin_from_description("audioconvert ! audioresample",
93
bin.add_pad(gst.GhostPad("sink", csp.get_pad("sink")))
94
bin.add_pad(gst.GhostPad("src", fx.get_pad("src")))
98
def _releaseBin(self, bin):
99
elements = bin.elements()
100
for element in elements.next():
104
def addInputStream(self, stream):
105
return OperationFactory.addInputStream(self, stream)
107
def addOutputStream(self, stream):
108
return OperationFactory.addOutputStream(self, stream)
57
110
class StreamModifierFactory(TransformFactory):
59
112
Factories that modify the nature/type of a stream.