def create_player self src local return print src if src net filesrc s

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
def create_player(self, src = 'local'):
return
print src
if src == 'net':
filesrc = self.player.get_by_name('filesrc')
if filesrc:
gst.element_unlink_many(self.filesrc, self.decoder)
self.player.remove(self.filesrc)
bufsrc = self.player.get_by_name('bufsrc')
if not bufsrc:
self.player.add(self.bufsrc)
gst.element_link_many(self.bufsrc, self.decoder)
elif src == 'local':
bufsrc = self.player.get_by_name('bufsrc')
if bufsrc:
gst.element_unlink_many(self.bufsrc, self.decoder)
self.player.remove(self.bufsrc)
filesrc = self.player.get_by_name('filesrc')
if not filesrc:
self.player.add(self.filesrc)
gst.element_link_many(self.filesrc, self.decoder)