This file is indexed.

/usr/lib/sltv/videomixer.py is in landell 0.92.1-1.1ubuntu1.

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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Holoscópio Tecnologia
# Author: Luciana Fujii Pontello <luciana@holoscopio.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

import gobject
import pygst
pygst.require("0.10")
import gst
from log import Log

class PictureInPicture(gst.Bin):

    __gproperties__ = {
            'width' : (gobject.TYPE_INT,                  # type
                        'width',                          # nick name
                        'Width of bigger video',          # description
                        0,                                # minimum value
                        32767,                            # maximum value
                        320,                              # default value
                        gobject.PARAM_READWRITE),         # flags

            'height' : (gobject.TYPE_INT,                 # type
                        'height',                         # nick name
                        'height of bigger video',         # description
                        0,                                # minimum value
                        32767,                            # maximum value
                        240,                              # default value
                        gobject.PARAM_READWRITE),         # flags

            'xposition' : (gobject.TYPE_INT,              # type
                        'Position X',                     # nick name
                        'PIP X coordinate',               # description
                        0,                                # minimum value
                        32767,                            # maximum value
                        0,                                # default value
                        gobject.PARAM_READWRITE),         # flags

            'yposition' : (gobject.TYPE_INT,              # type
                        'Position Y',                     # nick name
                        'PIP Y coordinate',               # description
                        0,                                # minimum value
                        32767,                            # maximum value
                        0,                                # default value
                        gobject.PARAM_READWRITE),         # flags
            'enabled' : (gobject.TYPE_BOOLEAN,            # type
                        'status',                         # nick name
                        'Status of pip',                  # description
                        True,                             # default value
                        gobject.PARAM_READWRITE),         # flags
            'position' : (gobject.TYPE_INT,               # type
                        'position',                       # nick name
                        'Selected position',              # description
                        0,                                # minimum value
                        3,                                # maximum value
                        0,                                # default value
                        gobject.PARAM_READWRITE),         # flags
            'a-active' : (gobject.TYPE_INT,               # type
                          'Active A',                     # nick name
                          'A Pad to be active',           # description
                          0,                              # minimum value
                          32,                             # maximum value
                          0,                              # default value
                          gobject.PARAM_READWRITE),       # flags
            'b-active' : (gobject.TYPE_INT,               # type
                          'Active B',                     # nick name
                          'B Pad to be active',           # description
                          0,                              # minimum value
                          32,                             # maximum value
                          0,                              # default value
                          gobject.PARAM_READWRITE),       # flags
    }

    def __init__(self):
        gst.Bin.__init__(self)

        self.width = 320
        self.height = 240
        self.x_position = 0
        self.y_position = 0
        self.enabled = True
        self.position = 0

        self.videomixer = gst.element_factory_make("videomixer2", "videomixer")
        self.add(self.videomixer)
        self.caps = self.make_caps(self.width, self.height)

        self.csp = gst.element_factory_make("ffmpegcolorspace", "pip_csp")
        self.add(self.csp)

        self.A_capsfilter = []
        self.B_capsfilter = []
        self.A_pads = []
        self.B_pads = []

        self.videomixer.link(self.csp)

        src_pad = gst.GhostPad("src", self.csp.src_pads().next())
        self.add_pad(src_pad)

        self.A_number = 0
        self.B_number = 0

        self.a_active = 0
        self._set_active_a(self.a_active)
        self.b_active = 0
        self._set_active_b(self.b_active)

    def get_request_pad_A(self):
        return self._create_A_input()

    def get_request_pad_B(self):
        return self._create_B_input()

    def _create_A_input(self):
        A_videoscale = gst.element_factory_make(
                "videoscale", None
        )
        self.add(A_videoscale)
        A_videorate = gst.element_factory_make(
                "videorate", None
        )
        self.add(A_videorate)
        A_capsfilter = gst.element_factory_make(
                "capsfilter", None
        )
        self.add(A_capsfilter)
        self.A_capsfilter.append(A_capsfilter)
        A_csp = gst.element_factory_make(
                "ffmpegcolorspace", None
        )
        self.add(A_csp)
        A_alpha = gst.element_factory_make(
                "alpha", None
        )
        self.add(A_alpha)
        A_capsfilter.set_property("caps", self.caps['A'])

        gst.element_link_many(
                A_videoscale, A_videorate, A_csp, A_alpha, A_capsfilter
        )

        pad = self.videomixer.get_pad("sink_%d")
        pad.set_property("zorder",1)
        pad.set_property("xpos",0)
        pad.set_property("ypos",0)
        A_capsfilter.src_pads().next().link(pad)
        self.A_pads.append(pad)

        sink_pad = gst.GhostPad(
                "sink_a_%d" % self.A_number, A_videoscale.sink_pads().next()
        )
        self.add_pad(sink_pad)
        self.A_number = self.A_number + 1
        return sink_pad

    def _create_B_input(self):
        B_videoscale = gst.element_factory_make(
                "videoscale", None
        )
        self.add(B_videoscale)
        B_videorate = gst.element_factory_make(
                "videorate", None
        )
        self.add(B_videorate)
        B_capsfilter = gst.element_factory_make(
                "capsfilter", None
        )
        self.add(B_capsfilter)
        self.B_capsfilter.append(B_capsfilter)
        B_capsfilter.set_property("caps", self.caps['B'])
        B_csp = gst.element_factory_make(
                "ffmpegcolorspace", None
        )
        B_alpha = gst.element_factory_make("alpha", None)
        self.add(B_alpha)
        self.add(B_csp)

        gst.element_link_many(
                B_videoscale, B_videorate, B_csp, B_alpha, B_capsfilter
        )

        pad = self.videomixer.get_pad("sink_%d")
        pad.set_property("zorder", 10)
        pad.set_property("xpos",0)
        pad.set_property("ypos",0)
        B_capsfilter.src_pads().next().link(pad)
        self.B_pads.append(pad)

        sink_pad = gst.GhostPad(
                "sink_b_%d" % self.B_number, B_videoscale.sink_pads().next()
        )
        self.add_pad(sink_pad)
        self.B_number = self.B_number + 1
        return sink_pad

    def make_caps(self, width, height):
        caps = {}
        inside_width = width/3
        inside_height = height/3
        resolution = ",width=" + str(inside_width) + ",height=" + str(inside_height)
        caps_string_inside = "video/x-raw-yuv" + resolution
        resolution = ",width=" + str(width) + ",height=" + str(height)
        caps_string_outside = "video/x-raw-yuv" + resolution
        caps['B'] = gst.caps_from_string(caps_string_inside)
        caps['A'] = gst.caps_from_string(caps_string_outside)
        return caps

    def _set_active_a(self, pad_number):
        for i, pad in enumerate(self.A_pads):
            if i == pad_number:
                pad.set_property("alpha", 1)
            else:
                pad.set_property("alpha", 0)

    def _set_active_b(self, pad_number):
        for i, pad in enumerate(self.B_pads):
            if i == pad_number:
                pad.set_property("alpha", 1)
            else:
                pad.set_property("alpha", 0)

    def do_get_property(self, property):
        if property.name == "width":
            return self.width
        elif property.name == "height":
            return self.height
        elif property.name == "xposition":
            return self.x_position
        elif property.name == "yposition":
            return self.y_position
        elif property.name == "enabled":
            return self.enabled
        elif property.name == "position":
            return self.position
        elif property.name == "a-active":
            return self.a_active
        elif property.name == "b-active":
            return self.b_active
        else:
            Log.warning('PictureInPicture unknown property %s' % property.name)

    def _set_caps(self):
        self.caps = self.make_caps(self.width, self.height)
        for capsfilter in self.A_capsfilter:
            capsfilter.set_property("caps", self.caps['A'])
        for capsfilter in self.B_capsfilter:
            capsfilter.set_property("caps", self.caps['B'])

    def _set_B_pad_property(self, property_name, value):
        for pad in self.B_pads:
            pad.set_property(property_name, value)

    def set_selected_position(self, selected):
        self.position = selected
        if selected == 0:
            self.set_property("xposition", 0)
            self.set_property("yposition", 0)
        elif selected == 1:
            self.set_property("xposition", (self.width - self.width/3))
            self.set_property("yposition", 0)
        elif selected == 2:
            self.set_property("xposition", 0)
            self.set_property("yposition", (self.height - self.height/3))
        elif selected == 3:
            self.set_property("xposition", (self.width - self.width/3))
            self.set_property("yposition", (self.height - self.height/3))

    def do_set_property(self, property, value):
        if property.name == "width":
            self.width = value
            self._set_caps()
        elif property.name == "height":
            self.height = value
            self._set_caps()
        elif property.name == "xposition":
            self.x_position = value
            self._set_B_pad_property("xpos", self.x_position)
        elif property.name == "yposition":
            self.y_position = value
            self._set_B_pad_property("ypos", self.y_position)
        elif property.name == "enabled":
            self.enabled = value
            if self.enabled:
                self._set_B_pad_property("zorder", 10)
            else:
                self._set_B_pad_property("zorder", 0)
        elif property.name == "position":
            self.set_selected_position(value)
        elif property.name == "a-active":
            self.a_active = value
            self._set_active_a(value)
        elif property.name == "b-active":
            self.b_active = value
            self._set_active_b(value)
        else:
            Log.warning('PictureInPicture unknown property %s' % property.name)

gobject.type_register(PictureInPicture)