Package elisa :: Package plugins :: Package good :: Package gstreamer_plugin :: Module gst_metadata_runner
[hide private]
[frames] | no frames]

Source Code for Module elisa.plugins.good.gstreamer_plugin.gst_metadata_runner

 1  #!/usr/bin/python 
 2  # -*- coding: utf-8 -*- 
 3  # Elisa - Home multimedia server 
 4  # Copyright (C) 2007-2008 Fluendo Embedded S.L. (www.fluendo.com). 
 5  # All rights reserved. 
 6  # 
 7  # This file is available under one of two license agreements. 
 8  # 
 9  # This file is licensed under the GPL version 2. 
10  # See "LICENSE.GPL" in the root of this distribution including a special 
11  # exception to use Elisa with Fluendo's plugins. 
12  # 
13  # The GPL part of Elisa is also available under a commercial licensing 
14  # agreement from Fluendo. 
15  # See "LICENSE.Elisa" in the root directory of this distribution package 
16  # for details on that license. 
17   
18  import gobject 
19  gobject.threads_init() 
20  from elisa.core import common 
21  common.boot() 
22   
23  from elisa.plugins.good.gstreamer_plugin.gst_metadata import \ 
24          GstMetadata, GstMetadataPipeline, TimeoutError 
25  from elisa.core.media_uri import MediaUri 
26   
27  import sys 
28  from twisted.internet import reactor 
29  from twisted.spread import pb, flavors, jelly 
30  from twisted.internet.stdio import StandardIO 
31   
32 -class GstMetadataBroker(pb.Broker):
33 - def __init__(self, is_client=False):
34 pb.Broker.__init__(self, is_client, jelly.DummySecurityOptions())
35
36 - def connectionLost(self, reason):
37 pb.Broker.connectionLost(self, reason) 38 39 reactor.stop()
40
41 -class GstMetadataPBRoot(flavors.Root):
42 - def __init__(self):
43 self.component = GstMetadata()
44
45 - def remote_initialize(self):
46 return self.component.initialize()
47
48 - def remote_clean(self):
49 return self.component.clean()
50
51 - def remote_able_to_handle(self, metadata):
52 return self.component.able_to_handle(metadata)
53
54 - def remote_get_metadata(self, metadata, low_priority=False):
55 dfr = self.component.get_metadata(metadata, low_priority) 56 return dfr
57
58 -def main():
59 # we are being run out of process, run perspective broker over stdin/stdout 60 # to communicate with elisa 61 62 import platform 63 if platform.system() != 'Windows': 64 # be nice while scanning 65 import os 66 os.nice(19) 67 68 root = GstMetadataPBRoot() 69 factory = pb.PBServerFactory(root) 70 factory.protocol = GstMetadataBroker 71 protocol = factory.buildProtocol(None) 72 transport = StandardIO(protocol) 73 reactor.run()
74 75 if __name__ == '__main__': 76 sys.exit(main()) 77