Package flumotion :: Package component :: Package producers :: Package rtsp :: Module rtsp
[hide private]

Source Code for Module flumotion.component.producers.rtsp.rtsp

 1  # -*- Mode: Python -*- 
 2  # vi:si:et:sw=4:sts=4:ts=4 
 3  # 
 4  # Flumotion - a streaming media server 
 5  # Copyright (C) 2004,2005 Fluendo, S.L. (www.fluendo.com). All rights reserved. 
 6   
 7  # This file may be distributed and/or modified under the terms of 
 8  # the GNU General Public License version 2 as published by 
 9  # the Free Software Foundation. 
10  # This file is distributed without any warranty; without even the implied 
11  # warranty of merchantability or fitness for a particular purpose. 
12  # See "LICENSE.GPL" in the source distribution for more information. 
13   
14  # Licensees having purchased or holding a valid Flumotion Advanced 
15  # Streaming Server license may use this file in accordance with the 
16  # Flumotion Advanced Streaming Server Commercial License Agreement. 
17  # See "LICENSE.Flumotion" in the source distribution for more information. 
18   
19  # Headers in this file shall remain intact. 
20   
21  from flumotion.component import feedcomponent 
22   
23  __version__ = "$Rev: 7162 $" 
24   
25   
26  # this is a producer component for rtsp sources eg axis network cameras 
27   
28   
29 -class Rtsp(feedcomponent.ParseLaunchComponent):
30
31 - def get_pipeline_string(self, properties):
32 width = properties.get('width', 0) 33 height = properties.get('height', 0) 34 location = properties.get('location') 35 framerate = properties.get('framerate', (25, 2)) 36 has_audio = properties.get('has-audio', True) 37 if width > 0 and height > 0: 38 scaling_template = (" videoscale method=1 ! " 39 "video/x-raw-yuv,width=%d,height=%d !" % (width, height)) 40 else: 41 scaling_template = "" 42 if has_audio: 43 audio_template = "d. ! queue ! audioconvert ! audio/x-raw-int" 44 else: 45 audio_template = "fakesrc silent=true ! audio/x-raw-int" 46 return ("rtspsrc name=src location=%s ! decodebin name=d ! queue " 47 " ! %s ffmpegcolorspace ! video/x-raw-yuv " 48 " ! videorate ! video/x-raw-yuv,framerate=%d/%d ! " 49 " @feeder:video@ %s ! @feeder:audio@" 50 % (location, scaling_template, framerate[0], 51 framerate[1], audio_template))
52