1
# PiTiVi , Non-linear video editor
5
# Copyright (c) 2005-2008, Edward Hervey <bilboed@bilboed.com>
6
# 2008,2009 Alessandro Decina <alessandro.decina@collabora.co.uk>
8
# This program is free software; you can redistribute it and/or
9
# modify it under the terms of the GNU Lesser General Public
10
# License as published by the Free Software Foundation; either
11
# version 2.1 of the License, or (at your option) any later version.
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
# Lesser General Public License for more details.
18
# You should have received a copy of the GNU Lesser General Public
19
# License along with this program; if not, write to the
20
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21
# Boston, MA 02110-1301, USA.
26
from pitivi.factories.base import RandomAccessSourceFactory, \
28
from pitivi.stream import MultimediaStream, AudioStream, VideoStream
31
class FileSourceFactory(RandomAccessSourceFactory):
33
Factory for local files.
35
@see: L{RandomAccessSourceFactory}.
38
def __init__(self, uri, name=''):
39
name = name or os.path.basename(uri)
40
RandomAccessSourceFactory.__init__(self, uri, name)
41
# FIXME: backward compatibility
45
class PictureFileSourceFactory(FileSourceFactory):
47
Factory for image sources.
49
@see: L{FileSourceFactory}, L{RandomAccessSourceFactory}.
52
duration = 3600 * gst.SECOND
53
default_duration = 5 * gst.SECOND
55
def _makeDefaultBin(self):
56
return self._makeStreamBin(self.output_streams[0])
58
def _makeStreamBin(self, output_stream, child_bin=None):
59
self.debug("making picture bin for %s", self.name)
60
freeze = gst.element_factory_make("imagefreeze")
62
self.debug("Chaining up with %r", freeze)
64
ret = FileSourceFactory._makeStreamBin(self, output_stream,
66
self.debug("Returning %r", ret)
71
class URISinkFactory(SinkFactory):
72
""" A simple sink factory """
74
def __init__(self, uri, *args, **kwargs):
76
SinkFactory.__init__(self, *args, **kwargs)
77
self.addInputStream(MultimediaStream(caps=gst.caps_new_any()))
79
def _makeBin(self, input_stream=None):
80
sink_element = gst.element_make_from_uri(gst.URI_SINK, self.uri)
81
sink_element.set_property("async", False)