2
# vi:si:et:sw=4:sts=4:ts=4
5
# Copyright (C) 2002 David I. Lehn
7
# This library is free software; you can redistribute it and/or
8
# modify it under the terms of the GNU Library General Public
9
# License as published by the Free Software Foundation; either
10
# version 2 of the License, or (at your option) any later version.
12
# This library is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
# Library General Public License for more details.
17
# You should have received a copy of the GNU Library General Public
18
# License along with this library; if not, write to the
19
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
# Boston, MA 02111-1307, USA.
22
# Author: David I. Lehn <dlehn@users.sourceforge.net>
24
__ltihooks_used__ = False
27
__ltihooks_used__ = True
33
# we always require 2.0 of pygtk; so if pygtk is not imported anywhere
34
# yet, we import pygtk here and .require
35
if 'gobject' not in sys.modules:
40
def __init__(self, type):
41
assert type in ('fourcc', 'intrange', 'doublerange', 'fractionrange', 'fraction')
45
def __init__(self, string):
46
Value.__init__(self, 'fourcc')
49
return '<gst.Fourcc %s>' % self.fourcc
51
class IntRange(Value):
52
def __init__(self, low, high):
53
Value.__init__(self, 'intrange')
57
return '<gst.IntRange [%d, %d]>' % (self.low, self.high)
59
class DoubleRange(Value):
60
def __init__(self, low, high):
61
Value.__init__(self, 'doublerange')
65
return '<gst.DoubleRange [%f, %f]>' % (self.low, self.high)
67
class FractionRange(Value):
68
def __init__(self, low, high):
69
Value.__init__(self, 'fractionrange')
73
return '<gst.FractionRange [%d/%d, %d/%d]>' % (self.low.num,
78
class Fraction(Value):
79
def __init__(self, num, denom):
80
Value.__init__(self, 'fraction')
84
return '<gst.Fraction %d/%d>' % (self.num, self.denom)
87
dlsave = sys.getdlopenflags()
88
sys.setdlopenflags(DLFCN.RTLD_LAZY | DLFCN.RTLD_GLOBAL)
93
version = get_gst_version
95
sys.setdlopenflags(dlsave)
98
# this restores previously installed importhooks, so we don't interfere
99
# with other people's module importers
100
# it also clears out the module completely as if it were never loaded,
101
# so that if anyone else imports ltihooks the hooks get installed
102
if __ltihooks_used__:
104
__ltihooks_used__ = False
107
del sys.modules['ltihooks']