/usr/lib/python2.7/dist-packages/gst-0.10/gst/__init__.py is in python-gst0.10 0.10.22-3ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | # -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# 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.
#
# Author: David I. Lehn <dlehn@users.sourceforge.net>
try:
import gstlibtoolimporter
gstlibtoolimporter.install()
except ImportError:
gstlibtoolimporter = None
import sys
# we always require 2.0 of pygtk; so if pygtk is not imported anywhere
# yet, we import pygtk here and .require
if 'gobject' not in sys.modules:
import pygtk
pygtk.require('2.0')
class Value:
def __init__(self, type):
assert type in ('fourcc', 'intrange', 'doublerange', 'fractionrange', '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
def __eq__(self, other):
if isinstance(other, Fourcc):
return self.fourcc == other.fourcc
return False
def __ne__(self, other):
return not self.__eq__(other)
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 FractionRange(Value):
def __init__(self, low, high):
Value.__init__(self, 'fractionrange')
self.low = low
self.high = high
def __repr__(self):
return '<gst.FractionRange [%d/%d, %d/%d]>' % (self.low.num,
self.low.denom,
self.high.num,
self.high.denom)
class Fraction(Value):
def __init__(self, num, denom=1):
def __gcd(a,b):
while b != 0:
tmp = a
a = b
b = tmp % b
return abs(a)
def __simplify():
num = self.num
denom = self.denom
if num < 0:
num = -num
denom = -denom
# Compute greatest common divisor
gcd = __gcd(num,denom)
if gcd != 0:
num /= gcd
denom /= gcd
self.num = num
self.denom = denom
Value.__init__(self, 'fraction')
self.num = num
self.denom = denom
__simplify()
def __repr__(self):
return '<gst.Fraction %d/%d>' % (self.num, self.denom)
def __eq__(self, other):
if isinstance(other, Fraction):
return self.num * other.denom == other.num * self.denom
return False
def __ne__(self, other):
return not self.__eq__(other)
def __mul__(self, other):
if isinstance(other, Fraction):
return Fraction(self.num * other.num,
self.denom * other.denom)
elif isinstance(other, int):
return Fraction(self.num * other, self.denom)
raise TypeError
__rmul__ = __mul__
def __div__(self, other):
if isinstance(other, Fraction):
return Fraction(self.num * other.denom,
self.denom * other.num)
elif isinstance(other, int):
return Fraction(self.num, self.denom * other)
return TypeError
def __rdiv__(self, other):
if isinstance(other, int):
return Fraction(self.denom * other, self.num)
return TypeError
def __float__(self):
return float(self.num) / float(self.denom)
try:
dlsave = sys.getdlopenflags()
from DLFCN import RTLD_GLOBAL, RTLD_LAZY
except AttributeError:
# windows doesn't have sys.getdlopenflags()
RTLD_GLOBAL = -1
RTLD_LAZY = -1
except ImportError:
RTLD_GLOBAL = -1
RTLD_LAZY = -1
import os
osname = os.uname()[0]
if osname == 'Linux' or osname == 'SunOS' or osname == 'FreeBSD' or osname == 'GNU/kFreeBSD' or osname == 'GNU':
machinename = os.uname()[4]
if machinename == 'mips' or machinename == 'mips64':
RTLD_GLOBAL = 0x4
RTLD_LAZY = 0x1
else:
RTLD_GLOBAL = 0x100
RTLD_LAZY = 0x1
elif osname == 'Darwin':
RTLD_GLOBAL = 0x8
RTLD_LAZY = 0x1
del os
except:
RTLD_GLOBAL = -1
RTLD_LAZY = -1
if RTLD_GLOBAL != -1 and RTLD_LAZY != -1:
sys.setdlopenflags(RTLD_LAZY | RTLD_GLOBAL)
try:
import libxml2
except:
pass
from _gst import *
import interfaces
if RTLD_GLOBAL != -1 and RTLD_LAZY != -1:
sys.setdlopenflags(dlsave)
del sys
version = get_gst_version
# Fixes for API cleanups that would cause an API breakage.
# See #446674
import warnings
if locals().has_key("parse_bin_from_description"):
def gst_parse_bin_from_description(*args, **kwargs):
warnings.warn("gst_parse_bin_from_description() is deprecated, please use parse_bin_from_description instead",
DeprecationWarning)
return parse_bin_from_description(*args, **kwargs)
if locals().has_key("message_new_buffering"):
def gst_message_new_buffering(*args, **kwargs):
warnings.warn("gst_message_new_buffering() is deprecated, please use message_new_buffering() instead",
DeprecationWarning)
return message_new_buffering(*args, **kwargs)
# 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 gstltihooks the hooks get installed
if gstlibtoolimporter is not None:
import audio
import pbutils
import tag
import video
gstlibtoolimporter.uninstall()
import sys
del sys.modules["gstlibtoolimporter"]
|