~ubuntu-branches/ubuntu/lucid/pitivi/lucid

« back to all changes in this revision

Viewing changes to pitivi/ui/plumber.py

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2009-05-27 14:22:49 UTC
  • mfrom: (1.2.1 upstream) (3.1.13 experimental)
  • Revision ID: james.westby@ubuntu.com-20090527142249-tj0qnkc37320ylml
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
# PiTiVi , Non-linear video editor
3
 
#
4
 
#       ui/plumber.py
5
 
#
6
 
# Copyright (c) 2005, Edward Hervey <edward@fluendo.com>
7
 
#
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.
12
 
#
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.
17
 
#
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., 59 Temple Place - Suite 330,
21
 
# Boston, MA 02111-1307, USA.
22
 
 
23
 
"""
24
 
Convenience functions for creating the output media sinks
25
 
"""
26
 
 
27
 
#
28
 
# The plumber takes care of the sinks
29
 
#
30
 
# This is a required level of abstraction for the many different sinks that
31
 
# exist out there
32
 
#
33
 
 
34
 
import gobject
35
 
import gst
36
 
import gst.interfaces
37
 
 
38
 
def get_video_sink():
39
 
    """ Returns a video sink bin that can be used in the Discoverer """
40
 
    try:
41
 
        gconfsink = gst.element_factory_make("gconfvideosink")
42
 
    except:
43
 
        gconfsink = gst.element_factory_make("autovideosink")
44
 
    gconfsink.realsink = None
45
 
 
46
 
    gconfsink.set_state(gst.STATE_READY)
47
 
 
48
 
    if not gconfsink.implements_interface(gst.interfaces.XOverlay):
49
 
        gconfsink.info("doesn't implement XOverlay interface")
50
 
        realsink = gconfsink.get_by_interface(gst.interfaces.XOverlay)
51
 
        if not realsink:
52
 
            gst.info("%s" % list(gconfsink.elements()))
53
 
            gconfsink.warning("couldn't even find an XOverlay within!!!")
54
 
        else:
55
 
            realsink.info("implements XOverlay interface")
56
 
            gconfsink.set_xwindow_id = realsink.set_xwindow_id
57
 
            gconfsink.expose = realsink.expose
58
 
            gconfsink.realsink = realsink
59
 
    else:
60
 
        gconfsink.realsink = gconfsink
61
 
    if gconfsink.realsink:
62
 
        if "force-aspect-ratio"in [prop.name for prop in gobject.list_properties(gconfsink.realsink)]:
63
 
            gconfsink.realsink.set_property("force-aspect-ratio", True)
64
 
        if "qos"in [prop.name for prop in gobject.list_properties(gconfsink.realsink)]:
65
 
            gconfsink.realsink.set_property("qos", False)
66
 
        if "max-lateness"in [prop.name for prop in gobject.list_properties(gconfsink.realsink)]:
67
 
            gconfsink.realsink.set_property("max-lateness", -1)
68
 
    return gconfsink
69
 
 
70
 
def get_audio_sink():
71
 
    """ Returns an audio sink bin that can be used in the Discoverer """
72
 
    try:
73
 
        gconfsink = gst.element_factory_make("gconfaudiosink")
74
 
    except:
75
 
        gconfsink = gst.element_factory_make("autoaudiosink")
76
 
    return gconfsink