2004-09-13 07:31:31 +00:00
|
|
|
# -*- Mode: Python -*-
|
|
|
|
# vi:si:et:sw=4:sts=4:ts=4
|
2002-03-24 11:41:24 +00:00
|
|
|
#
|
|
|
|
# gst-python
|
|
|
|
# Copyright (C) 2002 David I. Lehn
|
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Library General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Library General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Library General Public
|
|
|
|
# License along with this library; if not, write to the
|
|
|
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
# Boston, MA 02111-1307, USA.
|
|
|
|
#
|
2002-12-17 17:40:42 +00:00
|
|
|
# Author: David I. Lehn <dlehn@users.sourceforge.net>
|
2002-03-24 11:41:24 +00:00
|
|
|
|
2005-08-31 15:28:37 +00:00
|
|
|
__ltihooks_used__ = False
|
2004-03-31 14:00:54 +00:00
|
|
|
try:
|
2005-08-31 15:28:37 +00:00
|
|
|
import ltihooks
|
|
|
|
__ltihooks_used__ = True
|
2004-03-31 14:00:54 +00:00
|
|
|
except:
|
|
|
|
pass
|
2002-03-24 07:57:00 +00:00
|
|
|
|
2005-09-28 07:40:15 +00:00
|
|
|
import pygtk
|
|
|
|
pygtk.require('2.0')
|
2004-05-03 16:51:50 +00:00
|
|
|
import gobject
|
|
|
|
del gobject
|
|
|
|
|
2004-07-15 09:48:22 +00:00
|
|
|
try:
|
|
|
|
import sys, DLFCN
|
|
|
|
sys.setdlopenflags(DLFCN.RTLD_LAZY | DLFCN.RTLD_GLOBAL)
|
|
|
|
del sys, DLFCN
|
|
|
|
except ImportError:
|
|
|
|
pass
|
2002-03-24 07:57:00 +00:00
|
|
|
|
2005-06-17 10:59:47 +00:00
|
|
|
class Value:
|
|
|
|
def __init__(self, type):
|
|
|
|
assert type in ('fourcc', 'intrange', 'doublerange', 'fraction')
|
|
|
|
self.type = type
|
|
|
|
|
|
|
|
class Fourcc(Value):
|
|
|
|
def __init__(self, string):
|
|
|
|
Value.__init__(self, 'fourcc')
|
|
|
|
self.fourcc = string
|
|
|
|
def __repr__(self):
|
|
|
|
return '<gst.Fourcc %s>' % self.fourcc
|
|
|
|
|
|
|
|
class IntRange(Value):
|
|
|
|
def __init__(self, low, high):
|
|
|
|
Value.__init__(self, 'intrange')
|
|
|
|
self.low = low
|
|
|
|
self.high = high
|
|
|
|
def __repr__(self):
|
|
|
|
return '<gst.IntRange [%d, %d]>' % (self.low, self.high)
|
|
|
|
|
|
|
|
class DoubleRange(Value):
|
|
|
|
def __init__(self, low, high):
|
|
|
|
Value.__init__(self, 'doublerange')
|
|
|
|
self.low = low
|
|
|
|
self.high = high
|
|
|
|
def __repr__(self):
|
|
|
|
return '<gst.DoubleRange [%f, %f]>' % (self.low, self.high)
|
|
|
|
|
|
|
|
class Fraction(Value):
|
|
|
|
def __init__(self, num, denom):
|
|
|
|
Value.__init__(self, 'fraction')
|
|
|
|
self.num = num
|
|
|
|
self.denom = denom
|
|
|
|
def __repr__(self):
|
|
|
|
return '<gst.Fraction %d/%d>' % (self.num, self.denom)
|
|
|
|
|
2004-02-23 18:19:38 +00:00
|
|
|
from _gst import *
|
2005-09-02 10:56:19 +00:00
|
|
|
import interfaces
|
|
|
|
|
2005-08-31 15:28:37 +00:00
|
|
|
# this restores previously installed importhooks, so we don't interfere
|
|
|
|
# with other people's module importers
|
|
|
|
# it also clears out the module completely as if it were never loaded,
|
|
|
|
# so that if anyone else imports ltihooks the hooks get installed
|
|
|
|
if __ltihooks_used__:
|
|
|
|
ltihooks.uninstall()
|
|
|
|
__ltihooks_used__ = False
|
|
|
|
del ltihooks
|
|
|
|
import sys
|
2005-09-29 01:16:21 +00:00
|
|
|
if 'ltihooks' in sys.modules:
|
|
|
|
del sys.modules['ltihooks']
|
|
|
|
|