~ubuntu-branches/ubuntu/trusty/pitivi/trusty

« back to all changes in this revision

Viewing changes to pitivi/ui/plumber.py

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2006-02-04 14:42:30 UTC
  • Revision ID: james.westby@ubuntu.com-20060204144230-9ihvyas6lhgn81k1
Tags: upstream-0.9.9.2
ImportĀ upstreamĀ versionĀ 0.9.9.2

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
# The plumber takes care of the sinks
 
25
#
 
26
# This is a required level of abstraction for the many different sinks that
 
27
# exist out there
 
28
#
 
29
 
 
30
import gobject
 
31
import gst
 
32
import gst.interfaces
 
33
 
 
34
def get_video_sink(pitivi):
 
35
    """ Returns a video sink bin that can be used in the Discoverer """
 
36
    try:
 
37
        gconfsink = gst.element_factory_make("gconfvideosink")
 
38
    except:
 
39
        gconfsink = gst.element_factory_make("autovideosink")
 
40
    gconfsink.realsink = None
 
41
    
 
42
    gconfsink.set_state(gst.STATE_READY)
 
43
    
 
44
    if not gconfsink.implements_interface(gst.interfaces.XOverlay):
 
45
        gconfsink.info("doesn't implement XOverlay interface")
 
46
        realsink = gconfsink.get_by_interface(gst.interfaces.XOverlay)
 
47
        if not realsink:
 
48
            gst.info("%s" % list(gconfsink.elements()))
 
49
            gconfsink.warning("couldn't even find an XOverlay within!!!")
 
50
        else:
 
51
            realsink.info("implements XOverlay interface")
 
52
            gconfsink.set_xwindow_id = realsink.set_xwindow_id
 
53
            gconfsink.expose = realsink.expose
 
54
            gconfsink.realsink = realsink
 
55
    else:
 
56
        gconfsink.realsink = gconfsink
 
57
    if gconfsink.realsink:
 
58
        if "force-aspect-ratio"in [prop.name for prop in gobject.list_properties(gconfsink.realsink)]:
 
59
            gconfsink.realsink.set_property("force-aspect-ratio", True)
 
60
    return gconfsink
 
61
 
 
62
def get_audio_sink(pitivi):
 
63
    """ Returns an audio sink bin that can be used in the Discoverer """
 
64
    try:
 
65
        gconfsink = gst.element_factory_make("gconfaudiosink")
 
66
    except:
 
67
        gconfsink = gst.element_factory_make("autoaudiosink")
 
68
    return gconfsink